CbmRoot
Loading...
Searching...
No Matches
CbmDigitization.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
10#ifndef CBMDIGITIZATION_H
11#define CBMDIGITIZATION_H 1
12
13#include "CbmDaq.h"
14#include "CbmDefs.h"
16#include "CbmDigitizeInfo.h"
17
18#include <Logger.h>
19
20#include "TList.h"
21#include "TNamed.h"
22#include "TString.h"
23#include "TSystem.h"
24
25#include <map>
26#include <vector>
27
28#include "Defs.h"
29
30class TGeoManager;
31class CbmDigitizeBase;
32
33
34class CbmDigitization : public TNamed {
35
36public:
39
40
42 virtual ~CbmDigitization();
43
44
51 void AddInput(UInt_t inputId, TString fileName, cbm::sim::TimeDist dist = cbm::sim::TimeDist::Poisson,
52 Double_t eventRate = 0., ECbmTreeAccess mode = ECbmTreeAccess::kRegular);
53
54
63 void AddInput(TString fileName, cbm::sim::TimeDist dist = cbm::sim::TimeDist::Poisson, Double_t eventRate = 0.,
65 {
66 AddInput(0, fileName, dist, eventRate, mode);
67 }
68
76 Bool_t AddParameterAsciiFile(TString fileName);
77
78
85 void Deactivate(ECbmModuleId system);
86
87
93 void DeactivateAllBut(ECbmModuleId system);
94
95
102 void EmbedInput(UInt_t inputId, TString fileName, UInt_t targetInputId,
104
105
112 void GenerateRunInfo(Bool_t choice = kTRUE) { fGenerateRunInfo = choice; }
113
117 void DefaultInit();
118
120 void Run() { Run(-1, -1); }
121
122
126 void Run(Int_t nEvents) { Run(0, nEvents); }
127
128
133 void Run(Int_t event1, Int_t event2);
134
135
139 void SetCreateMatches(Bool_t choice = kTRUE) { fCreateMatches = choice; }
140
141
153 void SetDigitizer(ECbmModuleId system, CbmDigitizeBase* digitizer, TString branch = "", Bool_t persistent = kTRUE);
154
155
162 void SetMode(cbm::sim::Mode mode) { fMode = mode; }
163
164
172 void SetMonitorFile(const char* fileName) { fMoniFile = fileName; }
173
174
181 void SetOutputFile(TString fileName, Bool_t overwrite = kFALSE);
182
183
187 void SetParameterRootFile(TString fileName);
188
189
193 void SetProduceNoise(Bool_t choice = kTRUE) { fProduceNoise = choice; }
194
195
202 void SetStartTime(Double_t time) { fSource->SetTimeStart(time); }
203
204
214 void SetTimeSliceLength(Double_t length) { fTimeSliceLength = length; }
215
216
222 void StoreAllTimeSlices(Bool_t choice = kTRUE) { fDaq->StoreAllTimeSlices(choice); }
223
233
234
235private:
236 Bool_t fIsInit = kFALSE;
238 Double_t fTimeSliceLength = -1.;
239 Bool_t fProduceNoise = kTRUE;
240 ;
241 Bool_t fCreateMatches = kTRUE;
242 std::map<ECbmModuleId, CbmDigitizeInfo*> fDigitizers = {};
245 TString fOutFile = {};
246 TString fParRootFile = {};
247 TList fParAsciiFiles = {};
248 TString fMoniFile = {};
249 Bool_t fOverwriteOutput = kFALSE;
250 Bool_t fGenerateRunInfo = kTRUE;
251 Int_t fRun = 0;
252
253
256
257
260
261
270 Int_t CheckInput();
271
272
280
281
291 TString GetGeoTag(ECbmModuleId system, TGeoManager* geo);
292
293
295 void SetDefaultBranches();
296
297
299};
300
301#endif /* CBMDIGITIZATION_H */
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition CbmDefs.h:152
ECbmModuleId
Definition CbmDefs.h:39
CBM task class for filling digis into time slices.
Definition CbmDaq.h:44
void StoreAllTimeSlices(Bool_t choice=kTRUE)
Store all time-slices.
Definition CbmDaq.h:115
Source class for the input to digitization in CBM.
void SetTimeStart(Double_t time)
Set the offset for the first event time.
void EmbedInput(UInt_t inputId, TString fileName, UInt_t targetInputId, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Embed an input file into another one.
Int_t CheckInput()
Check the presence of input branches.
void SetParameterRootFile(TString fileName)
Set the parameter file name.
void SetStartTime(Double_t time)
Set the start time of the run.
void DefaultInit()
Initialize the branches, digitizers and parameter files With default values.
void DeactivateAllBut(ECbmModuleId system)
Deactivate all systems except the specified one.
void SetCreateMatches(Bool_t choice=kTRUE)
Set creation of links to MC.
CbmDigitization()
Constructor.
void SetMonitorFile(const char *fileName)
Set the monitor file name.
Int_t CreateDefaultDigitizers()
Instantiate the default digitisers for the active systems.
TString fMoniFile
Resource monitoring information.
void Run()
Process all events from input.
ClassDef(CbmDigitization, 3)
void SetDigitizer(ECbmModuleId system, CbmDigitizeBase *digitizer, TString branch="", Bool_t persistent=kTRUE)
Set a digitizer explicitly.
void SetOutputFile(TString fileName, Bool_t overwrite=kFALSE)
Set the output file name.
CbmDigitizeBase * GetDigitizer(ECbmModuleId system)
Get the pointer on a given digitizer if existing.
std::map< ECbmModuleId, CbmDigitizeInfo * > fDigitizers
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 SetTimeSliceLength(Double_t length)
Set length of the time-slices.
TString fOutFile
Output data (digis)
TList fParAsciiFiles
ASCII parameter files.
void StoreAllTimeSlices(Bool_t choice=kTRUE)
Store all time-slices.
void SetProduceNoise(Bool_t choice=kTRUE)
Set production of inter-event noise.
void Deactivate(ECbmModuleId system)
Deactivate a system for digitisation.
void GenerateRunInfo(Bool_t choice=kTRUE)
Write run info (default is kTRUE)
cbm::sim::Mode fMode
void Run(Int_t nEvents)
Process nEvents from input, starting with the first event.
CbmDigitization(const CbmDigitization &)=delete
Copy constructor forbidden.
CbmDigitizationSource * fSource
Input source.
virtual ~CbmDigitization()
Destructor
TString GetGeoTag(ECbmModuleId system, TGeoManager *geo)
Get the geometry tag of a system from a TGeoManager.
Double_t fTimeSliceLength
TString fParRootFile
ROOT parameter file.
void SetDefaultBranches()
Default settings for digitizers.
CbmDigitization operator=(const CbmDigitization &)=delete
Assignment operator forbidden.
void SetMode(cbm::sim::Mode mode)
Set event-by-event mode.
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.
Abstract base class for CBM digitisation tasks.
TimeDist
Definition Defs.h:29