CbmRoot
|
Source class for the input to digitization in CBM. More...
#include <CbmDigitizationSource.h>
Public Member Functions | |
CbmDigitizationSource () | |
Constructor. More... | |
virtual | ~CbmDigitizationSource () |
Destructor. More... | |
virtual Bool_t | ActivateObject (TObject **object, const char *branchName) |
Activate a branch and set its address. More... | |
void | AddInput (UInt_t inputId, TChain *chain, Double_t rate, ECbmTreeAccess mode=ECbmTreeAccess::kRegular) |
Add a transport input. More... | |
virtual Int_t | CheckMaxEventNo (Int_t lastEntry=0) |
Maximal entry number the source can run to. More... | |
virtual void | Close () |
Abstract in base class. No implementation here. More... | |
void | EmbedInput (UInt_t inputId, TChain *chain, UInt_t targetInputId, ECbmTreeAccess mode=ECbmTreeAccess::kRegular) |
Embed a transport input. More... | |
virtual void | FillEventHeader (FairEventHeader *event) |
Fill the output event header. More... | |
const std::set< TString > & | GetBranchList () const |
List of branch names @value Reference to set of branch names. More... | |
CbmMCInput * | GetFirstInput () |
First input from the first input set @value Pointer to first input. More... | |
virtual Source_Type | GetSourceType () |
Source type is kFILE. More... | |
virtual Bool_t | Init () |
Abstract in base class. No implementation here. More... | |
virtual Bool_t | InitUnpackers () |
Abstract in base class. No implementation here. More... | |
virtual Int_t | ReadEvent (UInt_t event=0) |
Provide one tree entry. More... | |
virtual Bool_t | ReInitUnpackers () |
Abstract in base class. No implementation here. More... | |
virtual void | Reset () |
Abstract in base class. No implementation here. More... | |
void | SetEventMode (Bool_t choice=kTRUE) |
Set event-by-event mode @value choice kTRUE if event-by-event mode. More... | |
virtual void | SetParUnpackers () |
Abstract in base class. No implementation here. More... | |
void | SetTimeStart (Double_t time) |
Set the offset for the first event time. More... | |
Private Member Functions | |
Bool_t | CheckBranchList (CbmMCInputSet *input) |
Compare an input set branch list with the reference list. More... | |
Int_t | ReadEventByEvent (UInt_t event) |
Get next entry in event-by-event mode. More... | |
void | ReadRunId () |
Read run ID from the first entry in the first input. More... | |
ClassDef (CbmDigitizationSource, 1) | |
Private Attributes | |
std::vector< CbmMCInputSet * > | fInputSets |
std::map< UInt_t, CbmMCInputSet * > | fInputMap |
std::map< Double_t, CbmMCInputSet * > | fNextEvent |
input ID -> inputSet More... | |
FairMCEventHeader * | fMCEventHeader |
time -> inputSet More... | |
TObjArray * | fListOfFolders |
std::set< TString > | fBranches |
Double_t | fTimeStart |
Double_t | fCurrentTime |
Int_t | fCurrentEntryId |
Int_t | fCurrentInputId |
Int_t | fCurrentRunId |
Bool_t | fFirstCall |
Bool_t | fEventMode |
CbmMCInputSet * | fCurrentInputSet |
Bool_t | fSwitchInputSet |
Source class for the input to digitization in CBM.
This class serves as input source for CBM digitization runs. It allows to mix an arbitrary number of different inputs (results of transport simulations) with different event rates. For each input chain, a sequence of event times is calculated. The respective next event is delivered to FairRootManager.
The API is the method AddInput, specifying a TChain with an event rate. The source object has to be registered to the run. The large number of non-API public methods is due to the implementation of the base class FairSource.
The class is based on FairMixedSource by M. Al-Turany, stripping unneeded functionality and introducing a different concept of input mixing.
Definition at line 42 of file CbmDigitizationSource.h.
CbmDigitizationSource::CbmDigitizationSource | ( | ) |
Constructor.
Definition at line 21 of file CbmDigitizationSource.cxx.
|
virtual |
Destructor.
Definition at line 42 of file CbmDigitizationSource.cxx.
References fBranches, and fInputSets.
|
virtual |
Activate a branch and set its address.
object | Pointer to pointer to branch class |
branchName | Name of branch |
Inherited from FairSource. This method will be called from FairRootManager::ActivateBranch(branchName) when an input branch is demanded by a task.
All input trees have to be connected to the argument object.
Definition at line 51 of file CbmDigitizationSource.cxx.
References fInputSets.
Referenced by Init().
void CbmDigitizationSource::AddInput | ( | UInt_t | inputId, |
TChain * | chain, | ||
Double_t | rate, | ||
ECbmTreeAccess | mode = ECbmTreeAccess::kRegular |
||
) |
Add a transport input.
inputId | Input number (identifier) |
chain | Pointer to input chain |
mode | Tree access mode (kRegular / kRepeat / kRandom) |
Definition at line 64 of file CbmDigitizationSource.cxx.
References CbmMCInputSet::AddInput(), CheckBranchList(), fBranches, fInputMap, fInputSets, CbmMCInputSet::GetBranchList(), kRegular, and kRepeat.
Referenced by CbmDigitization::AddInput().
|
private |
Compare an input set branch list with the reference list.
input | Pointer to CbmMCInputSet @value kTRUE if the branch list of the input set is compatible |
The branch list of the input set is considered compatible if all branches of the reference list are present in the input set. Additional branches in the input set are not considered harmful. The reference branch list is defined by the first input set.
Definition at line 107 of file CbmDigitizationSource.cxx.
References fBranches, and CbmMCInputSet::GetBranchList().
Referenced by AddInput().
|
virtual |
Maximal entry number the source can run to.
lastEntry | Last entry as specified by FairRunAna. Ignored. @value Last entry possible with this source |
Inherited from FairSource. Since there can be several inputs being randomly mixed together, a maximal entry number cannot be specified. Thus, a practically infinite value is returned. The run is then terminated by ReadEvent() returning non-zero. If lastEntry is specified by FairRunAna (i.e., by the user), this is the return value.
Definition at line 141 of file CbmDigitizationSource.cxx.
References fInputSets.
|
private |
|
inlinevirtual |
Abstract in base class. No implementation here.
Is actually not called at all from FairRunAna.
Definition at line 95 of file CbmDigitizationSource.h.
void CbmDigitizationSource::EmbedInput | ( | UInt_t | inputId, |
TChain * | chain, | ||
UInt_t | targetInputId, | ||
ECbmTreeAccess | mode = ECbmTreeAccess::kRegular |
||
) |
Embed a transport input.
inputId | Input number (identifier) |
chain | Pointer to input chain |
targetInputId | ID of the input to be embedded into |
mode | Tree access mode (kRegular / kRepeat / kRandom) |
Definition at line 161 of file CbmDigitizationSource.cxx.
References fInputMap, kRegular, and kRepeat.
Referenced by CbmDigitization::EmbedInput().
|
virtual |
Fill the output event header.
event | Pointer to event header |
Fills run ID, input ID, entry ID and event time.
Definition at line 194 of file CbmDigitizationSource.cxx.
References fCurrentEntryId, fCurrentInputId, fCurrentRunId, and fCurrentTime.
|
inline |
List of branch names @value Reference to set of branch names.
Definition at line 121 of file CbmDigitizationSource.h.
References fBranches.
Referenced by CbmDigitization::CheckInput().
CbmMCInput * CbmDigitizationSource::GetFirstInput | ( | ) |
First input from the first input set @value Pointer to first input.
Definition at line 208 of file CbmDigitizationSource.cxx.
References fInputMap.
Referenced by CbmDigitization::CheckInput().
|
inlinevirtual |
Source type is kFILE.
Definition at line 131 of file CbmDigitizationSource.h.
|
virtual |
Abstract in base class. No implementation here.
Definition at line 216 of file CbmDigitizationSource.cxx.
References ActivateObject(), fCurrentInputSet, fCurrentTime, fEventMode, fInputMap, fInputSets, fListOfFolders, fMCEventHeader, fNextEvent, fTimeStart, CbmMCInput::GetChain(), and CbmMCInputSet::GetDeltaT().
|
inlinevirtual |
Abstract in base class. No implementation here.
Is actually not called at all from FairRunAna.
Definition at line 146 of file CbmDigitizationSource.h.
|
virtual |
Provide one tree entry.
event | Event number. Has no effect here. @value 0 for success, 1 is end of tree is reached. |
The input with the smallest next event time is chosen. From each input, the entries are provided consecutively. If the end of the respective input tree is reached, such that no more entries can be read, 1 is returned, causing FairRunAna to stop the run.
Definition at line 271 of file CbmDigitizationSource.cxx.
References fCurrentEntryId, fCurrentInputId, fCurrentInputSet, fCurrentTime, fEventMode, fFirstCall, fNextEvent, fSwitchInputSet, CbmMCInputSet::GetDeltaT(), CbmMCInputSet::GetNextEntry(), ReadEventByEvent(), and ReadRunId().
|
private |
Get next entry in event-by-event mode.
event | Entry number @value 0 if successful, 1 if requested entry does not exist |
In the event-by-event mode, only the first input set is used. The event time is zero for all events.
Definition at line 330 of file CbmDigitizationSource.cxx.
References fCurrentEntryId, fCurrentInputId, fCurrentTime, fInputSets, CbmMCInput::GetChain(), CbmMCInput::GetMode(), CbmMCInput::GetNextEntry(), CbmMCInput::GetNofEntries(), and kRegular.
Referenced by ReadEvent().
|
private |
Read run ID from the first entry in the first input.
This is used for the first call to ReadEvent, which happens from FairRunAna::Init() to get the run ID. The run ID is read from FairMCEventHeader and copied to the FairEventHeader by FillEventHeader, which is also called from FairRunAna.
Definition at line 367 of file CbmDigitizationSource.cxx.
References fCurrentEntryId, fCurrentInputId, fCurrentRunId, fFirstCall, fInputSets, fMCEventHeader, and CbmMCInput::GetChain().
Referenced by ReadEvent().
|
inlinevirtual |
Abstract in base class. No implementation here.
Is actually not called at all from FairRunAna.
Definition at line 166 of file CbmDigitizationSource.h.
|
inlinevirtual |
Abstract in base class. No implementation here.
Definition at line 170 of file CbmDigitizationSource.h.
|
inline |
Set event-by-event mode @value choice kTRUE if event-by-event mode.
In the event-by-event mode, only the first input is processed. No event start time is generated; the event time is always zero.
Definition at line 179 of file CbmDigitizationSource.h.
References fEventMode.
Referenced by CbmDigitization::Run().
|
inlinevirtual |
Abstract in base class. No implementation here.
Is actually not called at all from FairRunAna.
Definition at line 186 of file CbmDigitizationSource.h.
|
inline |
Set the offset for the first event time.
time | Time offset for first event |
If the event times start with or close to zero, negative digi times can occur because of the finite time resolution of the detectors. However, the first time slice always start from zero. To avoid conflicts or loss of data, a time offset is introduced, preventing negative digi times. The default value of this offset is set in the constructor. It can be changed by this method.
Definition at line 199 of file CbmDigitizationSource.h.
References fTimeStart.
Referenced by CbmDigitization::SetStartTime().
|
private |
Definition at line 208 of file CbmDigitizationSource.h.
Referenced by AddInput(), CheckBranchList(), GetBranchList(), and ~CbmDigitizationSource().
|
private |
Definition at line 211 of file CbmDigitizationSource.h.
Referenced by FillEventHeader(), ReadEvent(), ReadEventByEvent(), and ReadRunId().
|
private |
Definition at line 212 of file CbmDigitizationSource.h.
Referenced by FillEventHeader(), ReadEvent(), ReadEventByEvent(), and ReadRunId().
|
private |
Definition at line 216 of file CbmDigitizationSource.h.
Referenced by Init(), and ReadEvent().
|
private |
Definition at line 213 of file CbmDigitizationSource.h.
Referenced by FillEventHeader(), and ReadRunId().
|
private |
Definition at line 210 of file CbmDigitizationSource.h.
Referenced by FillEventHeader(), Init(), ReadEvent(), and ReadEventByEvent().
|
private |
Definition at line 215 of file CbmDigitizationSource.h.
Referenced by Init(), ReadEvent(), and SetEventMode().
|
private |
Definition at line 214 of file CbmDigitizationSource.h.
Referenced by ReadEvent(), and ReadRunId().
|
private |
Definition at line 204 of file CbmDigitizationSource.h.
Referenced by AddInput(), EmbedInput(), GetFirstInput(), and Init().
|
private |
Definition at line 203 of file CbmDigitizationSource.h.
Referenced by ActivateObject(), AddInput(), CheckMaxEventNo(), Init(), ReadEventByEvent(), ReadRunId(), and ~CbmDigitizationSource().
|
private |
Definition at line 207 of file CbmDigitizationSource.h.
Referenced by Init().
|
private |
time -> inputSet
Definition at line 206 of file CbmDigitizationSource.h.
Referenced by Init(), and ReadRunId().
|
private |
input ID -> inputSet
Definition at line 205 of file CbmDigitizationSource.h.
Referenced by Init(), and ReadEvent().
|
private |
Definition at line 217 of file CbmDigitizationSource.h.
Referenced by ReadEvent().
|
private |
Definition at line 209 of file CbmDigitizationSource.h.
Referenced by Init(), and SetTimeStart().