38 #include "HepPDT/ParticleDataTable.hh" 40 #include "G4GeometryManager.hh" 41 #include "G4StateManager.hh" 42 #include "G4ApplicationState.hh" 43 #include "G4MTRunManagerKernel.hh" 44 #include "G4UImanager.hh" 46 #include "G4EventManager.hh" 49 #include "G4TransportationManager.hh" 50 #include "G4ParticleTable.hh" 52 #include "G4FieldManager.hh" 53 #include "G4CascadeInterface.hh" 55 #include "G4GDMLParser.hh" 56 #include "G4SystemOfUnits.hh" 66 m_managerInitialized(
false),
67 m_runTerminated(
false),
68 m_pUseMagneticField(p.getParameter<
bool>(
"UseMagneticField")),
69 m_PhysicsTablesDir(p.getParameter<
std::
string>(
"PhysicsTablesDirectory")),
70 m_StorePhysicsTables(p.getParameter<
bool>(
"StorePhysicsTables")),
71 m_RestorePhysicsTables(p.getParameter<
bool>(
"RestorePhysicsTables")),
76 m_G4Commands(p.getParameter<
std::vector<
std::
string> >(
"G4Commands")),
89 m_kernel =
new G4MTRunManagerKernel();
111 <<
"RunManagerMT: start initialisation of geometry";
120 <<
"RunManagerMT: start initialisation of magnetic field";
127 G4TransportationManager * tM =
128 G4TransportationManager::GetTransportationManager();
129 tM->SetFieldManager(fieldManager);
130 fieldBuilder.
build( fieldManager, tM->GetPropagatorInField());
136 <<
"RunManagerMT: create PhysicsList";
138 std::unique_ptr<PhysicsListMakerBase>
141 if (physicsMaker.get()==
nullptr) {
143 <<
"Unable to find the Physics list requested";
150 "Physics list construction failed!");
155 if(monopoleMass > 0.0) {
169 <<
"RunManagerMT: start initialisation of PhysicsList for master";
187 G4cout <<
"RunManagerMT: Requested UI commands: " << G4endl;
190 G4UImanager::GetUIpointer()->ApplyCommand(
command);
204 G4CascadeInterface::Initialize();
209 "G4RunManagerKernel initialization failed!");
213 std::ostringstream
dir;
217 G4UImanager::GetUIpointer()->ApplyCommand(cmd);
228 gdml.SetRegionExport(
true);
229 gdml.SetEnergyCutsExport(
true);
287 <<
" RunManager WARNING : " 288 <<
"error opening file <" <<
m_FieldFile <<
"> for magnetic field";
291 double rmax = 9000*mm;
292 double zmax = 24000*mm;
297 int nr = (
int)(rmax/dr);
298 int nz = 2*(
int)(zmax/dz);
305 double cosf =
cos(phi);
306 double sinf =
sin(phi);
308 double point[4] = {0.0,0.0,0.0,0.0};
309 double bfield[3] = {0.0,0.0,0.0};
311 fout << std::setprecision(6);
312 for(
int i=0;
i<=nr; ++
i) {
314 for(
int j=0; j<=nz; ++j) {
318 field->GetFieldValue(point, bfield);
319 fout <<
"R(mm)= " << r/mm <<
" phi(deg)= " << phi/degree
320 <<
" Z(mm)= " << z/mm <<
" Bz(tesla)= " << bfield[2]/tesla
321 <<
" Br(tesla)= " << (bfield[0]*cosf + bfield[1]*sinf)/tesla
322 <<
" Bphi(tesla)= " << (bfield[0]*sinf - bfield[1]*cosf)/tesla
void Connect(RunAction *)
const std::string m_PhysicsTablesDir
bool m_managerInitialized
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< DDG4ProductionCuts > m_prodCuts
void BeginOfRunAction(const G4Run *aRun) override
G4MTRunManagerKernel * m_kernel
SensitiveDetectorCatalog m_catalog
edm::ParameterSet m_pRunAction
def create(alignables, pedeDump, additionalData, outputFile, config)
HepPDT::ParticleDataTable ParticleDataTable
void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable)
Sin< T >::type sin(const T &t)
SimActivityRegistry::EndOfRunSignal m_endOfRunSignal
G4StateManager * m_stateManager
BeginOfRunSignal beginOfRunSignal_
std::vector< std::string > m_G4Commands
std::unique_ptr< CustomUIsession > m_UIsession
void initializeUserActions()
Compact representation of the geometrical detector hierarchy.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
RunManagerMT(edm::ParameterSet const &p)
RunAction
list of unwanted particles (gluons and quarks)
Cos< T >::type cos(const T &t)
EndOfRunSignal endOfRunSignal_
void DumpMagneticField(const G4Field *) const
void connect(Observer< const T * > *iObs)
does not take ownership of memory
void build(CMSFieldManager *fM, G4PropagatorInField *fP)
bool m_StorePhysicsTables
G4GeometryManager * m_geometryManager
std::unique_ptr< PhysicsList > m_physicsList
edm::ParameterSet m_pField
std::unique_ptr< DDDWorld > m_world
edm::ParameterSet m_pPhysics
DDDWorldSignal dddWorldSignal_
bool m_RestorePhysicsTables
void ReportRegions(const std::string &ss)
SimActivityRegistry::BeginOfRunSignal m_beginOfRunSignal
std::unique_ptr< SimRunInterface > m_runInterface
edm::ParameterSet m_g4overlap
RunAction * m_userRunAction
T get(const Candidate &c)
void EndOfRunAction(const G4Run *aRun) override
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
SimActivityRegistry m_registry