ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::BkgElectronClassification Class Reference

#include <BkgElectronClassification.h>

Inheritance diagram for DerivationFramework::BkgElectronClassification:
Collaboration diagram for DerivationFramework::BkgElectronClassification:

Public Member Functions

virtual StatusCode initialize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final

Private Attributes

ToolHandle< IMCTruthClassifierm_mcTruthClassifier
 MCTruthClassifier.
SG::ReadHandleKey< xAOD::ElectronContainerm_electronContainer
 input electron container
SG::ReadDecorHandleKey< xAOD::ElectronContainerm_electronTruthParticleLink
SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthContainer
 Input truth particle container.
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_truthPdgId { this, "DoNotSet_truthPdgId", m_electronContainer, "truthPdgId", "" }
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_firstEgMotherTruthType { this, "firstEgMotherTruthType", m_electronContainer, "firstEgMotherTruthType", "" }
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_firstEgMotherTruthOrigin { this, "firstEgMotherTruthOrigin", m_electronContainer, "firstEgMotherTruthOrigin", "" }
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_firstEgMotherTruthClassification
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_firstEgMotherTruthParticleLink
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_firstEgMotherPdgId { this, "firstEgMotherPdgId", m_electronContainer, "firstEgMotherPdgId", "" }
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_lastEgMotherTruthType { this, "lastEgMotherTruthType", m_electronContainer, "lastEgMotherTruthType", "" }
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_lastEgMotherTruthOrigin { this, "lastEgMotherTruthOrigin", m_electronContainer, "lastEgMotherTruthOrigin", "" }
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_lastEgMotherTruthClassification
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_lastEgMotherTruthParticleLink
SG::WriteDecorHandleKey< xAOD::ElectronContainerm_lastEgMotherPdgId { this, "lastEgMotherPdgId", m_electronContainer, "lastEgMotherPdgId", "" }

Detailed Description

Definition at line 23 of file BkgElectronClassification.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::BkgElectronClassification::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 47 of file BkgElectronClassification.cxx.

48{
49
50 SG::ReadHandle<xAOD::ElectronContainer> electrons{ m_electronContainer, ctx };
51 SG::ReadHandle<xAOD::TruthParticleContainer> truthContainer{ m_truthContainer,
52 ctx };
53
54 // Access for the pre-existing decoration
55 SG::ReadDecorHandle<xAOD::ElectronContainer,
56 ElementLink<xAOD::TruthParticleContainer>>
58
59 // pdg iD
60 SG::WriteDecorHandle<xAOD::ElectronContainer, int> tPdgID(m_truthPdgId, ctx);
61 // first mother decorations
62 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherTT(
64 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherTO(
66 SG::WriteDecorHandle<xAOD::ElectronContainer, unsigned int> firstEgMotherTC(
68 SG::WriteDecorHandle<xAOD::ElectronContainer, int> firstEgMotherPdgID(
70 SG::WriteDecorHandle<xAOD::ElectronContainer,
71 ElementLink<xAOD::TruthParticleContainer>>
72 firstEgMotherTPL(m_firstEgMotherTruthParticleLink, ctx);
73
74 // last mother decorations
75 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherTT(
77 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherTO(
79 SG::WriteDecorHandle<xAOD::ElectronContainer, unsigned int> lastEgMotherTC(
81 SG::WriteDecorHandle<xAOD::ElectronContainer, int> lastEgMotherPdgID(
83 SG::WriteDecorHandle<xAOD::ElectronContainer,
84 ElementLink<xAOD::TruthParticleContainer>>
85 lastEgMotherTPL(m_lastEgMotherTruthParticleLink, ctx);
86 //
87
88 for (const xAOD::Electron* el : *electrons) {
89 tPdgID(*el) = 0;
90 if (tPL.isPresent() && tPL(*el).isValid()) {
91 tPdgID(*el) = (*tPL(*el))->pdgId();
92 }
93 // Use the Helpers for electron from electron or photon
94 // Add Extra Decoration from Egamma helpers in case of BkgElectron (Electron
95 // coming for a photon) Go back to the first/last electron/photon Generator
96 // mother and classify this one
97 // First the one entering the Geant4, the first we meet on the way back
98 firstEgMotherTT(*el) = 0;
99 firstEgMotherTO(*el) = 0;
100 firstEgMotherTC(*el) = 0;
101 firstEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
102 firstEgMotherPdgID(*el) = 0;
103 const xAOD::TruthParticle* firstElTruth =
105
106 MCTruthPartClassifier::Info mcinfo(ctx);
107 if (firstElTruth) {
108 auto res = m_mcTruthClassifier->particleTruthClassifier(firstElTruth, &mcinfo);
109 firstEgMotherTT(*el) = res.first;
110 firstEgMotherTO(*el) = res.second;
111 firstEgMotherTC(*el) = std::get<0>(MCTruthPartClassifier::defOrigOfParticle(firstElTruth)); // See AGENE-2351
112 firstEgMotherPdgID(*el) = firstElTruth->pdgId();
113 ElementLink<xAOD::TruthParticleContainer> link(
114 firstElTruth, *truthContainer, ctx);
115 firstEgMotherTPL(*el) = link;
116 }
117
118 // The last electron / photon we meet on the way back towards the Generator
119 // vertex
120 lastEgMotherTT(*el) = 0;
121 lastEgMotherTO(*el) = 0;
122 lastEgMotherTC(*el) = 0;
123 lastEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
124 lastEgMotherPdgID(*el) = 0;
125 const xAOD::TruthParticle* lastElTruth =
127
128 if (lastElTruth) {
129 auto res = m_mcTruthClassifier->particleTruthClassifier(lastElTruth, &mcinfo);
130 lastEgMotherTT(*el) = res.first;
131 lastEgMotherTO(*el) = res.second;
132 lastEgMotherTC(*el) = std::get<0>(MCTruthPartClassifier::defOrigOfParticle(lastElTruth)); // See AGENE-2351
133 lastEgMotherPdgID(*el) = lastElTruth->pdgId();
134 ElementLink<xAOD::TruthParticleContainer> link(
135 lastElTruth, *truthContainer, ctx);
136 lastEgMotherTPL(*el) = link;
137 }
138 }
139 return StatusCode::SUCCESS;
140}
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.
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)
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".

◆ initialize()

StatusCode DerivationFramework::BkgElectronClassification::initialize ( )
finaloverridevirtual

Definition at line 17 of file BkgElectronClassification.cxx.

18{
19
20 ATH_MSG_DEBUG("Initializing " << name() << "...");
22 ATH_MSG_DEBUG("Retrieved tool " << m_mcTruthClassifier);
23
24 ATH_CHECK(m_electronContainer.initialize());
25 ATH_CHECK(m_truthContainer.initialize());
27 ATH_CHECK(m_truthPdgId.initialize());
28 //
33 ATH_CHECK(m_firstEgMotherPdgId.initialize());
34 //
39 ATH_CHECK(m_lastEgMotherPdgId.initialize());
40
41 ATH_MSG_DEBUG("Initialization successful");
42
43 return StatusCode::SUCCESS;
44}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)

Member Data Documentation

◆ m_electronContainer

SG::ReadHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_electronContainer
private
Initial value:
{
this,
"ElectronContainerName",
"Electrons",
"Input Electrons"
}

input electron container

Definition at line 42 of file BkgElectronClassification.h.

42 {
43 this,
44 "ElectronContainerName",
45 "Electrons",
46 "Input Electrons"
47 };

◆ m_electronTruthParticleLink

SG::ReadDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_electronTruthParticleLink
private
Initial value:
{ this, "electronTruthParticleLink",
m_electronContainer, "truthParticleLink", "" }

Definition at line 49 of file BkgElectronClassification.h.

49 { this, "electronTruthParticleLink",
50 m_electronContainer, "truthParticleLink", "" }; // Decoration applied in egammaTruthAssociationAlg

◆ m_firstEgMotherPdgId

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_firstEgMotherPdgId { this, "firstEgMotherPdgId", m_electronContainer, "firstEgMotherPdgId", "" }
private

Definition at line 76 of file BkgElectronClassification.h.

76{ this, "firstEgMotherPdgId", m_electronContainer, "firstEgMotherPdgId", "" };

◆ m_firstEgMotherTruthClassification

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthClassification
private
Initial value:
{ this, "firstEgMotherTruthClassification",
m_electronContainer, "firstEgMotherTruthClassification", "" }

Definition at line 68 of file BkgElectronClassification.h.

68 { this, "firstEgMotherTruthClassification",
69 m_electronContainer, "firstEgMotherTruthClassification", "" };

◆ m_firstEgMotherTruthOrigin

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthOrigin { this, "firstEgMotherTruthOrigin", m_electronContainer, "firstEgMotherTruthOrigin", "" }
private

Definition at line 66 of file BkgElectronClassification.h.

66{ this, "firstEgMotherTruthOrigin", m_electronContainer, "firstEgMotherTruthOrigin", "" };

◆ m_firstEgMotherTruthParticleLink

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthParticleLink
private
Initial value:
{ this,
"firstEgMotherTruthParticleLink",
m_electronContainer, "firstEgMotherTruthParticleLink",
"" }

Definition at line 71 of file BkgElectronClassification.h.

71 { this,
72 "firstEgMotherTruthParticleLink",
73 m_electronContainer, "firstEgMotherTruthParticleLink",
74 "" };

◆ m_firstEgMotherTruthType

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthType { this, "firstEgMotherTruthType", m_electronContainer, "firstEgMotherTruthType", "" }
private

Definition at line 64 of file BkgElectronClassification.h.

64{ this, "firstEgMotherTruthType", m_electronContainer, "firstEgMotherTruthType", "" };

◆ m_lastEgMotherPdgId

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_lastEgMotherPdgId { this, "lastEgMotherPdgId", m_electronContainer, "lastEgMotherPdgId", "" }
private

Definition at line 90 of file BkgElectronClassification.h.

90{ this, "lastEgMotherPdgId", m_electronContainer, "lastEgMotherPdgId", "" };

◆ m_lastEgMotherTruthClassification

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthClassification
private
Initial value:
{ this, "lastEgMotherTruthClassification",
m_electronContainer, "lastEgMotherTruthClassification", "" }

Definition at line 82 of file BkgElectronClassification.h.

82 { this, "lastEgMotherTruthClassification",
83 m_electronContainer, "lastEgMotherTruthClassification", "" };

◆ m_lastEgMotherTruthOrigin

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthOrigin { this, "lastEgMotherTruthOrigin", m_electronContainer, "lastEgMotherTruthOrigin", "" }
private

Definition at line 80 of file BkgElectronClassification.h.

80{ this, "lastEgMotherTruthOrigin", m_electronContainer, "lastEgMotherTruthOrigin", "" };

◆ m_lastEgMotherTruthParticleLink

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthParticleLink
private
Initial value:
{ this,
"lastEgMotherTruthParticleLink",
m_electronContainer, "lastEgMotherTruthParticleLink",
"" }

Definition at line 85 of file BkgElectronClassification.h.

85 { this,
86 "lastEgMotherTruthParticleLink",
87 m_electronContainer, "lastEgMotherTruthParticleLink",
88 "" };

◆ m_lastEgMotherTruthType

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthType { this, "lastEgMotherTruthType", m_electronContainer, "lastEgMotherTruthType", "" }
private

Definition at line 78 of file BkgElectronClassification.h.

78{ this, "lastEgMotherTruthType", m_electronContainer, "lastEgMotherTruthType", "" };

◆ m_mcTruthClassifier

ToolHandle<IMCTruthClassifier> DerivationFramework::BkgElectronClassification::m_mcTruthClassifier
private
Initial value:
{
this,
"MCTruthClassifierTool",
"",
"Handle to the MCTruthClassifier"
}

MCTruthClassifier.

Definition at line 34 of file BkgElectronClassification.h.

34 {
35 this,
36 "MCTruthClassifierTool",
37 "",
38 "Handle to the MCTruthClassifier"
39 };

◆ m_truthContainer

SG::ReadHandleKey<xAOD::TruthParticleContainer> DerivationFramework::BkgElectronClassification::m_truthContainer
private
Initial value:
{
this,
"TruthParticleContainerName",
"TruthParticles",
"Input Truth Particles"
}

Input truth particle container.

Definition at line 53 of file BkgElectronClassification.h.

53 {
54 this,
55 "TruthParticleContainerName",
56 "TruthParticles",
57 "Input Truth Particles"
58 };

◆ m_truthPdgId

SG::WriteDecorHandleKey<xAOD::ElectronContainer> DerivationFramework::BkgElectronClassification::m_truthPdgId { this, "DoNotSet_truthPdgId", m_electronContainer, "truthPdgId", "" }
private

Definition at line 62 of file BkgElectronClassification.h.

62{ this, "DoNotSet_truthPdgId", m_electronContainer, "truthPdgId", "" };

The documentation for this class was generated from the following files: