CbmRoot
CbmTransport.h
Go to the documentation of this file.
1 
6 #ifndef CBMTRANSPORT_H
7 #define CBMTRANSPORT_H 1
8 
9 
10 #include "CbmMCEventFilter.h"
11 #include "CbmSetup.h"
12 #include "CbmStackFilter.h"
13 #include "TNamed.h"
14 #include "TString.h"
15 #include <functional>
16 #include <iostream>
17 #include <memory>
18 
19 class TGeant3;
20 class TGeant4;
21 class TVirtualMC;
22 class FairField;
23 class FairGenerator;
24 class FairRunSim;
25 class CbmEventGenerator;
26 class CbmTarget;
27 class CbmGeant3Settings;
28 class CbmGeant4Settings;
29 
31 
33 
34 
40 class CbmTransport : public TNamed {
41 
42 public:
44  CbmTransport();
45 
46 
48  virtual ~CbmTransport();
49 
50 
55  void AddInput(const char* fileName, ECbmGenerator generator = kUnigen);
56 
57 
61  void AddInput(FairGenerator* generator);
62 
63 
65  void ConfigureVMC();
66 
67 
75  void ForceVertexAtZ(Double_t zVertex);
76 
77 
81  void ForceVertexInTarget(Bool_t choice = kTRUE);
82 
83 
89  void GenerateRunInfo(Bool_t choice = kTRUE) { fGenerateRunInfo = choice; }
90 
91 
95  CbmSetup* GetSetup() const { return fSetup; }
96 
97 
101  std::unique_ptr<CbmStackFilter>& GetStackFilter() { return fStackFilter; }
102 
103 
107  void SetSetupSource(ECbmSetupSource setupSource);
108 
109 
113  void LoadSetup(const char* setupName);
114 
115 
124  void RegisterRadLength(Bool_t choice = kTRUE);
125 
126 
130  void Run(Int_t nEvents);
131 
132 
146  void SetBeamAngle(Double_t x0,
147  Double_t y0,
148  Double_t sigmaX = -1.,
149  Double_t sigmaY = -1.);
150 
151 
168  void SetBeamPosition(Double_t x0,
169  Double_t y0,
170  Double_t sigmaX = -1.,
171  Double_t sigmaY = -1.,
172  Double_t zF = 0.);
173 
174 
183  void SetDecayMode(Int_t pdg, UInt_t nDaughters, Int_t* daughterPdg);
184 
185 
191  void SetEngine(ECbmEngine engine) { fEngine = engine; }
192 
193 
201  void SetEventFilter(std::unique_ptr<CbmMCEventFilter>& filter) {
202  fEventFilter.reset();
203  fEventFilter = std::move(filter);
204  }
205 
206 
207  void SetEventFilterMinNofData(ECbmDataType type, Int_t value) {
208  fEventFilter->SetMinNofData(type, value);
209  }
210 
211 
219  void SetField(FairField* field) { fField = field; }
220 
221 
228  void SetGeoFileName(TString name);
229 
230 
240  void SetMediaFileName(TString fileName) {
241  fSetup->SetMediaFilePath(fileName.Data());
242  }
243 
244 
250  void SetParFileName(TString name);
251 
252 
260  void SetStackFilter(std::unique_ptr<CbmStackFilter>& filter) {
261  fStackFilter.reset();
262  fStackFilter = std::move(filter);
263  }
264 
265 
279  void SetTarget(const char* medium,
280  Double_t thickness,
281  Double_t diameter,
282  Double_t x = 0.,
283  Double_t y = 0.,
284  Double_t z = 0.,
285  Double_t rot = 0.);
286 
287 
291  void SetOutFileName(TString name);
292 
293 
303  void SetRandomEventPlane(Double_t phiMin = 0.,
304  Double_t phiMax = 2. * TMath::Pi());
305 
306 
319  void SetVertexSmearXY(Bool_t choice = kTRUE);
320 
321 
329  void SetVertexSmearZ(Bool_t choice = kTRUE);
330 
331 
340  void StoreTrajectories(Bool_t choice = kTRUE) { fStoreTrajectories = choice; }
341 
350 
359 
360 private:
362  FairField* fField;
363  std::shared_ptr<CbmTarget> fTarget;
365  std::unique_ptr<CbmMCEventFilter> fEventFilter;
366  FairRunSim* fRun;
367  TString fOutFileName;
368  TString fParFileName;
369  TString fGeoFileName;
370  std::vector<FairGenerator*> fGenerators;
371  Double_t fRealTimeInit;
372  Double_t fRealTimeRun;
373  Double_t fCpuTime;
375  std::unique_ptr<CbmStackFilter> fStackFilter;
378  std::function<void()> fSimSetup;
379  std::map<Int_t, std::vector<Int_t>> fDecayModes;
380 
383 
385  void InitEventGenerator();
386 
387 
389  void ForceUserDecays();
390 
391 
393  void PiAndEtaDecay(TVirtualMC* vmc);
394 
400  void RegisterIons();
401 
402 
404  void RegisterSetup();
405 
407 };
408 
409 #endif /* CBMTRANSPORT_H */
CbmTransport::fDecayModes
std::map< Int_t, std::vector< Int_t > > fDecayModes
Definition: CbmTransport.h:379
CbmTransport::fEventFilter
std::unique_ptr< CbmMCEventFilter > fEventFilter
Definition: CbmTransport.h:365
CbmTransport::SetSetupSource
void SetSetupSource(ECbmSetupSource setupSource)
Set the source the setup will be loaded from.
Definition: CbmTransport.cxx:293
CbmTransport::StoreTrajectories
void StoreTrajectories(Bool_t choice=kTRUE)
Enable storing of trajectories.
Definition: CbmTransport.h:340
CbmTransport::InitEventGenerator
void InitEventGenerator()
Event generator initialisation.
Definition: CbmTransport.cxx:268
CbmTransport::fParFileName
TString fParFileName
Definition: CbmTransport.h:368
CbmTransport::SetRandomEventPlane
void SetRandomEventPlane(Double_t phiMin=0., Double_t phiMax=2. *TMath::Pi())
Activate random event plane.
Definition: CbmTransport.cxx:703
CbmTransport::fOutFileName
TString fOutFileName
Definition: CbmTransport.h:367
kUrqmd
@ kUrqmd
Definition: CbmTransport.h:30
CbmTransport::SetEngine
void SetEngine(ECbmEngine engine)
Set transport engine.
Definition: CbmTransport.h:191
CbmTransport::fEventGen
CbmEventGenerator * fEventGen
Definition: CbmTransport.h:364
CbmTransport::fGeant4Settings
CbmGeant4Settings * fGeant4Settings
Definition: CbmTransport.h:382
kPluto
@ kPluto
Definition: CbmTransport.h:30
kGeant4
@ kGeant4
Definition: CbmTransport.h:32
ECbmEngine
ECbmEngine
Definition: CbmTransport.h:32
CbmTransport::fEngine
ECbmEngine fEngine
Definition: CbmTransport.h:374
CbmTransport::fRealTimeInit
Double_t fRealTimeInit
Definition: CbmTransport.h:371
CbmTransport::SetEventFilterMinNofData
void SetEventFilterMinNofData(ECbmDataType type, Int_t value)
Definition: CbmTransport.h:207
CbmTransport::fGeant3Settings
CbmGeant3Settings * fGeant3Settings
Definition: CbmTransport.h:381
CbmTransport::fGenerators
std::vector< FairGenerator * > fGenerators
Definition: CbmTransport.h:370
CbmTransport::~CbmTransport
virtual ~CbmTransport()
Destructor
Definition: CbmTransport.cxx:98
CbmEventGenerator
CbmEventGenerator.
Definition: CbmEventGenerator.h:34
CbmTransport::fField
FairField * fField
Definition: CbmTransport.h:362
CbmTransport
User interface class for transport simulation.
Definition: CbmTransport.h:40
kUnigen
@ kUnigen
Definition: CbmTransport.h:30
CbmTarget
Class for constructing the geometry of the CBM target.
Definition: CbmTarget.h:31
CbmTransport::fSetup
CbmSetup * fSetup
Definition: CbmTransport.h:361
CbmTransport::SetGeant4Settings
void SetGeant4Settings(CbmGeant4Settings *val)
Set user defined transport settings for Geant4.
Definition: CbmTransport.h:358
CbmStackFilter.h
CbmTransport::SetBeamPosition
void SetBeamPosition(Double_t x0, Double_t y0, Double_t sigmaX=-1., Double_t sigmaY=-1., Double_t zF=0.)
Set the beam position.
Definition: CbmTransport.cxx:631
CbmTransport::RegisterIons
void RegisterIons()
Register ions.
Definition: CbmTransport.cxx:307
CbmTransport::AddInput
void AddInput(const char *fileName, ECbmGenerator generator=kUnigen)
Add an input by file name and generator type.
Definition: CbmTransport.cxx:103
CbmSetup
Definition: CbmSetup.h:31
CbmSetup.h
CbmTransport::fRealTimeRun
Double_t fRealTimeRun
Definition: CbmTransport.h:372
CbmSetup::SetMediaFilePath
void SetMediaFilePath(std::string filePath)
Definition: CbmSetup.h:63
ECbmDataType
ECbmDataType
Definition: CbmDefs.h:76
CbmTransport::SetVertexSmearZ
void SetVertexSmearZ(Bool_t choice=kTRUE)
Enable smearing of event vertex in z.
Definition: CbmTransport.cxx:754
CbmTransport::CbmTransport
CbmTransport()
Constructor.
Definition: CbmTransport.cxx:53
CbmTransport::GetSetup
CbmSetup * GetSetup() const
Detector setup interface.
Definition: CbmTransport.h:95
CbmTransport::SetGeoFileName
void SetGeoFileName(TString name)
Define geometry file name (output)
Definition: CbmTransport.cxx:661
CbmTransport::RegisterSetup
void RegisterSetup()
Create and register the setup modules.
Definition: CbmTransport.cxx:375
CbmTransport::SetStackFilter
void SetStackFilter(std::unique_ptr< CbmStackFilter > &filter)
Set a user-defined stack filter class.
Definition: CbmTransport.h:260
CbmTransport::ForceUserDecays
void ForceUserDecays()
Force user-defined single-mode decays.
Definition: CbmTransport.cxx:192
CbmTransport::fCpuTime
Double_t fCpuTime
Definition: CbmTransport.h:373
CbmTransport::RegisterRadLength
void RegisterRadLength(Bool_t choice=kTRUE)
Enable registration of radiation length.
Definition: CbmTransport.cxx:366
CbmTransport::fGenerateRunInfo
Bool_t fGenerateRunInfo
Definition: CbmTransport.h:376
CbmTransport::ForceVertexInTarget
void ForceVertexInTarget(Bool_t choice=kTRUE)
Enable or disable forcing the vertex to be in the target.
Definition: CbmTransport.cxx:184
CbmTransport::ConfigureVMC
void ConfigureVMC()
Set the parameters for the TVirtualMC.
Definition: CbmTransport.cxx:133
CbmTransport::PiAndEtaDecay
void PiAndEtaDecay(TVirtualMC *vmc)
Correct decay modes for pi0 and eta.
Definition: CbmTransport.cxx:380
xMath::Pi
double Pi()
Definition: xMath.h:5
CbmTransport::fRun
FairRunSim * fRun
Definition: CbmTransport.h:366
CbmTransport::fStackFilter
std::unique_ptr< CbmStackFilter > fStackFilter
Definition: CbmTransport.h:375
CbmTransport::fStoreTrajectories
Bool_t fStoreTrajectories
Definition: CbmTransport.h:377
CbmTransport::fGeoFileName
TString fGeoFileName
Definition: CbmTransport.h:369
CbmTransport::ClassDef
ClassDef(CbmTransport, 3)
CbmGeant3Settings
User interface class to define the Geant3 simulation settings.
Definition: CbmGeant3Settings.h:19
CbmTransport::SetParFileName
void SetParFileName(TString name)
Define parameter file name.
Definition: CbmTransport.cxx:681
ECbmSetupSource
ECbmSetupSource
Definition: CbmSetup.h:25
CbmGeant4Settings
User interface class to define the Geant4 simulation settings.
Definition: CbmGeant4Settings.h:23
CbmTransport::Run
void Run(Int_t nEvents)
Execute transport run.
Definition: CbmTransport.cxx:457
ECbmGenerator
ECbmGenerator
Definition: CbmTransport.h:30
CbmMCEventFilter.h
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTransport::SetDecayMode
void SetDecayMode(Int_t pdg, UInt_t nDaughters, Int_t *daughterPdg)
Set a decay mode for a particle.
Definition: CbmTransport.cxx:643
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTransport::ForceVertexAtZ
void ForceVertexAtZ(Double_t zVertex)
Force the event vertex to be at a given z position.
Definition: CbmTransport.cxx:176
CbmTransport::GetStackFilter
std::unique_ptr< CbmStackFilter > & GetStackFilter()
Access to stack filter object.
Definition: CbmTransport.h:101
CbmTransport::SetVertexSmearXY
void SetVertexSmearXY(Bool_t choice=kTRUE)
Enable smearing of event vertex in x and y.
Definition: CbmTransport.cxx:746
kGeant3
@ kGeant3
Definition: CbmTransport.h:32
CbmTransport::SetMediaFileName
void SetMediaFileName(TString fileName)
Set the media file name.
Definition: CbmTransport.h:240
CbmTransport::LoadSetup
void LoadSetup(const char *setupName)
Use a standard setup.
Definition: CbmTransport.cxx:300
CbmTransport::SetTarget
void SetTarget(const char *medium, Double_t thickness, Double_t diameter, Double_t x=0., Double_t y=0., Double_t z=0., Double_t rot=0.)
Define the target.
Definition: CbmTransport.cxx:730
CbmTransport::SetEventFilter
void SetEventFilter(std::unique_ptr< CbmMCEventFilter > &filter)
Set a user-defined event filter class.
Definition: CbmTransport.h:201
CbmTransport::GenerateRunInfo
void GenerateRunInfo(Bool_t choice=kTRUE)
Trigger generation of a run info file.
Definition: CbmTransport.h:89
CbmTransport::fSimSetup
std::function< void()> fSimSetup
Definition: CbmTransport.h:378
CbmTransport::SetGeant3Settings
void SetGeant3Settings(CbmGeant3Settings *val)
Set user defined transport settings for Geant3.
Definition: CbmTransport.h:349
CbmTransport::SetField
void SetField(FairField *field)
Set magnetic field.
Definition: CbmTransport.h:219
CbmTransport::SetBeamAngle
void SetBeamAngle(Double_t x0, Double_t y0, Double_t sigmaX=-1., Double_t sigmaY=-1.)
Set the beam angle (emittency at the beam position)
Definition: CbmTransport.cxx:620
CbmTransport::SetOutFileName
void SetOutFileName(TString name)
Define output file name.
Definition: CbmTransport.cxx:710
CbmTransport::fTarget
std::shared_ptr< CbmTarget > fTarget
Definition: CbmTransport.h:363