13 #include <FairEventHeader.h>
14 #include <FairLogger.h>
15 #include <FairLogger.h>
16 #include <FairRootManager.h>
17 #include <FairRunAna.h>
20 #include <TGenericClassInfo.h>
21 #include <TStopwatch.h>
36 using std::setprecision;
39 using std::stringstream;
45 , fIsEventByEvent(eventMode)
46 , fTimeSliceLength(-1.)
48 , fStoreEmptySlices(kFALSE)
49 , fTimeEventPrevious(-1.)
54 , fNofTimeSlicesEmpty(0)
57 , fTimeSliceFirst(-1.)
64 , fEventsCurrent(nullptr)
72 , fIsEventByEvent(kFALSE)
73 , fTimeSliceLength(tsLength)
75 , fStoreEmptySlices(kFALSE)
76 , fTimeEventPrevious(-1.)
81 , fNofTimeSlicesEmpty(0)
84 , fTimeSliceFirst(-1.)
91 , fEventsCurrent(nullptr)
103 Bool_t result = kTRUE;
105 result = (result && digitizer.second->CheckOutput());
130 if (entry.second) entry.second->FillCustomData(1, kTRUE);
137 FairRootManager::Instance()->Fill();
156 for (Int_t iLink = 0; iLink < match.
GetNofLinks(); iLink++) {
177 Int_t file = FairRunAna::Instance()->GetEventHeader()->GetInputFileId();
178 Int_t
event = FairRootManager::Instance()->GetEntryNr();
179 Double_t eventTime = FairRunAna::Instance()->GetEventHeader()->GetEventTime();
186 LOG(debug) << GetName() <<
": Fill time is " << fillTime <<
" ns";
214 LOG(info) << left << setw(15) << GetName() <<
"[" << fixed << setprecision(3)
215 <<
fTimer.RealTime() <<
" s]"
229 LOG(debug) << GetName() <<
": Fill time slice up to t = " << tMax <<
" ns";
231 LOG(debug) << GetName() <<
": Fill time slice";
236 std::stringstream ss;
237 ss << GetName() <<
": Fill data: ";
238 ULong64_t nDataAll = 0;
242 nData = digitizer.second->FillTimeSlice(
fTimeSlice, tMax);
244 nData = digitizer.second->FillTimeSlice(
fTimeSlice);
249 LOG(debug) << ss.str();
252 LOG(debug) << GetName() <<
": total " << nData <<
" moved";
262 std::cout << std::endl;
263 LOG(info) << fName <<
": Finish run";
283 LOG(fatal) << GetName() <<
": Time-slice mode is flexible but "
284 <<
" buffers are not empty after fill!";
292 LOG(fatal) << GetName() <<
": Time-slice mode is event but "
293 <<
" buffers are not empty!";
298 std::cout << std::endl;
299 LOG(info) <<
"=====================================";
300 LOG(info) << GetName() <<
": Run summary";
301 LOG(info) <<
"Events: " << setw(10) << right <<
fNofEvents;
302 LOG(info) <<
"Digis: " << setw(10) << right <<
fNofDigis <<
" from "
303 << setw(10) << right << fixed << setprecision(1) <<
fTimeDigiFirst
304 <<
" ns to " << setw(10) << right << fixed << setprecision(1)
308 LOG(info) <<
"Time slices: " << setw(10) << right <<
fNofTimeSlices
309 <<
" from " << setw(10) << right << fixed << setprecision(1)
313 LOG(info) <<
"Time slices: " << setw(10) << right <<
fNofTimeSlices;
315 LOG(info) <<
"=====================================";
317 std::cout << std::endl;
328 nData += digitizer.second->GetDaqBufferSize();
338 ss <<
"Buffer status: empty";
347 <<
" " << digitizer.second->GetDaqBufferStatus();
358 Double_t test = digitizer.second->GetDaqBufferTimeFirst();
362 tMin = (tMin < test ? tMin : test);
373 Double_t test = digitizer.second->GetDaqBufferTimeLast();
377 tMax = (tMax > test ? tMax : test);
387 std::cout << std::endl;
388 LOG(info) <<
"==========================================================";
389 LOG(info) << fName <<
": Initialisation";
394 LOG(info) << fName <<
": Event mode";
398 LOG(info) << fName <<
": Time-based mode, time slice duration "
402 LOG(info) << fName <<
": Time-based mode, flexible time slice";
411 FairRootManager::Instance()->Register(
"TimeSlice.",
"DAQ",
fTimeSlice, kTRUE);
415 FairRootManager::Instance()->Register(
418 LOG(info) << GetName() <<
": Initialisation successful";
419 LOG(info) <<
"==========================================================";
420 std::cout << std::endl;
429 Bool_t empty = kTRUE;
431 if (digitizer.second->GetDaqBufferSize()) {
444 std::stringstream ss;
445 ss << GetName() <<
": Current MC event range: ";
448 LOG(info) << ss.str();
453 Int_t file = it->first;
454 Int_t firstEvent = it->second.first;
455 Int_t lastEvent = it->second.second;
456 ss <<
"\n Input file " << file <<
", first event " << firstEvent
457 <<
", last event " << lastEvent;
460 LOG(info) << ss.str();
489 entry.second->ClearOutput();