ATLAS Offline Software
ParticleLevelElectronObjectSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 // Filename: ParticleLevelElectronObjectSelector.cxx
6 // Description:
7 // Author: Fabian Wilk
8 // Created: Sun Feb 22 15:18:45 2015
9 
11 
14 
15 namespace top {
17  : m_opt(opt) { /* Deliberately Empty */}
18 
19  /* virtual */ bool
21  // Obtain the particle type and particle origin from the decoration
22  // created by the MCTruthClassifier. For legacy reasons, try both
23  // decoration names.
24  unsigned int type;
25 
26  if (truthParticle.isAvailable<unsigned int>("particleType")) {
27  type = truthParticle.auxdata<unsigned int>("particleType");
28  } else if (truthParticle.isAvailable<unsigned int>("classifierParticleType")) {
29  type = truthParticle.auxdata<unsigned int>("classifierParticleType");
30  } else {
31  throw std::runtime_error("ParticleLevelElectronObjectSelector::apply: "
32  "Could not obtain MCTruthClassifier result decoration.");
33  }
34 
35  // --------------------------------------------------
36  // Accept electrons iff they do not come from a hadron
37  using namespace MCTruthPartClassifier;
38  if (m_opt.not_from_hadron &&
40  return false;
41  }
42 
43  // If it is requested that tauons are hadrons, perform a check of the
44  // ancestry: It shall not contain a single tauon.
45  if (m_opt.tau_is_hadron) {
46  auto truthProxy = truthParticle.auxdata<ElementLink<xAOD::TruthParticleContainer> >("originalTruthParticle");
47  if (not truthProxy.isValid()) {
48  throw std::runtime_error("ParticleLevelElectronObjectSelector::apply: "
49  "Could not obtain 'originalTruthParticle' reference.");
50  }
51  if (truth::isLeptonFromTau(*truthProxy)) {
52  return false;
53  }
54  }
55 
56  // --------------------------------------------------
57  // Apply kinematic cut on the dressed pT:
58  // must exceed 25 GeV
59  if (truthParticle.auxdata<float>("pt_dressed") < m_opt.pt_min) {
60  return false;
61  }
62 
63  // --------------------------------------------------
64  // Apply kinematic cut on the dressed eta:
65  // must be less than or equal to 2.5
66  if (std::abs(truthParticle.auxdata<float>("eta_dressed")) > m_opt.eta_max) {
67  return false;
68  }
69 
70 
71  // --------------------------------------------------
72  // Everything that reaches this point has passed the selection
73  return true;
74  }
75 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::ParticleLevelElectronObjectSelector::Options::not_from_hadron
bool not_from_hadron
Definition: ParticleLevelElectronObjectSelector.h:36
top::ParticleLevelElectronObjectSelector::Options
Definition: ParticleLevelElectronObjectSelector.h:25
IsoElectron
@ IsoElectron
Definition: TruthClasses.h:11
top::ParticleLevelElectronObjectSelector::m_opt
Options m_opt
Definition: ParticleLevelElectronObjectSelector.h:43
ParticleLevelElectronObjectSelector.h
top::ParticleLevelElectronObjectSelector::Options::pt_min
double pt_min
Definition: ParticleLevelElectronObjectSelector.h:34
MCTruthClassifierDefs.h
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
top::ParticleLevelElectronObjectSelector::Options::tau_is_hadron
bool tau_is_hadron
Definition: ParticleLevelElectronObjectSelector.h:37
top::ParticleLevelElectronObjectSelector::Options::eta_max
double eta_max
Definition: ParticleLevelElectronObjectSelector.h:35
TruthTools.h
pmontree.opt
opt
Definition: pmontree.py:16
top::ParticleLevelElectronObjectSelector::apply
virtual bool apply(const xAOD::TruthParticle &truthParticle)
Definition: ParticleLevelElectronObjectSelector.cxx:20
xAOD::IParticle::isAvailable
bool isAvailable(const std::string &name, const std::string &clsname="") const
Check if a user property is available for reading or not.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:131
top::truth::isLeptonFromTau
bool isLeptonFromTau(const xAOD::TruthParticle *truthParticle)
Function the check if a particle is a lepton which was produced in the decay of a tau lepton.
Definition: TruthTools.cxx:1044
MCTruthPartClassifier
Definition: TruthClassifiers.h:12
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
top::ParticleLevelElectronObjectSelector::ParticleLevelElectronObjectSelector
ParticleLevelElectronObjectSelector(Options cuts=Options())
Definition: ParticleLevelElectronObjectSelector.cxx:16
xAOD::IParticle::auxdata
T & auxdata(const std::string &name, const std::string &clsname="")
Fetch an aux data variable, as a non-const reference.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:96