ATLAS Offline Software
ParticleLevelMuonObjectSelector.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: ParticleLevelMuonObjectSelector.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("ParticleLevelMuonObjectSelector::apply: "
32  "Could not obtain MCTruthClassifier result decoration.");
33  }
34 
35  // --------------------------------------------------
36  // Accept muons 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("ParticleLevelMuonObjectSelector::apply: "
49  "Could not obtain 'originalTruthParticle' reference.");
50  }
51  if (truth::isLeptonFromTau(*truthProxy)) {
52  return false;
53  }
54  }
55 
56 
57  // --------------------------------------------------
58  // Apply kinematic cut on the dressed pT:
59  // must exceed 25 GeV
60  if (truthParticle.auxdata<float>("pt_dressed") < m_opt.pt_min) {
61  return false;
62  }
63 
64  // --------------------------------------------------
65  // Apply kinematic cut on the dressed eta:
66  // must be less than or equal to 2.5
67  if (std::abs(truthParticle.auxdata<float>("eta_dressed")) > m_opt.eta_max) {
68  return false;
69  }
70 
71 
72  // --------------------------------------------------
73  // Everything that reaches this point has passed the selection
74  return true;
75  }
76 }
top::ParticleLevelMuonObjectSelector::m_opt
Options m_opt
Definition: ParticleLevelMuonObjectSelector.h:43
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
ParticleLevelMuonObjectSelector.h
top::ParticleLevelMuonObjectSelector::Options::not_from_hadron
bool not_from_hadron
Definition: ParticleLevelMuonObjectSelector.h:36
top::ParticleLevelMuonObjectSelector::apply
virtual bool apply(const xAOD::TruthParticle &truthParticle)
Definition: ParticleLevelMuonObjectSelector.cxx:20
MCTruthClassifierDefs.h
top::ParticleLevelMuonObjectSelector::Options::eta_max
double eta_max
Definition: ParticleLevelMuonObjectSelector.h:35
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
top::ParticleLevelMuonObjectSelector::ParticleLevelMuonObjectSelector
ParticleLevelMuonObjectSelector(Options opt=Options())
Definition: ParticleLevelMuonObjectSelector.cxx:16
top::ParticleLevelMuonObjectSelector::Options::pt_min
double pt_min
Definition: ParticleLevelMuonObjectSelector.h:34
IsoMuon
@ IsoMuon
Definition: TruthClasses.h:15
top::ParticleLevelMuonObjectSelector::Options::tau_is_hadron
bool tau_is_hadron
Definition: ParticleLevelMuonObjectSelector.h:37
TruthTools.h
pmontree.opt
opt
Definition: pmontree.py:16
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
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
top::ParticleLevelMuonObjectSelector::Options
Definition: ParticleLevelMuonObjectSelector.h:25