ATLAS Offline Software
Tracking
TrkValidation
TrkValTools
src
InDetHaloSelector.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// InDetHaloSelector.cxx
7
// Source file for class InDetHaloSelector
9
10
#include "
TrkValTools/InDetHaloSelector.h
"
11
#include "
AtlasHepMC/GenVertex.h
"
12
#include "CLHEP/Geometry/Point3D.h"
13
#include "
AtlasHepMC/GenParticle.h
"
14
#include "
TruthUtils/HepMCHelpers.h
"
15
#include "
GeneratorObjects/McEventCollection.h
"
16
17
Trk::InDetHaloSelector::InDetHaloSelector
(
const
std::string&
type
,
const
std::string&
name
,
18
const
IInterface*
parent
)
19
:
AthAlgTool
(
type
,
name
,
parent
)
20
21
{
22
declareInterface<IGenParticleSelector>(
this
);
23
24
}
25
29
StatusCode
Trk::InDetHaloSelector::initialize
() {
30
ATH_MSG_DEBUG
(
"initialise in "
<<
name
());
31
return
StatusCode::SUCCESS;
32
}
33
34
StatusCode
Trk::InDetHaloSelector::finalize
() {
35
ATH_MSG_DEBUG
(
"starting finalize() in "
<<
name
());
36
return
StatusCode::SUCCESS;
37
}
38
39
std::vector<HepMC::ConstGenParticlePtr>*
40
Trk::InDetHaloSelector::selectGenSignal
(
const
McEventCollection
* SimTracks)
const
{
41
42
if
(! SimTracks)
return
nullptr
;
43
44
std::vector<HepMC::ConstGenParticlePtr>* genSignal =
45
new
std::vector<HepMC::ConstGenParticlePtr>;
46
47
// pile-up: vector of MCEC has more than one entry
48
DataVector<HepMC::GenEvent>::const_iterator
itCollision = SimTracks->
begin
();
49
50
for
( ; itCollision != SimTracks->
end
(); ++itCollision ) {
51
const
HepMC::GenEvent* genEvent = *itCollision;
52
53
for
(
const
auto
&
particle
: *genEvent) {
54
55
// 1) require stable particle from generation or simulation
56
if
(!
MC::isStable
(
particle
))
continue
;
57
58
int
pdgCode =
particle
->pdg_id();
59
if
(
MC::isNucleus
(pdgCode))
continue
;
// ignore nuclei from hadronic interactions
60
ATH_MSG_DEBUG
(
"Checking particle "
<<
particle
);
61
float
charge
=
MC::charge
(pdgCode);
62
ATH_MSG_DEBUG
(
"particle charge = "
<<
charge
);
63
if
(std::fabs(
charge
)<0.5)
continue
;
64
65
genSignal->push_back(
particle
);
66
67
}
// loop and select particles
68
}
// loop and select pile-up vertices
69
return
genSignal;
70
}
71
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:76
isNucleus
bool isNucleus(const T &p)
PDG rule 16: Nuclear codes are given as 10-digit numbersĀ±10LZZZAAAI.
Definition:
AtlasPID.h:583
Trk::InDetHaloSelector::selectGenSignal
virtual std::vector< HepMC::ConstGenParticlePtr > * selectGenSignal(const McEventCollection *) const
main method performing the genparticle selection; it works on the entire collection.
Definition:
InDetHaloSelector.cxx:40
GenVertex.h
GenParticle.h
Trk::InDetHaloSelector::initialize
virtual StatusCode initialize()
initialize
Definition:
InDetHaloSelector.cxx:29
Trk::InDetHaloSelector::finalize
virtual StatusCode finalize()
Definition:
InDetHaloSelector.cxx:34
McEventCollection.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
test_pyathena.parent
parent
Definition:
test_pyathena.py:15
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition:
McEventCollection.h:33
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:794
Trk::InDetHaloSelector::InDetHaloSelector
InDetHaloSelector(const std::string &type, const std::string &name, const IInterface *parent)
Definition:
InDetHaloSelector.cxx:17
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
charge
double charge(const T &p)
Definition:
AtlasPID.h:756
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition:
HepMCHelpers.h:45
InDetHaloSelector.h
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
AthAlgTool
Definition:
AthAlgTool.h:26
HepMCHelpers.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Generated on Tue Dec 24 2024 21:11:39 for ATLAS Offline Software by
1.8.18