CbmRoot
Loading...
Searching...
No Matches
CbmDigitize< Digi > Class Template Referenceabstract

Base class template for CBM digitisation tasks. More...

#include <CbmDigitize.h>

Inheritance diagram for CbmDigitize< Digi >:
[legend]
Collaboration diagram for CbmDigitize< Digi >:
[legend]

Public Types

typedef std::pair< std::unique_ptr< Digi >, std::unique_ptr< CbmMatch > > Data
 Short for data to be handled (pair of digi and match)
 

Public Member Functions

 CbmDigitize ()
 Default constructor.
 
 CbmDigitize (const char *name, const char *branchName="")
 Constructor with name.
 
virtual ~CbmDigitize ()
 Destructor.
 
Bool_t CheckOutput ()
 Check the output for being time-sorted.
 
Double_t GetLatency () const
 Return the detector specific latency @value latency.
 
void ClearOutput ()
 Clear the output arrays.
 
ULong64_t FillTimeSlice (CbmTimeSlice *timeSlice)
 Move data from the DaqBuffer into the current time slice.
 
ULong64_t FillTimeSlice (CbmTimeSlice *timeSlice, Double_t fillTime)
 Move data from the DaqBuffer into the current time slice.
 
ULong64_t GetDaqBufferSize () const
 Size of DAQ buffer @value Number of data in the DAQ buffer.
 
std::string GetDaqBufferStatus () const
 Debug output of DAQ buffer status @value String with status of DAQ buffer.
 
Double_t GetDaqBufferTimeFirst () const
 Time stamp of first data in the DAQ buffer @value Time stamp of first data in the DAQ buffer.
 
Double_t GetDaqBufferTimeLast () const
 Time stamp of last data in the DAQ buffer @value Time stamp of last data in the DAQ buffer.
 
void RegisterOutput ()
 Register the output arrays.
 
void SendData (Double_t time, Digi *digi, CbmMatch *match=nullptr)
 Send a digi and the corresponding match object to the DAQ.
 
virtual void FillCustomData (Double_t, Bool_t=kTRUE)
 Fill custom data into time slice.
 
void GetEventInfo ()
 Get event information.
 
Double_t GetEventTime () const
 Current event time @value Start time of current event [ns].
 
virtual ECbmModuleId GetSystemId () const =0
 Detector system ID.
 
void SetCreateMatches (Bool_t choice=kTRUE)
 Set creation of links to MC.
 
void SetEventMode (Bool_t choice=kTRUE)
 Set event-by-event mode.
 
void SetInactiveChannelFile (const char *fileName)
 Set the file containing the list of inactive channels.
 
void SetProduceNoise (Bool_t choice=kTRUE)
 Set production of inter-event noise.
 
void SetRunStartTime (Double_t time)
 Set the run start time.
 

Protected Member Functions

virtual std::pair< size_t, bool > ReadInactiveChannels ()
 Set of inactive channels, indicated by CbmAddress.
 

Protected Attributes

Bool_t fEventMode
 
Bool_t fProduceNoise
 Flag for event-by-event mode.
 
Bool_t fCreateMatches
 Flag for production of inter-event noise.
 
Double_t fRunStartTime = 0
 Flag for creation of links to MC.
 
Int_t fCurrentInput
 Start time of run [ns].
 
Int_t fCurrentEvent
 Number of current input.
 
Int_t fCurrentMCEntry
 Number of current MC event.
 
Double_t fCurrentEventTime
 Number of current MC entry.
 
TString fInactiveChannelFileName = ""
 Time of current MC event [ns].
 
std::set< uint32_t > fInactiveChannels = {}
 Name of file with inactive channels.
 

Private Member Functions

ULong64_t FillTimeSlice (CbmTimeSlice *timeSlice, Bool_t checkLimit, Double_t fillTime)
 Move data from the DaqBuffer into the current time slice.
 
bool IsChannelActive (const Digi &digi)
 Test if the channel of a digi object is set active.
 
 ClassDef (CbmDigitize, 1)
 

Private Attributes

TString fBranchName = ""
 Output branch name.
 
std::vector< Digi > * fDigis = nullptr
 
std::vector< CbmMatch > * fMatches = nullptr
 Output array (Digi)
 
std::multimap< double, DatafDaqBuffer
 Output array (CbmMatch)
 

Detailed Description

template<class Digi>
class CbmDigitize< Digi >

Base class template for CBM digitisation tasks.

Author
Volker Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e
Date
31 January 2020

Concrete digitisers should concretise with their digi class as template parameters.

The requirement for the digi class is to implement Double_t GetTime().

Definition at line 44 of file CbmDigitize.h.

Member Typedef Documentation

◆ Data

template<class Digi >
std::pair<std::unique_ptr<Digi>, std::unique_ptr<CbmMatch> > CbmDigitize< Digi >::Data

Short for data to be handled (pair of digi and match)

Definition at line 48 of file CbmDigitize.h.

Constructor & Destructor Documentation

◆ CbmDigitize() [1/2]

template<class Digi >
CbmDigitize< Digi >::CbmDigitize ( )
inline

Default constructor.

Definition at line 52 of file CbmDigitize.h.

◆ CbmDigitize() [2/2]

template<class Digi >
CbmDigitize< Digi >::CbmDigitize ( const char * name,
const char * branchName = "" )
inline

Constructor with name.

Parameters
nameTask name

Definition at line 58 of file CbmDigitize.h.

◆ ~CbmDigitize()

template<class Digi >
virtual CbmDigitize< Digi >::~CbmDigitize ( )
inlinevirtual

Destructor.

Definition at line 62 of file CbmDigitize.h.

Member Function Documentation

◆ CheckOutput()

template<class Digi >
Bool_t CbmDigitize< Digi >::CheckOutput ( )
inlinevirtual

Check the output for being time-sorted.

Implements CbmDigitizeBase.

Definition at line 67 of file CbmDigitize.h.

References CbmDigitize< Digi >::fDigis.

◆ ClassDef()

template<class Digi >
CbmDigitize< Digi >::ClassDef ( CbmDigitize< Digi > ,
1  )
private

◆ ClearOutput()

template<class Digi >
void CbmDigitize< Digi >::ClearOutput ( )
inlinevirtual

Clear the output arrays.

Implements CbmDigitizeBase.

Definition at line 96 of file CbmDigitize.h.

References CbmDigitizeBase::fCreateMatches, CbmDigitize< Digi >::fDigis, and CbmDigitize< Digi >::fMatches.

◆ FillCustomData()

virtual void CbmDigitizeBase::FillCustomData ( Double_t ,
Bool_t = kTRUE )
inlinevirtualinherited

Fill custom data into time slice.

Parameters
fillTimeTime until data can be filled
limitIf kTRUE, only data up to fillTime will be treated; otherwise, all.

This method allows the digitizer to implement additional functionality than writing digis and match objects. It will be called from CbmDaq.

Definition at line 75 of file CbmDigitizeBase.h.

◆ FillTimeSlice() [1/3]

template<class Digi >
ULong64_t CbmDigitize< Digi >::FillTimeSlice ( CbmTimeSlice * timeSlice)
inlinevirtual

Move data from the DaqBuffer into the current time slice.

Parameters
timeSlicePointer to current time slice object @value Number of digi objects filled into the time slice.

For regular time slices, all data with time stamp within the interval of the current time slice are moved from the buffer to the time slice. For time slices of type kFlexible or kEvent, all data will be moved.

Implements CbmDigitizeBase.

Definition at line 114 of file CbmDigitize.h.

References CbmDigitize< Digi >::FillTimeSlice().

Referenced by CbmDigitize< Digi >::FillTimeSlice(), and CbmDigitize< Digi >::FillTimeSlice().

◆ FillTimeSlice() [2/3]

template<class Digi >
ULong64_t CbmDigitize< Digi >::FillTimeSlice ( CbmTimeSlice * timeSlice,
Bool_t checkLimit,
Double_t fillTime )
inlineprivate

Move data from the DaqBuffer into the current time slice.

Parameters
timeSlicePointer to current time slice object
fillTimeTime up to which data will be moved [ns] @value Number of digi objects filled into the time slice.

For regular time slices, all data with time stamp within the interval of the current time slice are moved from the buffer to the time slice. For time slices of type kFlexible or kEvent, all data will be moved.

If checkLimit is selected, only data with time stamp less than fillTime are moved.

Definition at line 273 of file CbmDigitize.h.

References CbmDigitizeBase::fCreateMatches, CbmDigitize< Digi >::fDaqBuffer, CbmDigitize< Digi >::fDigis, CbmDigitize< Digi >::fMatches, CbmTimeSlice::GetEndTime(), CbmTimeSlice::GetStartTime(), CbmDigitizeBase::GetSystemId(), CbmTimeSlice::IsEvent(), CbmTimeSlice::IsFlexible(), CbmTimeSlice::IsRegular(), and CbmTimeSlice::RegisterData().

◆ FillTimeSlice() [3/3]

template<class Digi >
ULong64_t CbmDigitize< Digi >::FillTimeSlice ( CbmTimeSlice * timeSlice,
Double_t fillTime )
inlinevirtual

Move data from the DaqBuffer into the current time slice.

Parameters
timeSlicePointer to current time slice object
fillTimeTime up to which data will be moved [ns] @value Number of digi objects filled into the time slice.

Move data with time stamp up to fillTime from the buffer to the time slice. For regular time slices, only data with time stamp within the time slice interval will be moved. For time slices of type kFlexible or kEvent, all data up to fillTime will be moved.

Implements CbmDigitizeBase.

Definition at line 129 of file CbmDigitize.h.

References CbmDigitize< Digi >::FillTimeSlice().

◆ GetDaqBufferSize()

template<class Digi >
ULong64_t CbmDigitize< Digi >::GetDaqBufferSize ( ) const
inlinevirtual

Size of DAQ buffer @value Number of data in the DAQ buffer.

Implements CbmDigitizeBase.

Definition at line 140 of file CbmDigitize.h.

References CbmDigitize< Digi >::fDaqBuffer.

Referenced by CbmDigitize< Digi >::GetDaqBufferStatus().

◆ GetDaqBufferStatus()

template<class Digi >
std::string CbmDigitize< Digi >::GetDaqBufferStatus ( ) const
inlinevirtual

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

Implements CbmDigitizeBase.

Definition at line 148 of file CbmDigitize.h.

References CbmDigitize< Digi >::GetDaqBufferSize(), CbmDigitize< Digi >::GetDaqBufferTimeFirst(), and CbmDigitize< Digi >::GetDaqBufferTimeLast().

◆ GetDaqBufferTimeFirst()

template<class Digi >
Double_t CbmDigitize< Digi >::GetDaqBufferTimeFirst ( ) const
inlinevirtual

Time stamp of first data in the DAQ buffer @value Time stamp of first data in the DAQ buffer.

Implements CbmDigitizeBase.

Definition at line 162 of file CbmDigitize.h.

References CbmDigitize< Digi >::fDaqBuffer.

Referenced by CbmDigitize< Digi >::GetDaqBufferStatus().

◆ GetDaqBufferTimeLast()

template<class Digi >
Double_t CbmDigitize< Digi >::GetDaqBufferTimeLast ( ) const
inlinevirtual

Time stamp of last data in the DAQ buffer @value Time stamp of last data in the DAQ buffer.

Implements CbmDigitizeBase.

Definition at line 174 of file CbmDigitize.h.

References CbmDigitize< Digi >::fDaqBuffer.

Referenced by CbmDigitize< Digi >::GetDaqBufferStatus().

◆ GetEventInfo()

void CbmDigitizeBase::GetEventInfo ( )
inherited

Get event information.

MC input number, entry number and event time are taken from FairEventHeader and stored in the private data members for convenience. Note that the MC entry number need not coincide with the event number, for instance if the run does not start with the first MC entry, or in the case of mixed MC inputs to digitization.

Definition at line 57 of file CbmDigitizeBase.cxx.

References CbmDigitizeBase::fCurrentEvent, CbmDigitizeBase::fCurrentEventTime, CbmDigitizeBase::fCurrentInput, and CbmDigitizeBase::fCurrentMCEntry.

Referenced by CbmBmonDigitize::Exec(), CbmFsdDigitize::Exec(), CbmMuchDigitizeGem::Exec(), CbmMvdDigitizer::Exec(), CbmPsdSimpleDigitizer::Exec(), CbmRichDigitizer::Exec(), CbmStsDigitize::Exec(), CbmStsDigitizePixel::Exec(), CbmTofDigitize::Exec(), and CbmTrdDigitizer::Exec().

◆ GetEventTime()

Double_t CbmDigitizeBase::GetEventTime ( ) const
inlineinherited

Current event time @value Start time of current event [ns].

Definition at line 113 of file CbmDigitizeBase.h.

References CbmDigitizeBase::fCurrentEventTime.

◆ GetLatency()

template<class Digi >
Double_t CbmDigitize< Digi >::GetLatency ( ) const
inlinevirtual

Return the detector specific latency @value latency.

If there is no detector sopecific implementation the return value is 0. which does not change the default value set in CbmDaq.

Implements CbmDigitizeBase.

Reimplemented in CbmMvdDigitizer.

Definition at line 92 of file CbmDigitize.h.

◆ GetSystemId()

virtual ECbmModuleId CbmDigitizeBase::GetSystemId ( ) const
pure virtualinherited

◆ IsChannelActive()

template<class Digi >
bool CbmDigitize< Digi >::IsChannelActive ( const Digi & digi)
inlineprivate

Test if the channel of a digi object is set active.

Parameters
digiobject
Returns
.true. if the respective channel is active

Definition at line 350 of file CbmDigitize.h.

References CbmDigitizeBase::fInactiveChannels.

Referenced by CbmDigitize< Digi >::SendData().

◆ ReadInactiveChannels()

std::pair< size_t, bool > CbmDigitizeBase::ReadInactiveChannels ( )
protectedvirtualinherited

Set of inactive channels, indicated by CbmAddress.

Read the list of inactive channels from file

Parameters
fileNameFile name
Returns
Number of channels read from file, success of file reading

Reading from the file will stop when a read error occurs. In that case, or when the file could not be opened at all, the success flag will be .false.

Reimplemented in CbmStsDigitize.

Definition at line 80 of file CbmDigitizeBase.cxx.

References CbmDigitizeBase::fInactiveChannelFileName, and CbmDigitizeBase::fInactiveChannels.

Referenced by CbmBmonDigitize::Init(), CbmMuchDigitizeGem::Init(), CbmMvdDigitizer::Init(), CbmPsdSimpleDigitizer::Init(), CbmRichDigitizer::Init(), CbmTofDigitize::Init(), and CbmTrdDigitizer::Init().

◆ RegisterOutput()

template<class Digi >
void CbmDigitize< Digi >::RegisterOutput ( )
inline

Register the output arrays.

Arrays for the digis and the match objects will be created and registered as output to the ROOT tree. The current implementation uses std::vector as container.

Definition at line 189 of file CbmDigitize.h.

References CbmDigitize< Digi >::fBranchName, CbmDigitizeBase::fCreateMatches, CbmDigitize< Digi >::fDigis, and CbmDigitize< Digi >::fMatches.

◆ SendData()

template<class Digi >
void CbmDigitize< Digi >::SendData ( Double_t time,
Digi * digi,
CbmMatch * match = nullptr )
inline

Send a digi and the corresponding match object to the DAQ.

Parameters
timeGlobal time of the digi
digiPointer to digi object (template parameter)
matchPointer to match object

Time is passed as a seperate parameter because the global time might be too large for some digi classes to store internally. So digis are not required to have a valid timestamp at this point. Later on when the time slices are known, the timestamp is overwritten with the relative time to the beginning of the time slice.

TODO: The interface should be unique pointers, meaning that the digitisers have to create objects by unique pointers from the start.

Definition at line 237 of file CbmDigitize.h.

References CbmDigitize< Digi >::fDaqBuffer, and CbmDigitize< Digi >::IsChannelActive().

Referenced by CbmTrdModuleSim2D::FlushBuffer().

◆ SetCreateMatches()

void CbmDigitizeBase::SetCreateMatches ( Bool_t choice = kTRUE)
inlineinherited

Set creation of links to MC.

Parameters
ChoiceIf kTRUE, the match objects will be created

Definition at line 154 of file CbmDigitizeBase.h.

References CbmDigitizeBase::fCreateMatches.

Referenced by CbmStsDigitizePixel::Init(), and CbmDigitization::Run().

◆ SetEventMode()

void CbmDigitizeBase::SetEventMode ( Bool_t choice = kTRUE)
inlineinherited

Set event-by-event mode.

Parameters
ChoiceIf kTRUE, the digitizer will run in event-by-event mode

Definition at line 160 of file CbmDigitizeBase.h.

References CbmDigitizeBase::fEventMode.

Referenced by CbmDigitization::Run().

◆ SetInactiveChannelFile()

void CbmDigitizeBase::SetInactiveChannelFile ( const char * fileName)
inlineinherited

Set the file containing the list of inactive channels.

Parameters
fileNameName of file

Channels are identified by their CbmAddress. The file must contain a list of addresses, one per line. Comments after the address are allowed if separated by a blank.

Definition at line 169 of file CbmDigitizeBase.h.

References CbmDigitizeBase::fInactiveChannelFileName.

◆ SetProduceNoise()

void CbmDigitizeBase::SetProduceNoise ( Bool_t choice = kTRUE)
inlineinherited

Set production of inter-event noise.

Parameters
ChoiceIf kTRUE, the digitizer will produce noise

Definition at line 175 of file CbmDigitizeBase.h.

References CbmDigitizeBase::fProduceNoise.

Referenced by CbmDigitization::Run().

◆ SetRunStartTime()

void CbmDigitizeBase::SetRunStartTime ( Double_t time)
inlineinherited

Set the run start time.

Parameters
Runstart time [ns]

Definition at line 181 of file CbmDigitizeBase.h.

References CbmDigitizeBase::fRunStartTime.

Referenced by CbmDigitization::Run().

Member Data Documentation

◆ fBranchName

template<class Digi >
TString CbmDigitize< Digi >::fBranchName = ""
private

Output branch name.

Definition at line 248 of file CbmDigitize.h.

Referenced by CbmDigitize< Digi >::RegisterOutput().

◆ fCreateMatches

◆ fCurrentEvent

◆ fCurrentEventTime

◆ fCurrentInput

◆ fCurrentMCEntry

◆ fDaqBuffer

template<class Digi >
std::multimap<double, Data> CbmDigitize< Digi >::fDaqBuffer
private

Output array (CbmMatch)

DAQ buffer. Here, the digis and matches are buffered until they are filled into the time slice output (ROOT branch). The map key is the digi time.

Definition at line 257 of file CbmDigitize.h.

Referenced by CbmDigitize< Digi >::FillTimeSlice(), CbmDigitize< Digi >::GetDaqBufferSize(), CbmDigitize< Digi >::GetDaqBufferTimeFirst(), CbmDigitize< Digi >::GetDaqBufferTimeLast(), and CbmDigitize< Digi >::SendData().

◆ fDigis

template<class Digi >
std::vector<Digi>* CbmDigitize< Digi >::fDigis = nullptr
private

◆ fEventMode

◆ fInactiveChannelFileName

◆ fInactiveChannels

std::set<uint32_t> CbmDigitizeBase::fInactiveChannels = {}
protectedinherited

◆ fMatches

template<class Digi >
std::vector<CbmMatch>* CbmDigitize< Digi >::fMatches = nullptr
private

◆ fProduceNoise

Bool_t CbmDigitizeBase::fProduceNoise
protectedinherited

◆ fRunStartTime

Double_t CbmDigitizeBase::fRunStartTime = 0
protectedinherited

Flag for creation of links to MC.

Definition at line 188 of file CbmDigitizeBase.h.

Referenced by CbmRichDigitizer::Exec(), CbmStsDigitize::Exec(), and CbmDigitizeBase::SetRunStartTime().


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