CbmRoot
CbmMCInputSet Class Reference

A MC transport input to digitisation in CBM. More...

#include <CbmMCInputSet.h>

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

Public Member Functions

 CbmMCInputSet ()
 Default constructor. More...
 
 CbmMCInputSet (Double_t rate)
 Constructor. More...
 
virtual ~CbmMCInputSet ()
 Destructor. More...
 
virtual Bool_t ActivateObject (TObject **object, const char *branchName)
 Activate and connect all input chains. More...
 
void AddInput (UInt_t inputId, TChain *chain, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
 Add an input to the set. More...
 
const std::set< TString > & GetBranchList () const
 List of branches @value Reference to branch list. More...
 
Double_t GetDeltaT ()
 Time difference to next event @value Time difference to next event [ns]. More...
 
std::pair< UInt_t, CbmMCInput * > GetFirstInput ()
 Accessor to first input @value ID and Pointer to first CbmMCInput object. More...
 
CbmMCInputGetInput (UInt_t id)
 Accessor to input. More...
 
Int_t GetMaxNofEvents () const
 Maximal number of events to be read from the input set @value Maximal number of events. More...
 
std::tuple< Bool_t, UInt_t, Int_t > GetNextEntry ()
 Get the next entry from the inputs @value Status tuple. More...
 
Double_t GetRate () const
 Event rate @value Event rate [1/s]. More...
 
void RegisterChains ()
 register all input chains to the FairRootManager More...
 

Private Member Functions

Bool_t CheckBranchList (CbmMCInput *input)
 Compare an input branch list with the reference branch list. More...
 
 ClassDef (CbmMCInputSet, 1)
 

Private Attributes

Double_t fRate
 
std::map< UInt_t, CbmMCInput * > fInputs
 
std::map< UInt_t, CbmMCInput * >::iterator fInputHandle
 
std::set< TString > fBranches
 
TF1 * fDeltaDist
 

Detailed Description

A MC transport input to digitisation in CBM.

Author
Volker Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e
Date
23 November 2018 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 34 of file CbmMCInputSet.h.

Constructor & Destructor Documentation

◆ CbmMCInputSet() [1/2]

CbmMCInputSet::CbmMCInputSet ( )

Default constructor.

Definition at line 14 of file CbmMCInputSet.cxx.

◆ CbmMCInputSet() [2/2]

CbmMCInputSet::CbmMCInputSet ( Double_t  rate)

Constructor.

Parameters
rateEvent rate [1/s]. Must be positive.

Definition at line 19 of file CbmMCInputSet.cxx.

References fDeltaDist, fInputHandle, and fInputs.

◆ ~CbmMCInputSet()

CbmMCInputSet::~CbmMCInputSet ( )
virtual

Destructor.

Definition at line 38 of file CbmMCInputSet.cxx.

References fDeltaDist, and fInputs.

Member Function Documentation

◆ ActivateObject()

Bool_t CbmMCInputSet::ActivateObject ( TObject **  object,
const char *  branchName 
)
virtual

Activate and connect all input chains.

Parameters
objectPointer to pointer to branch class
branchNameName of branch

All input trees have to be connected to the argument object.

Definition at line 47 of file CbmMCInputSet.cxx.

References fInputs, and CbmMCInput::GetChain().

◆ AddInput()

void CbmMCInputSet::AddInput ( UInt_t  inputId,
TChain *  chain,
ECbmTreeAccess  mode = ECbmTreeAccess::kRegular 
)

Add an input to the set.

Parameters
inputIdUnique input identifier
inputPointer to CbmMCInput object

Definition at line 63 of file CbmMCInputSet.cxx.

References CheckBranchList(), fBranches, fInputHandle, fInputs, and CbmMCInput::GetBranchList().

Referenced by CbmDigitizationSource::AddInput().

◆ CheckBranchList()

Bool_t CbmMCInputSet::CheckBranchList ( CbmMCInput input)
private

Compare an input branch list with the reference branch list.

Parameters
inputPointer 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 103 of file CbmMCInputSet.cxx.

References fBranches, and CbmMCInput::GetBranchList().

Referenced by AddInput().

◆ ClassDef()

CbmMCInputSet::ClassDef ( CbmMCInputSet  ,
 
)
private

◆ GetBranchList()

const std::set<TString>& CbmMCInputSet::GetBranchList ( ) const
inline

List of branches @value Reference to branch list.

Definition at line 72 of file CbmMCInputSet.h.

References fBranches.

Referenced by CbmDigitizationSource::AddInput(), and CbmDigitizationSource::CheckBranchList().

◆ GetDeltaT()

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 136 of file CbmMCInputSet.cxx.

References fDeltaDist.

Referenced by CbmDigitizationSource::Init(), and CbmDigitizationSource::ReadEvent().

◆ GetFirstInput()

std::pair<UInt_t, CbmMCInput*> CbmMCInputSet::GetFirstInput ( )
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 91 of file CbmMCInputSet.h.

References fInputs.

◆ GetInput()

CbmMCInput* CbmMCInputSet::GetInput ( UInt_t  id)
inline

Accessor to input.

Parameters
idUnique input identifier @value Pointer to CbmMCInput object. Null if ID is not used.

Definition at line 102 of file CbmMCInputSet.h.

References fInputs.

◆ GetMaxNofEvents()

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 144 of file CbmMCInputSet.cxx.

References fInputs.

◆ GetNextEntry()

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 164 of file CbmMCInputSet.cxx.

References fInputHandle, and fInputs.

Referenced by CbmDigitizationSource::ReadEvent().

◆ GetRate()

Double_t CbmMCInputSet::GetRate ( ) const
inline

Event rate @value Event rate [1/s].

Definition at line 134 of file CbmMCInputSet.h.

References fRate.

◆ RegisterChains()

void CbmMCInputSet::RegisterChains ( )

register all input chains to the FairRootManager

Definition at line 187 of file CbmMCInputSet.cxx.

References fInputs.

Member Data Documentation

◆ fBranches

std::set<TString> CbmMCInputSet::fBranches
private

Definition at line 145 of file CbmMCInputSet.h.

Referenced by AddInput(), CheckBranchList(), and GetBranchList().

◆ fDeltaDist

TF1* CbmMCInputSet::fDeltaDist
private

Definition at line 146 of file CbmMCInputSet.h.

Referenced by CbmMCInputSet(), GetDeltaT(), and ~CbmMCInputSet().

◆ fInputHandle

std::map<UInt_t, CbmMCInput*>::iterator CbmMCInputSet::fInputHandle
private

Definition at line 144 of file CbmMCInputSet.h.

Referenced by AddInput(), CbmMCInputSet(), and GetNextEntry().

◆ fInputs

std::map<UInt_t, CbmMCInput*> CbmMCInputSet::fInputs
private

◆ fRate

Double_t CbmMCInputSet::fRate
private

Definition at line 142 of file CbmMCInputSet.h.

Referenced by GetRate().


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