CbmRoot
|
#include <CbmDigitization.h>
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. | |
CbmDigitizeBase * | GetDigitizer (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 = {} |
CbmDaq * | fDaq = new CbmDaq() |
CbmDigitizationSource * | fSource = 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 |
Definition at line 34 of file CbmDigitization.h.
CbmDigitization::CbmDigitization | ( | ) |
|
virtual |
|
privatedelete |
Copy constructor forbidden.
|
inline |
Add an input file.
fileName | Name of input file (MC) |
eventRate | Rate for events from input file [1/s] |
mode | Tree 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().
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.
inputId | Unique input identifier |
fileName | Name of input file (MC) |
eventRate | Rate for events from input file [1/s] |
mode | Tree 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().
Bool_t CbmDigitization::AddParameterAsciiFile | ( | TString | fileName | ) |
Add an ASCII parameter file.
fileName | Name of parameter file |
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().
|
private |
Check the presence of input branches.
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().
|
private |
|
private |
Instantiate the default digitisers for the active systems.
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().
void CbmDigitization::Deactivate | ( | ECbmModuleId | system | ) |
Deactivate a system for digitisation.
system | System 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().
void CbmDigitization::DeactivateAllBut | ( | ECbmModuleId | system | ) |
Deactivate all systems except the specified one.
system | System 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().
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().
void CbmDigitization::EmbedInput | ( | UInt_t | inputId, |
TString | fileName, | ||
UInt_t | targetInputId, | ||
ECbmTreeAccess | mode = ECbmTreeAccess::kRegular ) |
Embed an input file into another one.
inputId | Unique input identifier |
fileName | Name of input file (MC) |
targetInputId | ID of the input to be embedded into |
mode | Tree 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().
|
inline |
Write run info (default is kTRUE)
choice | If 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.
CbmDigitizeBase * CbmDigitization::GetDigitizer | ( | ECbmModuleId | system | ) |
Get the pointer on a given digitizer if existing.
system | System ID (ECbmModuleId) |
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.
|
private |
Get the geometry tag of a system from a TGeoManager.
system | Detector system (ECbmModuleId) |
geo | Pointer to TGeoManager |
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().
|
privatedelete |
Assignment operator forbidden.
|
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().
void CbmDigitization::Run | ( | Int_t | event1, |
Int_t | event2 ) |
Process input from event1 to event2.
event1 | First event to process |
event2 | Last event to process |
Definition at line 345 of file CbmDigitization.cxx.
References DefaultInit(), fCreateMatches, fDaq, fDigitizers, fGenerateRunInfo, fMode, fMoniFile, fOutFile, fParAsciiFiles, fParRootFile, fProduceNoise, fSource, fTimeSliceLength, CbmDigitizeBase::GetLatency(), CbmDigitizationSource::GetStartTime(), CbmRunAna::SetAsync(), CbmDigitizeBase::SetCreateMatches(), CbmDaq::SetDigitizer(), CbmDigitizeBase::SetEventMode(), CbmDaq::SetLatency(), CbmDigitizationSource::SetMode(), CbmDigitizeBase::SetProduceNoise(), CbmDigitizeBase::SetRunStartTime(), and StoreAllTimeSlices().
|
inline |
Process nEvents from input, starting with the first event.
nEvents | Number of events to process |
Definition at line 126 of file CbmDigitization.h.
References Run().
Referenced by Run().
|
inline |
Set creation of links to MC.
Choice | If kTRUE, the match objects will be created |
Definition at line 139 of file CbmDigitization.h.
References fCreateMatches.
|
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().
void CbmDigitization::SetDigitizer | ( | ECbmModuleId | system, |
CbmDigitizeBase * | digitizer, | ||
TString | branch = "", | ||
Bool_t | persistent = kTRUE ) |
Set a digitizer explicitly.
system | System ID (ECbmModuleId) |
digitizer | Pointer to digitizer instance |
branch | Input branch name (MCPoint) |
persistent | if 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.
|
inline |
Set event-by-event mode.
choice | If 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().
|
inline |
Set the monitor file name.
fileName | Name 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().
void CbmDigitization::SetOutputFile | ( | TString | fileName, |
Bool_t | overwrite = kFALSE ) |
Set the output file name.
path | Name of output file |
overwrite | Overwrite 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().
void CbmDigitization::SetParameterRootFile | ( | TString | fileName | ) |
Set the parameter file name.
fileName | Name of output file |
Definition at line 561 of file CbmDigitization.cxx.
References fParRootFile.
Referenced by cbm::sim::digitization::Run::Exec(), and CbmDigitizationConfig::SetIO().
|
inline |
Set production of inter-event noise.
Choice | If 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().
|
inline |
Set the start time of the run.
time | Start 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().
|
inline |
Set length of the time-slices.
length | Length 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().
|
inline |
Store all time-slices.
choice | If 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().
|
private |
Definition at line 241 of file CbmDigitization.h.
Referenced by Run(), and SetCreateMatches().
Definition at line 243 of file CbmDigitization.h.
Referenced by Run(), and StoreAllTimeSlices().
|
private |
Definition at line 242 of file CbmDigitization.h.
Referenced by CheckInput(), CreateDefaultDigitizers(), Deactivate(), DeactivateAllBut(), GetDigitizer(), Run(), SetDefaultBranches(), SetDigitizer(), and ~CbmDigitization().
|
private |
Definition at line 250 of file CbmDigitization.h.
Referenced by GenerateRunInfo(), and Run().
|
private |
Definition at line 236 of file CbmDigitization.h.
Referenced by DefaultInit().
|
private |
Definition at line 237 of file CbmDigitization.h.
|
private |
Resource monitoring information.
Definition at line 248 of file CbmDigitization.h.
Referenced by Run(), and SetMonitorFile().
|
private |
Output data (digis)
Definition at line 245 of file CbmDigitization.h.
Referenced by Run(), and SetOutputFile().
|
private |
Definition at line 249 of file CbmDigitization.h.
|
private |
ASCII parameter files.
Definition at line 247 of file CbmDigitization.h.
Referenced by AddParameterAsciiFile(), and Run().
|
private |
ROOT parameter file.
Definition at line 246 of file CbmDigitization.h.
Referenced by DefaultInit(), Run(), and SetParameterRootFile().
|
private |
Definition at line 239 of file CbmDigitization.h.
Referenced by Run(), and SetProduceNoise().
|
private |
Definition at line 251 of file CbmDigitization.h.
Referenced by CheckInput(), and DefaultInit().
|
private |
Input source.
Definition at line 244 of file CbmDigitization.h.
Referenced by AddInput(), CheckInput(), EmbedInput(), Run(), and SetStartTime().
|
private |
Definition at line 238 of file CbmDigitization.h.
Referenced by Run(), and SetTimeSliceLength().