ATLAS Offline Software
G4EMProcessesPhysicsTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Include files
6 
7 // local
9 
10 // Geant4 headers
11 #include "G4ParticleTable.hh"
12 #include "G4ProcessManager.hh"
13 #include "G4hIonisation.hh"
14 #include "G4hMultipleScattering.hh"
15 #include <cmath>
16 
17 //-----------------------------------------------------------------------------
18 // Implementation file for class : G4EMProcessesPhysicsTool
19 //
20 // August-2020 : Miha Muskinja
21 //-----------------------------------------------------------------------------
22 
23 //=============================================================================
24 // Standard constructor, initializes variables
25 //=============================================================================
27  const std::string &name,
28  const IInterface *parent)
29  : base_class(type, name, parent)
30 {
31  m_physicsOptionType = G4AtlasPhysicsOption::Type::QS_ExtraProc;
32 
33  declareProperty("ParticleList", m_particleList);
34 }
35 
36 //=============================================================================
37 // Initialize
38 //=============================================================================
40 {
41  ATH_MSG_DEBUG("initializing...");
42  return StatusCode::SUCCESS;
43 }
44 
45 //=============================================================================
46 // GetPhysicsOption
47 //=============================================================================
48 auto G4EMProcessesPhysicsTool::GetPhysicsOption() -> UPPhysicsConstructor {
49  return std::make_unique<G4EMProcessesPhysicsTool::PhysicsConstructor>(
50  name(), msgLevel(), m_particleList);
51 }
52 
53 //=============================================================================
54 // ConstructParticle
55 //=============================================================================
57 
58 //=============================================================================
59 // ConstructProcess
60 //=============================================================================
62  ATH_MSG_DEBUG("G4EMProcessesPhysicsTool::ConstructProcess() - start");
63  ATH_MSG_DEBUG("G4EMProcessesPhysicsTool::ConstructProcess() - m_particleList = " << m_particleList);
64  G4ParticleTable::G4PTblDicIterator *particleIterator = G4ParticleTable::GetParticleTable()->GetIterator();
65  particleIterator->reset();
66 
67  while ((*particleIterator)())
68  {
69  G4ParticleDefinition *particle = particleIterator->value();
70  if (std::find(m_particleList.begin(), m_particleList.end(), std::abs(particle->GetPDGEncoding())) != m_particleList.end())
71  {
72  ATH_MSG_DEBUG("Adding EM processes for "
73  << particle->GetParticleName());
74  G4ProcessManager *proc = particle->GetProcessManager();
75  proc->AddProcess(new G4hMultipleScattering, -1, 1, 1);
76  proc->AddProcess(new G4hIonisation, -1, 2, 2);
77  }
78  } // End of the particle iterator
79  ATH_MSG_DEBUG("G4EMProcessesPhysicsTool::ConstructProcess() - end");
80 }
G4AtlasPhysicsOption::QS_ExtraProc
@ QS_ExtraProc
Definition: IPhysicsOptionTool.h:25
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:79
G4EMProcessesPhysicsTool.h
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
G4EMProcessesPhysicsTool::initialize
virtual StatusCode initialize() override final
Destructor.
Definition: G4EMProcessesPhysicsTool.cxx:39
G4EMProcessesPhysicsTool::G4EMProcessesPhysicsTool
G4EMProcessesPhysicsTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: G4EMProcessesPhysicsTool.cxx:26
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
G4EMProcessesPhysicsTool::PhysicsConstructor::ConstructParticle
virtual void ConstructParticle() override
Definition: G4EMProcessesPhysicsTool.cxx:56
G4EMProcessesPhysicsTool::m_particleList
std::vector< int > m_particleList
list of particles to apply the em processes to
Definition: G4EMProcessesPhysicsTool.h:51
mc.proc
proc
Definition: mc.PhPy8EG_A14NNPDF23_gg4l_example.py:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
G4EMProcessesPhysicsTool::PhysicsConstructor::ConstructProcess
virtual void ConstructProcess() override
Definition: G4EMProcessesPhysicsTool.cxx:61
G4EMProcessesPhysicsTool::GetPhysicsOption
virtual UPPhysicsConstructor GetPhysicsOption() override final
Implements.
Definition: G4EMProcessesPhysicsTool.cxx:48