ATLAS Offline Software
VGammaORTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef GAMMAORTOOLS_VGAMMAORTOOL_H
6 #define GAMMAORTOOLS_VGAMMAORTOOL_H
7 
8 #include <vector>
9 #include <map>
10 #include <string>
14 #include "AsgTools/AsgTool.h"
15 #include "AsgTools/AnaToolHandle.h"
17 
18 /****************************************************************************/
37 class VGammaORTool: public asg::AsgTool, virtual public IVGammaORTool {
39 public:
40  VGammaORTool(const std::string& name);
41  virtual ~VGammaORTool() override;
42 
50  // four vectors (can be used if the full truth record is not available or broken)
55  virtual StatusCode inOverlap(bool& result,
56  const std::vector<TLorentzVector>* leptons=0,
57  const std::vector<TLorentzVector>* photons=0,
58  const std::vector<int>* lepton_origins=0,
59  const std::vector<int>* photon_origins=0) const override;
60 
68  // four vectors (can be used if the full truth record is not available or broken)
73  virtual StatusCode photonPtsOutsideDr(std::vector<float>& result,
74  const std::vector<TLorentzVector>* leptons=0,
75  const std::vector<TLorentzVector>* photons=0,
76  const std::vector<int>* lepton_origins=0,
77  const std::vector<int>* photon_origins=0) const override;
78 
86  // four vectors (can be used if the full truth record is not available or broken)
91  virtual StatusCode photonPtsOutsideDrs(std::map<float, std::vector<float> >& result,
92  const std::vector<TLorentzVector>* leptons=0,
93  const std::vector<TLorentzVector>* photons=0,
94  const std::vector<int>* lepton_origins=0,
95  const std::vector<int>* photon_origins=0) const override;
96 
99  virtual bool frixioneIsolated(const xAOD::TruthParticle& photon,
100  const xAOD::TruthParticleContainer& truthParticles,
101  float dR0, float exponent, float epsilon) const override;
102 
103 
107  std::vector<TLorentzVector> getPhotonP4s(const xAOD::TruthParticleContainer& truthParticleContainer) const;
108 
111  std::vector<TLorentzVector> getLeptonP4s(const xAOD::TruthParticleContainer& truthParticleContainer) const;
112 
113 private:
114 
115  // This function performs the actual algorithm needed for OR, if one of the public functions is called
116  // It returns a vector of ordered photon pTs for multiple lepton-photon dR cuts
117  StatusCode photonPtsOutsideDrs(std::map<float, std::vector<float> >& result,
118  const std::vector<float>& drCuts,
119  const std::vector<TLorentzVector>* leptons=0,
120  const std::vector<TLorentzVector>* photons=0,
121  const std::vector<int>* lepton_origins=0,
122  const std::vector<int>* photon_origins=0) const;
123 
124  // Set the right leptons, get them either from user or the current event
125  StatusCode setInput(std::vector<TLorentzVector>& leptons_out,
126  std::vector<TLorentzVector>& photons_out,
127  const std::vector<TLorentzVector>* lepton_p4s,
128  const std::vector<TLorentzVector>* photon_p4s,
129  const std::vector<int>* lepton_origins,
130  const std::vector<int>* photon_origins) const;
131 
132  // Filter out photons whose origin is among the veto origins (typically photons from hadron decays)
133  std::vector<TLorentzVector> filterPhotonOrigins(const std::vector<TLorentzVector>&, const std::vector<int>&) const;
134 
135  // Filter out leptons whose origin is among the veto origins (typically photons from hadron decays)
136  // Return list containing all leptons from prefered origins (from hard process) first
137  // As fallback leptons from origins not explictly vetoed (e.g. unkown origins) are added at the end of the list
138  std::vector<TLorentzVector> filterLeptonOrigins(const std::vector<TLorentzVector>&, const std::vector<int>&) const;
139 
140  // Check whether a lepton originates from tau decay
141  bool isFromTau(const xAOD::TruthParticle& lepton, int nRecursions=0) const;
142 
143  // Internal helper function to check wheter photon pTs are compatible with configured overlap cuts
144  bool checkPhotonPts(const std::vector<float>& photon_pts) const;
145 
146  // Implementation of Eq 3.4 in https://arxiv.org/pdf/hep-ph/9801442
147  float frixioneFunc(float dR, float dR0, float exponent, float epsilon) const;
148 
149  // MCTruthClassifier
151 
152  // CONFIGURATION =================================================
153 
154  // Number of leptons expected in process (e.g. 2 for Z+gamma, 1 for W+gamma, 4 for ZZ+gamma)
155  // If this is set to a negative number, all possible leptons are considered
156  // Per default this includes leptons from unkown origins, so it is more robuts to set a positive value
157  // for m_n_leptons as a upper limit
159  // Lepton flavours considered, signed pdgIds (only relevant if leptons are not provided by user)
160  // If possible, restricting flavors can increase the robustness
161  std::vector<int> m_lepton_pdgIds;
162  // Lepton origins preferred when searching prompt leptons
163  // These origins should be associated with the hard process
164  // Origin codes are defined here:
165  // https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/MCTruthClassifier/trunk/MCTruthClassifier/MCTruthClassifierDefs.h
166  std::vector<int> m_preferred_lepton_origins;
167  // Lepton origins of leptons never used as prompt
168  // These should be e.g. hadron origins
169  std::vector<int> m_lepton_veto_origins;
170 
171  // Photon origins vetoed when searching prompt leptons
172  // These should be photons from hadron/tau decays
173  // Origin codes are defined here:
174  // https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/MCTruthClassifier/trunk/MCTruthClassifier/MCTruthClassifierDefs.h
175  std::vector<int> m_veto_photon_origins;
176 
177  // p_T (y) cut(s) used in inOverlap function -- only 1 for Vgamma OR, 2 for Vgammagamma
178  std::vector<float> m_photon_pT_cuts;
179  // delta R (l,y) cut for used in inOverlap and photonPtsOutsideDr function
181  // List of dR cuts for which the highest photon pT will be determined by photonPtsOutsideDrs function
182  std::vector<float> m_dR_lepton_photon_cuts;
183 
184  // Require photons to be Frixione isolated (https://arxiv.org/abs/hep-ph/9801442)?
186  // Isolation cone used for Frixione isolation
188  // exponent in Eq 3.4 in https://arxiv.org/pdf/hep-ph/9801442
190  // epsilon in Eq 3.4 in https://arxiv.org/pdf/hep-ph/9801442
192  // Which stable particles are *not* considered in isolation? Usually leptons and photons.
194 
195  // Minimum photon pT considered in algorithm -- increase speeds up algorithm as less photons need to be classified
197 
198  // Name of truth particle collection
200 };
201 
202 
203 
204 #endif //> !GAMMAORTOOLS_VGAMMAORTOOL_H
VGammaORTool::filterLeptonOrigins
std::vector< TLorentzVector > filterLeptonOrigins(const std::vector< TLorentzVector > &, const std::vector< int > &) const
Definition: VGammaORTool.cxx:201
VGammaORTool::m_photon_pT_cuts
std::vector< float > m_photon_pT_cuts
Definition: VGammaORTool.h:178
IVGammaORTool
Definition: IVGammaORTool.h:33
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
VGammaORTool
This tool can be used to identify the overlap of a V+jets and V+gamma sample or in fact between most ...
Definition: VGammaORTool.h:37
asg::AnaToolHandle< MCTruthClassifier >
VGammaORTool::VGammaORTool
VGammaORTool(const std::string &name)
Definition: VGammaORTool.cxx:8
get_generator_info.result
result
Definition: get_generator_info.py:21
VGammaORTool::checkPhotonPts
bool checkPhotonPts(const std::vector< float > &photon_pts) const
Definition: VGammaORTool.cxx:332
IVGammaORTool.h
TruthParticleContainer.h
MCTruthClassifier.h
VGammaORTool::photonPtsOutsideDrs
virtual StatusCode photonPtsOutsideDrs(std::map< float, std::vector< float > > &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
Determine the pTs of photons outside of several dR cuts that are configured in tool initialization (d...
Definition: VGammaORTool.cxx:78
VGammaORTool::m_frixione_dR
float m_frixione_dR
Definition: VGammaORTool.h:187
VGammaORTool::m_dR_lepton_photon_cuts
std::vector< float > m_dR_lepton_photon_cuts
Definition: VGammaORTool.h:182
VGammaORTool::m_veto_photon_origins
std::vector< int > m_veto_photon_origins
Definition: VGammaORTool.h:175
VGammaORTool::getPhotonP4s
std::vector< TLorentzVector > getPhotonP4s(const xAOD::TruthParticleContainer &truthParticleContainer) const
Get final state photons from truthParticleContainer A minimum pT cut and isolation is applied accordi...
Definition: VGammaORTool.cxx:298
VGammaORTool::m_frixione_epsilon
float m_frixione_epsilon
Definition: VGammaORTool.h:191
VGammaORTool::m_lepton_veto_origins
std::vector< int > m_lepton_veto_origins
Definition: VGammaORTool.h:169
VGammaORTool::photonPtsOutsideDr
virtual StatusCode photonPtsOutsideDr(std::vector< float > &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
Determine the pTs of photons outside the dR cut that is configured in tool initialization (dR_lepton_...
Definition: VGammaORTool.cxx:64
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
VGammaORTool::m_use_gamma_iso
bool m_use_gamma_iso
Definition: VGammaORTool.h:185
VGammaORTool::m_truthClassifier
asg::AnaToolHandle< MCTruthClassifier > m_truthClassifier
Definition: VGammaORTool.h:150
VGammaORTool::isFromTau
bool isFromTau(const xAOD::TruthParticle &lepton, int nRecursions=0) const
Definition: VGammaORTool.cxx:316
VGammaORTool::inOverlap
virtual StatusCode inOverlap(bool &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
Determine whether current event is in overlap region (set via reference).
Definition: VGammaORTool.cxx:50
VGammaORTool::frixioneFunc
float frixioneFunc(float dR, float dR0, float exponent, float epsilon) const
Definition: VGammaORTool.cxx:391
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AnaToolHandle.h
VGammaORTool::getLeptonP4s
std::vector< TLorentzVector > getLeptonP4s(const xAOD::TruthParticleContainer &truthParticleContainer) const
Get final state leptons from truthParticleContainer Filter function is applied, only leptons from rel...
Definition: VGammaORTool.cxx:244
VGammaORTool::setInput
StatusCode setInput(std::vector< TLorentzVector > &leptons_out, std::vector< TLorentzVector > &photons_out, const std::vector< TLorentzVector > *lepton_p4s, const std::vector< TLorentzVector > *photon_p4s, const std::vector< int > *lepton_origins, const std::vector< int > *photon_origins) const
Definition: VGammaORTool.cxx:125
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
VGammaORTool::m_abs_pdgids_excluded_from_iso
std::vector< int > m_abs_pdgids_excluded_from_iso
Definition: VGammaORTool.h:193
VGammaORTool::filterPhotonOrigins
std::vector< TLorentzVector > filterPhotonOrigins(const std::vector< TLorentzVector > &, const std::vector< int > &) const
Definition: VGammaORTool.cxx:178
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:199
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
VGammaORTool::m_truthparticle_collection_name
std::string m_truthparticle_collection_name
Definition: VGammaORTool.h:199
VGammaORTool::frixioneIsolated
virtual bool frixioneIsolated(const xAOD::TruthParticle &photon, const xAOD::TruthParticleContainer &truthParticles, float dR0, float exponent, float epsilon) const override
Function determining whether a photon is frixione isolated from truthParticles Parameters as defined ...
Definition: VGammaORTool.cxx:349
VGammaORTool::m_n_leptons
int m_n_leptons
Definition: VGammaORTool.h:158
AsgTool.h
TruthParticle.h
VGammaORTool::m_dR_lepton_photon_cut
float m_dR_lepton_photon_cut
Definition: VGammaORTool.h:180
VGammaORTool::m_lepton_pdgIds
std::vector< int > m_lepton_pdgIds
Definition: VGammaORTool.h:161
VGammaORTool::m_frixione_exponent
float m_frixione_exponent
Definition: VGammaORTool.h:189
VGammaORTool::~VGammaORTool
virtual ~VGammaORTool() override
Definition: VGammaORTool.cxx:43
VGammaORTool::m_min_considered_photon_pT
float m_min_considered_photon_pT
Definition: VGammaORTool.h:196
VGammaORTool::m_preferred_lepton_origins
std::vector< int > m_preferred_lepton_origins
Definition: VGammaORTool.h:166