CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PFIsolationEstimator.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------------------
2 // $Id $
3 //
4 // PFIsolationEstimator
5 //
6 // Helper Class for calculating PFIsolation for Photons & Electron onthe fly. This class takes
7 // PF Particle collection and the reconstructed vertex collection as input.
8 //
9 // Authors: Vasundhara Chetluru
10 //--------------------------------------------------------------------------------------------------
11 
16 
17 //#define STANDALONE // <---- this line
18 
19 #ifndef PFIsolationEstimator_H
20 #define PFIsolationEstimator_H
21 
22 #ifndef STANDALONE
28 #endif
29 #include <TROOT.h>
30 #include "TMVA/Factory.h"
31 #include "TMVA/Tools.h"
32 #include "TMVA/Reader.h"
33 #include "TH1.h"
34 #include "TH2.h"
35 
42 
45 
47 
50 
52 public:
55 
56  enum VetoType {
57  kElectron = -1, // MVA for non-triggering electrons
58  kPhoton = 1 // MVA for triggering electrons
59  };
60 
65  void initializeRings(int iNumberOfRings, float fRingSize);
66  Bool_t isInitialized() const { return fisInitialized; }
67 
68  float fGetIsolation(const reco::PFCandidate* pfCandidate,
69  const reco::PFCandidateCollection* pfParticlesColl,
70  reco::VertexRef vtx,
72  std::vector<float> fGetIsolationInRings(const reco::PFCandidate* pfCandidate,
73  const reco::PFCandidateCollection* pfParticlesColl,
74  reco::VertexRef vtx,
76 
77  float fGetIsolation(const reco::Photon* photon,
78  const reco::PFCandidateCollection* pfParticlesColl,
79  reco::VertexRef vtx,
81  std::vector<float> fGetIsolationInRings(const reco::Photon* photon,
82  const reco::PFCandidateCollection* pfParticlesColl,
83  reco::VertexRef vtx,
85 
87  const reco::PFCandidateCollection* pfParticlesColl,
88  const reco::VertexRef vtx,
90  std::vector<float> fGetIsolationInRings(const reco::GsfElectron* electron,
91  const reco::PFCandidateCollection* pfParticlesColl,
92  reco::VertexRef vtx,
94 
96 
97  void setConeSize(float fValue = 0.4) { fConeSize = fValue; };
98 
99  void setParticleType(int iValue) { iParticleType = iValue; };
100 
101  //Veto booleans
102  void setApplyVeto(Bool_t bValue = kTRUE) { bApplyVeto = bValue; };
103  void setApplyPFPUVeto(Bool_t bValue = kFALSE) { bApplyPFPUVeto = bValue; };
104  void setApplyDzDxyVeto(Bool_t bValue = kTRUE) { bApplyDzDxyVeto = bValue; };
105  void setApplyMissHitPhVeto(Bool_t bValue = kFALSE) { bApplyMissHitPhVeto = bValue; };
106  void setDeltaRVetoBarrel(Bool_t bValue = kTRUE) { bDeltaRVetoBarrel = bValue; };
107  void setDeltaRVetoEndcap(Bool_t bValue = kTRUE) { bDeltaRVetoEndcap = bValue; };
108  void setRectangleVetoBarrel(Bool_t bValue = kTRUE) { bRectangleVetoBarrel = bValue; };
109  void setRectangleVetoEndcap(Bool_t bValue = kTRUE) { bRectangleVetoEndcap = bValue; };
110  //Use crystal size
111  void setUseCrystalSize(Bool_t bValue = kFALSE) { bUseCrystalSize = bValue; };
112 
113  //Veto Values
114  void setDeltaRVetoBarrelPhotons(float fValue = -1.0) { fDeltaRVetoBarrelPhotons = fValue; };
115  void setDeltaRVetoBarrelNeutrals(float fValue = -1.0) { fDeltaRVetoBarrelNeutrals = fValue; };
116  void setDeltaRVetoBarrelCharged(float fValue = -1.0) { fDeltaRVetoBarrelCharged = fValue; };
117  void setDeltaRVetoEndcapPhotons(float fValue = -1.0) { fDeltaRVetoEndcapPhotons = fValue; };
118  void setDeltaRVetoEndcapNeutrals(float fValue = -1.0) { fDeltaRVetoEndcapNeutrals = fValue; };
119  void setDeltaRVetoEndcapCharged(float fValue = -1.0) { fDeltaRVetoEndcapCharged = fValue; };
120  void setNumberOfCrystalEndcapPhotons(float fValue = -1) { fNumberOfCrystalEndcapPhotons = fValue; };
121 
128 
135 
136  //Veto implementation
137  float isPhotonParticleVetoed(const reco::PFCandidate* pfIsoCand);
138  float isNeutralParticleVetoed(const reco::PFCandidate* pfIsoCand);
140  float isChargedParticleVetoed(const reco::PFCandidate* pfIsoCand,
141  reco::VertexRef vtx,
143 
146  return fIsolationPhoton;
147  };
150  return fIsolationNeutral;
151  };
154  return fIsolationCharged;
155  };
157 
158  std::vector<float> getIsolationInRingsPhoton() { return fIsolationInRingsPhoton; };
159  std::vector<float> getIsolationInRingsNeutral() { return fIsolationInRingsNeutral; };
160  std::vector<float> getIsolationInRingsCharged() { return fIsolationInRingsCharged; };
162 
163  void setNumbersOfRings(int iValue = 1) { iNumberOfRings = iValue; };
164  void setRingSize(float fValue = 0.4) { fRingSize = fValue; };
165 
167  float getRingSize() { return fRingSize; };
168 
169  int matchPFObject(const reco::Photon* photon, const reco::PFCandidateCollection* pfParticlesColl);
170  int matchPFObject(const reco::GsfElectron* photon, const reco::PFCandidateCollection* pfParticlesColl);
171 
172 private:
174 
176  float fIsolation;
181 
182  std::vector<float> fIsolationInRings;
183  std::vector<float> fIsolationInRingsPhoton;
184  std::vector<float> fIsolationInRingsNeutral;
185  std::vector<float> fIsolationInRingsCharged;
186  std::vector<float> fIsolationInRingsChargedAll;
187 
189  float fConeSize;
190  Bool_t bApplyVeto;
195 
198 
201 
205 
209 
211 
215 
219 
223 
227 
230 
231  float fRingSize;
232 
233  float fDeltaR;
234  float fDeltaEta;
235  float fDeltaPhi;
236 
237  float fEta;
238  float fPhi;
239  float fEtaSC;
240  float fPhiSC;
241 
242  float fPt;
243  float fVx;
244  float fVy;
245  float fVz;
246 
249 
251 
252  void initialize(Bool_t bApplyVeto, int iParticleType);
253 };
254 
255 #endif
void setRectangleVetoEndcap(Bool_t bValue=kTRUE)
void setDeltaRVetoBarrel(Bool_t bValue=kTRUE)
std::vector< float > fIsolationInRings
std::vector< float > fIsolationInRingsChargedAll
void setNumberOfCrystalEndcapPhotons(float fValue=-1)
void setDeltaRVetoEndcap(Bool_t bValue=kTRUE)
void setRectangleDeltaPhiVetoBarrelPhotons(float fValue=-1.0)
void setApplyMissHitPhVeto(Bool_t bValue=kFALSE)
std::vector< float > getIsolationInRingsPhoton()
std::vector< float > fGetIsolationInRings(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
float isChargedParticleVetoed(const reco::PFCandidate *pfIsoCand, edm::Handle< reco::VertexCollection > vertices)
void setApplyDzDxyVeto(Bool_t bValue=kTRUE)
reco::VertexRef chargedHadronVertex(edm::Handle< reco::VertexCollection > verticies, const reco::PFCandidate &pfcand)
void setNumbersOfRings(int iValue=1)
void setDeltaRVetoBarrelNeutrals(float fValue=-1.0)
math::XYZVector vtxWRTCandidate
void setDeltaRVetoEndcapNeutrals(float fValue=-1.0)
void setDeltaRVetoBarrelCharged(float fValue=-1.0)
std::vector< float > getIsolationInRingsCharged()
float isPhotonParticleVetoed(const reco::PFCandidate *pfIsoCand)
void initialize(Bool_t bApplyVeto, int iParticleType)
void setDeltaRVetoEndcapPhotons(float fValue=-1.0)
void setApplyPFPUVeto(Bool_t bValue=kFALSE)
void setRectangleVetoBarrel(Bool_t bValue=kTRUE)
void setRectangleDeltaEtaVetoBarrelNeutrals(float fValue=-1.0)
void setUseCrystalSize(Bool_t bValue=kFALSE)
void setParticleType(int iValue)
std::vector< float > fIsolationInRingsPhoton
void setRectangleDeltaPhiVetoBarrelCharged(float fValue=-1.0)
int matchPFObject(const reco::Photon *photon, const reco::PFCandidateCollection *pfParticlesColl)
void setRectangleDeltaPhiVetoEndcapNeutrals(float fValue=-1.0)
void setRectangleDeltaPhiVetoBarrelNeutrals(float fValue=-1.0)
void setRectangleDeltaEtaVetoBarrelCharged(float fValue=-1.0)
std::vector< float > fIsolationInRingsCharged
float isNeutralParticleVetoed(const reco::PFCandidate *pfIsoCand)
void initializeRings(int iNumberOfRings, float fRingSize)
void setDeltaRVetoBarrelPhotons(float fValue=-1.0)
reco::SuperClusterRef refSC
void initializeElectronIsolation(Bool_t bApplyVeto)
void setRectangleDeltaPhiVetoEndcapCharged(float fValue=-1.0)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
void setRectangleDeltaEtaVetoEndcapCharged(float fValue=-1.0)
void setRectangleDeltaEtaVetoEndcapPhotons(float fValue=-1.0)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
void setDeltaRVetoEndcapCharged(float fValue=-1.0)
Bool_t isInitialized() const
void setApplyVeto(Bool_t bValue=kTRUE)
void initializeElectronIsolationInRings(Bool_t bApplyVeto, int iNumberOfRings, float fRingSize)
void setRingSize(float fValue=0.4)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
std::vector< float > getIsolationInRingsNeutral()
void initializePhotonIsolation(Bool_t bApplyVeto)
void setRectangleDeltaPhiVetoEndcapPhotons(float fValue=-1.0)
float fGetIsolation(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
std::vector< float > fIsolationInRingsNeutral
void setRectangleDeltaEtaVetoBarrelPhotons(float fValue=-1.0)
void setRectangleDeltaEtaVetoEndcapNeutrals(float fValue=-1.0)
void setConeSize(float fValue=0.4)
std::vector< float > getIsolationInRingsChargedAll()
void initializePhotonIsolationInRings(Bool_t bApplyVeto, int iNumberOfRings, float fRingSize)