test
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 
9 
11 
13 
14 #include <memory>
15 
16 namespace CLHEP {
17  class HepJamesRandom;
18 }
19 
20 namespace sim {
21  class FieldBuilder;
22  class ChordFinderSetter;
23 }
24 
25 class PrimaryTransformer;
26 class Generator;
27 class PhysicsList;
28 class CustomUIsession;
29 
30 class SimWatcher;
31 class SimProducer;
32 class G4SimEvent;
33 
34 class RunAction;
35 
36 class DDCompactView;
37 class DDDWorld;
38 class DDG4ProductionCuts;
39 class MagneticField;
40 
41 class G4MTRunManagerKernel;
42 class G4Run;
43 class G4Event;
44 class G4Field;
45 class RunAction;
46 
47 class SimRunInterface;
48 
49 namespace HepPDT {
50  class ParticleDataTable;
51 }
52 
58 class RunManagerMTWorker;
59 
61 {
62  friend class RunManagerMTWorker;
63 
64 public:
65  explicit RunManagerMT(edm::ParameterSet const & p);
66  ~RunManagerMT();
67 
68  void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable);
69 
70  void initializeUserActions();
71 
72  void stopG4();
73 
74  void Connect(RunAction*);
75 
76  // Keep this to keep ExceptionHandler to compile, probably removed
77  // later (or functionality moved to RunManagerMTWorker)
78  inline void abortRun(bool softAbort=false) {}
79 
80  inline const DDDWorld& world() const {
81  return *m_world;
82  }
83 
84  inline const SensitiveDetectorCatalog& catalog() const {
85  return m_catalog;
86  }
87 
88  inline const std::vector<std::string>& G4Commands() const {
89  return m_G4Commands;
90  }
91 
92  // In order to share the physics list with the worker threads, we
93  // need a non-const pointer. Thread-safety is handled inside Geant4
94  // with TLS.
96  return m_physicsList.get();
97  }
98 
99  // In order to share the ChordFinderSetter (for
100  // G4MonopoleTransportation) with the worker threads, we need a
101  // non-const pointer. Thread-safety is handled inside
102  // ChordFinderStter with TLS.
104  return m_chordFinderSetter.get();
105  }
106 
107 private:
108  void terminateRun();
109  void DumpMagneticField( const G4Field*) const;
110 
111  G4MTRunManagerKernel * m_kernel;
112 
113  std::unique_ptr<CustomUIsession> m_UIsession;
114  std::unique_ptr<PhysicsList> m_physicsList;
119  G4Run* m_currentRun;
120  std::unique_ptr<SimRunInterface> m_runInterface;
121 
125  bool m_check;
130  std::vector<std::string> m_G4Commands;
132 
133  std::unique_ptr<DDDWorld> m_world;
134  std::unique_ptr<DDG4ProductionCuts> m_prodCuts;
137 
139  std::unique_ptr<sim::ChordFinderSetter> m_chordFinderSetter;
140 
144 };
145 
146 #endif
void Connect(RunAction *)
const std::string m_PhysicsTablesDir
Definition: RunManagerMT.h:122
bool m_managerInitialized
Definition: RunManagerMT.h:115
const SensitiveDetectorCatalog & catalog() const
Definition: RunManagerMT.h:84
std::unique_ptr< DDG4ProductionCuts > m_prodCuts
Definition: RunManagerMT.h:134
G4MTRunManagerKernel * m_kernel
Definition: RunManagerMT.h:111
SensitiveDetectorCatalog m_catalog
Definition: RunManagerMT.h:136
edm::ParameterSet m_pRunAction
Definition: RunManagerMT.h:128
HepPDT::ParticleDataTable ParticleDataTable
void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable)
Definition: RunManagerMT.cc:92
void terminateRun()
void abortRun(bool softAbort=false)
Definition: RunManagerMT.h:78
bool m_runTerminated
Definition: RunManagerMT.h:116
sim::FieldBuilder * m_fieldBuilder
Definition: RunManagerMT.h:138
std::vector< std::string > m_G4Commands
Definition: RunManagerMT.h:130
std::unique_ptr< CustomUIsession > m_UIsession
Definition: RunManagerMT.h:113
G4Run * m_currentRun
Definition: RunManagerMT.h:119
std::string m_RegionFile
Definition: RunManagerMT.h:143
void initializeUserActions()
type of data representation of DDCompactView
Definition: DDCompactView.h:90
Definition: sim.h:19
std::string m_WriteFile
Definition: RunManagerMT.h:142
RunManagerMT(edm::ParameterSet const &p)
Definition: RunManagerMT.cc:61
const DDDWorld & world() const
Definition: RunManagerMT.h:80
bool m_pUseMagneticField
Definition: RunManagerMT.h:117
edm::ParameterSet m_p
Definition: RunManagerMT.h:131
sim::ChordFinderSetter * chordFinderSetterForWorker() const
Definition: RunManagerMT.h:103
void DumpMagneticField(const G4Field *) const
bool m_StorePhysicsTables
Definition: RunManagerMT.h:123
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManagerMT.h:114
std::string m_FieldFile
Definition: RunManagerMT.h:141
edm::ParameterSet m_pField
Definition: RunManagerMT.h:126
std::unique_ptr< DDDWorld > m_world
Definition: RunManagerMT.h:133
PhysicsList * physicsListForWorker() const
Definition: RunManagerMT.h:95
edm::ParameterSet m_pPhysics
Definition: RunManagerMT.h:127
bool m_RestorePhysicsTables
Definition: RunManagerMT.h:124
std::unique_ptr< sim::ChordFinderSetter > m_chordFinderSetter
Definition: RunManagerMT.h:139
const std::vector< std::string > & G4Commands() const
Definition: RunManagerMT.h:88
std::unique_ptr< SimRunInterface > m_runInterface
Definition: RunManagerMT.h:120
edm::ParameterSet m_g4overlap
Definition: RunManagerMT.h:129
RunAction * m_userRunAction
Definition: RunManagerMT.h:118
SimActivityRegistry m_registry
Definition: RunManagerMT.h:135