|
|
Go to the documentation of this file.
30 #include "HepPDT/ParticleDataTable.hh"
33 #include "G4GeometryManager.hh"
34 #include "G4StateManager.hh"
35 #include "G4ApplicationState.hh"
36 #include "G4MTRunManagerKernel.hh"
37 #include "G4UImanager.hh"
39 #include "G4EventManager.hh"
42 #include "G4TransportationManager.hh"
43 #include "G4ParticleTable.hh"
44 #include "G4CascadeInterface.hh"
45 #include "G4EmParameters.hh"
46 #include "G4HadronicParameters.hh"
47 #include "G4NuclearLevelData.hh"
49 #include "G4GDMLParser.hh"
50 #include "G4SystemOfUnits.hh"
52 #include "G4LogicalVolume.hh"
53 #include "G4LogicalVolumeStore.hh"
54 #include "G4PhysicalVolumeStore.hh"
55 #include "G4Region.hh"
56 #include "G4RegionStore.hh"
68 : m_managerInitialized(
false),
69 m_runTerminated(
false),
70 m_PhysicsTablesDir(
p.getUntrackedParameter<
std::
string>(
"PhysicsTablesDirectory",
"")),
71 m_StorePhysicsTables(
p.getUntrackedParameter<
bool>(
"StorePhysicsTables",
false)),
72 m_RestorePhysicsTables(
p.getUntrackedParameter<
bool>(
"RestorePhysicsTables",
false)),
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;
118 G4VPhysicalVolume*
world =
m_world.get()->GetWorldVolume();
122 G4cout <<
"RunManagerMT: geometry is initialized: " << timer << G4endl;
127 <<
"RunManagerMT: Define cuts: " <<
cuts <<
" Geant4 run manager verbosity: " << verb;
129 const G4RegionStore* regStore = G4RegionStore::GetInstance();
130 const G4PhysicalVolumeStore*
pvs = G4PhysicalVolumeStore::GetInstance();
131 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
132 unsigned int numPV =
pvs->size();
133 unsigned int numLV = lvs->size();
134 unsigned int nn = regStore->size();
136 <<
"RunManagerMT: " << numPV <<
" physical volumes; " << numLV <<
" logical volumes; " <<
nn <<
" regions.";
145 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: create PhysicsList";
147 std::unique_ptr<PhysicsListMakerBase> physicsMaker(
149 if (physicsMaker.get() ==
nullptr) {
155 if (phys ==
nullptr) {
158 G4EmParameters::Instance()->SetVerbose(verb);
159 G4EmParameters::Instance()->SetWorkerVerbose(verb - 1);
163 if (monopoleMass > 0.0) {
178 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: start initialisation of PhysicsList for master";
184 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: PhysicsList and cuts are defined";
188 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: Requested UI commands: ";
191 G4UImanager::GetUIpointer()->ApplyCommand(
command);
196 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: G4State is Init";
200 if (
m_kernel->RunInitialization()) {
208 G4cout <<
"RunManagerMT: physics is initialized: " << timer << G4endl;
212 std::ostringstream
dir;
216 G4UImanager::GetUIpointer()->ApplyCommand(
cmd);
219 G4NuclearLevelData::GetInstance()->UploadNuclearLevelData(84);
224 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT: Physics is initilized, now initialise user actions";
230 if (!writeFile.empty()) {
232 gdml.SetRegionExport(
true);
233 gdml.SetEnergyCutsExport(
true);
234 gdml.Write(writeFile,
m_world->GetWorldVolume(),
true);
241 if (
m_check || !regionFile.empty()) {
254 G4cout <<
"RunManagerMT: initG4 done " << timer << G4endl;
286 edm::LogVerbatim(
"SimG4CoreApplication") <<
"RunManagerMT:: terminateRun done";
std::unique_ptr< SimRunInterface > m_runInterface
edm::ParameterSet m_g4overlap
std::vector< std::string > m_G4Commands
const TkSoA *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
void initializeUserActions()
CustomUIsession * m_UIsession
SimActivityRegistry m_registry
DDDWorldSignal dddWorldSignal_
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