126 LOG(info) <<
"Init parameter containers for CbmDeviceEventBuilderEtofStar2019.";
131 std::string message {
"CbmStar2019TofPar,111"};
132 LOG(info) <<
"Requesting parameter container CbmStar2019TofPar, sending message: " << message;
134 FairMQMessagePtr req(NewSimpleMessage(
"CbmStar2019TofPar,111"));
135 FairMQMessagePtr rep(NewMessage());
137 if (Send(req,
"parameters") > 0) {
138 if (Receive(rep,
"parameters") >= 0) {
139 if (rep->GetSize() != 0) {
142 LOG(info) <<
"Received unpack parameter from parmq server: " <<
fUnpackPar;
146 LOG(error) <<
"Received empty reply. Parameter not available";
163 std::vector<std::pair<TNamed*, std::string>> vHistos =
fEventBuilderAlgo->GetHistoVector();
166 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
167 for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto )
169 server->Register( Form( "/%s", vHistos[ uHisto ].second.data() ), vHistos[ uHisto ].first );
170 } // for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto )
172 server->RegisterCommand("/Reset_EvtBuild_Hist", "bStarEtof2019EventBuilderResetHistos=kTRUE");
173 server->Restrict("/Reset_EvtBuild_Hist", "allow=admin");
182 FairRuntimeDb* fRtdb = FairRuntimeDb::instance();
186 LOG(info) <<
"Setting parameter containers for " <<
fParCList->GetEntries() <<
" entries ";
189 FairParGenericSet* tempObj = (FairParGenericSet*) (
fParCList->At(iparC));
192 std::string sParamName {tempObj->GetName()};
194 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(fRtdb->getContainer(sParamName.data()));
195 LOG(info) <<
" - Get " << sParamName.data() <<
" at " << newObj;
196 if (
nullptr == newObj) {
198 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
203 LOG(info) <<
" - Mod " << sParamName.data() <<
" to " << newObj;
218 LOG(info) <<
"FIXME ===> Jumping 1st TS as corrupted with current FW + "
219 "FLESNET combination";
224 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in event builder algorithm class";
228 std::vector<CbmTofStarSubevent2019>& eventBuffer =
fEventBuilderAlgo->GetEventBuffer();
230 for (UInt_t uEvent = 0; uEvent < eventBuffer.size(); ++uEvent) {
232 Int_t iBuffSzByte = 0;
233 void* pDataBuff = eventBuffer[uEvent].BuildOutput(iBuffSzByte);
234 if (NULL != pDataBuff) {
249 SendSubevent(eventBuffer[uEvent].GetTrigger().GetStarTrigerWord(), (
char*) pDataBuff, iBuffSzByte, 0);
253 LOG(debug) <<
"Sent STAR event with size " << iBuffSzByte <<
" Bytes"
254 <<
" and token " << eventBuffer[uEvent].GetTrigger().GetStarToken();
257 LOG(error) <<
"Invalid STAR SubEvent Output, can only happen if trigger "
258 <<
" object was not set => Do Nothing more with it!!! ";
305 LOG(debug) <<
"Received message number " <<
fNumMessages <<
" with " << parts.Size() <<
" parts";
307 fles::StorableTimeslice ts {0};
311 std::string msgStr(
static_cast<char*
>(parts.At(0)->GetData()), (parts.At(0))->GetSize());
312 std::istringstream iss(msgStr);
313 boost::archive::binary_iarchive inputArchive(iss);
317 LOG(info) <<
"Initialize TS components list to " << ts.num_components();
318 for (
size_t c {0}; c < ts.num_components(); c++) {
319 auto systemID =
static_cast<int>(ts.descriptor(c, 0).sys_id);
320 LOG(info) <<
"Found systemID: " << std::hex << systemID << std::dec;
326 fles::StorableTimeslice component {0};
328 uint ncomp = parts.Size();
329 for (uint i = 0; i < ncomp; i++) {
330 std::string msgStr(
static_cast<char*
>(parts.At(i)->GetData()), (parts.At(i))->GetSize());
331 std::istringstream iss(msgStr);
332 boost::archive::binary_iarchive inputArchive(iss);
334 inputArchive >> component;
338 LOG(debug) <<
"HandleParts message " <<
fNumMessages <<
" with indx " << component.index();
345 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in event builder algorithm class";
349 std::vector<CbmTofStarSubevent2019>& eventBuffer =
fEventBuilderAlgo->GetEventBuffer();
350 LOG(debug) <<
"Process time slice " <<
fNumMessages <<
" with " << eventBuffer.size() <<
" events";
354 for (UInt_t uEvent = 0; uEvent < eventBuffer.size(); ++uEvent) {
356 Int_t iBuffSzByte = 0;
357 void* pDataBuff = eventBuffer[uEvent].BuildOutput(iBuffSzByte);
358 if (NULL != pDataBuff) {
373 SendSubevent(eventBuffer[uEvent].GetTrigger().GetStarTrigerWord(), (
char*) pDataBuff, iBuffSzByte, 0);
375 LOG(debug) <<
"Sent STAR event " << uEvent <<
" with size " << iBuffSzByte <<
" Bytes"
376 <<
", token " << eventBuffer[uEvent].GetTrigger().GetStarToken() <<
", TrigWord "
377 << eventBuffer[uEvent].GetTrigger().GetStarTrigerWord();
382 LOG(info) <<
"Processed " <<
fulTsCounter <<
" TS, CPUtime: " <<
dctime / 10. <<
" ms/TS";
473 LOG(debug) <<
"SendSubevent " <<
fNumEvt <<
", TrigWord " << trig <<
" with size " << nData << Form(
" at %p ", pData);
475 std::stringstream ossE;
476 boost::archive::binary_oarchive oaE(ossE);
478 std::string* strMsgE =
new std::string(ossE.str());
487 std::string* strMsg =
new std::string(pData, nData);
490 parts.AddPart(NewMessage(
491 const_cast<char*
>(strMsgE->c_str()),
493 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
496 parts.AddPart(NewMessage(
497 const_cast<char*
>(strMsg->c_str()),
499 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
502 LOG(debug) <<
"Send data to channel " << idx <<
" " <<
fChannelsToSend[idx][0];
520 LOG(info) <<
"Closing binary file used for event dump.";
527 std::vector<std::pair<TNamed*, std::string>> vHistos =
fEventBuilderAlgo->GetHistoVector();
530 TFile* oldFile = gFile;
531 TDirectory* oldDir = gDirectory;
534 TFile* histoFile =
nullptr;
537 histoFile =
new TFile(
"data/eventBuilderMonHist.root",
"RECREATE");
541 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
543 gDirectory->mkdir(vHistos[uHisto].second.data());
544 gDirectory->cd(vHistos[uHisto].second.data());
547 vHistos[uHisto].first->Write();