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  this->SetPhysicsName(this->name());
43  return StatusCode::SUCCESS;
44 }
45 
46 //=============================================================================
47 // GetPhysicsOption
48 //=============================================================================
50 {
51  return this;
52 }
53 
54 //=============================================================================
55 // ConstructParticle
56 //=============================================================================
58 
59 //=============================================================================
60 // ConstructProcess
61 //=============================================================================
63 {
64  ATH_MSG_DEBUG("G4EMProcessesPhysicsTool::ConstructProcess() - start");
65  ATH_MSG_DEBUG("G4EMProcessesPhysicsTool::ConstructProcess() - m_particleList = " << m_particleList);
66  G4ParticleTable::G4PTblDicIterator *particleIterator = G4ParticleTable::GetParticleTable()->GetIterator();
67  particleIterator->reset();
68 
69  while ((*particleIterator)())
70  {
71  G4ParticleDefinition *particle = particleIterator->value();
72  if (std::find(m_particleList.begin(), m_particleList.end(), std::abs(particle->GetPDGEncoding())) != m_particleList.end())
73  {
74  ATH_MSG_DEBUG("Adding EM processes for "
75  << particle->GetParticleName());
76  G4ProcessManager *proc = particle->GetProcessManager();
77  proc->AddProcess(new G4hMultipleScattering, -1, 1, 1);
78  proc->AddProcess(new G4hIonisation, -1, 2, 2);
79  }
80  } // End of the particle iterator
81  ATH_MSG_DEBUG("G4EMProcessesPhysicsTool::ConstructProcess() - end");
82 }
G4AtlasPhysicsOption::QS_ExtraProc
@ QS_ExtraProc
Definition: IPhysicsOptionTool.h:24
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
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
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::m_particleList
std::vector< int > m_particleList
list of particles to apply the em processes to
Definition: G4EMProcessesPhysicsTool.h:42
G4EMProcessesPhysicsTool::ConstructProcess
virtual void ConstructProcess() override final
Definition: G4EMProcessesPhysicsTool.cxx:62
mc.proc
proc
Definition: mc.PhPy8EG_A14NNPDF23_gg4l_example.py:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
G4EMProcessesPhysicsTool::ConstructParticle
virtual void ConstructParticle() override final
Definition: G4EMProcessesPhysicsTool.cxx:57
G4EMProcessesPhysicsTool::GetPhysicsOption
virtual G4EMProcessesPhysicsTool * GetPhysicsOption() override final
Implements.
Definition: G4EMProcessesPhysicsTool.cxx:49
G4EMProcessesPhysicsTool
Definition: G4EMProcessesPhysicsTool.h:24