CbmRoot
CbmDaq Class Reference

CBM task class for filling digis into time slices. More...

#include <CbmDaq.h>

Inheritance diagram for CbmDaq:
[legend]
Collaboration diagram for CbmDaq:
[legend]

Public Member Functions

 CbmDaq (Bool_t eventMode=kFALSE)
 Constructor. More...
 
 CbmDaq (Double_t tsLength)
 Constructor for regular DAQ mode. More...
 
 ~CbmDaq ()
 Destructor
More...
 
virtual void Exec (Option_t *opt)
 Task execution. More...
 
virtual InitStatus Init ()
 Initialisation. More...
 
void SetLatency (Double_t time)
 Set the DAQ buffer latency. More...
 
void SetDigitizer (ECbmModuleId system, CbmDigitizeBase *digitizer)
 Set the digitizer for a given system. More...
 
void SetTimeSliceLength (Double_t length)
 Set the time-slice length. More...
 
void StoreAllTimeSlices (Bool_t choice=kTRUE)
 Store all time-slices. More...
 

Private Member Functions

Bool_t CheckOutput () const
 Check the output arrays for being time-sorted. More...
 
void CloseTimeSlice ()
 
Int_t CopyEventList ()
 
void FillData (CbmDigi *digi)
 Copy data (digi) from the DaqBuffer into the output array. More...
 
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. More...
 
std::string GetBufferStatus (Bool_t verbose=kFALSE) const
 Debug output of DAQ buffer status @value String with status of DAQ buffers. More...
 
Double_t GetBufferTimeFirst () const
 Time of first datum in DAQ buffers @value Minimum time stamp in all DAQ buffers. More...
 
Double_t GetBufferTimeLast () const
 Time of last datum in DAQ buffers @value Maximum time stamp in all DAQ buffers. More...
 
Bool_t IsDaqBufferEmpty () const
 Check for empty DAQ buffers. More...
 
void PrintCurrentEventRange () const
 
void StartNextTimeSlice ()
 Start a new time slice in the output tree. More...
 
virtual void Finish ()
 
 CbmDaq (const CbmDaq &)=delete
 
CbmDaqoperator= (const CbmDaq &)=delete
 
 ClassDef (CbmDaq, 4)
 

Private Attributes

Bool_t fIsEventByEvent
 Flag for event-by-event mode. More...
 
Double_t fTimeSliceLength
 Time-slice length [ns]. More...
 
Double_t fLatency
 Maximal time disorder of input data [ns]. More...
 
Bool_t fStoreEmptySlices
 Flag to store also empty time slices. More...
 
Double_t fTimeEventPrevious
 Time of previous event [ns]. More...
 
Int_t fNofEvents
 Number of processed events. More...
 
Int_t fNofDigis
 Total number of processed digis. More...
 
Int_t fNofDigisIgnored
 Number of ignored digis. More...
 
Int_t fNofTimeSlices
 Number of time slices. More...
 
Int_t fNofTimeSlicesEmpty
 Number of empty time slices. More...
 
Double_t fTimeDigiFirst
 Time of first digi. More...
 
Double_t fTimeDigiLast
 Time of last digi. More...
 
Double_t fTimeSliceFirst
 Start time of first time slice. More...
 
Double_t fTimeSliceLast
 Stop time of last time slice. More...
 
TStopwatch fTimer
 
std::map< ECbmModuleId, TClonesArray * > fDigis
 Stop watch. More...
 
std::map< ECbmModuleId, CbmDigitizeBase * > fDigitizers
 Output arrays (digis) More...
 
CbmTimeSlicefTimeSlice
 Array of registered digitizers. More...
 
CbmMCEventList fEventList
 Current time slice. More...
 
CbmMCEventListfEventsCurrent
 MC event list (all) More...
 
std::map< Int_t, std::pair< Int_t, Int_t > > fEventRange
 MC events for current time slice. More...
 

Detailed Description

CBM task class for filling digis into time slices.

Author
Volker Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e
Date
20 July 2012 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.

Definition at line 40 of file CbmDaq.h.

Constructor & Destructor Documentation

◆ CbmDaq() [1/3]

CbmDaq::CbmDaq ( Bool_t  eventMode = kFALSE)

Constructor.

Parameters
eventModeIf 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 43 of file CbmDaq.cxx.

◆ CbmDaq() [2/3]

CbmDaq::CbmDaq ( Double_t  tsLength)

Constructor for regular DAQ mode.

Parameters
tslengthDuration of time slices [ns]

Definition at line 70 of file CbmDaq.cxx.

◆ ~CbmDaq()

CbmDaq::~CbmDaq ( )

Destructor

Definition at line 97 of file CbmDaq.cxx.

◆ CbmDaq() [3/3]

CbmDaq::CbmDaq ( const CbmDaq )
privatedelete

Copy constructor and assignment operator are not allowed.

Member Function Documentation

◆ CheckOutput()

Bool_t CbmDaq::CheckOutput ( ) const
private

Check the output arrays for being time-sorted.

Returns
kTRUE if all outputs are time-sorted

Definition at line 102 of file CbmDaq.cxx.

References fDigitizers.

Referenced by CloseTimeSlice().

◆ ClassDef()

CbmDaq::ClassDef ( CbmDaq  ,
 
)
private

◆ CloseTimeSlice()

void CbmDaq::CloseTimeSlice ( )
private

◆ CopyEventList()

Int_t CbmDaq::CopyEventList ( )
private

Copy the MC events contributing to the current time slice to the output array.

Returns
Number of MC events for this time slice

Definition at line 152 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().

◆ Exec()

◆ FillData()

void CbmDaq::FillData ( CbmDigi *  digi)
private

Copy data (digi) from the DaqBuffer into the output array.

Parameters
digiPointer to digi object

◆ FillTimeSlice()

ULong64_t CbmDaq::FillTimeSlice ( Bool_t  timeLimit,
Double_t  fillTime = -1. 
)
private

Move data from the buffer into the current time slice

Parameters
checkTimeIf true, data will be moved up to fillTime.
fillTimeTime up to which data are moved
Returns
Number of digis filled into the time slice

Definition at line 226 of file CbmDaq.cxx.

References fDigitizers, fTimeSlice, GetBufferStatus(), CbmModuleList::GetModuleNameCaps(), and CbmTimeSlice::ToString().

Referenced by Exec(), and Finish().

◆ Finish()

◆ GetBufferSize()

ULong64_t CbmDaq::GetBufferSize ( ) const
private

Size of DAQ buffers @value Sum of number of data in all DAQ buffers.

Definition at line 325 of file CbmDaq.cxx.

References fDigitizers.

Referenced by GetBufferStatus().

◆ GetBufferStatus()

std::string CbmDaq::GetBufferStatus ( Bool_t  verbose = kFALSE) const
private

Debug output of DAQ buffer status @value String with status of DAQ buffers.

Definition at line 335 of file CbmDaq.cxx.

References fDigitizers, GetBufferSize(), GetBufferTimeFirst(), GetBufferTimeLast(), CbmModuleList::GetModuleNameCaps(), and IsDaqBufferEmpty().

Referenced by CloseTimeSlice(), Exec(), FillTimeSlice(), and Finish().

◆ GetBufferTimeFirst()

Double_t CbmDaq::GetBufferTimeFirst ( ) const
private

Time of first datum in DAQ buffers @value Minimum time stamp in all DAQ buffers.

Definition at line 355 of file CbmDaq.cxx.

References fDigitizers.

Referenced by GetBufferStatus().

◆ GetBufferTimeLast()

Double_t CbmDaq::GetBufferTimeLast ( ) const
private

Time of last datum in DAQ buffers @value Maximum time stamp in all DAQ buffers.

Definition at line 370 of file CbmDaq.cxx.

References fDigitizers.

Referenced by GetBufferStatus().

◆ Init()

InitStatus CbmDaq::Init ( )
virtual

◆ IsDaqBufferEmpty()

Bool_t CbmDaq::IsDaqBufferEmpty ( ) const
private

Check for empty DAQ buffers.

value True if all DAQ buffers are empty

Definition at line 428 of file CbmDaq.cxx.

References fDigitizers.

Referenced by Finish(), and GetBufferStatus().

◆ operator=()

CbmDaq& CbmDaq::operator= ( const CbmDaq )
privatedelete

◆ PrintCurrentEventRange()

void CbmDaq::PrintCurrentEventRange ( ) const
private

Screen log of the range of MC events contributing to the current time slice

Definition at line 442 of file CbmDaq.cxx.

References fEventRange.

Referenced by CloseTimeSlice().

◆ SetDigitizer()

void CbmDaq::SetDigitizer ( ECbmModuleId  system,
CbmDigitizeBase digitizer 
)

Set the digitizer for a given system.

Parameters
systemSystem Id (ECbmModuleId)
digitizerPointer to digitizer instance

Definition at line 466 of file CbmDaq.cxx.

References fDigitizers.

Referenced by CbmDigitization::Run().

◆ SetLatency()

void CbmDaq::SetLatency ( Double_t  time)
inline

Set the DAQ buffer latency.

Parameters
timeBuffer 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 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 88 of file CbmDaq.h.

References fLatency.

◆ SetTimeSliceLength()

void CbmDaq::SetTimeSliceLength ( Double_t  length)
inline

Set the time-slice length.

Parameters
lengthLength of a time-slice [ns]

Definition at line 101 of file CbmDaq.h.

References fTimeSliceLength.

◆ StartNextTimeSlice()

void CbmDaq::StartNextTimeSlice ( )
private

Start a new time slice in the output tree.

Definition at line 474 of file CbmDaq.cxx.

References CbmMCEventList::Clear(), fDigitizers, fEventRange, fEventsCurrent, fTimeSlice, fTimeSliceLength, CbmTimeSlice::GetStartTime(), CbmTimeSlice::IsRegular(), and CbmTimeSlice::Reset().

Referenced by Exec(), and Finish().

◆ StoreAllTimeSlices()

void CbmDaq::StoreAllTimeSlices ( Bool_t  choice = kTRUE)
inline

Store all time-slices.

Parameters
choiceIf kTRUE; also empty slices will be stored.

By default, only time slices containing data are filled into the tree.

Definition at line 109 of file CbmDaq.h.

References fStoreEmptySlices.

Referenced by CbmDigitization::StoreAllTimeSlices().

Member Data Documentation

◆ fDigis

std::map<ECbmModuleId, TClonesArray*> CbmDaq::fDigis
private

Stop watch.

Definition at line 130 of file CbmDaq.h.

◆ fDigitizers

◆ fEventList

CbmMCEventList CbmDaq::fEventList
private

Current time slice.

Definition at line 134 of file CbmDaq.h.

Referenced by CopyEventList(), Exec(), and Finish().

◆ fEventRange

std::map<Int_t, std::pair<Int_t, Int_t> > CbmDaq::fEventRange
private

MC events for current time slice.

First and last event in current time slice for each input

Definition at line 139 of file CbmDaq.h.

Referenced by PrintCurrentEventRange(), and StartNextTimeSlice().

◆ fEventsCurrent

CbmMCEventList* CbmDaq::fEventsCurrent
private

MC event list (all)

Definition at line 135 of file CbmDaq.h.

Referenced by CloseTimeSlice(), CopyEventList(), Init(), and StartNextTimeSlice().

◆ fIsEventByEvent

Bool_t CbmDaq::fIsEventByEvent
private

Flag for event-by-event mode.

Definition at line 113 of file CbmDaq.h.

Referenced by Init().

◆ fLatency

Double_t CbmDaq::fLatency
private

Maximal time disorder of input data [ns].

Definition at line 115 of file CbmDaq.h.

Referenced by Exec(), and SetLatency().

◆ fNofDigis

Int_t CbmDaq::fNofDigis
private

Total number of processed digis.

Definition at line 120 of file CbmDaq.h.

Referenced by Exec(), and Finish().

◆ fNofDigisIgnored

Int_t CbmDaq::fNofDigisIgnored
private

Number of ignored digis.

Definition at line 121 of file CbmDaq.h.

Referenced by Finish().

◆ fNofEvents

Int_t CbmDaq::fNofEvents
private

Number of processed events.

Definition at line 119 of file CbmDaq.h.

Referenced by Exec(), and Finish().

◆ fNofTimeSlices

Int_t CbmDaq::fNofTimeSlices
private

Number of time slices.

Definition at line 122 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fNofTimeSlicesEmpty

Int_t CbmDaq::fNofTimeSlicesEmpty
private

Number of empty time slices.

Definition at line 123 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fStoreEmptySlices

Bool_t CbmDaq::fStoreEmptySlices
private

Flag to store also empty time slices.

Definition at line 116 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and StoreAllTimeSlices().

◆ fTimeDigiFirst

Double_t CbmDaq::fTimeDigiFirst
private

Time of first digi.

Definition at line 124 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fTimeDigiLast

Double_t CbmDaq::fTimeDigiLast
private

Time of last digi.

Definition at line 125 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fTimeEventPrevious

Double_t CbmDaq::fTimeEventPrevious
private

Time of previous event [ns].

Definition at line 117 of file CbmDaq.h.

Referenced by Exec(), and Init().

◆ fTimer

TStopwatch CbmDaq::fTimer
private

Definition at line 129 of file CbmDaq.h.

Referenced by Exec().

◆ fTimeSlice

CbmTimeSlice* CbmDaq::fTimeSlice
private

Array of registered digitizers.

Definition at line 133 of file CbmDaq.h.

Referenced by CloseTimeSlice(), CopyEventList(), Exec(), FillTimeSlice(), Finish(), Init(), and StartNextTimeSlice().

◆ fTimeSliceFirst

Double_t CbmDaq::fTimeSliceFirst
private

Start time of first time slice.

Definition at line 126 of file CbmDaq.h.

Referenced by Finish(), and Init().

◆ fTimeSliceLast

Double_t CbmDaq::fTimeSliceLast
private

Stop time of last time slice.

Definition at line 127 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fTimeSliceLength

Double_t CbmDaq::fTimeSliceLength
private

Time-slice length [ns].

Definition at line 114 of file CbmDaq.h.

Referenced by Init(), SetTimeSliceLength(), and StartNextTimeSlice().


The documentation for this class was generated from the following files: