FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairRunSim.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #ifndef FAIRRUNSIM_H
9 #define FAIRRUNSIM_H
10 
11 #include "FairIon.h" // for FairIon
12 #include "FairMCApplication.h" // for FairMCApplication
13 #include "FairParticle.h" // for FairParticle
14 #include "FairRun.h" // for FairRun
15 
16 #include <Rtypes.h> // for Bool_t, Double_t, Int_t, etc
17 #include <TMCtls.h> // for multi-threading
18 #include <TObjArray.h> // for TObjArray
19 #include <TString.h> // for TString
20 #include <functional>
21 
22 class FairField;
23 class FairMCEventHeader;
24 class FairMesh;
25 class FairModule;
28 
35 class FairRunSim : public FairRun
36 {
37  public:
39  FairRunSim(Bool_t isMaster = kTRUE);
41  virtual ~FairRunSim();
43  static FairRunSim* Instance();
47  void AddModule(FairModule* Mod);
51  void AddNewIon(FairIon* ion) { fIons->Add(ion); }
55  void AddNewParticle(FairParticle* Particle) { fParticles->Add(Particle); }
59  TObjArray* GetUserDefIons();
63  TObjArray* GetUserDefParticles();
64 
68  virtual void Init();
72  virtual void Run(Int_t NEvents = 0, Int_t NotUsed = 0);
76  void SetField(FairField* field);
81 
86  void SetMCEventHeader(FairMCEventHeader* McHeader) { fMCEvHead = McHeader; }
87 
89  void SetMaterials(const char* MatFileName);
90 
92  void SetStoreTraj(Bool_t storeTraj = kTRUE) { fStoreTraj = storeTraj; }
93 
95  Bool_t GetStoreTraj() const { return fStoreTraj; }
96 
98  void SetTrackingDebugMode(Bool_t set)
99  {
100  if (fApp) {
102  }
103  }
104 
106  void SetGeoModel(char* name);
107 
109  TString* GetGeoModel() { return fLoaderName; }
110 
112  FairField* GetField() { return fField; }
113 
116 
118  TObjArray* GetListOfModules() { return ListOfModules; }
119 
122 
124  void SetPythiaDecayer(Bool_t decayer) { fPythiaDecayer = decayer; }
125 
127  void SetPythiaDecayer(const TString& Config);
128 
130  void SetUserDecay(const TString& Config);
131 
133  void SetUserDecay(Bool_t decay) { fUserDecay = decay; }
134 
136  Bool_t IsExtDecayer() { return fPythiaDecayer; }
137 
139  Bool_t IsUserDecay() { return fUserDecay; }
140 
142  void SetRadLenRegister(Bool_t value) { fRadLength = value; }
143 
144  void SetRadMapRegister(Bool_t value) { fRadMap = value; }
145 
146  void SetRadGridRegister(Bool_t value) { fRadGrid = value; }
147 
148  void AddMesh(FairMesh* Mesh);
149 
150  void SetUserConfig(const TString& Config) { fUserConfig = Config; }
151  TString GetUserConfig() { return fUserConfig; }
152 
153  void SetUserCuts(const TString& Cuts) { fUserCuts = Cuts; }
154  TString GetUserCuts() { return fUserCuts; }
155 
157  void SetBeamMom(Double_t BeamMom)
158  {
159  fBeamMom = BeamMom;
160  fUseBeamMom = kTRUE;
161  }
162 
164  Double_t GetBeamMom() { return fBeamMom; }
165 
167  Bool_t UseBeamMom() { return fUseBeamMom; }
168  void SetFieldContainer();
169 
170  void SetSimSetup(std::function<void()> f)
171  {
172  fSimSetup = f;
173  fUseSimSetupFunction = true;
174  }
175  void SetSimSetupPostInit(std::function<void()> f)
176  {
177  fSimSetupPostInit = f;
179  }
180 
183 
184  void SetIsMT(Bool_t isMT) { fIsMT = isMT; }
185  Bool_t IsMT() const { return fIsMT; }
186 
187  void SetImportTGeoToVMC(Bool_t v) { fImportTGeoToVMC = v; }
188  Bool_t IsImportTGeoToVMC() const { return fImportTGeoToVMC; }
189 
190  void StopMCRun() { fApp->StopMCRun(); }
191 
192  private:
193  FairRunSim(const FairRunSim& M);
194  FairRunSim& operator=(const FairRunSim&) { return *this; }
195  void SetMCConfig();
196  void CheckFlukaExec();
197 
198  protected:
199  Int_t count;
201  Double_t fBeamMom;
202  Bool_t fUseBeamMom;
205  static TMCThreadLocal FairRunSim* fginstance;
207  const char* fMapName;
208  TObjArray* fIons;
209  TObjArray* fParticles;
210  TObjArray* ListOfModules;
211  TString MatFname;
212  Bool_t fStoreTraj;
213  TString* fLoaderName;
214  Bool_t fPythiaDecayer;
216  Bool_t fUserDecay;
218  Bool_t fRadLength;
219  Bool_t fRadMap;
220  Bool_t fRadGrid;
221  TObjArray* fMeshList;
222  TString fUserConfig;
223  TString fUserCuts;
224  Bool_t fIsMT;
226  std::function<void()> fSimSetup;
227  bool fUseSimSetupFunction = false;
229  std::function<void()> fSimSetupPostInit;
230  bool fUseSimSetupPostInitFunction = false;
233 
234  ClassDef(FairRunSim, 2);
235 };
236 
237 #endif // FAIRRUNSIM_H
void AddMesh(FairMesh *Mesh)
Definition: FairRunSim.cxx:124
Bool_t fPythiaDecayer
/** Geometry Model (TGeo or G3)*/
Definition: FairRunSim.h:214
TString * GetGeoModel()
Definition: FairRunSim.h:109
TString fUserConfig
/** radiation grid scoring
Definition: FairRunSim.h:222
FairRunSim(Bool_t isMaster=kTRUE)
Definition: FairRunSim.cxx:49
void SetRadMapRegister(Bool_t value)
Definition: FairRunSim.h:144
std::function< void()> fSimSetupPostInit
Definition: FairRunSim.h:229
static TMCThreadLocal FairRunSim * fginstance
/** MC Event Header */
Definition: FairRunSim.h:205
Bool_t IsMT() const
Definition: FairRunSim.h:185
void SetField(FairField *field)
Definition: FairRunSim.cxx:308
Bool_t fRadMap
/** flag for registring radiation length*/
Definition: FairRunSim.h:219
const char * fMapName
Definition: FairRunSim.h:207
FairMCEventHeader * GetMCEventHeader()
Definition: FairRunSim.cxx:357
void SetFieldContainer()
Definition: FairRunSim.cxx:247
FairMCEventHeader * fMCEvHead
/** Primary Event Generator */
Definition: FairRunSim.h:204
TString MatFname
/** Array of used modules */
Definition: FairRunSim.h:211
Bool_t fUseBeamMom
/** Beam Energy in GeV/c */
Definition: FairRunSim.h:202
Bool_t fImportTGeoToVMC
/** MT mode option (Geant4 only)*/
Definition: FairRunSim.h:225
TString GetUserConfig()
Definition: FairRunSim.h:151
Bool_t IsImportTGeoToVMC() const
Definition: FairRunSim.h:188
static FairRunSim * Instance()
Definition: FairRunSim.cxx:116
void SetGenerator(FairPrimaryGenerator *Gen)
Definition: FairRunSim.cxx:310
FairMCApplication * fApp
/** Internal counter*/
Definition: FairRunSim.h:200
Bool_t fRadLength
/** Macro for decay configuration*/
Definition: FairRunSim.h:218
TObjArray * ListOfModules
/** Array of user defined particles*/
Definition: FairRunSim.h:210
*bool fUseSimSetupPostInitFunction
Definition: FairRunSim.h:231
FairPrimaryGenerator * GetPrimaryGenerator()
Definition: FairRunSim.h:121
TString fPythiaDecayerConfig
/** flag for using Pythia decayer*/
Definition: FairRunSim.h:215
void SetSimSetup(std::function< void()> f)
Definition: FairRunSim.h:170
Int_t count
Definition: FairRunSim.h:199
TObjArray * fParticles
/** Array of user defined ions */
Definition: FairRunSim.h:209
void SetTrackingDebugMode(Bool_t set)
void StopMCRun()
Definition: FairRunSim.h:190
void SetIsMT(Bool_t isMT)
Definition: FairRunSim.h:184
TObjArray * fMeshList
Definition: FairRunSim.h:221
FairPrimaryGenerator * fGen
/** flag for use Beam Energy */
Definition: FairRunSim.h:203
TObjArray * GetUserDefIons()
Definition: FairRunSim.cxx:131
Bool_t fUserDecay
/** Macro for Pythia decay configuration*/
Definition: FairRunSim.h:216
Bool_t fIsMT
/** Macro for geant cuts*/
Definition: FairRunSim.h:224
Bool_t IsExtDecayer()
Definition: FairRunSim.h:136
TString fUserCuts
/** Macro for geant configuration*/
Definition: FairRunSim.h:223
void SetPythiaDecayer(Bool_t decayer)
Definition: FairRunSim.h:124
FairGenericVMCConfig * fSimulationConfig
Definition: FairRunSim.h:232
virtual ~FairRunSim()
Definition: FairRunSim.cxx:89
Bool_t IsUserDecay()
Definition: FairRunSim.h:139
ClassDef(FairRunSim, 2)
/** Simulation configuration */
void SetUserDecay(Bool_t decay)
Definition: FairRunSim.h:133
TObjArray * GetListOfModules()
Definition: FairRunSim.h:118
void SetImportTGeoToVMC(Bool_t v)
Definition: FairRunSim.h:187
void SetTrackingDebugMode(Bool_t set)
Definition: FairRunSim.h:98
void SetUserCuts(const TString &Cuts)
Definition: FairRunSim.h:153
Bool_t fStoreTraj
/** Material file name */
Definition: FairRunSim.h:212
virtual void Init()
Definition: FairRunSim.cxx:143
void SetGeoModel(char *name)
Definition: FairRunSim.cxx:331
Bool_t GetStoreTraj() const
Definition: FairRunSim.h:95
void SetMaterials(const char *MatFileName)
Definition: FairRunSim.cxx:312
TString * fLoaderName
/** Trajectory store flags */
Definition: FairRunSim.h:213
void SetSimSetupPostInit(std::function< void()> f)
Definition: FairRunSim.h:175
Bool_t fRadGrid
/** flag for RadiationMapManager
Definition: FairRunSim.h:220
void SetUserConfig(const TString &Config)
Definition: FairRunSim.h:150
void SetRadLenRegister(Bool_t value)
Definition: FairRunSim.h:142
FairField * GetField()
Definition: FairRunSim.h:112
TString GetUserCuts()
Definition: FairRunSim.h:154
virtual void StopMCRun()
FairGenericVMCConfig * GetSimulationConfig()
Definition: FairRunSim.h:182
std::function< void()> fSimSetup
/** Allow importing TGeometry to VMC */
Definition: FairRunSim.h:226
TString fUserDecayConfig
Definition: FairRunSim.h:217
void SetUserDecay(const TString &Config)
Definition: FairRunSim.cxx:350
virtual void Run(Int_t NEvents=0, Int_t NotUsed=0)
Definition: FairRunSim.cxx:306
void AddModule(FairModule *Mod)
Definition: FairRunSim.cxx:118
void AddNewIon(FairIon *ion)
Definition: FairRunSim.h:51
TObjArray * fIons
/** Input file name map*/
Definition: FairRunSim.h:208
void SetSimulationConfig(FairGenericVMCConfig *tconf)
Definition: FairRunSim.h:181
void SetRadGridRegister(Bool_t value)
Definition: FairRunSim.h:146
Bool_t UseBeamMom()
Definition: FairRunSim.h:167
FairField * fField
/** Singleton Instance */
Definition: FairRunSim.h:206
Double_t GetBeamMom()
Definition: FairRunSim.h:164
void SetMCEventHeader(FairMCEventHeader *McHeader)
Definition: FairRunSim.h:86
Double_t fBeamMom
/** Main VMC application */
Definition: FairRunSim.h:201
void Config()
Configuration macro for Geant3 VirtualMC.
Definition: flConfig.C:10
TObjArray * GetUserDefParticles()
Definition: FairRunSim.cxx:137
void SetBeamMom(Double_t BeamMom)
Definition: FairRunSim.h:157
void AddNewParticle(FairParticle *Particle)
Definition: FairRunSim.h:55
void SetStoreTraj(Bool_t storeTraj=kTRUE)
Definition: FairRunSim.h:92
*bool fUseSimSetupFunction
Definition: FairRunSim.h:228