CMS 3D CMS Logo

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 
12 
17 
18 //#define STANDALONE // <---- this line
19 
20 #ifndef PFIsolationEstimator_H
21 #define PFIsolationEstimator_H
22 
23 #ifndef STANDALONE
29 #endif
30 #include <TROOT.h>
31 #include "TMVA/Factory.h"
32 #include "TMVA/Tools.h"
33 #include "TMVA/Reader.h"
34 #include "TH1.h"
35 #include "TH2.h"
36 
37 
44 
47 
49 
52 
54  public:
57 
58  enum VetoType {
59  kElectron = -1, // MVA for non-triggering electrons
60  kPhoton = 1 // MVA for triggering electrons
61  };
62 
63 
68  void initializeRings(int iNumberOfRings, float fRingSize);
69  Bool_t isInitialized() const { return fisInitialized; }
70 
71 
73  std::vector<float > fGetIsolationInRings(const reco::PFCandidate * pfCandidate,const reco::PFCandidateCollection* pfParticlesColl,reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices);
74 
76  std::vector<float > fGetIsolationInRings(const reco::Photon* photon,const reco::PFCandidateCollection* pfParticlesColl,reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices);
77 
79  std::vector<float > fGetIsolationInRings(const reco::GsfElectron* electron,const reco::PFCandidateCollection* pfParticlesColl,reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices);
80 
81 
83 
84  void setConeSize(float fValue = 0.4){ fConeSize = fValue;};
85 
86  void setParticleType(int iValue){iParticleType = iValue;};
87 
88  //Veto booleans
89  void setApplyVeto(Bool_t bValue = kTRUE){ bApplyVeto = bValue;};
90  void setApplyPFPUVeto(Bool_t bValue = kFALSE){bApplyPFPUVeto = bValue;};
91  void setApplyDzDxyVeto(Bool_t bValue = kTRUE){ bApplyDzDxyVeto = bValue;};
92  void setApplyMissHitPhVeto(Bool_t bValue = kFALSE){ bApplyMissHitPhVeto = bValue;};
93  void setDeltaRVetoBarrel(Bool_t bValue = kTRUE){ bDeltaRVetoBarrel = bValue;};
94  void setDeltaRVetoEndcap(Bool_t bValue = kTRUE){ bDeltaRVetoEndcap = bValue;};
95  void setRectangleVetoBarrel(Bool_t bValue = kTRUE){ bRectangleVetoBarrel = bValue;};
96  void setRectangleVetoEndcap(Bool_t bValue = kTRUE){ bRectangleVetoEndcap = bValue;};
97  //Use crystal size
98  void setUseCrystalSize(Bool_t bValue = kFALSE) { bUseCrystalSize = bValue;};
99 
100  //Veto Values
101  void setDeltaRVetoBarrelPhotons(float fValue = -1.0){fDeltaRVetoBarrelPhotons=fValue;};
102  void setDeltaRVetoBarrelNeutrals(float fValue = -1.0){fDeltaRVetoBarrelNeutrals=fValue;};
103  void setDeltaRVetoBarrelCharged(float fValue = -1.0){fDeltaRVetoBarrelCharged=fValue;};
104  void setDeltaRVetoEndcapPhotons(float fValue = -1.0){fDeltaRVetoEndcapPhotons=fValue;};
105  void setDeltaRVetoEndcapNeutrals(float fValue = -1.0){fDeltaRVetoEndcapNeutrals=fValue;};
106  void setDeltaRVetoEndcapCharged(float fValue = -1.0){fDeltaRVetoEndcapCharged=fValue;};
108 
115 
116 
123 
124  //Veto implementation
125  float isPhotonParticleVetoed( const reco::PFCandidate* pfIsoCand );
126  float isNeutralParticleVetoed( const reco::PFCandidate* pfIsoCand );
129 
130 
135 
136  std::vector<float > getIsolationInRingsPhoton(){ return fIsolationInRingsPhoton; };
137  std::vector<float > getIsolationInRingsNeutral(){ return fIsolationInRingsNeutral; };
138  std::vector<float > getIsolationInRingsCharged(){ return fIsolationInRingsCharged; };
140 
141 
142  void setNumbersOfRings(int iValue = 1){iNumberOfRings = iValue;};
143  void setRingSize(float fValue = 0.4){fRingSize = fValue;};
144 
146  float getRingSize(){return fRingSize; };
147 
148  int matchPFObject(const reco::Photon* photon, const reco::PFCandidateCollection* pfParticlesColl );
149  int matchPFObject(const reco::GsfElectron* photon, const reco::PFCandidateCollection* pfParticlesColl );
150 
151  private:
152 
153 
155 
157  float fIsolation;
162 
163  std::vector<float > fIsolationInRings;
164  std::vector<float > fIsolationInRingsPhoton;
165  std::vector<float > fIsolationInRingsNeutral;
166  std::vector<float > fIsolationInRingsCharged;
167  std::vector<float > fIsolationInRingsChargedAll;
168 
170  float fConeSize;
171  Bool_t bApplyVeto;
176 
179 
182 
186 
190 
192 
196 
200 
204 
208 
211 
212  float fRingSize;
213 
214  float fDeltaR;
215  float fDeltaEta;
216  float fDeltaPhi;
217 
218  float fEta;
219  float fPhi;
220  float fEtaSC;
221  float fPhiSC;
222 
223  float fPt;
224  float fVx;
225  float fVy;
226  float fVz;
227 
230 
232 
233  void initialize( Bool_t bApplyVeto, int iParticleType);
234 };
235 
236 #endif
void setRectangleVetoEndcap(Bool_t bValue=kTRUE)
void setDeltaRVetoBarrel(Bool_t bValue=kTRUE)
std::vector< float > fIsolationInRingsNeutral
std::vector< float > fIsolationInRingsPhoton
std::vector< float > getIsolationInRingsCharged()
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 > 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)
std::vector< float > getIsolationInRingsPhoton()
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)
float isPhotonParticleVetoed(const reco::PFCandidate *pfIsoCand)
void initialize(Bool_t bApplyVeto, int iParticleType)
std::vector< float > fIsolationInRings
void setDeltaRVetoEndcapPhotons(float fValue=-1.0)
void setApplyPFPUVeto(Bool_t bValue=kFALSE)
void setRectangleVetoBarrel(Bool_t bValue=kTRUE)
void setRectangleDeltaEtaVetoBarrelNeutrals(float fValue=-1.0)
std::vector< float > fIsolationInRingsChargedAll
void setUseCrystalSize(Bool_t bValue=kFALSE)
void setParticleType(int iValue)
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)
float isNeutralParticleVetoed(const reco::PFCandidate *pfIsoCand)
void initializeRings(int iNumberOfRings, float fRingSize)
std::vector< float > fIsolationInRingsCharged
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:30
void setDeltaRVetoEndcapCharged(float fValue=-1.0)
std::vector< float > getIsolationInRingsChargedAll()
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:40
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)
void setRectangleDeltaEtaVetoBarrelPhotons(float fValue=-1.0)
void setRectangleDeltaEtaVetoEndcapNeutrals(float fValue=-1.0)
void setConeSize(float fValue=0.4)
void initializePhotonIsolationInRings(Bool_t bApplyVeto, int iNumberOfRings, float fRingSize)