|
|
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"
44 #include "G4EmParameters.hh"
45 #include "G4HadronicParameters.hh"
46 #include "G4NuclearLevelData.hh"
48 #include "G4GDMLParser.hh"
49 #include "G4SystemOfUnits.hh"
51 #include "G4LogicalVolume.hh"
52 #include "G4LogicalVolumeStore.hh"
53 #include "G4PhysicalVolumeStore.hh"
54 #include "G4Region.hh"
55 #include "G4RegionStore.hh"
67 : m_managerInitialized(
false),
68 m_runTerminated(
false),
69 m_PhysicsTablesDir(
p.getUntrackedParameter<
std::
string>(
"PhysicsTablesDirectory",
"")),
70 m_StorePhysicsTables(
p.getUntrackedParameter<
bool>(
"StorePhysicsTables",
false)),
71 m_RestorePhysicsTables(
p.getUntrackedParameter<
bool>(
"RestorePhysicsTables",
false)),
72 m_UseParametrisedEMPhysics(
p.getUntrackedParameter<
bool>(
"UseParametrisedEMPhysics")),
87 m_kernel =
new G4MTRunManagerKernel();
92 m_check =
p.getUntrackedParameter<
bool>(
"CheckGeometry",
false);
101 edm::LogWarning(
"SimG4CoreApplication") <<
"RunManagerMT::initG4 was already done - exit";
110 <<
"RunManagerMT: start initialising of geometry DD4Hep: " << geoFromDD4hep <<
"\n"
111 <<
" cutsPerRegion: " <<
cuts <<
" cutForProton: " << protonCut <<
"\n"
112 <<
" G4 verbosity: " << verb;
115 G4VPhysicalVolume*
world =
m_world.get()->GetWorldVolume();
119 <<
"RunManagerMT: Define cuts: " <<
cuts <<
" Geant4 run manager verbosity: " << verb;
121 const G4RegionStore* regStore = G4RegionStore::GetInstance();
122 const G4PhysicalVolumeStore*
pvs = G4PhysicalVolumeStore::GetInstance();
123 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
124 unsigned int numPV =
pvs->size();
125 unsigned int numLV = lvs->size();
126 unsigned int nn = regStore->size();
128 <<
"###RunManagerMT: " << numPV <<
" PhysVolumes; " << numLV <<
" LogVolumes; " <<
nn <<
" Regions.";
137 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: create PhysicsList";
139 std::unique_ptr<PhysicsListMakerBase> physicsMaker(
141 if (physicsMaker.get() ==
nullptr) {
147 if (phys ==
nullptr) {
150 G4EmParameters::Instance()->SetVerbose(verb);
151 G4EmParameters::Instance()->SetWorkerVerbose(verb - 1);
155 if (monopoleMass > 0.0) {
171 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: start initialisation of PhysicsList for master";
177 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: PhysicsList and cuts are defined";
181 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: Requested UI commands: ";
184 G4UImanager::GetUIpointer()->ApplyCommand(
command);
189 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: G4State is Init";
193 if (
m_kernel->RunInitialization()) {
200 std::ostringstream
dir;
204 G4UImanager::GetUIpointer()->ApplyCommand(
cmd);
207 G4NuclearLevelData::GetInstance()->UploadNuclearLevelData(84);
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()) {
272 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT:: terminateRun done";
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
Log< level::Warning, false > LogWarning
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
Log< level::Info, true > LogVerbatim
bool m_managerInitialized
T getParameter(std::string const &) const
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