CbmRoot
|
CBM task class for filling digis into time slices. More...
#include <CbmDaq.h>
Public Member Functions | |
CbmDaq (Bool_t eventMode=kFALSE) | |
Constructor. | |
CbmDaq (Double_t tsLength) | |
Constructor for regular DAQ mode. | |
~CbmDaq () | |
Destructor | |
virtual void | Exec (Option_t *opt) |
Task execution. | |
virtual InitStatus | Init () |
Initialisation. | |
void | SetLatency (Double_t time) |
Set the DAQ buffer latency. | |
void | SetDigitizer (ECbmModuleId system, CbmDigitizeBase *digitizer) |
Set the digitizer for a given system. | |
void | SetTimeSliceLength (Double_t length) |
Set the time-slice length. | |
void | StoreAllTimeSlices (Bool_t choice=kTRUE) |
Store all time-slices. | |
Private Member Functions | |
Bool_t | CheckOutput () const |
Check the output arrays for being time-sorted. | |
void | CloseTimeSlice () |
Int_t | CopyEventList () |
void | FillData (CbmDigi *digi) |
Copy data (digi) from the DaqBuffer into the output array. | |
ULong64_t | FillTimeSlice (Bool_t timeLimit, Double_t fillTime=-1.) |
ULong64_t | GetBufferSize () const |
Size of DAQ buffers @value Sum of number of data in all DAQ buffers. | |
std::string | GetBufferStatus (Bool_t verbose=kFALSE) const |
Debug output of DAQ buffer status @value String with status of DAQ buffers. | |
Double_t | GetBufferTimeFirst () const |
Time of first datum in DAQ buffers @value Minimum time stamp in all DAQ buffers. | |
Double_t | GetBufferTimeLast () const |
Time of last datum in DAQ buffers @value Maximum time stamp in all DAQ buffers. | |
Bool_t | IsDaqBufferEmpty () const |
Check for empty DAQ buffers. | |
void | PrintCurrentEventRange () const |
void | StartNextTimeSlice () |
Start a new time slice in the output tree. | |
virtual void | Finish () |
CbmDaq (const CbmDaq &)=delete | |
CbmDaq & | operator= (const CbmDaq &)=delete |
ClassDef (CbmDaq, 4) | |
Private Attributes | |
Bool_t | fIsEventByEvent |
Flag for event-by-event mode. | |
Double_t | fTimeSliceLength |
Time-slice length [ns]. | |
Double_t | fLatency = 5000. |
Maximal time disorder of input data [ns]. | |
Bool_t | fStoreEmptySlices |
Flag to store also empty time slices. | |
Double_t | fTimeEventPrevious |
Time of previous event [ns]. | |
Int_t | fNofEvents |
Number of processed events. | |
Int_t | fNofDigis |
Total number of processed digis. | |
Int_t | fNofDigisIgnored |
Number of ignored digis. | |
Int_t | fNofTimeSlices |
Number of time slices. | |
Int_t | fNofTimeSlicesEmpty |
Number of empty time slices. | |
Double_t | fTimeDigiFirst |
Time of first digi. | |
Double_t | fTimeDigiLast |
Time of last digi. | |
Double_t | fTimeSliceFirst |
Start time of first time slice. | |
Double_t | fTimeSliceLast |
Stop time of last time slice. | |
TStopwatch | fTimer |
std::map< ECbmModuleId, TClonesArray * > | fDigis |
Stop watch. | |
std::map< ECbmModuleId, CbmDigitizeBase * > | fDigitizers |
Output arrays (digis) | |
CbmTimeSlice * | fTimeSlice |
Array of registered digitizers. | |
CbmMCEventList | fEventList |
Current time slice. | |
CbmMCEventList * | fEventsCurrent |
MC event list (all) | |
std::map< Int_t, std::pair< Int_t, Int_t > > | fEventRange |
MC events for current time slice. | |
CBM task class for filling digis into time slices.
The CbmDaq collects raw data (digis) from various input sources (detectors), sorts them w.r.t. time and fills time slices. The digis in one time slice are written to TCLonesArrays as branches of the output tree. One tree entry corresponds to one time slice (interval), the duration of which can be adjusted.
CbmDaq::CbmDaq | ( | Bool_t | eventMode = kFALSE | ) |
Constructor.
eventMode | If true, run in event-by-event mode |
By default, the DAQ will run in time-based mode with flexible time slices (all data into one time slice). To choose the event-by-event mode, set the argument to true; then, data will be grouped into events, one event per time slice. To select the regular mode with time slices of fixed duration, use the constructor with Double_t argument.
Definition at line 46 of file CbmDaq.cxx.
CbmDaq::CbmDaq | ( | Double_t | tsLength | ) |
Constructor for regular DAQ mode.
tslength | Duration of time slices [ns] |
Definition at line 74 of file CbmDaq.cxx.
CbmDaq::~CbmDaq | ( | ) |
Destructor
Definition at line 102 of file CbmDaq.cxx.
|
privatedelete |
Copy constructor and assignment operator are not allowed.
|
private |
Check the output arrays for being time-sorted.
Definition at line 107 of file CbmDaq.cxx.
References fDigitizers.
Referenced by CloseTimeSlice().
|
private |
|
private |
Close the current time slice The current slice is filled to the tree. It is then reset to the next time slice interval.
Definition at line 118 of file CbmDaq.cxx.
References CheckOutput(), CopyEventList(), fDigitizers, fEventsCurrent, fNofTimeSlices, fNofTimeSlicesEmpty, fStoreEmptySlices, fTimeDigiFirst, fTimeDigiLast, fTimeSlice, fTimeSliceLast, GetBufferStatus(), CbmTimeSlice::GetEndTime(), CbmTimeSlice::GetTimeDataFirst(), CbmTimeSlice::GetTimeDataLast(), CbmTimeSlice::IsEmpty(), PrintCurrentEventRange(), CbmMCEventList::Sort(), and CbmTimeSlice::ToString().
|
private |
Copy the MC events contributing to the current time slice to the output array.
Definition at line 160 of file CbmDaq.cxx.
References fEventList, fEventsCurrent, fTimeSlice, CbmLink::GetEntry(), CbmMCEventList::GetEventTime(), CbmLink::GetFile(), CbmMatch::GetLink(), CbmTimeSlice::GetMatch(), CbmMatch::GetNofLinks(), and CbmMCEventList::Insert().
Referenced by CloseTimeSlice().
|
virtual |
Task execution.
Definition at line 179 of file CbmDaq.cxx.
References CloseTimeSlice(), fEventList, FillTimeSlice(), fLatency, fNofDigis, fNofEvents, fTimeEventPrevious, fTimer, fTimeSlice, GetBufferStatus(), CbmTimeSlice::GetEndTime(), CbmMCEventList::Insert(), CbmTimeSlice::IsEvent(), CbmTimeSlice::IsFlexible(), CbmTimeSlice::IsRegular(), and StartNextTimeSlice().
|
private |
Copy data (digi) from the DaqBuffer into the output array.
digi | Pointer to digi object |
|
private |
Move data from the buffer into the current time slice
checkTime | If true, data will be moved up to fillTime. |
fillTime | Time up to which data are moved |
Definition at line 235 of file CbmDaq.cxx.
References fDigitizers, fTimeSlice, GetBufferStatus(), CbmModuleList::GetModuleNameCaps(), and CbmTimeSlice::ToString().
|
privatevirtual |
At end of run: Process the remaining data in the CbmDaqBuffer
Definition at line 271 of file CbmDaq.cxx.
References CloseTimeSlice(), fEventList, FillTimeSlice(), fNofDigis, fNofDigisIgnored, fNofEvents, fNofTimeSlices, fNofTimeSlicesEmpty, fTimeDigiFirst, fTimeDigiLast, fTimeSlice, fTimeSliceFirst, fTimeSliceLast, GetBufferStatus(), IsDaqBufferEmpty(), CbmTimeSlice::IsFlexible(), CbmTimeSlice::IsRegular(), StartNextTimeSlice(), and CbmMCEventList::ToString().
|
private |
Size of DAQ buffers @value Sum of number of data in all DAQ buffers.
Definition at line 335 of file CbmDaq.cxx.
References fDigitizers.
Referenced by GetBufferStatus().
|
private |
Debug output of DAQ buffer status @value String with status of DAQ buffers.
Definition at line 346 of file CbmDaq.cxx.
References fDigitizers, GetBufferSize(), GetBufferTimeFirst(), GetBufferTimeLast(), CbmModuleList::GetModuleNameCaps(), and IsDaqBufferEmpty().
Referenced by CloseTimeSlice(), Exec(), FillTimeSlice(), and Finish().
|
private |
Time of first datum in DAQ buffers @value Minimum time stamp in all DAQ buffers.
Definition at line 366 of file CbmDaq.cxx.
References fDigitizers.
Referenced by GetBufferStatus().
|
private |
Time of last datum in DAQ buffers @value Maximum time stamp in all DAQ buffers.
Definition at line 382 of file CbmDaq.cxx.
References fDigitizers.
Referenced by GetBufferStatus().
|
virtual |
Initialisation.
Definition at line 398 of file CbmDaq.cxx.
References fEventsCurrent, fIsEventByEvent, fTimeEventPrevious, fTimeSlice, fTimeSliceFirst, fTimeSliceLength, CbmTimeSlice::GetStartTime(), CbmTimeSlice::kEvent, and CbmTimeSlice::kFlexible.
|
private |
Check for empty DAQ buffers.
value True if all DAQ buffers are empty
Definition at line 442 of file CbmDaq.cxx.
References fDigitizers.
Referenced by Finish(), and GetBufferStatus().
|
private |
Screen log of the range of MC events contributing to the current time slice
Definition at line 457 of file CbmDaq.cxx.
References fEventRange.
Referenced by CloseTimeSlice().
void CbmDaq::SetDigitizer | ( | ECbmModuleId | system, |
CbmDigitizeBase * | digitizer ) |
Set the digitizer for a given system.
system | System Id (ECbmModuleId) |
digitizer | Pointer to digitizer instance |
Definition at line 481 of file CbmDaq.cxx.
References fDigitizers.
Referenced by CbmDigitization::Run().
void CbmDaq::SetLatency | ( | Double_t | time | ) |
Set the DAQ buffer latency.
time | Buffer latency [ns] |
To decide when a time-slice can be closed (no more data in the time-slice interval will come), the DAQ takes into account a certain time-disordering of digis. The latency is the maximal time difference between the current (event) time and the time-stamp of the digi. It should at least be the maximum dead time of all detectors plus some safety margin accounting for the time resolution of the detectors. The latency is only changed if the latency passed as argument is larger than the current value to avoid that a call from a second digitizer lowers the latency set by a first digitizer. The current default of 2,000 ns corresponds to the STS with dead time of 800 ns and time resolution of 5 ns.
Definition at line 512 of file CbmDaq.cxx.
References fLatency.
Referenced by CbmDigitization::Run().
|
inline |
Set the time-slice length.
length | Length of a time-slice [ns] |
Definition at line 107 of file CbmDaq.h.
References fTimeSliceLength.
|
private |
Start a new time slice in the output tree.
Definition at line 490 of file CbmDaq.cxx.
References CbmMCEventList::Clear(), fDigitizers, fEventRange, fEventsCurrent, fTimeSlice, fTimeSliceLength, CbmTimeSlice::GetStartTime(), CbmTimeSlice::IsRegular(), and CbmTimeSlice::Reset().
|
inline |
Store all time-slices.
choice | If kTRUE; also empty slices will be stored. |
By default, only time slices containing data are filled into the tree.
Definition at line 115 of file CbmDaq.h.
References fStoreEmptySlices.
Referenced by CbmDigitization::StoreAllTimeSlices().
|
private |
|
private |
Output arrays (digis)
Definition at line 137 of file CbmDaq.h.
Referenced by CheckOutput(), CloseTimeSlice(), FillTimeSlice(), GetBufferSize(), GetBufferStatus(), GetBufferTimeFirst(), GetBufferTimeLast(), IsDaqBufferEmpty(), SetDigitizer(), and StartNextTimeSlice().
|
private |
Current time slice.
Definition at line 139 of file CbmDaq.h.
Referenced by CopyEventList(), Exec(), and Finish().
|
private |
MC events for current time slice.
First and last event in current time slice for each input
Definition at line 144 of file CbmDaq.h.
Referenced by PrintCurrentEventRange(), and StartNextTimeSlice().
|
private |
MC event list (all)
Definition at line 140 of file CbmDaq.h.
Referenced by CloseTimeSlice(), CopyEventList(), Init(), and StartNextTimeSlice().
|
private |
|
private |
Maximal time disorder of input data [ns].
Definition at line 121 of file CbmDaq.h.
Referenced by Exec(), and SetLatency().
|
private |
|
private |
|
private |
|
private |
Number of time slices.
Definition at line 128 of file CbmDaq.h.
Referenced by CloseTimeSlice(), and Finish().
|
private |
Number of empty time slices.
Definition at line 129 of file CbmDaq.h.
Referenced by CloseTimeSlice(), and Finish().
|
private |
Flag to store also empty time slices.
Definition at line 122 of file CbmDaq.h.
Referenced by CloseTimeSlice(), and StoreAllTimeSlices().
|
private |
Time of first digi.
Definition at line 130 of file CbmDaq.h.
Referenced by CloseTimeSlice(), and Finish().
|
private |
Time of last digi.
Definition at line 131 of file CbmDaq.h.
Referenced by CloseTimeSlice(), and Finish().
|
private |
|
private |
Array of registered digitizers.
Definition at line 138 of file CbmDaq.h.
Referenced by CloseTimeSlice(), CopyEventList(), Exec(), FillTimeSlice(), Finish(), Init(), and StartNextTimeSlice().
|
private |
|
private |
Stop time of last time slice.
Definition at line 133 of file CbmDaq.h.
Referenced by CloseTimeSlice(), and Finish().
|
private |
Time-slice length [ns].
Definition at line 120 of file CbmDaq.h.
Referenced by Init(), SetTimeSliceLength(), and StartNextTimeSlice().