ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
charge
double charge(const T &p)
Definition
AtlasPID.h:1003
GenParticle.h
GenVertex.h
HepMCHelpers.h
ATLAS-specific HepMC functions.
InDetHaloSelector.h
McEventCollection.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
DataVector::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
Definition
McEventCollection.h:31
Trk::InDetHaloSelector::initialize
virtual StatusCode initialize()
initialize
Definition
InDetHaloSelector.cxx:29
Trk::InDetHaloSelector::finalize
virtual StatusCode finalize()
Definition
InDetHaloSelector.cxx:34
Trk::InDetHaloSelector::InDetHaloSelector
InDetHaloSelector(const std::string &type, const std::string &name, const IInterface *parent)
Definition
InDetHaloSelector.cxx:17
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
HepMC::GenEvent
HepMC3::GenEvent GenEvent
Definition
GenEvent.h:39
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition
HepMCHelpers.h:46
MC::charge
double charge(const T &p)
Definition
HepMCHelpers.h:1004
MC::isNucleus
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
Definition
HepMCHelpers.h:709
type
Generated on
for ATLAS Offline Software by
1.17.0