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

virtual StatusCode initialize () override final
 
virtual StatusCode addBranches (const EventContext &ctx) 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", 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_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_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 44 of file BkgElectronClassification.cxx.

45 {
46 
49  ctx };
50 
51  // Access for the already existing info
52  static const SG::AuxElement::Accessor<int> tT("truthType");
53  static const SG::AuxElement::Accessor<int> tO("truthOrigin");
54  static const SG::AuxElement::Accessor<
56  tPL("truthParticleLink");
57 
58  // pdg iD
60  // first mother decorations
69  firstEgMotherTPL(m_firstEgMotherTruthParticleLink, ctx);
70 
71  // last mother decorations
77  m_lastEgMotherPdgId, ctx);
80  lastEgMotherTPL(m_lastEgMotherTruthParticleLink, ctx);
81  //
82 
83  for (const xAOD::Electron* el : *electrons) {
84  tPdgID(*el) = 0;
85  if (tPL.isAvailable(*el) && tPL(*el).isValid()) {
86  tPdgID(*el) = (*tPL(*el))->pdgId();
87  }
88  // Use the Helpers for electron from electron or photon
89  // Add Extra Decoration from Egamma helpers in case of BkgElectron (Electron
90  // coming for a photon) Go back to the first/last electron/photon Generator
91  // mother and classify this one
92  // First the one entering the Geant, the first we meet on the way back
93  firstEgMotherTT(*el) = 0;
94  firstEgMotherTO(*el) = 0;
95  firstEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
96  firstEgMotherPdgID(*el) = 0;
97  const xAOD::TruthParticle* firstElTruth =
99 
100  MCTruthPartClassifier::Info mcinfo(ctx);
101  if (firstElTruth) {
102  auto res = m_mcTruthClassifier->particleTruthClassifier(firstElTruth, &mcinfo);
103  firstEgMotherTT(*el) = res.first;
104  firstEgMotherTO(*el) = res.second;
105  firstEgMotherPdgID(*el) = firstElTruth->pdgId();
107  firstElTruth, *truthContainer, ctx);
108  firstEgMotherTPL(*el) = link;
109  }
110 
111  // The last electron / photon we meet on the way back towards the Generator
112  // vertex
113  lastEgMotherTT(*el) = 0;
114  lastEgMotherTO(*el) = 0;
115  lastEgMotherTPL(*el) = ElementLink<xAOD::TruthParticleContainer>();
116  lastEgMotherPdgID(*el) = 0;
117  const xAOD::TruthParticle* lastElTruth =
119 
120  if (lastElTruth) {
121  auto res = m_mcTruthClassifier->particleTruthClassifier(lastElTruth, &mcinfo);
122  lastEgMotherTT(*el) = res.first;
123  lastEgMotherTO(*el) = res.second;
124  lastEgMotherPdgID(*el) = lastElTruth->pdgId();
126  lastElTruth, *truthContainer, ctx);
127  lastEgMotherTPL(*el) = link;
128  }
129  }
130  return StatusCode::SUCCESS;
131 }

◆ initialize()

StatusCode DerivationFramework::BkgElectronClassification::initialize ( )
finaloverridevirtual

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.

◆ m_firstEgMotherPdgId

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

Definition at line 69 of file BkgElectronClassification.h.

◆ m_firstEgMotherTruthOrigin

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

Definition at line 62 of file BkgElectronClassification.h.

◆ m_firstEgMotherTruthParticleLink

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

Definition at line 64 of file BkgElectronClassification.h.

◆ m_firstEgMotherTruthType

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

Definition at line 60 of file BkgElectronClassification.h.

◆ m_lastEgMotherPdgId

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

Definition at line 80 of file BkgElectronClassification.h.

◆ m_lastEgMotherTruthOrigin

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

Definition at line 73 of file BkgElectronClassification.h.

◆ m_lastEgMotherTruthParticleLink

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

Definition at line 75 of file BkgElectronClassification.h.

◆ m_lastEgMotherTruthType

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

Definition at line 71 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 34 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 49 of file BkgElectronClassification.h.

◆ m_truthPdgId

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

Definition at line 58 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:80
DerivationFramework::BkgElectronClassification::m_truthContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthContainer
Input truth particle container.
Definition: BkgElectronClassification.h:49
DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthType
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthType
Definition: BkgElectronClassification.h:60
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:62
DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthOrigin
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthOrigin
Definition: BkgElectronClassification.h:73
DerivationFramework::BkgElectronClassification::m_firstEgMotherTruthParticleLink
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_firstEgMotherTruthParticleLink
Definition: BkgElectronClassification.h:64
DerivationFramework::BkgElectronClassification::m_electronContainer
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronContainer
input electron container
Definition: BkgElectronClassification.h:42
DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthType
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthType
Definition: BkgElectronClassification.h:71
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:69
DerivationFramework::BkgElectronClassification::m_truthPdgId
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_truthPdgId
Definition: BkgElectronClassification.h:58
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
python.getProblemFolderFromLogs.el
dictionary el
Definition: getProblemFolderFromLogs.py:54
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
runIDPVM.pdgId
pdgId
Definition: runIDPVM.py:91
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:34
DerivationFramework::BkgElectronClassification::m_lastEgMotherTruthParticleLink
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lastEgMotherTruthParticleLink
Definition: BkgElectronClassification.h:75
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
MCTruthPartClassifier::Info
Definition: IMCTruthClassifier.h:49
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17