ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetSimUtils
TRT_TR_Process
src
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
"
6
#include "
TRTTransitionRadiation.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
//=============================================================================
47
StatusCode
TRTPhysicsTool::initialize
( )
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
//=============================================================================
63
void
TRTPhysicsTool::PhysicsConstructor::ConstructParticle
() {}
64
65
//=============================================================================
66
// Physics process construction
67
//=============================================================================
68
void
TRTPhysicsTool::PhysicsConstructor::ConstructProcess
() {
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
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
PARTICLEITERATOR
#define PARTICLEITERATOR
Definition
LucidPhysicsTool.cxx:25
TRTPhysicsTool.h
TRTTransitionRadiation.h
TRTPhysicsTool::PhysicsConstructor::m_xmlFile
std::string m_xmlFile
Definition
TRTPhysicsTool.h:48
TRTPhysicsTool::PhysicsConstructor::ConstructParticle
virtual void ConstructParticle() override
Definition
TRTPhysicsTool.cxx:63
TRTPhysicsTool::PhysicsConstructor::ConstructProcess
virtual void ConstructProcess() override
Definition
TRTPhysicsTool.cxx:68
TRTPhysicsTool::m_xmlFile
std::string m_xmlFile
Definition
TRTPhysicsTool.h:53
TRTPhysicsTool::GetPhysicsOption
virtual UPPhysicsConstructor GetPhysicsOption() override
IPhysicsOptionTool method; simply returns self.
Definition
TRTPhysicsTool.cxx:56
TRTPhysicsTool::TRTPhysicsTool
TRTPhysicsTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition
TRTPhysicsTool.cxx:36
TRTPhysicsTool::initialize
virtual StatusCode initialize() override
Destructor.
Definition
TRTPhysicsTool.cxx:47
TRTTransitionRadiation
Definition
TRTTransitionRadiation.h:20
type
Generated on
for ATLAS Offline Software by
1.17.0