13 #include "MicrosliceContents.hpp"
14 #include "Timeslice.hpp"
15 #include "TimesliceInputArchive.hpp"
16 #include "TimesliceMultiInputArchive.hpp"
17 #include "TimesliceMultiSubscriber.hpp"
18 #include "TimesliceSubscriber.hpp"
20 #include "FairLogger.h"
21 #include "FairRunOnline.h"
23 #include "TClonesArray.h"
25 #include "THttpServer.h"
36 , fInputFileList(new TObjString())
43 , fHistoMissedTS(nullptr)
44 , fHistoMissedTSEvo(nullptr)
45 , fNofTSSinceLastTS(0)
49 , fbWriteOutput(kFALSE)
50 , fTimeSliceMetaDataArray(nullptr) {}
58 std::string fileList {
""};
60 std::string fileName =
dynamic_cast<TObjString*
>(obj)->GetString().Data();
68 if (!
fSource) { LOG(fatal) <<
"Could not connect to publisher."; }
71 std::string fileList {
""};
73 std::string fileName =
dynamic_cast<TObjString*
>(obj)->GetString().Data();
78 LOG(info) <<
"Input File String: " << fileList;
81 new fles::TimesliceMultiInputArchive(fileList,
fDirName.Data()));
83 fSource.reset(
new fles::TimesliceMultiInputArchive(fileList));
93 LOG(info) <<
"Initialize " << (*itUnp)->GetName();
97 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
101 "Missed_TS_Evo",
"Missed TS evolution; TS Idx []", 100000, 0., 10000000.);
109 FairRootManager* ioman = FairRootManager::Instance();
110 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
113 LOG(fatal) <<
"Failed creating the TS meta data TClonesarray ";
115 ioman->Register(
"TimesliceMetaData",
126 LOG(info) <<
"Set parameter container " << (*itUnp)->GetName();
127 (*itUnp)->SetParContainers();
132 Bool_t result = kTRUE;
135 LOG(info) <<
"Initialize parameter container " << (*itUnp)->GetName();
136 result = result && (*itUnp)->InitContainers();
142 Bool_t result = kTRUE;
145 LOG(info) <<
"Initialize parameter container " << (*itUnp)->GetName();
146 result = result && (*itUnp)->ReInitContainers();
154 if (1 == retVal) { LOG(info) <<
"No more input"; }
160 const fles::MicrosliceDescriptor& mdsc) {
161 LOG(info) <<
"Header ID: Ox" << std::hex << static_cast<int>(mdsc.hdr_id)
163 LOG(info) <<
"Header version: Ox" << std::hex
164 <<
static_cast<int>(mdsc.hdr_ver) << std::dec;
165 LOG(info) <<
"Equipement ID: " << mdsc.eq_id;
166 LOG(info) <<
"Flags: " << mdsc.flags;
167 LOG(info) <<
"Sys ID: Ox" << std::hex << static_cast<int>(mdsc.sys_id)
169 LOG(info) <<
"Sys version: Ox" << std::hex << static_cast<int>(mdsc.sys_ver)
171 LOG(info) <<
"Microslice Idx: " << mdsc.idx;
172 LOG(info) <<
"Checksum: " << mdsc.crc;
173 LOG(info) <<
"Size: " << mdsc.size;
174 LOG(info) <<
"Offset: " << mdsc.offset;
178 if (0 == ts.num_components()) {
179 LOG(error) <<
"No Component in TS " << ts.index();
182 LOG(info) <<
"Found " << ts.num_components()
183 <<
" different components in timeslice";
190 LOG(info) <<
"Finish " << (*itUnp)->GetName();
207 while (
auto timeslice =
fSource->get()) {
213 const fles::Timeslice& ts = *timeslice;
214 auto tsIndex = ts.index();
216 LOG(debug) <<
"Missed Timeslices. Old TS Number was " <<
fTSNumber
217 <<
" New TS Number is " << tsIndex;
229 LOG(info) <<
"Reading Timeslice " <<
fTSNumber;
233 for (
size_t c {0}; c < ts.num_components(); c++) {
234 auto systemID =
static_cast<int>(ts.descriptor(c, 0).sys_id);
235 LOG(info) <<
"Found systemID: " << std::hex << systemID << std::dec;
238 auto it_list =
fUnpackers.equal_range(systemID);
239 if (it_list.first == it_list.second) {
240 LOG(info) <<
"Could not find unpacker for system id 0x" << std::hex
241 << systemID << std::dec;
243 for (
auto it = it_list.first; it != it_list.second; ++it) {
244 it->second->AddMsComponentToList(c, systemID);
245 it->second->SetNbMsInTs(ts.num_core_microslices(),
246 ts.num_microslices(c)
247 - ts.num_core_microslices());
257 (*itUnp)->DoUnpack(ts, 0);