CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunManagerMT.h
Go to the documentation of this file.
1 #ifndef SimG4Core_RunManagerMT_H
2 #define SimG4Core_RunManagerMT_H
3 
4 #include <memory>
10 
12 
15 
16 #include <memory>
17 #include "boost/shared_ptr.hpp"
18 
19 namespace CLHEP {
20  class HepJamesRandom;
21 }
22 
23 namespace sim {
24  class FieldBuilder;
25  class ChordFinderSetter;
26 }
27 
28 class PrimaryTransformer;
29 class Generator;
30 class PhysicsList;
31 
32 class SimWatcher;
33 class SimProducer;
34 class G4SimEvent;
35 
36 class RunAction;
37 
38 class DDCompactView;
39 class DDDWorld;
40 class MagneticField;
41 
42 class G4RunManagerKernel;
43 class G4Run;
44 class G4Event;
45 class G4Field;
46 class RunAction;
47 
48 class SimRunInterface;
49 //class ExceptionHandler;
50 
51 namespace HepPDT {
52  class ParticleDataTable;
53 }
54 
62 {
63 public:
65  ~RunManagerMT();
66 
67  void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable);
68 
69  void initializeUserActions();
70 
71  void stopG4();
72 
73  void Connect(RunAction*);
74 
75  // Keep this to keep ExceptionHandler to compile, probably removed
76  // later (or functionality moved to RunManagerMTWorker)
77  void abortRun(bool softAbort=false) {}
78 
79  const DDDWorld& world() const {
80  return *m_world;
81  }
82 
84  return m_catalog;
85  }
86 
87  const std::vector<std::string>& G4Commands() const {
88  return m_G4Commands;
89  }
90 
91  // In order to share the physics list with the worker threads, we
92  // need a non-const pointer. Thread-safety is handled inside Geant4
93  // with TLS. Should we consider a friend declaration here in order
94  // to avoid misuse?
96  return m_physicsList.get();
97  }
98 
99 private:
100  void terminateRun();
101  void DumpMagneticField( const G4Field*) const;
102 
103  G4RunManagerKernel * m_kernel;
104 
105  std::unique_ptr<PhysicsList> m_physicsList;
109  std::unique_ptr<RunAction> m_userRunAction;
110  std::unique_ptr<SimRunInterface> m_runInterface;
111 
115  bool m_check;
119  std::vector<std::string> m_G4Commands;
120  //ExceptionHandler* m_CustomExceptionHandler ;
121 
122  std::unique_ptr<DDDWorld> m_world;
125 
127  std::unique_ptr<sim::ChordFinderSetter> m_chordFinderSetter;
128 
131 };
132 
133 #endif
void Connect(RunAction *)
const std::string m_PhysicsTablesDir
Definition: RunManagerMT.h:112
bool m_managerInitialized
Definition: RunManagerMT.h:106
const SensitiveDetectorCatalog & catalog() const
Definition: RunManagerMT.h:83
SensitiveDetectorCatalog m_catalog
Definition: RunManagerMT.h:124
edm::ParameterSet m_pRunAction
Definition: RunManagerMT.h:118
HepPDT::ParticleDataTable ParticleDataTable
void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable)
Definition: RunManagerMT.cc:94
void terminateRun()
void abortRun(bool softAbort=false)
Definition: RunManagerMT.h:77
bool m_runTerminated
Definition: RunManagerMT.h:107
sim::FieldBuilder * m_fieldBuilder
Definition: RunManagerMT.h:126
std::vector< std::string > m_G4Commands
Definition: RunManagerMT.h:119
void initializeUserActions()
type of data representation of DDCompactView
Definition: DDCompactView.h:77
Definition: sim.h:19
std::string m_WriteFile
Definition: RunManagerMT.h:130
RunManagerMT(edm::ParameterSet const &p)
Definition: RunManagerMT.cc:61
const DDDWorld & world() const
Definition: RunManagerMT.h:79
std::unique_ptr< RunAction > m_userRunAction
Definition: RunManagerMT.h:109
G4RunManagerKernel * m_kernel
Definition: RunManagerMT.h:103
const bool m_pUseMagneticField
Definition: RunManagerMT.h:108
void DumpMagneticField(const G4Field *) const
bool m_StorePhysicsTables
Definition: RunManagerMT.h:113
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManagerMT.h:105
std::string m_FieldFile
Definition: RunManagerMT.h:129
edm::ParameterSet m_pField
Definition: RunManagerMT.h:116
std::unique_ptr< DDDWorld > m_world
Definition: RunManagerMT.h:122
PhysicsList * physicsListForWorker() const
Definition: RunManagerMT.h:95
edm::ParameterSet m_pPhysics
Definition: RunManagerMT.h:117
bool m_RestorePhysicsTables
Definition: RunManagerMT.h:114
std::unique_ptr< sim::ChordFinderSetter > m_chordFinderSetter
Definition: RunManagerMT.h:127
const std::vector< std::string > & G4Commands() const
Definition: RunManagerMT.h:87
std::unique_ptr< SimRunInterface > m_runInterface
Definition: RunManagerMT.h:110
SimActivityRegistry m_registry
Definition: RunManagerMT.h:123