49{
50
52 SG::ReadHandle<xAOD::TruthParticleContainer> truthContainer{
m_truthContainer,
53 ctx };
54
55
57 ElementLink<xAOD::TruthParticleContainer>>
59
60
61 SG::WriteDecorHandle<xAOD::ElectronContainer, int> tPdgID(
m_truthPdgId, ctx);
62
63 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherTT(
65 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherTO(
67 SG::WriteDecorHandle<xAOD::ElectronContainer, unsigned int> firstEgMotherTC(
69 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherPdgID(
72 ElementLink<xAOD::TruthParticleContainer>>
74
75
76 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherTT(
78 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherTO(
80 SG::WriteDecorHandle<xAOD::ElectronContainer, unsigned int> lastEgMotherTC(
82 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherPdgID(
85 ElementLink<xAOD::TruthParticleContainer>>
87
88
90 tPdgID(*el) = 0;
91 if (tPL.isPresent() && tPL(*el).isValid()) {
93 tPdgID(*el) = truthEl->
pdgId();
94
95
97 for (
size_t p = 0;
p < truthEl->
nParents(); ++
p) {
100 << "truth thinning) for truth electron with pt "
101 << truthEl->
pt() <<
" MeV");
102 break;
103 }
104 }
105 }
106 }
107
108
109
110
111
112 firstEgMotherTT(*el) = 0;
113 firstEgMotherTO(*el) = 0;
114 firstEgMotherTC(*el) = 0;
115 firstEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
116 firstEgMotherPdgID(*el) = 0;
119
120 if (firstElTruth) {
122 firstEgMotherTT(*el) =
res.first;
123 firstEgMotherTO(*el) =
res.second;
125 firstEgMotherPdgID(*el) = firstElTruth->
pdgId();
126 ElementLink<xAOD::TruthParticleContainer>
link(
127 firstElTruth, *truthContainer, ctx);
128 firstEgMotherTPL(*el) =
link;
129 }
130
131
132
133 lastEgMotherTT(*el) = 0;
134 lastEgMotherTO(*el) = 0;
135 lastEgMotherTC(*el) = 0;
136 lastEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
137 lastEgMotherPdgID(*el) = 0;
140
141 if (lastElTruth) {
143 lastEgMotherTT(*el) =
res.first;
144 lastEgMotherTO(*el) =
res.second;
146 lastEgMotherPdgID(*el) = lastElTruth->
pdgId();
147 ElementLink<xAOD::TruthParticleContainer>
link(
148 lastElTruth, *truthContainer, ctx);
149 lastEgMotherTPL(*el) =
link;
150 }
151 }
152 return StatusCode::SUCCESS;
153}
#define ATH_MSG_WARNING(x,...)
std::pair< std::vector< unsigned int >, bool > res
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthOrigin
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronContainer
input electron container
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_truthPdgId
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthParticleLink
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthContainer
Input truth particle container.
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthClassification
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherPdgId
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthType
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthOrigin
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthParticleLink
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthType
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherPdgId
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronTruthParticleLink
ToolHandle< IMCTruthClassifier > m_mcTruthClassifier
MCTruthClassifier.
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthClassification
int pdgId() const
PDG ID code.
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
size_t nParents() const
Number of parents of this particle.
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)
bool isElectron(const T &p)
pointer & link(pointer p) const
Return a reference to the link for an element.
const xAOD::TruthParticle * getBkgElectronMother(const xAOD::Electron *el, const bool allTheWayBack=true)
Helper wrapper function for calling the function above extracting the truth from a reco electron.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TruthParticle_v1 TruthParticle
Typedef to implementation.
Electron_v1 Electron
Definition of the current "egamma version".