ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
DerivationFramework::BkgElectronClassification Class Reference

#include <BkgElectronClassification.h>

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

Public Member Functions

 BkgElectronClassification (const std::string &t, const std::string &n, const IInterface *p)
 
virtual StatusCode initialize () override final
 
virtual StatusCode addBranches () const override final
 

Private Attributes

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

Detailed Description

Definition at line 23 of file BkgElectronClassification.h.

Constructor & Destructor Documentation

◆ BkgElectronClassification()

DerivationFramework::BkgElectronClassification::BkgElectronClassification ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 15 of file BkgElectronClassification.cxx.

18  : base_class(t, n, p)
19 {
20 
21 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::BkgElectronClassification::addBranches ( ) const
finaloverridevirtual

Definition at line 66 of file BkgElectronClassification.cxx.

67 {
68 
69  const EventContext& ctx = Gaudi::Hive::currentContext();
72  ctx };
73 
74  // Access for the already existing info
75  static const SG::AuxElement::Accessor<int> tT("truthType");
76  static const SG::AuxElement::Accessor<int> tO("truthOrigin");
77  static const SG::AuxElement::Accessor<
79  tPL("truthParticleLink");
80 
81  // pdg iD
83  // first mother decorations
92  firstEgMotherTPL(m_firstEgMotherTruthParticleLink, ctx);
93 
94  // last mother decorations
100  m_lastEgMotherPdgId, ctx);
103  lastEgMotherTPL(m_lastEgMotherTruthParticleLink, ctx);
104  //
105 
106  for (const xAOD::Electron* el : *electrons) {
107  tPdgID(*el) = 0;
108  if (tPL.isAvailable(*el) && tPL(*el).isValid()) {
109  tPdgID(*el) = (*tPL(*el))->pdgId();
110  }
111  // Use the Helpers for electron from electron or photon
112  // Add Extra Decoration from Egamma helpers in case of BkgElectron (Electron
113  // coming for a photon) Go back to the first/last electron/photon Generator
114  // mother and classify this one
115  // First the one entering the Geant, the first we meet on the way back
116  firstEgMotherTT(*el) = 0;
117  firstEgMotherTO(*el) = 0;
118  firstEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
119  firstEgMotherPdgID(*el) = 0;
120  const xAOD::TruthParticle* firstElTruth =
122 
123  MCTruthPartClassifier::Info mcinfo(ctx);
124  if (firstElTruth) {
125  auto res = m_mcTruthClassifier->particleTruthClassifier(firstElTruth, &mcinfo);
126  firstEgMotherTT(*el) = res.first;
127  firstEgMotherTO(*el) = res.second;
128  firstEgMotherPdgID(*el) = firstElTruth->pdgId();
130  firstElTruth, *truthContainer, ctx);
131  firstEgMotherTPL(*el) = link;
132  }
133 
134  // The last electron / photon we meet on the way back towards the Generator
135  // vertex
136  lastEgMotherTT(*el) = 0;
137  lastEgMotherTO(*el) = 0;
138  lastEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
139  lastEgMotherPdgID(*el) = 0;
140  const xAOD::TruthParticle* lastElTruth =
142 
143  if (lastElTruth) {
144  auto res = m_mcTruthClassifier->particleTruthClassifier(lastElTruth, &mcinfo);
145  lastEgMotherTT(*el) = res.first;
146  lastEgMotherTO(*el) = res.second;
147  lastEgMotherPdgID(*el) = lastElTruth->pdgId();
149  lastElTruth, *truthContainer, ctx);
150  lastEgMotherTPL(*el) = link;
151  }
152  }
153  return StatusCode::SUCCESS;
154 }

◆ initialize()

StatusCode DerivationFramework::BkgElectronClassification::initialize ( )
finaloverridevirtual

Definition at line 24 of file BkgElectronClassification.cxx.

25 {
26 
27  ATH_MSG_DEBUG("Initializing " << name() << "...");
28  ATH_CHECK(m_mcTruthClassifier.retrieve());
29  ATH_MSG_DEBUG("Retrieved tool " << m_mcTruthClassifier);
30 
33 
34  const std::string baseName = m_electronContainer.key();
35  m_truthPdgId = baseName + ".truthPdgId";
36  //
37  m_firstEgMotherTruthType = baseName + ".firstEgMotherTruthType";
38  m_firstEgMotherTruthOrigin = baseName + ".firstEgMotherTruthOrigin";
40  baseName + ".firstEgMotherTruthParticleLink";
41  m_firstEgMotherPdgId = baseName + ".firstEgMotherPdgId";
42  //
43  m_lastEgMotherTruthType = baseName + ".lastEgMotherTruthType";
44  m_lastEgMotherTruthOrigin = baseName + ".lastEgMotherTruthOrigin";
45  m_lastEgMotherTruthParticleLink = baseName + ".lastEgMotherTruthParticleLink";
46  m_lastEgMotherPdgId = baseName + ".lastEgMotherPdgId";
47 
49  //
54  //
59 
60  ATH_MSG_DEBUG("Initialization successful");
61 
62  return StatusCode::SUCCESS;
63 }

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 43 of file BkgElectronClassification.h.

◆ m_firstEgMotherPdgId

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

Definition at line 71 of file BkgElectronClassification.h.

◆ m_firstEgMotherTruthOrigin

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

Definition at line 64 of file BkgElectronClassification.h.

◆ m_firstEgMotherTruthParticleLink

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

Definition at line 66 of file BkgElectronClassification.h.

◆ m_firstEgMotherTruthType

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

Definition at line 62 of file BkgElectronClassification.h.

◆ m_lastEgMotherPdgId

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

Definition at line 82 of file BkgElectronClassification.h.

◆ m_lastEgMotherTruthOrigin

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

Definition at line 75 of file BkgElectronClassification.h.

◆ m_lastEgMotherTruthParticleLink

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

Definition at line 77 of file BkgElectronClassification.h.

◆ m_lastEgMotherTruthType

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

Definition at line 73 of file BkgElectronClassification.h.

◆ m_mcTruthClassifier

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

MCTruthClassifier.

Definition at line 35 of file BkgElectronClassification.h.

◆ 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 50 of file BkgElectronClassification.h.

◆ m_truthPdgId

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

Definition at line 60 of file BkgElectronClassification.h.


The documentation for this class was generated from the following files:
DerivationFramework::BkgElectronClassification::m_lastEgMotherPdgId
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherPdgId
Definition: BkgElectronClassification.h:82
DerivationFramework::BkgElectronClassification::m_truthContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthContainer
Input truth particle container.
Definition: BkgElectronClassification.h:50
DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthType
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthType
Definition: BkgElectronClassification.h:62
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthOrigin
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthOrigin
Definition: BkgElectronClassification.h:64
DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthOrigin
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthOrigin
Definition: BkgElectronClassification.h:75
DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthParticleLink
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthParticleLink
Definition: BkgElectronClassification.h:66
DerivationFramework::BkgElectronClassification::m_electronContainer
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronContainer
input electron container
Definition: BkgElectronClassification.h:43
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthType
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthType
Definition: BkgElectronClassification.h:73
xAOD::EgammaHelpers::getBkgElectronMother
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.
Definition: EgammaTruthxAODHelpers.cxx:137
DerivationFramework::BkgElectronClassification::m_firstEgMotherPdgId
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherPdgId
Definition: BkgElectronClassification.h:71
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::BkgElectronClassification::m_truthPdgId
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_truthPdgId
Definition: BkgElectronClassification.h:60
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:11
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::ElectronContainer
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
xAOD::Electron_v1
Definition: Electron_v1.h:34
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
DerivationFramework::BkgElectronClassification::m_mcTruthClassifier
ToolHandle< IMCTruthClassifier > m_mcTruthClassifier
MCTruthClassifier.
Definition: BkgElectronClassification.h:35
DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthParticleLink
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthParticleLink
Definition: BkgElectronClassification.h:77
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
MCTruthPartClassifier::Info
Definition: IMCTruthClassifier.h:49
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17