45{
46
48 SG::ReadHandle<xAOD::TruthParticleContainer> truthContainer{
m_truthContainer,
49 ctx };
50
51
55 ElementLink<xAOD::TruthParticleContainer>>
56 tPL("truthParticleLink");
57
58
59 SG::WriteDecorHandle<xAOD::ElectronContainer, int> tPdgID(
m_truthPdgId, ctx);
60
61 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherTT(
63 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherTO(
65 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherPdgID(
68 ElementLink<xAOD::TruthParticleContainer>>
70
71
72 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherTT(
74 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherTO(
76 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherPdgID(
79 ElementLink<xAOD::TruthParticleContainer>>
81
82
84 tPdgID(*el) = 0;
85 if (tPL.isAvailable(*el) && tPL(*el).isValid()) {
86 tPdgID(*el) = (*tPL(*el))->
pdgId();
87 }
88
89
90
91
92
93 firstEgMotherTT(*el) = 0;
94 firstEgMotherTO(*el) = 0;
95 firstEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
96 firstEgMotherPdgID(*el) = 0;
99
100 MCTruthPartClassifier::Info mcinfo(ctx);
101 if (firstElTruth) {
103 firstEgMotherTT(*el) =
res.first;
104 firstEgMotherTO(*el) =
res.second;
105 firstEgMotherPdgID(*el) = firstElTruth->
pdgId();
106 ElementLink<xAOD::TruthParticleContainer> link(
107 firstElTruth, *truthContainer, ctx);
108 firstEgMotherTPL(*el) = link;
109 }
110
111
112
113 lastEgMotherTT(*el) = 0;
114 lastEgMotherTO(*el) = 0;
115 lastEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
116 lastEgMotherPdgID(*el) = 0;
119
120 if (lastElTruth) {
122 lastEgMotherTT(*el) =
res.first;
123 lastEgMotherTO(*el) =
res.second;
124 lastEgMotherPdgID(*el) = lastElTruth->
pdgId();
125 ElementLink<xAOD::TruthParticleContainer> link(
126 lastElTruth, *truthContainer, ctx);
127 lastEgMotherTPL(*el) = link;
128 }
129 }
130 return StatusCode::SUCCESS;
131}
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_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
ToolHandle< IMCTruthClassifier > m_mcTruthClassifier
MCTruthClassifier.
SG::Accessor< T, ALLOC > Accessor
int pdgId() const
PDG ID code.
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".