CbmRoot
Loading...
Searching...
No Matches
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.
 
 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
 
CbmDaqoperator= (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)
 
CbmTimeSlicefTimeSlice
 Array of registered digitizers.
 
CbmMCEventList fEventList
 Current time slice.
 
CbmMCEventListfEventsCurrent
 MC event list (all)
 
std::map< Int_t, std::pair< Int_t, Int_t > > fEventRange
 MC events for current time slice.
 

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 44 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 46 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 74 of file CbmDaq.cxx.

◆ ~CbmDaq()

CbmDaq::~CbmDaq ( )

Destructor

Definition at line 102 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 107 of file CbmDaq.cxx.

References fDigitizers.

Referenced by CloseTimeSlice().

◆ ClassDef()

CbmDaq::ClassDef ( CbmDaq ,
4  )
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 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().

◆ 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 235 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 335 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 346 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 366 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 382 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 442 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 457 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 481 of file CbmDaq.cxx.

References fDigitizers.

Referenced by CbmDigitization::Run().

◆ SetLatency()

void CbmDaq::SetLatency ( Double_t time)

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 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().

◆ SetTimeSliceLength()

void CbmDaq::SetTimeSliceLength ( Double_t length)
inline

Set the time-slice length.

Parameters
lengthLength of a time-slice [ns]

Definition at line 107 of file CbmDaq.h.

References fTimeSliceLength.

◆ StartNextTimeSlice()

void CbmDaq::StartNextTimeSlice ( )
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().

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 115 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 136 of file CbmDaq.h.

◆ fDigitizers

◆ fEventList

CbmMCEventList CbmDaq::fEventList
private

Current time slice.

Definition at line 139 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 144 of file CbmDaq.h.

Referenced by PrintCurrentEventRange(), and StartNextTimeSlice().

◆ fEventsCurrent

CbmMCEventList* CbmDaq::fEventsCurrent
private

MC event list (all)

Definition at line 140 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 119 of file CbmDaq.h.

Referenced by Init().

◆ fLatency

Double_t CbmDaq::fLatency = 5000.
private

Maximal time disorder of input data [ns].

Definition at line 121 of file CbmDaq.h.

Referenced by Exec(), and SetLatency().

◆ fNofDigis

Int_t CbmDaq::fNofDigis
private

Total number of processed digis.

Definition at line 126 of file CbmDaq.h.

Referenced by Exec(), and Finish().

◆ fNofDigisIgnored

Int_t CbmDaq::fNofDigisIgnored
private

Number of ignored digis.

Definition at line 127 of file CbmDaq.h.

Referenced by Finish().

◆ fNofEvents

Int_t CbmDaq::fNofEvents
private

Number of processed events.

Definition at line 125 of file CbmDaq.h.

Referenced by Exec(), and Finish().

◆ fNofTimeSlices

Int_t CbmDaq::fNofTimeSlices
private

Number of time slices.

Definition at line 128 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fNofTimeSlicesEmpty

Int_t CbmDaq::fNofTimeSlicesEmpty
private

Number of empty time slices.

Definition at line 129 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 122 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and StoreAllTimeSlices().

◆ fTimeDigiFirst

Double_t CbmDaq::fTimeDigiFirst
private

Time of first digi.

Definition at line 130 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fTimeDigiLast

Double_t CbmDaq::fTimeDigiLast
private

Time of last digi.

Definition at line 131 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fTimeEventPrevious

Double_t CbmDaq::fTimeEventPrevious
private

Time of previous event [ns].

Definition at line 123 of file CbmDaq.h.

Referenced by Exec(), and Init().

◆ fTimer

TStopwatch CbmDaq::fTimer
private

Definition at line 135 of file CbmDaq.h.

Referenced by Exec().

◆ fTimeSlice

CbmTimeSlice* CbmDaq::fTimeSlice
private

Array of registered digitizers.

Definition at line 138 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 132 of file CbmDaq.h.

Referenced by Finish(), and Init().

◆ fTimeSliceLast

Double_t CbmDaq::fTimeSliceLast
private

Stop time of last time slice.

Definition at line 133 of file CbmDaq.h.

Referenced by CloseTimeSlice(), and Finish().

◆ fTimeSliceLength

Double_t CbmDaq::fTimeSliceLength
private

Time-slice length [ns].

Definition at line 120 of file CbmDaq.h.

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


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