CbmRoot
Loading...
Searching...
No Matches
CbmDigitization Class Reference

#include <CbmDigitization.h>

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

Public Member Functions

 CbmDigitization ()
 Constructor.
 
virtual ~CbmDigitization ()
 Destructor

 
void AddInput (UInt_t inputId, TString fileName, cbm::sim::TimeDist dist=cbm::sim::TimeDist::Poisson, Double_t eventRate=0., ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
 Add an input file.
 
void AddInput (TString fileName, cbm::sim::TimeDist dist=cbm::sim::TimeDist::Poisson, Double_t eventRate=0., ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
 Add an input file.
 
Bool_t AddParameterAsciiFile (TString fileName)
 Add an ASCII parameter file.
 
void Deactivate (ECbmModuleId system)
 Deactivate a system for digitisation.
 
void DeactivateAllBut (ECbmModuleId system)
 Deactivate all systems except the specified one.
 
void EmbedInput (UInt_t inputId, TString fileName, UInt_t targetInputId, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
 Embed an input file into another one.
 
void GenerateRunInfo (Bool_t choice=kTRUE)
 Write run info (default is kTRUE)
 
void DefaultInit ()
 Initialize the branches, digitizers and parameter files With default values.
 
void Run ()
 Process all events from input.
 
void Run (Int_t nEvents)
 Process nEvents from input, starting with the first event.
 
void Run (Int_t event1, Int_t event2)
 Process input from event1 to event2.
 
void SetCreateMatches (Bool_t choice=kTRUE)
 Set creation of links to MC.
 
void SetDigitizer (ECbmModuleId system, CbmDigitizeBase *digitizer, TString branch="", Bool_t persistent=kTRUE)
 Set a digitizer explicitly.
 
void SetMode (cbm::sim::Mode mode)
 Set event-by-event mode.
 
void SetMonitorFile (const char *fileName)
 Set the monitor file name.
 
void SetOutputFile (TString fileName, Bool_t overwrite=kFALSE)
 Set the output file name.
 
void SetParameterRootFile (TString fileName)
 Set the parameter file name.
 
void SetProduceNoise (Bool_t choice=kTRUE)
 Set production of inter-event noise.
 
void SetStartTime (Double_t time)
 Set the start time of the run.
 
void SetTimeSliceLength (Double_t length)
 Set length of the time-slices.
 
void StoreAllTimeSlices (Bool_t choice=kTRUE)
 Store all time-slices.
 
CbmDigitizeBaseGetDigitizer (ECbmModuleId system)
 Get the pointer on a given digitizer if existing.
 

Private Member Functions

 CbmDigitization (const CbmDigitization &)=delete
 Copy constructor forbidden.
 
CbmDigitization operator= (const CbmDigitization &)=delete
 Assignment operator forbidden.
 
Int_t CheckInput ()
 Check the presence of input branches.
 
Int_t CreateDefaultDigitizers ()
 Instantiate the default digitisers for the active systems.
 
TString GetGeoTag (ECbmModuleId system, TGeoManager *geo)
 Get the geometry tag of a system from a TGeoManager.
 
void SetDefaultBranches ()
 Default settings for digitizers.
 
 ClassDef (CbmDigitization, 3)
 

Private Attributes

Bool_t fIsInit = kFALSE
 
cbm::sim::Mode fMode = cbm::sim::Mode::Timebased
 
Double_t fTimeSliceLength = -1.
 
Bool_t fProduceNoise = kTRUE
 
Bool_t fCreateMatches = kTRUE
 
std::map< ECbmModuleId, CbmDigitizeInfo * > fDigitizers = {}
 
CbmDaqfDaq = new CbmDaq()
 
CbmDigitizationSourcefSource = new CbmDigitizationSource()
 Input source.
 
TString fOutFile = {}
 Output data (digis)
 
TString fParRootFile = {}
 ROOT parameter file.
 
TList fParAsciiFiles = {}
 ASCII parameter files.
 
TString fMoniFile = {}
 Resource monitoring information.
 
Bool_t fOverwriteOutput = kFALSE
 
Bool_t fGenerateRunInfo = kTRUE
 
Int_t fRun = 0
 

Detailed Description

Definition at line 34 of file CbmDigitization.h.

Constructor & Destructor Documentation

◆ CbmDigitization() [1/2]

CbmDigitization::CbmDigitization ( )

Constructor.

Definition at line 46 of file CbmDigitization.cxx.

References SetDefaultBranches().

◆ ~CbmDigitization()

CbmDigitization::~CbmDigitization ( )
virtual

Destructor

Definition at line 51 of file CbmDigitization.cxx.

References fDigitizers.

◆ CbmDigitization() [2/2]

CbmDigitization::CbmDigitization ( const CbmDigitization & )
privatedelete

Copy constructor forbidden.

Member Function Documentation

◆ AddInput() [1/2]

void CbmDigitization::AddInput ( TString fileName,
cbm::sim::TimeDist dist = cbm::sim::TimeDist::Poisson,
Double_t eventRate = 0.,
ECbmTreeAccess mode = ECbmTreeAccess::kRegular )
inline

Add an input file.

Parameters
fileNameName of input file (MC)
eventRateRate for events from input file [1/s]
modeTree access mode (kRegular / kRepeat / kRandom)

Shortcut for legacy reasons, when only one input file is used. This will set the inputId to zero. Repeated use will lead to abort.

Definition at line 63 of file CbmDigitization.h.

References AddInput().

◆ AddInput() [2/2]

void CbmDigitization::AddInput ( UInt_t inputId,
TString fileName,
cbm::sim::TimeDist dist = cbm::sim::TimeDist::Poisson,
Double_t eventRate = 0.,
ECbmTreeAccess mode = ECbmTreeAccess::kRegular )

Add an input file.

Parameters
inputIdUnique input identifier
fileNameName of input file (MC)
eventRateRate for events from input file [1/s]
modeTree access mode (kRegular / kRepeat / kRandom)

Definition at line 63 of file CbmDigitization.cxx.

References CbmDigitizationSource::AddInput(), fSource, and kRegular.

Referenced by AddInput(), cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetIO().

◆ AddParameterAsciiFile()

Bool_t CbmDigitization::AddParameterAsciiFile ( TString fileName)

Add an ASCII parameter file.

Parameters
fileNameName of parameter file
Returns
kTRUE is file is found

All ASCII parameter files will be concatenated and used as second input to the runtime database.

Definition at line 76 of file CbmDigitization.cxx.

References fParAsciiFiles.

Referenced by DefaultInit().

◆ CheckInput()

Int_t CbmDigitization::CheckInput ( )
private

Check the presence of input branches.

Returns
Number of required branches (MCPoint) found in the tree.

The branch list is searched for the input branches (MCPoint) required by the digitizers. For each present input branch, the corresponding digitizer will be instantiated. In addition, the run number is extracted from the MCEventHeader.

Definition at line 90 of file CbmDigitization.cxx.

References fDigitizers, fRun, fSource, CbmDigitizationSource::GetBranchList(), CbmMCInput::GetChain(), CbmDigitizationSource::GetFirstInput(), and CbmModuleList::GetModuleNameCaps().

Referenced by DefaultInit().

◆ ClassDef()

CbmDigitization::ClassDef ( CbmDigitization ,
3  )
private

◆ CreateDefaultDigitizers()

Int_t CbmDigitization::CreateDefaultDigitizers ( )
private

Instantiate the default digitisers for the active systems.

Returns
Number of instantiated digitisers

For systems not having explicitly defined their digitizers, the default digitisers are instantiated.

Definition at line 128 of file CbmDigitization.cxx.

References fDigitizers, kBmon, kFsd, kMuch, kMvd, kPsd, kRich, kSts, kTof, and kTrd.

Referenced by DefaultInit().

◆ Deactivate()

void CbmDigitization::Deactivate ( ECbmModuleId system)

Deactivate a system for digitisation.

Parameters
systemSystem ID (ECbmModuleId)

The digitiser for this system will not be run even if the MCPoint branch is present in the input tree.

Definition at line 215 of file CbmDigitization.cxx.

References fDigitizers.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetGeometry().

◆ DeactivateAllBut()

void CbmDigitization::DeactivateAllBut ( ECbmModuleId system)

Deactivate all systems except the specified one.

Parameters
systemSystem ID (ECbmModuleId)

Only the digitiser of the specified system will run.

Definition at line 223 of file CbmDigitization.cxx.

References fDigitizers.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetGeometry().

◆ DefaultInit()

void CbmDigitization::DefaultInit ( )

Initialize the branches, digitizers and parameter files With default values.

Definition at line 267 of file CbmDigitization.cxx.

References AddParameterAsciiFile(), CheckInput(), CreateDefaultDigitizers(), fIsInit, fParRootFile, fRun, GetGeoTag(), kFsd, kTof, and kTrd.

Referenced by Run().

◆ EmbedInput()

void CbmDigitization::EmbedInput ( UInt_t inputId,
TString fileName,
UInt_t targetInputId,
ECbmTreeAccess mode = ECbmTreeAccess::kRegular )

Embed an input file into another one.

Parameters
inputIdUnique input identifier
fileNameName of input file (MC)
targetInputIdID of the input to be embedded into
modeTree access mode (kRegular / kRepeat / kRandom)

Definition at line 233 of file CbmDigitization.cxx.

References CbmDigitizationSource::EmbedInput(), and fSource.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetIO().

◆ GenerateRunInfo()

void CbmDigitization::GenerateRunInfo ( Bool_t choice = kTRUE)
inline

Write run info (default is kTRUE)

Parameters
choiceIf kTRUE, run info will be written

The run info comprises CPU and memory consumption for each event. It will be written to a separate ROOT file.

Definition at line 112 of file CbmDigitization.h.

References fGenerateRunInfo.

◆ GetDigitizer()

CbmDigitizeBase * CbmDigitization::GetDigitizer ( ECbmModuleId system)

Get the pointer on a given digitizer if existing.

Parameters
systemSystem ID (ECbmModuleId)
Returns
digitizer Pointer to digitizer instance if found, NULL otherwise

This method can be called from the macro level, between CbmDigitization instantiation and the call to the Run method (which itself calls the CbmRunAna Init method) to set specific parameters.

Definition at line 570 of file CbmDigitization.cxx.

References fDigitizers.

◆ GetGeoTag()

TString CbmDigitization::GetGeoTag ( ECbmModuleId system,
TGeoManager * geo )
private

Get the geometry tag of a system from a TGeoManager.

Parameters
systemDetector system (ECbmModuleId)
geoPointer to TGeoManager
Returns
Geometry tag

The implementation assumes that the top-level volume name of each system in the geometry contains the geometry tag in the form of e.g., sts_v16g

Definition at line 244 of file CbmDigitization.cxx.

References CbmModuleList::GetModuleName().

Referenced by DefaultInit().

◆ operator=()

CbmDigitization CbmDigitization::operator= ( const CbmDigitization & )
privatedelete

Assignment operator forbidden.

◆ Run() [1/3]

void CbmDigitization::Run ( )
inline

Process all events from input.

Definition at line 120 of file CbmDigitization.h.

References Run().

Referenced by cbm::sim::digitization::Run::Exec(), and Run().

◆ Run() [2/3]

◆ Run() [3/3]

void CbmDigitization::Run ( Int_t nEvents)
inline

Process nEvents from input, starting with the first event.

Parameters
nEventsNumber of events to process

Definition at line 126 of file CbmDigitization.h.

References Run().

Referenced by Run().

◆ SetCreateMatches()

void CbmDigitization::SetCreateMatches ( Bool_t choice = kTRUE)
inline

Set creation of links to MC.

Parameters
ChoiceIf kTRUE, the match objects will be created

Definition at line 139 of file CbmDigitization.h.

References fCreateMatches.

◆ SetDefaultBranches()

void CbmDigitization::SetDefaultBranches ( )
private

Default settings for digitizers.

Definition at line 496 of file CbmDigitization.cxx.

References fDigitizers, kBmon, kFsd, kMuch, kMvd, kPsd, kRich, kSts, kTof, and kTrd.

Referenced by CbmDigitization().

◆ SetDigitizer()

void CbmDigitization::SetDigitizer ( ECbmModuleId system,
CbmDigitizeBase * digitizer,
TString branch = "",
Bool_t persistent = kTRUE )

Set a digitizer explicitly.

Parameters
systemSystem ID (ECbmModuleId)
digitizerPointer to digitizer instance
branchInput branch name (MCPoint)
persistentif kTRUE, the output (digis) will be persistent

This method has to be called from the macro level, if a digitizer different from the default one or with different settings than the default ones is to be used. The respective digitizer has to be instantiated before. The ownership is passed to this class.

Definition at line 512 of file CbmDigitization.cxx.

References fDigitizers.

◆ SetMode()

void CbmDigitization::SetMode ( cbm::sim::Mode mode)
inline

Set event-by-event mode.

Parameters
choiceIf kTRUE, digitisation will be done event-by-event

In the event-by-event mode, one time slice will be created for each input event. There will be no interference between events.

Definition at line 162 of file CbmDigitization.h.

References fMode.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetDigitizationParameters().

◆ SetMonitorFile()

void CbmDigitization::SetMonitorFile ( const char * fileName)
inline

Set the monitor file name.

Parameters
fileNameName of monitor file

The monitor file stores information on the resource usage. If a file name is specified, a corresponding file will be created and filled. By default, monitoring is not recorded.

Definition at line 172 of file CbmDigitization.h.

References fMoniFile.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetIO().

◆ SetOutputFile()

void CbmDigitization::SetOutputFile ( TString fileName,
Bool_t overwrite = kFALSE )

Set the output file name.

Parameters
pathName of output file
overwriteOverwrite output file if already existing

If the directory of the file does not exist, it will be created.

Definition at line 536 of file CbmDigitization.cxx.

References fOutFile.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetIO().

◆ SetParameterRootFile()

void CbmDigitization::SetParameterRootFile ( TString fileName)

Set the parameter file name.

Parameters
fileNameName of output file

Definition at line 561 of file CbmDigitization.cxx.

References fParRootFile.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetIO().

◆ SetProduceNoise()

void CbmDigitization::SetProduceNoise ( Bool_t choice = kTRUE)
inline

Set production of inter-event noise.

Parameters
ChoiceIf kTRUE, the digitizer will produce noise

Definition at line 193 of file CbmDigitization.h.

References fProduceNoise.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetDigitizationParameters().

◆ SetStartTime()

void CbmDigitization::SetStartTime ( Double_t time)
inline

Set the start time of the run.

Parameters
timeStart time of run [ns]

A default of 1000 ns is hard-coded in the constructor of CbmDigitizationSource. It can be changed with this method.

Definition at line 202 of file CbmDigitization.h.

References fSource, and CbmDigitizationSource::SetTimeStart().

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetDigitizationParameters().

◆ SetTimeSliceLength()

void CbmDigitization::SetTimeSliceLength ( Double_t length)
inline

Set length of the time-slices.

Parameters
lengthLength of time-slices [ns]

The raw data will be sorted into time-slices of the specified length.

If the time-slice length is negative (default), one time-slice for all input data will be created.

Definition at line 214 of file CbmDigitization.h.

References fTimeSliceLength.

Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetDigitizationParameters().

◆ StoreAllTimeSlices()

void CbmDigitization::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 222 of file CbmDigitization.h.

References fDaq, and CbmDaq::StoreAllTimeSlices().

Referenced by cbm::sim::digitization::Run::Exec(), and Run().

Member Data Documentation

◆ fCreateMatches

Bool_t CbmDigitization::fCreateMatches = kTRUE
private

Definition at line 241 of file CbmDigitization.h.

Referenced by Run(), and SetCreateMatches().

◆ fDaq

CbmDaq* CbmDigitization::fDaq = new CbmDaq()
private

Definition at line 243 of file CbmDigitization.h.

Referenced by Run(), and StoreAllTimeSlices().

◆ fDigitizers

◆ fGenerateRunInfo

Bool_t CbmDigitization::fGenerateRunInfo = kTRUE
private

Definition at line 250 of file CbmDigitization.h.

Referenced by GenerateRunInfo(), and Run().

◆ fIsInit

Bool_t CbmDigitization::fIsInit = kFALSE
private

Definition at line 236 of file CbmDigitization.h.

Referenced by DefaultInit().

◆ fMode

cbm::sim::Mode CbmDigitization::fMode = cbm::sim::Mode::Timebased
private

Definition at line 237 of file CbmDigitization.h.

Referenced by Run(), and SetMode().

◆ fMoniFile

TString CbmDigitization::fMoniFile = {}
private

Resource monitoring information.

Definition at line 248 of file CbmDigitization.h.

Referenced by Run(), and SetMonitorFile().

◆ fOutFile

TString CbmDigitization::fOutFile = {}
private

Output data (digis)

Definition at line 245 of file CbmDigitization.h.

Referenced by Run(), and SetOutputFile().

◆ fOverwriteOutput

Bool_t CbmDigitization::fOverwriteOutput = kFALSE
private

Definition at line 249 of file CbmDigitization.h.

◆ fParAsciiFiles

TList CbmDigitization::fParAsciiFiles = {}
private

ASCII parameter files.

Definition at line 247 of file CbmDigitization.h.

Referenced by AddParameterAsciiFile(), and Run().

◆ fParRootFile

TString CbmDigitization::fParRootFile = {}
private

ROOT parameter file.

Definition at line 246 of file CbmDigitization.h.

Referenced by DefaultInit(), Run(), and SetParameterRootFile().

◆ fProduceNoise

Bool_t CbmDigitization::fProduceNoise = kTRUE
private

Definition at line 239 of file CbmDigitization.h.

Referenced by Run(), and SetProduceNoise().

◆ fRun

Int_t CbmDigitization::fRun = 0
private

Definition at line 251 of file CbmDigitization.h.

Referenced by CheckInput(), and DefaultInit().

◆ fSource

CbmDigitizationSource* CbmDigitization::fSource = new CbmDigitizationSource()
private

Input source.

Definition at line 244 of file CbmDigitization.h.

Referenced by AddInput(), CheckInput(), EmbedInput(), Run(), and SetStartTime().

◆ fTimeSliceLength

Double_t CbmDigitization::fTimeSliceLength = -1.
private

Definition at line 238 of file CbmDigitization.h.

Referenced by Run(), and SetTimeSliceLength().


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