Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TRTPhysicsTool.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 "TRTPhysicsTool.h"
7 
8 #include "G4ProcessManager.hh"
9 #include "G4ParticleTable.hh"
10 #include "G4VProcess.hh"
11 #include "G4Version.hh"
12 #include "G4AutoDelete.hh"
13 
14 #include "globals.hh"
15 #include <iostream>
16 #include <memory>
17 
18 //-----------------------------------------------------------------------------
19 // Implementation file for class : TRTPhysicsTool
20 //
21 // 18-05-2015 Edoardo Farina
22 //-----------------------------------------------------------------------------
23 
24 #if G4VERSION_NUMBER > 1029
25 #define PARTICLEITERATOR (this->GetParticleIterator())
26 #elif G4VERSION_NUMBER > 1009
27 #define PARTICLEITERATOR aParticleIterator
28 #else
29 #define PARTICLEITERATOR theParticleIterator
30 #endif
31 
32 
33 //=============================================================================
34 // Standard constructor, initializes variables
35 //=============================================================================
36 TRTPhysicsTool::TRTPhysicsTool(const std::string& type, const std::string& name,
37  const IInterface* parent)
38  : base_class(type, name, parent) {
39  m_physicsOptionType = G4AtlasPhysicsOption::Type::GlobalProcesses;
40 
41  declareProperty("XMLFile", m_xmlFile="TRgeomodelgeometry.xml");
42 }
43 
44 //=============================================================================
45 // Initialize
46 //=============================================================================
48 {
49  ATH_MSG_DEBUG("TRTPhysicsTool initialize()");
50  return StatusCode::SUCCESS;
51 }
52 
53 //=============================================================================
54 // Return the physics constructor
55 //=============================================================================
56 auto TRTPhysicsTool::GetPhysicsOption() -> UPPhysicsConstructor {
57  return std::make_unique<TRTPhysicsTool::PhysicsConstructor>(name(), this->msgLevel(), m_xmlFile);
58 }
59 
60 //=============================================================================
61 // Particle construction; not implemented
62 //=============================================================================
64 
65 //=============================================================================
66 // Physics process construction
67 //=============================================================================
69  ATH_MSG_DEBUG("TRTPhysicsTool::ConstructProcess() - start");
70 
71  // Use the Geant4 garbage collection mechanism to clean this up.
72  // It's just a convenient way to clean up in multi-threading.
73  auto trProc = new TRTTransitionRadiation("XTR", m_xmlFile) ;
74  G4AutoDelete::Register(trProc);
75 
76  PARTICLEITERATOR->reset();
77  while( (*PARTICLEITERATOR)() ) {
78  G4ParticleDefinition* particle = PARTICLEITERATOR->value();
79  G4ProcessManager* pmanager = particle->GetProcessManager();
80  if ( particle->GetPDGCharge() != 0.0 && particle->GetPDGMass() != 0.0 ) {
81  trProc->SetVerboseLevel(1);
82  ATH_MSG_DEBUG("TRT Process Added to "<<particle->GetParticleName());
83  pmanager->AddDiscreteProcess(trProc);
84  }
85  }
86  ATH_MSG_DEBUG("TRTPhysicsTool::ConstructProcess() - end");
87 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
TRTTransitionRadiation
Definition: TRTTransitionRadiation.h:20
TRTPhysicsTool::GetPhysicsOption
virtual UPPhysicsConstructor GetPhysicsOption() override
IPhysicsOptionTool method; simply returns self.
Definition: TRTPhysicsTool.cxx:56
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TRTPhysicsTool::TRTPhysicsTool
TRTPhysicsTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: TRTPhysicsTool.cxx:36
TRTPhysicsTool::m_xmlFile
std::string m_xmlFile
Definition: TRTPhysicsTool.h:53
TRTPhysicsTool.h
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
TRTPhysicsTool::initialize
virtual StatusCode initialize() override
Destructor.
Definition: TRTPhysicsTool.cxx:47
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TRTPhysicsTool::PhysicsConstructor::ConstructProcess
virtual void ConstructProcess() override
Definition: TRTPhysicsTool.cxx:68
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TRTTransitionRadiation.h
G4AtlasPhysicsOption::GlobalProcesses
@ GlobalProcesses
Definition: IPhysicsOptionTool.h:26
TRTPhysicsTool::PhysicsConstructor::ConstructParticle
virtual void ConstructParticle() override
Definition: TRTPhysicsTool.cxx:63
PARTICLEITERATOR
#define PARTICLEITERATOR
Definition: TRTPhysicsTool.cxx:29