ATLAS Offline Software
Classes | Public Member Functions | Private Attributes | List of all members
top::ParticleLevelPhotonObjectSelector Class Reference

#include <ParticleLevelPhotonObjectSelector.h>

Inheritance diagram for top::ParticleLevelPhotonObjectSelector:
Collaboration diagram for top::ParticleLevelPhotonObjectSelector:

Classes

struct  Options
 

Public Member Functions

 ParticleLevelPhotonObjectSelector (Options cuts=Options())
 
virtual bool apply (const xAOD::TruthParticle &truthParticle)
 

Private Attributes

Options m_opt
 

Detailed Description

Definition at line 26 of file ParticleLevelPhotonObjectSelector.h.

Constructor & Destructor Documentation

◆ ParticleLevelPhotonObjectSelector()

top::ParticleLevelPhotonObjectSelector::ParticleLevelPhotonObjectSelector ( Options  cuts = Options())

Definition at line 11 of file ParticleLevelPhotonObjectSelector.cxx.

12  : m_opt(opt) { /* Deliberately Empty */}

Member Function Documentation

◆ apply()

bool top::ParticleLevelPhotonObjectSelector::apply ( const xAOD::TruthParticle truthParticle)
virtual

Implements top::ObjectSelectorBase< xAOD::TruthParticle >.

Definition at line 70 of file ParticleLevelPhotonObjectSelector.cxx.

70  {
71  // --------------------------------------------------
72  // Require that the photon is status=1 (stable)
73  // TODO: Should we include other statuses?
74  if (!MC::isStable(&truthParticle)) {
75  return false;
76  }
77 
78  // --------------------------------------------------
79  // Apply kinematic cut on the pT:
80  // must exceed 25 GeV
81  if (truthParticle.pt() < m_opt.pt_min) {
82  return false;
83  }
84 
85  // --------------------------------------------------
86  // Apply kinematic cut on the eta:
87  // must be less than or equal to 2.5
88  if (std::abs(truthParticle.eta()) > m_opt.eta_max) {
89  return false;
90  }
91 
92  // --------------------------------------------------
93  // Apply particle origin cut.
94  if (m_opt.origin.size()) {
95  unsigned int origin = 0;
96  if (truthParticle.isAvailable<unsigned int>("particleOrigin")) {
97  origin = truthParticle.auxdata<unsigned int>("particleOrigin");
98  } else if (truthParticle.isAvailable<unsigned int>("classifierParticleOrigin")) {
99  origin = truthParticle.auxdata<unsigned int>("classifierParticleOrigin");
100  } else {
101  top::check(false, "Could not obtain MCTruthClassifier result decoration.");
102  }
103 
104  if (std::find(m_opt.origin.begin(), m_opt.origin.end(), origin) == m_opt.origin.end()) {
105  return false;
106  }
107  }
108 
109  // --------------------------------------------------
110  // Apply isolation cut
111  if (m_opt.isolationVar.size()) {
112  top::check(truthParticle.isAvailable<float>(m_opt.isolationVar),
113  "[ParticleLevelPhotonObjectSelector] Selected isolation variable not available!");
114  if (m_opt.isolationCut <= truthParticle.auxdata<float>(m_opt.isolationVar) / truthParticle.pt()) {
115  return false;
116  }
117  }
118 
119  // --------------------------------------------------
120  // Everything that reaches this point has passed the selection
121  return true;
122  }

Member Data Documentation

◆ m_opt

Options top::ParticleLevelPhotonObjectSelector::m_opt
private

Definition at line 49 of file ParticleLevelPhotonObjectSelector.h.


The documentation for this class was generated from the following files:
top::ParticleLevelPhotonObjectSelector::Options::origin
std::vector< MCTruthPartClassifier::ParticleOrigin > origin
Definition: ParticleLevelPhotonObjectSelector.h:41
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
top::ParticleLevelPhotonObjectSelector::Options::isolationVar
std::string isolationVar
Definition: ParticleLevelPhotonObjectSelector.h:42
top::ParticleLevelPhotonObjectSelector::Options::pt_min
double pt_min
Definition: ParticleLevelPhotonObjectSelector.h:39
top::ParticleLevelPhotonObjectSelector::Options::isolationCut
float isolationCut
Definition: ParticleLevelPhotonObjectSelector.h:43
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
top::ParticleLevelPhotonObjectSelector::Options::eta_max
double eta_max
Definition: ParticleLevelPhotonObjectSelector.h:40
pmontree.opt
opt
Definition: pmontree.py:16
xAOD::TruthParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TruthParticle_v1.cxx:174
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
MC::isStable
bool isStable(const T &p)
Definition: HepMCHelpers.h:30
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
xAOD::TruthParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TruthParticle_v1.cxx:166
top::ParticleLevelPhotonObjectSelector::m_opt
Options m_opt
Definition: ParticleLevelPhotonObjectSelector.h:49