ATLAS Offline Software
Tracking
TrkValidation
TrkValTools
src
InDetReconstructableSelector.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
// InDetReconstructableSelector.cxx
7
// Source file for class InDetReconstructableSelector
9
10
#include "
TrkValTools/InDetReconstructableSelector.h
"
11
#include "
AtlasHepMC/GenVertex.h
"
12
#include "CLHEP/Units/SystemOfUnits.h"
13
#include "
AtlasHepMC/GenParticle.h
"
14
#include "
TruthUtils/HepMCHelpers.h
"
15
#include "
GeneratorObjects/McEventCollection.h
"
16
17
Trk::InDetReconstructableSelector::InDetReconstructableSelector
(
const
std::string&
type
,
const
std::string&
name
,
18
const
IInterface*
parent
)
19
:
AthAlgTool
(
type
,
name
,
parent
),
20
m_minPt (1000.),
21
m_maxEta ( 3.0),
22
m_selectPrimariesOnly(false),
23
m_maxRStartPrimary ( 25.0*
CLHEP
::
mm
),
24
m_maxZStartPrimary ( 200.0*
CLHEP
::
mm
),
25
m_maxRStartAll ( 360.0*
CLHEP
::
mm
),
26
m_maxZStartAll (2000.0*
CLHEP
::
mm
)
27
28
{
29
declareInterface<IGenParticleSelector>(
this
);
30
31
declareProperty
(
"MinPt"
,
m_minPt
);
32
declareProperty
(
"MaxEta"
,
m_maxEta
);
33
declareProperty
(
"SelectPrimariesOnly"
,
m_selectPrimariesOnly
,
"flag to restrict to primaries or not"
);
34
declareProperty
(
"MaxRStartPrimary"
,
m_maxRStartPrimary
,
"production vtx r for primaries"
);
35
declareProperty
(
"MaxZStartPrimary"
,
m_maxZStartPrimary
,
"production vtx z for primaries"
);
36
declareProperty
(
"MaxRStartAll"
,
m_maxRStartAll
,
"production vtx r for all"
);
37
declareProperty
(
"MaxZStartAll"
,
m_maxZStartAll
,
"production vtx z for all"
);
38
}
39
43
StatusCode
Trk::InDetReconstructableSelector::initialize
() {
44
ATH_MSG_INFO
(
"initialise in "
<<
name
());
45
return
StatusCode::SUCCESS;
46
}
47
48
StatusCode
Trk::InDetReconstructableSelector::finalize
() {
49
ATH_MSG_INFO
(
"starting finalize() in "
<<
name
());
50
return
StatusCode::SUCCESS;
51
}
52
53
std::vector<HepMC::ConstGenParticlePtr>*
54
Trk::InDetReconstructableSelector::selectGenSignal
(
const
McEventCollection
* SimTracks)
const
{
55
56
if
(! SimTracks)
return
nullptr
;
57
58
std::vector<HepMC::ConstGenParticlePtr>* genSignal =
59
new
std::vector<HepMC::ConstGenParticlePtr>;
60
61
// pile-up: vector of MCEC has more than one entry
62
DataVector<HepMC::GenEvent>::const_iterator
itCollision = SimTracks->
begin
();
63
64
for
( ; itCollision != SimTracks->
end
(); ++itCollision ) {
65
const
HepMC::GenEvent* genEvent = *itCollision;
66
67
for
(
const
auto
&
particle
: *genEvent) {
68
69
70
// 1) require stable particle from generation or simulation
71
if
(!
MC::isStable
(
particle
))
continue
;
72
73
if
(
particle
->production_vertex() ==
nullptr
) {
74
ATH_MSG_WARNING
(
"GenParticle without production vertex - simulation corrupt? "
);
75
ATH_MSG_DEBUG
(
"It's this one: "
<<
particle
);
76
continue
;
77
}
else
{
78
79
// 2) require track inside ID - relaxed definition including decays of neutrals (secondaries)
80
if
( std::abs(
particle
->production_vertex()->position().perp()) > m_maxRStartAll ||
81
std::abs(
particle
->production_vertex()->position().z()) > m_maxZStartAll )
continue
;
82
83
// 3) if jobOption, require strict definition of particles from within beam pipe
84
if
( m_selectPrimariesOnly &&
85
( std::abs(
particle
->production_vertex()->position().perp()) > m_maxRStartPrimary ||
86
std::abs(
particle
->production_vertex()->position().z()) > m_maxZStartPrimary ) )
continue
;
87
88
int
pdgCode =
particle
->pdg_id();
89
if
(
MC::isNucleus
(pdgCode))
continue
;
// ignore nuclei from hadronic interactions
90
const
float
charge
=
MC::charge
(pdgCode);
91
if
(std::abs(
charge
)<0.5)
continue
;
92
93
if
(std::abs(
particle
->momentum().perp()) > m_minPt && std::abs(
particle
->momentum().pseudoRapidity()) < m_maxEta ) {
94
genSignal->push_back(
particle
);
95
}
96
}
97
}
// loop and select particles
98
}
// loop and select pile-up vertices
99
return
genSignal;
100
}
101
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
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
Trk::InDetReconstructableSelector::m_maxEta
float m_maxEta
Definition:
InDetReconstructableSelector.h:46
Trk::InDetReconstructableSelector::m_maxRStartAll
float m_maxRStartAll
Max R of start vertex for primaries and secondaries.
Definition:
InDetReconstructableSelector.h:50
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
GenVertex.h
GenParticle.h
Trk::InDetReconstructableSelector::m_selectPrimariesOnly
bool m_selectPrimariesOnly
Definition:
InDetReconstructableSelector.h:47
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
CLHEP
STD'S.
Definition:
IAtRndmGenSvc.h:19
Trk::InDetReconstructableSelector::m_maxZStartPrimary
float m_maxZStartPrimary
Max Z of start vertex to be considered primary.
Definition:
InDetReconstructableSelector.h:49
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::InDetReconstructableSelector::finalize
virtual StatusCode finalize()
Definition:
InDetReconstructableSelector.cxx:48
Trk::InDetReconstructableSelector::m_maxZStartAll
float m_maxZStartAll
Max z of start vertex for primaries + sec.
Definition:
InDetReconstructableSelector.h:51
InDetReconstructableSelector.h
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.
python.SystemOfUnits.mm
int mm
Definition:
SystemOfUnits.py:83
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition:
HepMCHelpers.h:45
Trk::InDetReconstructableSelector::InDetReconstructableSelector
InDetReconstructableSelector(const std::string &type, const std::string &name, const IInterface *parent)
Definition:
InDetReconstructableSelector.cxx:17
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
Trk::InDetReconstructableSelector::m_minPt
float m_minPt
Definition:
InDetReconstructableSelector.h:45
Trk::InDetReconstructableSelector::selectGenSignal
virtual std::vector< HepMC::ConstGenParticlePtr > * selectGenSignal(const McEventCollection *) const
main method performing the genparticle selection; it works on the entire collection.
Definition:
InDetReconstructableSelector.cxx:54
AthAlgTool
Definition:
AthAlgTool.h:26
Trk::InDetReconstructableSelector::m_maxRStartPrimary
float m_maxRStartPrimary
Max R of start vertex to be considered primary.
Definition:
InDetReconstructableSelector.h:48
HepMCHelpers.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Trk::InDetReconstructableSelector::initialize
virtual StatusCode initialize()
initialize
Definition:
InDetReconstructableSelector.cxx:43
Generated on Tue Dec 24 2024 21:11:45 for ATLAS Offline Software by
1.8.18