|
|
Go to the documentation of this file.
30 #include "HepPDT/ParticleDataTable.hh"
32 #include "G4GeometryManager.hh"
33 #include "G4StateManager.hh"
34 #include "G4ApplicationState.hh"
35 #include "G4MTRunManagerKernel.hh"
36 #include "G4UImanager.hh"
38 #include "G4EventManager.hh"
41 #include "G4TransportationManager.hh"
42 #include "G4ParticleTable.hh"
43 #include "G4CascadeInterface.hh"
45 #include "G4GDMLParser.hh"
46 #include "G4SystemOfUnits.hh"
48 #include "G4LogicalVolume.hh"
49 #include "G4LogicalVolumeStore.hh"
50 #include "G4PhysicalVolumeStore.hh"
51 #include "G4Region.hh"
52 #include "G4RegionStore.hh"
62 : m_managerInitialized(
false),
63 m_runTerminated(
false),
64 m_PhysicsTablesDir(
p.getUntrackedParameter<
std::
string>(
"PhysicsTablesDirectory",
"")),
65 m_StorePhysicsTables(
p.getUntrackedParameter<
bool>(
"StorePhysicsTables",
false)),
66 m_RestorePhysicsTables(
p.getUntrackedParameter<
bool>(
"RestorePhysicsTables",
false)),
67 m_UseParametrisedEMPhysics(
p.getUntrackedParameter<
bool>(
"UseParametrisedEMPhysics")),
71 m_G4Commands(
p.getParameter<
std::vector<
std::
string> >(
"G4Commands")),
82 m_kernel =
new G4MTRunManagerKernel();
87 m_check =
p.getUntrackedParameter<
bool>(
"CheckGeometry",
false);
96 edm::LogWarning(
"SimG4CoreApplication") <<
"RunManagerMT::initG4 was already done - exit";
105 <<
"RunManagerMT: start initialising of geometry DD4Hep: " << geoFromDD4hep <<
"\n"
106 <<
" cutsPerRegion: " <<
cuts <<
" cutForProton: " << protonCut <<
"\n"
107 <<
" G4 verbosity: " << verb;
110 G4VPhysicalVolume*
world =
m_world.get()->GetWorldVolume();
114 <<
"RunManagerMT: Define cuts: " <<
cuts <<
" Geant4 run manager verbosity: " << verb;
116 const G4RegionStore* regStore = G4RegionStore::GetInstance();
117 const G4PhysicalVolumeStore*
pvs = G4PhysicalVolumeStore::GetInstance();
118 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
119 unsigned int numPV =
pvs->size();
120 unsigned int numLV = lvs->size();
121 unsigned int nn = regStore->size();
123 <<
"###RunManagerMT: " << numPV <<
" PhysVolumes; " << numLV <<
" LogVolumes; " <<
nn <<
" Regions.";
132 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: create PhysicsList";
134 std::unique_ptr<PhysicsListMakerBase> physicsMaker(
136 if (physicsMaker.get() ==
nullptr) {
142 if (phys ==
nullptr) {
148 if (monopoleMass > 0.0) {
164 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: start initialisation of PhysicsList for master";
170 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: PhysicsList and cuts are defined";
174 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: Requested UI commands: ";
177 G4UImanager::GetUIpointer()->ApplyCommand(
command);
182 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: G4State is Init";
192 G4CascadeInterface::Initialize();
194 if (
m_kernel->RunInitialization()) {
201 std::ostringstream
dir;
205 G4UImanager::GetUIpointer()->ApplyCommand(
cmd);
212 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: Physics is initilized, now initialise user actions";
218 if (!writeFile.empty()) {
220 gdml.SetRegionExport(
true);
221 gdml.SetEnergyCutsExport(
true);
222 gdml.Write(writeFile,
m_world->GetWorldVolume(),
true);
229 if (
m_check || !regionFile.empty()) {
std::unique_ptr< SimRunInterface > m_runInterface
edm::ParameterSet m_g4overlap
std::vector< std::string > m_G4Commands
void initializeUserActions()
CustomUIsession * m_UIsession
SimActivityRegistry m_registry
DDDWorldSignal dddWorldSignal_
bool m_UseParametrisedEMPhysics
T getUntrackedParameter(std::string const &, T const &) const
def create(alignables, pedeDump, additionalData, outputFile, config)
SimActivityRegistry::BeginOfRunSignal m_beginOfRunSignal
RunAction
list of unwanted particles (gluons and quarks)
RunManagerMT(edm::ParameterSet const &)
Compact representation of the geometrical detector hierarchy.
const DDDWorld & world() const
G4StateManager * m_stateManager
edm::ParameterSet m_pPhysics
void connect(Observer< const T * > *iObs)
does not take ownership of memory
std::unique_ptr< PhysicsList > m_physicsList
void initG4(const DDCompactView *, const cms::DDCompactView *, const HepPDT::ParticleDataTable *)
EndOfRunSignal endOfRunSignal_
RunAction * m_userRunAction
SimActivityRegistry::EndOfRunSignal m_endOfRunSignal
T getParameter(std::string const &) const
bool m_managerInitialized
bool m_StorePhysicsTables
void EndOfRunAction(const G4Run *aRun) override
void Connect(RunAction *)
G4GeometryManager * m_geometryManager
const std::string m_PhysicsTablesDir
std::unique_ptr< DDDWorld > m_world
bool m_RestorePhysicsTables
edm::ParameterSet m_pRunAction
BeginOfRunSignal beginOfRunSignal_
G4MTRunManagerKernel * m_kernel
HepPDT::ParticleDataTable ParticleDataTable
SensitiveDetectorCatalog m_catalog
void BeginOfRunAction(const G4Run *aRun) override