CbmRoot
|
A MC transport input to digitisation in CBM. More...
#include <CbmMCInputSet.h>
Public Member Functions | |
CbmMCInputSet () | |
Default constructor. | |
CbmMCInputSet (cbm::sim::TimeDist dist, Double_t rate) | |
Constructor. | |
virtual | ~CbmMCInputSet () |
Destructor. | |
virtual Bool_t | ActivateObject (TObject **object, const char *branchName) |
Activate and connect all input chains. | |
void | AddInput (UInt_t inputId, TChain *chain, ECbmTreeAccess mode=ECbmTreeAccess::kRegular) |
Add an input to the set. | |
const std::set< TString > & | GetBranchList () const |
List of branches @value Reference to branch list. | |
Double_t | GetDeltaT () |
Time difference to next event @value Time difference to next event [ns]. | |
std::pair< UInt_t, CbmMCInput * > | GetFirstInput () |
Accessor to first input @value ID and Pointer to first CbmMCInput object. | |
CbmMCInput * | GetInput (UInt_t id) |
Accessor to input. | |
Int_t | GetMaxNofEvents () const |
Maximal number of events to be read from the input set @value Maximal number of events. | |
std::tuple< Bool_t, UInt_t, Int_t > | GetNextEntry () |
Get the next entry from the inputs @value Status tuple. | |
Double_t | GetEventRate () const |
Event rate @value Event rate [1/s]. | |
void | RegisterChains () |
register all input chains to the FairRootManager | |
Private Member Functions | |
Bool_t | CheckBranchList (CbmMCInput *input) |
Compare an input branch list with the reference branch list. | |
ClassDef (CbmMCInputSet, 1) | |
Private Attributes | |
cbm::sim::TimeDist | fTimeDist = cbm::sim::TimeDist::Poisson |
Double_t | fEventRate |
std::map< UInt_t, CbmMCInput * > | fInputs |
std::map< UInt_t, CbmMCInput * >::iterator | fInputHandle |
std::set< TString > | fBranches |
TF1 * | fDeltaDist |
A MC transport input to digitisation in CBM.
CbmMCInputSet represents one MC input line to digitization. It is characterised by an event rate, allowing to sample the time difference to the previous event using the method GetDeltaT(). Assuming a Poisson process, deltaT is obtained from an exponential distribution, the first moment of which being the inverse rate.
The input set consists of one or several single inputs (class CbmMCInput). Subsequent calls to GetNextEntry() will subsequently call CbmMCInput::GetNextEntry(), until all inputs were used once, after which GetNextEntry() will return kTRUE.
Definition at line 42 of file CbmMCInputSet.h.
CbmMCInputSet::CbmMCInputSet | ( | ) |
Default constructor.
Definition at line 21 of file CbmMCInputSet.cxx.
CbmMCInputSet::CbmMCInputSet | ( | cbm::sim::TimeDist | dist, |
Double_t | rate ) |
Constructor.
rate | Event rate [1/s]. Must be positive. |
Definition at line 26 of file CbmMCInputSet.cxx.
References fDeltaDist, fInputHandle, fInputs, and fTimeDist.
|
virtual |
|
virtual |
Activate and connect all input chains.
object | Pointer to pointer to branch class |
branchName | Name of branch |
All input trees have to be connected to the argument object.
Definition at line 57 of file CbmMCInputSet.cxx.
References fInputs, and CbmMCInput::GetChain().
void CbmMCInputSet::AddInput | ( | UInt_t | inputId, |
TChain * | chain, | ||
ECbmTreeAccess | mode = ECbmTreeAccess::kRegular ) |
Add an input to the set.
inputId | Unique input identifier |
input | Pointer to CbmMCInput object |
Definition at line 74 of file CbmMCInputSet.cxx.
References CheckBranchList(), fBranches, fInputHandle, fInputs, and CbmMCInput::GetBranchList().
Referenced by CbmDigitizationSource::AddInput().
|
private |
Compare an input branch list with the reference branch list.
input | Pointer to CbmMCInput object @value kTRUE if the branch list of the input is compatible |
The branch list of the input is considered compatible if all branches of the global list are present in the input. Additional branches in the input are not considered harmful. The reference branch list is defined by the first input.
Definition at line 111 of file CbmMCInputSet.cxx.
References fBranches, and CbmMCInput::GetBranchList().
Referenced by AddInput().
|
private |
|
inline |
List of branches @value Reference to branch list.
Definition at line 78 of file CbmMCInputSet.h.
References fBranches.
Referenced by CbmDigitizationSource::AddInput(), and CbmDigitizationSource::CheckBranchList().
Double_t CbmMCInputSet::GetDeltaT | ( | ) |
Time difference to next event @value Time difference to next event [ns].
This method samples from the probability distribution for the time difference between two subsequent events, assuming a Poisson process (exponential distribution). The return value is zero if the rate was specified to be non-positive.
Definition at line 144 of file CbmMCInputSet.cxx.
References fDeltaDist, fEventRate, and fTimeDist.
Referenced by CbmDigitizationSource::Init(), and CbmDigitizationSource::ReadEvent().
|
inline |
Event rate @value Event rate [1/s].
Definition at line 138 of file CbmMCInputSet.h.
References fEventRate.
|
inline |
Accessor to first input @value ID and Pointer to first CbmMCInput object.
Returns -1 for the ID and a null pointer if no input is connected.
Definition at line 97 of file CbmMCInputSet.h.
References fInputs.
|
inline |
Accessor to input.
id | Unique input identifier @value Pointer to CbmMCInput object. Null if ID is not used. |
Definition at line 108 of file CbmMCInputSet.h.
References fInputs.
Int_t CbmMCInputSet::GetMaxNofEvents | ( | ) | const |
Maximal number of events to be read from the input set @value Maximal number of events.
If there is at least one limited input (mode = kRegular), the return value is the number of inputs times the minimal event number from all inputs. This reflects the fact that all inputs are read sequentially. If all inputs are unlimited (kRepeat or kRandom), the return value is -1.
Definition at line 166 of file CbmMCInputSet.cxx.
References fInputs.
std::tuple< Bool_t, UInt_t, Int_t > CbmMCInputSet::GetNextEntry | ( | ) |
Get the next entry from the inputs @value Status tuple.
The return tuple consists of: Flag whether the used input is the last one in the set ID of the used input Entry number from the used input. If -1, the end of this input was reached.
Definition at line 186 of file CbmMCInputSet.cxx.
References fInputHandle, and fInputs.
Referenced by CbmDigitizationSource::ReadEvent().
void CbmMCInputSet::RegisterChains | ( | ) |
register all input chains to the FairRootManager
Definition at line 210 of file CbmMCInputSet.cxx.
References fInputs.
|
private |
Definition at line 150 of file CbmMCInputSet.h.
Referenced by AddInput(), CheckBranchList(), and GetBranchList().
|
private |
Definition at line 151 of file CbmMCInputSet.h.
Referenced by CbmMCInputSet(), GetDeltaT(), and ~CbmMCInputSet().
|
private |
Definition at line 147 of file CbmMCInputSet.h.
Referenced by GetDeltaT(), and GetEventRate().
|
private |
Definition at line 149 of file CbmMCInputSet.h.
Referenced by AddInput(), CbmMCInputSet(), and GetNextEntry().
|
private |
Definition at line 148 of file CbmMCInputSet.h.
Referenced by ActivateObject(), AddInput(), CbmMCInputSet(), GetFirstInput(), GetInput(), GetMaxNofEvents(), GetNextEntry(), RegisterChains(), and ~CbmMCInputSet().
|
private |
Definition at line 146 of file CbmMCInputSet.h.
Referenced by CbmMCInputSet(), and GetDeltaT().