CbmRoot
CbmDigitization Class Reference

#include <CbmDigitization.h>

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

Public Member Functions

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

Private Member Functions

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

Private Attributes

Bool_t fIsInit
 
Bool_t fEventMode
 
Double_t fTimeSliceLength
 
Bool_t fProduceNoise
 
Bool_t fCreateMatches
 
std::map< ECbmModuleId, CbmDigitizeInfo * > fDigitizers
 
CbmDaqfDaq
 
CbmDigitizationSourcefSource
 Input source. More...
 
TString fOutFile
 Output data (digis) More...
 
TString fParRootFile
 ROOT parameter file. More...
 
TList fParAsciiFiles
 ASCII parameter files. More...
 
TString fMoniFile
 Resource monitoring information. More...
 
Bool_t fOverwriteOutput
 
Bool_t fGenerateRunInfo
 
Int_t fRun
 

Detailed Description

Definition at line 25 of file CbmDigitization.h.

Constructor & Destructor Documentation

◆ CbmDigitization() [1/2]

CbmDigitization::CbmDigitization ( )

Constructor.

Definition at line 32 of file CbmDigitization.cxx.

References SetDefaultBranches().

◆ ~CbmDigitization()

CbmDigitization::~CbmDigitization ( )
virtual

Destructor

Definition at line 55 of file CbmDigitization.cxx.

References fDigitizers, and fSource.

◆ CbmDigitization() [2/2]

CbmDigitization::CbmDigitization ( const CbmDigitization )
privatedelete

Copy constructor forbidden.

Member Function Documentation

◆ AddInput() [1/2]

void CbmDigitization::AddInput ( TString  fileName,
Double_t  eventRate = -1.,
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 56 of file CbmDigitization.h.

References AddInput().

◆ AddInput() [2/2]

void CbmDigitization::AddInput ( UInt_t  inputId,
TString  fileName,
Double_t  eventRate = -1.,
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 67 of file CbmDigitization.cxx.

References CbmDigitizationSource::AddInput(), and fSource.

Referenced by AddInput().

◆ 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 81 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 95 of file CbmDigitization.cxx.

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

Referenced by DefaultInit().

◆ ClassDef()

CbmDigitization::ClassDef ( CbmDigitization  ,
 
)
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 133 of file CbmDigitization.cxx.

References fDigitizers, fEventMode, 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 207 of file CbmDigitization.cxx.

References fDigitizers.

◆ 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 215 of file CbmDigitization.cxx.

References fDigitizers.

◆ DefaultInit()

void CbmDigitization::DefaultInit ( )

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

Definition at line 261 of file CbmDigitization.cxx.

References AddParameterAsciiFile(), CheckInput(), CreateDefaultDigitizers(), fIsInit, fParRootFile, fRun, GetGeoTag(), 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 225 of file CbmDigitization.cxx.

References CbmDigitizationSource::EmbedInput(), and fSource.

◆ 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 107 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 561 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 239 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 115 of file CbmDigitization.h.

References Run().

Referenced by Run().

◆ Run() [2/3]

void CbmDigitization::Run ( Int_t  event1,
Int_t  event2 
)

◆ 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 121 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 134 of file CbmDigitization.h.

References fCreateMatches.

◆ SetDefaultBranches()

void CbmDigitization::SetDefaultBranches ( )
private

Default settings for digitizers.

Definition at line 478 of file CbmDigitization.cxx.

References fDigitizers, 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 498 of file CbmDigitization.cxx.

References fDigitizers.

◆ SetEventMode()

void CbmDigitization::SetEventMode ( Bool_t  choice = kTRUE)
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 160 of file CbmDigitization.h.

References fEventMode.

◆ 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 170 of file CbmDigitization.h.

References fMoniFile.

◆ 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 526 of file CbmDigitization.cxx.

References fOutFile.

◆ SetParameterRootFile()

void CbmDigitization::SetParameterRootFile ( TString  fileName)

Set the parameter file name.

Parameters
fileNameName of output file

Definition at line 551 of file CbmDigitization.cxx.

References fParRootFile.

◆ 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 191 of file CbmDigitization.h.

References fProduceNoise.

◆ 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 200 of file CbmDigitization.h.

References fSource, and CbmDigitizationSource::SetTimeStart().

◆ 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 212 of file CbmDigitization.h.

References fTimeSliceLength.

◆ 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 220 of file CbmDigitization.h.

References fDaq, and CbmDaq::StoreAllTimeSlices().

Referenced by Run().

Member Data Documentation

◆ fCreateMatches

Bool_t CbmDigitization::fCreateMatches
private

Definition at line 240 of file CbmDigitization.h.

Referenced by Run(), and SetCreateMatches().

◆ fDaq

CbmDaq* CbmDigitization::fDaq
private

Definition at line 242 of file CbmDigitization.h.

Referenced by Run(), and StoreAllTimeSlices().

◆ fDigitizers

◆ fEventMode

Bool_t CbmDigitization::fEventMode
private

Definition at line 237 of file CbmDigitization.h.

Referenced by CreateDefaultDigitizers(), Run(), and SetEventMode().

◆ fGenerateRunInfo

Bool_t CbmDigitization::fGenerateRunInfo
private

Definition at line 249 of file CbmDigitization.h.

Referenced by GenerateRunInfo(), and Run().

◆ fIsInit

Bool_t CbmDigitization::fIsInit
private

Definition at line 236 of file CbmDigitization.h.

Referenced by DefaultInit().

◆ fMoniFile

TString CbmDigitization::fMoniFile
private

Resource monitoring information.

Definition at line 247 of file CbmDigitization.h.

Referenced by Run(), and SetMonitorFile().

◆ fOutFile

TString CbmDigitization::fOutFile
private

Output data (digis)

Definition at line 244 of file CbmDigitization.h.

Referenced by Run(), and SetOutputFile().

◆ fOverwriteOutput

Bool_t CbmDigitization::fOverwriteOutput
private

Definition at line 248 of file CbmDigitization.h.

◆ fParAsciiFiles

TList CbmDigitization::fParAsciiFiles
private

ASCII parameter files.

Definition at line 246 of file CbmDigitization.h.

Referenced by AddParameterAsciiFile(), and Run().

◆ fParRootFile

TString CbmDigitization::fParRootFile
private

ROOT parameter file.

Definition at line 245 of file CbmDigitization.h.

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

◆ fProduceNoise

Bool_t CbmDigitization::fProduceNoise
private

Definition at line 239 of file CbmDigitization.h.

Referenced by Run(), and SetProduceNoise().

◆ fRun

Int_t CbmDigitization::fRun
private

Definition at line 250 of file CbmDigitization.h.

Referenced by CheckInput(), and DefaultInit().

◆ fSource

CbmDigitizationSource* CbmDigitization::fSource
private

Input source.

Definition at line 243 of file CbmDigitization.h.

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

◆ fTimeSliceLength

Double_t CbmDigitization::fTimeSliceLength
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: