ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkValidation
TrkValTools
src
InDetPrimaryConversionSelector.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
// InDetPrimaryConversionSelector.cxx
7
// Source file for class InDetPrimaryConversionSelector
9
10
#include "
TrkValTools/InDetPrimaryConversionSelector.h
"
11
#include "
AtlasHepMC/GenVertex.h
"
12
#include "CLHEP/Geometry/Point3D.h"
13
#include "CLHEP/Units/SystemOfUnits.h"
14
#include "
AtlasHepMC/GenParticle.h
"
15
#include "
TruthUtils/HepMCHelpers.h
"
16
#include "
GeneratorObjects/McEventCollection.h
"
17
18
Trk::InDetPrimaryConversionSelector::InDetPrimaryConversionSelector
(
const
std::string&
type
,
const
std::string& name,
19
const
IInterface* parent)
20
:
AthAlgTool
(
type
,name,parent),
21
m_minPt
( 500. ),
22
m_maxEta
( 2.5 ),
23
m_maxRStartAll
( 800.0*
CLHEP
::mm),
24
m_maxZStartAll
(2000.0*
CLHEP
::mm)
25
26
{
27
declareInterface<IGenParticleSelector>(
this
);
28
29
declareProperty
(
"MinPt"
,
m_minPt
);
30
declareProperty
(
"MaxEta"
,
m_maxEta
);
31
declareProperty
(
"MaxRStartAll"
,
m_maxRStartAll
,
"production vtx r for all"
);
32
declareProperty
(
"MaxZStartAll"
,
m_maxZStartAll
,
"production vtx z for all"
);
33
}
34
38
StatusCode
Trk::InDetPrimaryConversionSelector::initialize
() {
39
ATH_MSG_INFO
(
"initialise in "
<< name());
40
return
StatusCode::SUCCESS;
41
}
42
43
StatusCode
Trk::InDetPrimaryConversionSelector::finalize
() {
44
ATH_MSG_INFO
(
"starting finalize() in "
<< name());
45
return
StatusCode::SUCCESS;
46
}
47
48
std::vector<HepMC::ConstGenParticlePtr>*
49
Trk::InDetPrimaryConversionSelector::selectGenSignal
(
const
McEventCollection
* SimTracks)
const
{
50
51
if
(! SimTracks)
return
nullptr
;
52
53
std::vector<HepMC::ConstGenParticlePtr>* genSignal =
54
new
std::vector<HepMC::ConstGenParticlePtr>;
55
// pile-up: vector of MCEC has more than one entry
56
DataVector<HepMC::GenEvent>::const_iterator
itCollision = SimTracks->
begin
();
57
58
for
( ; itCollision != SimTracks->
end
(); ++itCollision ) {
59
const
HepMC::GenEvent
* genEvent = *itCollision;
60
61
for
(
const
auto
& particle: *genEvent) {
62
63
// 1) require stable particle from generation or simulation
64
if
(!
MC::isStable
(particle))
continue
;
65
66
if
(!particle->production_vertex()) {
67
ATH_MSG_WARNING
(
"GenParticle without production vertex - simulation corrupt? "
);
68
ATH_MSG_DEBUG
(
"It's this one: "
<< particle);
69
continue
;
70
}
else
{
71
72
// 2) require track inside ID - relaxed definition including decays of neutrals (secondaries)
73
if
( std::fabs(particle->production_vertex()->position().perp()) >
m_maxRStartAll
||
74
std::fabs(particle->production_vertex()->position().z()) >
m_maxZStartAll
)
continue
;
75
76
int
pdgCode = particle->pdg_id();
77
if
(
MC::isNucleus
(pdgCode))
continue
;
// ignore nuclei from hadronic interactions
78
ATH_MSG_DEBUG
(
"found particle = "
<< particle);
79
80
// assume for the moment we're only running over single gamma MC files ...
81
auto
prodVertex = particle->production_vertex();
82
if
( std::abs(pdgCode) == 11 ) {
83
ATH_MSG_DEBUG
(
"Electron/Positron detected -- checking for production process ..."
);
84
for
(
const
auto
& inParticle: prodVertex->particles_in()) {
85
ATH_MSG_DEBUG
(
" --> checking morther: "
<< inParticle );
86
if
(
MC::isPhoton
(inParticle) ||
MC::isElectron
(inParticle) ){
87
if
(std::fabs(particle->momentum().perp()) >
m_minPt
&& std::fabs(particle->momentum().pseudoRapidity()) <
m_maxEta
) {
88
genSignal->push_back(particle);
89
ATH_MSG_DEBUG
(
"Selected this electron/positron!"
);
90
break
;
91
}
// if (particle pt, eta)
92
}
// if (mother is electron or gamma ...)
93
}
// loop over mother particles
94
}
// if (have electron/positron)
95
}
// if (have stable particle)
96
}
// loop and select particles
97
}
// loop and select pile-up vertices
98
return
genSignal;
99
}
100
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GenParticle.h
GenVertex.h
HepMCHelpers.h
ATLAS-specific HepMC functions.
InDetPrimaryConversionSelector.h
McEventCollection.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
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::InDetPrimaryConversionSelector::initialize
virtual StatusCode initialize()
initialize
Definition
InDetPrimaryConversionSelector.cxx:38
Trk::InDetPrimaryConversionSelector::m_minPt
float m_minPt
Definition
InDetPrimaryConversionSelector.h:45
Trk::InDetPrimaryConversionSelector::InDetPrimaryConversionSelector
InDetPrimaryConversionSelector(const std::string &type, const std::string &name, const IInterface *parent)
Definition
InDetPrimaryConversionSelector.cxx:18
Trk::InDetPrimaryConversionSelector::finalize
virtual StatusCode finalize()
Definition
InDetPrimaryConversionSelector.cxx:43
Trk::InDetPrimaryConversionSelector::m_maxZStartAll
float m_maxZStartAll
Max z of start vertex for primaries + sec.
Definition
InDetPrimaryConversionSelector.h:48
Trk::InDetPrimaryConversionSelector::selectGenSignal
virtual std::vector< HepMC::ConstGenParticlePtr > * selectGenSignal(const McEventCollection *) const
main method performing the genparticle selection; it works on the entire collection.
Definition
InDetPrimaryConversionSelector.cxx:49
Trk::InDetPrimaryConversionSelector::m_maxRStartAll
float m_maxRStartAll
Max R of start vertex for primaries and secondaries.
Definition
InDetPrimaryConversionSelector.h:47
Trk::InDetPrimaryConversionSelector::m_maxEta
float m_maxEta
Definition
InDetPrimaryConversionSelector.h:46
CLHEP
STD'S.
Definition
CaloNoiseCompCondAlg.h:57
HepMC::GenEvent
HepMC3::GenEvent GenEvent
Definition
GenEvent.h:39
MC::isPhoton
bool isPhoton(const T &p)
Definition
HepMCHelpers.h:383
MC::isElectron
bool isElectron(const T &p)
Definition
HepMCHelpers.h:209
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition
HepMCHelpers.h:46
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