ATLAS Offline Software
FastSimulationConstructorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // class header
7 
8 // G4 headers
9 #include "G4FastSimulationManagerProcess.hh"
10 #include "G4ParticleDefinition.hh"
11 #include "G4ProcessManager.hh"
12 
13 //=============================================================================
14 // Standard constructor, initializes variables
15 //=============================================================================
17  const std::string& type, const std::string& name, const IInterface* parent)
18  : base_class(type, name, parent) {
19  m_physicsOptionType = G4AtlasPhysicsOption::Type::UnknownType;
20 }
21 
22 //=============================================================================
23 // Initialize
24 //=============================================================================
26  ATH_MSG_VERBOSE("FastSimulationConstructorTool initialize( )");
27 
28  return StatusCode::SUCCESS;
29 }
30 
31 auto FastSimulationConstructorTool::GetPhysicsOption() -> UPPhysicsConstructor {
32  return std::make_unique<FastSimulationConstructorTool::PhysicsConstructor>(
33  m_initializeFastSimulation, name(), this->msgLevel());
34 }
35 
36 //=============================================================================
37 // Physics Constructor implementation
38 //=============================================================================
39 
41  bool initializeFastSimulation, const std::string& name, MSG::Level level)
42  : IPhysicsContructor(name, level), m_initializeFastSimulation(initializeFastSimulation) {}
43 
45 
47 
49  ATH_MSG_INFO("Fast simulation initialization flag is set to false. Skipping fast simulation setup.");
50  return;
51  }
52 
53  ATH_MSG_INFO("ConstructProcess for FastSimulation being run");
54  // Enable fast simulation processes for all particle types
55  G4FastSimulationManagerProcess* fastSimManagerProcess =
56  new G4FastSimulationManagerProcess;
57  G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
58  G4ParticleTable::G4PTblDicIterator* theParticleIterator =
59  theParticleTable->GetIterator();
60 
61  theParticleIterator->reset();
62  while ((*theParticleIterator)()) {
63  G4ParticleDefinition* particle = theParticleIterator->value();
64  G4ProcessManager* pmanager = particle->GetProcessManager();
65  // TOD: magic numbers?
66  pmanager->AddProcess(fastSimManagerProcess, -1, 1, 1);
67  }
68 }
FastSimulationConstructorTool::m_initializeFastSimulation
Gaudi::Property< bool > m_initializeFastSimulation
Definition: FastSimulationConstructorTool.h:45
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:79
FastSimulationConstructorTool.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
FastSimulationConstructorTool::FastSimulationConstructorTool
FastSimulationConstructorTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: FastSimulationConstructorTool.cxx:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
FastSimulationConstructorTool::PhysicsConstructor::ConstructProcess
virtual void ConstructProcess() override
Definition: FastSimulationConstructorTool.cxx:46
FastSimulationConstructorTool::GetPhysicsOption
UPPhysicsConstructor GetPhysicsOption() override
Definition: FastSimulationConstructorTool.cxx:31
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FastSimulationConstructorTool::PhysicsConstructor::ConstructParticle
virtual void ConstructParticle() override
Definition: FastSimulationConstructorTool.cxx:44
FastSimulationConstructorTool::PhysicsConstructor::PhysicsConstructor
PhysicsConstructor(bool initializeFastSimulation, const std::string &name, MSG::Level level)
Definition: FastSimulationConstructorTool.cxx:40
G4AtlasPhysicsOption::UnknownType
@ UnknownType
Definition: IPhysicsOptionTool.h:27
FastSimulationConstructorTool::initialize
virtual StatusCode initialize() override
Initialize method.
Definition: FastSimulationConstructorTool.cxx:25
IPhysicsContructor
Definition: IPhysicsConstructor.h:41