FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMCApplication.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 // -------------------------------------------------------------------------
9 // ----- FairMCApplication header file -----
10 // ----- Created 06/01/04 by M. Al-Turany -----
11 // -------------------------------------------------------------------------
12 
13 #ifndef FAIR_MC_APPLICATION_H
14 #define FAIR_MC_APPLICATION_H
15 
16 #include "FairRunInfo.h" // for FairRunInfo
17 
18 #include <Rtypes.h> // for Int_t, Bool_t, Double_t, etc
19 #include <TLorentzVector.h> // for TLorentzVector
20 #include <TString.h> // for TString
21 #include <TVirtualMCApplication.h> // for TVirtualMCApplication
22 #include <list> // for list
23 #include <map> // for map, multimap, etc
24 
25 class FairDetector;
26 class FairEventHeader;
27 class FairField;
28 class FairGenericStack;
29 class FairMCEventHeader;
31 class FairRadGridManager;
32 class FairRadLenManager;
33 class FairRadMapManager;
34 class FairRootManager;
35 class FairTask;
36 class FairTrajFilter;
37 class FairVolume;
38 class FairRunSim;
39 class TChain;
40 class TIterator;
41 class TObjArray;
42 class TRefArray;
43 class TTask;
44 class TVirtualMC;
45 
47 {
51 };
52 
60 class FairMCApplication : public TVirtualMCApplication
61 {
62  public:
69  FairMCApplication(const char* name, const char* title, TObjArray* ModList, const char* MatName);
75  virtual ~FairMCApplication();
78  static FairMCApplication* Instance();
79  virtual void AddDecayModes();
81  virtual void AddParticles(); // MC Application
83  virtual void AddIons(); // MC Application
88  void AddTask(TTask* fTask);
90  virtual void BeginEvent(); // MC Application
92  virtual void BeginPrimary(); // MC Application
94  virtual void ConstructGeometry(); // MC Application
96  virtual Bool_t MisalignGeometry();
98  virtual void ConstructOpGeometry(); // MC Application
100  virtual void FinishEvent(); // MC Application
102  virtual void FinishPrimary(); // MC Application
104  void FinishRun();
106  virtual void GeneratePrimaries(); // MC Application
108  FairDetector* GetDetector(const char* DetName);
110  FairField* GetField() { return fxField; }
114  TTask* GetListOfTasks();
116  TChain* GetChain();
118  virtual void InitGeometry(); // MC Application
120  void InitMC(const char* setup, const char* cuts);
122  void InitTasks();
124  virtual void PostTrack(); // MC Application
126  virtual void PreTrack(); // MC Application
127 
129  virtual TVirtualMCApplication* CloneForWorker() const;
130 
132  virtual void InitOnWorker();
133 
135  virtual void FinishRunOnWorker();
136 
140  void RunMC(Int_t nofEvents);
145  void SetField(FairField* field);
150  void SetGenerator(FairPrimaryGenerator* fxGenerator);
154  void SetParTask();
160  void SetPythiaDecayer(Bool_t decayer) { fPythiaDecayer = decayer; }
164  void SetPythiaDecayerConfig(const TString decayerConf) { fPythiaDecayerConfig = decayerConf; }
168  void SetRadiationLengthReg(Bool_t RadLen);
172  void SetRadiationMapReg(Bool_t RadMap);
176  void SetTrackingDebugMode(Bool_t set) { fDebug = set; }
182  void SetUserDecay(Bool_t decay) { fUserDecay = decay; }
186  void SetUserDecayConfig(const TString decayerConf) { fUserDecayConfig = decayerConf; }
188  virtual void Stepping(); // MC Application
190  virtual void StopRun();
192  virtual void StopMCRun();
194  virtual Double_t TrackingRmax() const; // MC Application
196  virtual Double_t TrackingZmax() const; // MC Application
197 
198  void AddMeshList(TObjArray* meshList);
199 
205  void SetSaveCurrentEvent(Bool_t set) { fSaveCurrentEvent = set; }
206 
211 
212  private:
213  // methods
214  Int_t GetIonPdg(Int_t z, Int_t a) const;
215 
216  void UndoGeometryModifications();
217 
218  protected:
219  // data members
221  TRefArray* fActiveDetectors;
224 
225  TRefArray* fDetectors;
227  TRefArray* fDetMap;
229  TIterator* fModIter;
230 
231  TObjArray* fModules;
234 
238 
240 
242 
243  TRefArray* fSenVolumes;
244 
249  Int_t fMcVersion; // mc Version
252 
253  Bool_t fTrajAccepted;
254 
255  Bool_t fUserDecay;
258 
259  Bool_t fDebug;
260 
265  std::multimap<Int_t, FairVolume*> fVolMap;
266 
267  std::multimap<Int_t, FairVolume*>::iterator fVolIter;
268 
270  std::map<Int_t, Int_t> fModVolMap;
271 
272  std::map<Int_t, Int_t>::iterator fModVolIter;
273  TLorentzVector fTrkPos;
274 
275  Bool_t fRadLength;
276 
279 
280  Bool_t fRadMap;
281 
283 
285 
287 
289 
290  std::list<FairDetector*> listActiveDetectors;
291 
292  std::list<FairDetector*> listDetectors;
293 
295  TVirtualMC* fMC;
298 
301 
304 
306 
307  private:
311  FairMCApplication& operator=(const FairMCApplication&);
312 
313  FairRunInfo fRunInfo;
314  Bool_t fGeometryIsInitialized;
315 
316  static FairMCApplication* fgMasterInstance;
317 };
318 
319 // inline functions
320 
322 {
323  return static_cast<FairMCApplication*>(TVirtualMCApplication::Instance());
324 }
325 
326 #endif
virtual void FinishRunOnWorker()
FairMCApplicationState fState
void SetPythiaDecayerConfig(const TString decayerConf)
TRefArray * fActiveDetectors
virtual void AddParticles()
virtual void FinishEvent()
void SetPythiaDecayer(Bool_t decayer)
FairField * GetField()
virtual void StopRun()
FairEventHeader * fEventHeader
std::map< Int_t, Int_t > fModVolMap
FairRootManager * fRootManager
virtual Double_t TrackingRmax() const
virtual void Stepping()
virtual Double_t TrackingZmax() const
virtual void InitGeometry()
void SetRadiationMapReg(Bool_t RadMap)
virtual Bool_t MisalignGeometry()
std::map< Int_t, Int_t >::iterator fModVolIter
FairDetector * fDisDet
FairGenericStack * GetStack()
FairRadGridManager * fRadGridMan
virtual void FinishPrimary()
std::list< FairDetector * > listActiveDetectors
FairMCApplicationState
FairDetector * GetDetector(const char *DetName)
virtual void ConstructGeometry()
FairRadLenManager * fRadLenMan
std::multimap< Int_t, FairVolume * > fVolMap
void SetRadiationLengthReg(Bool_t RadLen)
void AddMeshList(TObjArray *meshList)
virtual TVirtualMCApplication * CloneForWorker() const
TLorentzVector fTrkPos
void SetTrackingDebugMode(Bool_t set)
static FairMCApplication * Instance()
virtual void PreTrack()
void SetField(FairField *field)
void SetUserDecayConfig(const TString decayerConf)
virtual void ConstructOpGeometry()
std::list< FairDetector * > listDetectors
ClassDef(FairMCApplication, 4)
virtual void GeneratePrimaries()
virtual void AddDecayModes()
FairMCEventHeader * fMCEventHeader
FairMCApplicationState GetState() const
FairPrimaryGenerator * GetGenerator()
virtual void InitOnWorker()
FairPrimaryGenerator * fEvGen
FairGenericStack * fStack
virtual void BeginPrimary()
virtual void StopMCRun()
virtual void BeginEvent()
void AddTask(TTask *fTask)
std::multimap< Int_t, FairVolume * >::iterator fVolIter
virtual void PostTrack()
void SetSaveCurrentEvent(Bool_t set)
void InitMC(const char *setup, const char *cuts)
void SetGenerator(FairPrimaryGenerator *fxGenerator)
FairTrajFilter * fTrajFilter
void RunMC(Int_t nofEvents)
FairRadMapManager * fRadMapMan
void SetUserDecay(Bool_t decay)