18#include "FairParGenericSet.h"
19#include "FairRootManager.h"
21#include "FairRunOnline.h"
22#include "FairRuntimeDb.h"
26#include "THttpServer.h"
43 , fbMonitorMode(kFALSE)
44 , fbWriteOutput(kTRUE)
57 LOG(info) <<
"CbmCosy2019MonitorTaskHodo::Init";
58 LOG(info) <<
"Initializing mCBM Hodoscopes Monitor";
78 LOG(info) <<
"Setting parameter containers for " << GetName();
82 for (Int_t iparC = 0; iparC < parCList->GetEntries(); ++iparC) {
83 FairParGenericSet* tempObj = (FairParGenericSet*) (parCList->At(iparC));
84 parCList->Remove(tempObj);
86 std::string sParamName {tempObj->GetName()};
87 FairParGenericSet* newObj =
88 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
90 if (
nullptr == newObj) {
91 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
95 parCList->AddAt(newObj, iparC);
102 LOG(info) <<
"Init parameter containers for " << GetName();
133 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
134 if (
nullptr != server) {
135 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
136 if (
nullptr != vHistos[uHisto].
first)
137 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
140 for (UInt_t uCanvas = 0; uCanvas < vCanvas.size(); ++uCanvas) {
141 if (
nullptr != vCanvas[uCanvas].
first)
142 server->Register(Form(
"/%s", vCanvas[uCanvas].second.data()), vCanvas[uCanvas].first);
145 server->RegisterCommand(
"/Reset_MoniHodo_Hist",
"bCosy2019MonitorTaskHodoResetHistos=kTRUE");
146 server->Restrict(
"/Reset_MoniHodo_Hist",
"allow=admin");
156 LOG(info) <<
"ReInit parameter containers for " << GetName();
170 LOG(info) <<
"Reset Hodoscopes monitor histos ";
176 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in monitor algorithm class";
181 std::vector< CbmHodoDigi > vDigi = fMonitorAlgo->GetVector();
183 for( auto digi: vDigi) {
185 LOG(debug) << "Fill digi TClonesarray with "
186 << Form("0x%08x", digi.GetAddress())
187 << " at " << static_cast<Int_t>( fHodoDigiCloneArray->GetEntriesFast() );
189 new( (*fHodoDigiCloneArray)[ fHodoDigiCloneArray->GetEntriesFast() ] )
194 fMonitorAlgo->ClearVector();
222 TFile* oldFile = gFile;
223 TDirectory* oldDir = gDirectory;
225 TFile* histoFile =
nullptr;
228 histoFile =
new TFile(
"data/HistosMonitorHodo.root",
"RECREATE");
230 if (
nullptr == histoFile)
return kFALSE;
235 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
237 TString sFolder = vHistos[uHisto].second.data();
238 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
239 gDirectory->cd(sFolder);
242 vHistos[uHisto].first->Write();
247 for (UInt_t uCanvas = 0; uCanvas < vCanvas.size(); ++uCanvas) {
249 TString sFolder = vCanvas[uCanvas].second.data();
250 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
251 gDirectory->cd(sFolder);
254 vCanvas[uCanvas].first->Write();
ClassImp(CbmConverterManager)
Bool_t bCosy2019MonitorTaskHodoResetHistos
Bool_t CreateHistograms()
void SetDpbId(UInt_t uDpbId=0x5b75)
void SetHodoElinkIdx(UInt_t uElinkHodoA=5, UInt_t uElinkHodoB=10)
void SetHodoInvertY(Bool_t bInvHodoA=kFALSE, Bool_t bInvHodoB=kTRUE)
Default set closest cosmic setup stack.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Bool_t ReInitContainers()
void SetHodoSwapXY(Bool_t bSwapHodoA=kFALSE, Bool_t bSwapHodoB=kTRUE)
Default set for mMUCH FMC slots 8 and 9.
void SetHodoInvertX(Bool_t bInvHodoA=kFALSE, Bool_t bInvHodoB=kTRUE)
Default set closest cosmic setup stack.
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
Bool_t ProcessTs(const fles::Timeslice &ts)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void SetHodoInvertX(Bool_t bInvHodoA=kFALSE, Bool_t bInvHodoB=kTRUE)
void SetHodoSwapXY(Bool_t bSwapHodoA=kFALSE, Bool_t bSwapHodoB=kTRUE)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
void SetHodoInvertY(Bool_t bInvHodoA=kFALSE, Bool_t bInvHodoB=kTRUE)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void SetHodoElinkIdx(UInt_t uElinkHodoA=5, UInt_t uElinkHodoB=10)
CbmCosy2019MonitorAlgoHodo * fMonitorAlgo
Processing algo.
Bool_t ReInitContainers()
Bool_t fbMonitorMode
Control flags.
uint64_t fulTsCounter
If ON the output TClonesArray of digi is written to disk.
virtual ~CbmCosy2019MonitorTaskHodo()
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
CbmCosy2019MonitorTaskHodo(UInt_t uNbSdpb=1)
void SetDpbId(UInt_t uDpbId=0x5b75)
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()