CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
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 
53 
55  public:
58 
59  enum VetoType {
60  kElectron = -1, // MVA for non-triggering electrons
61  kPhoton = 1 // MVA for triggering electrons
62  };
63 
64 
69  void initializeRings(int iNumberOfRings, float fRingSize);
70  Bool_t isInitialized() const { return fisInitialized; }
71 
72 
75 
78 
81 
82 
84 
85  void setConeSize(float fValue = 0.4){ fConeSize = fValue;};
86 
87  void setParticleType(int iValue){iParticleType = iValue;};
88 
89  //Veto booleans
90  void setApplyVeto(Bool_t bValue = kTRUE){ bApplyVeto = bValue;};
91  void setApplyPFPUVeto(Bool_t bValue = kFALSE){bApplyPFPUVeto = bValue;};
92  void setApplyDzDxyVeto(Bool_t bValue = kTRUE){ bApplyDzDxyVeto = bValue;};
93  void setApplyMissHitPhVeto(Bool_t bValue = kFALSE){ bApplyMissHitPhVeto = bValue;};
94  void setDeltaRVetoBarrel(Bool_t bValue = kTRUE){ bDeltaRVetoBarrel = bValue;};
95  void setDeltaRVetoEndcap(Bool_t bValue = kTRUE){ bDeltaRVetoEndcap = bValue;};
96  void setRectangleVetoBarrel(Bool_t bValue = kTRUE){ bRectangleVetoBarrel = bValue;};
97  void setRectangleVetoEndcap(Bool_t bValue = kTRUE){ bRectangleVetoEndcap = bValue;};
98  //Use crystal size
99  void setUseCrystalSize(Bool_t bValue = kFALSE) { bUseCrystalSize = bValue;};
100 
101  //Veto Values
102  void setDeltaRVetoBarrelPhotons(float fValue = -1.0){fDeltaRVetoBarrelPhotons=fValue;};
103  void setDeltaRVetoBarrelNeutrals(float fValue = -1.0){fDeltaRVetoBarrelNeutrals=fValue;};
104  void setDeltaRVetoBarrelCharged(float fValue = -1.0){fDeltaRVetoBarrelCharged=fValue;};
105  void setDeltaRVetoEndcapPhotons(float fValue = -1.0){fDeltaRVetoEndcapPhotons=fValue;};
106  void setDeltaRVetoEndcapNeutrals(float fValue = -1.0){fDeltaRVetoEndcapNeutrals=fValue;};
107  void setDeltaRVetoEndcapCharged(float fValue = -1.0){fDeltaRVetoEndcapCharged=fValue;};
109 
116 
117 
124 
125  //Veto implementation
126  float isPhotonParticleVetoed( const reco::PFCandidate* pfIsoCand );
127  float isNeutralParticleVetoed( const reco::PFCandidate* pfIsoCand );
130 
131 
136 
137  std::vector<float > getIsolationInRingsPhoton(){ return fIsolationInRingsPhoton; };
138  std::vector<float > getIsolationInRingsNeutral(){ return fIsolationInRingsNeutral; };
139  std::vector<float > getIsolationInRingsCharged(){ return fIsolationInRingsCharged; };
141 
142 
143  void setNumbersOfRings(int iValue = 1){iNumberOfRings = iValue;};
144  void setRingSize(float fValue = 0.4){fRingSize = fValue;};
145 
147  float getRingSize(){return fRingSize; };
148 
149  int matchPFObject(const reco::Photon* photon, const reco::PFCandidateCollection* pfParticlesColl );
150  int matchPFObject(const reco::GsfElectron* photon, const reco::PFCandidateCollection* pfParticlesColl );
151 
152  private:
153 
154 
156 
158  float fIsolation;
163 
164  std::vector<float > fIsolationInRings;
165  std::vector<float > fIsolationInRingsPhoton;
166  std::vector<float > fIsolationInRingsNeutral;
167  std::vector<float > fIsolationInRingsCharged;
168  std::vector<float > fIsolationInRingsChargedAll;
169 
171  float fConeSize;
172  Bool_t bApplyVeto;
177 
180 
183 
187 
191 
193 
197 
201 
205 
209 
212 
213  float fRingSize;
214 
215  float fDeltaR;
216  float fDeltaEta;
217  float fDeltaPhi;
218 
219  float fEta;
220  float fPhi;
221  float fEtaSC;
222  float fPhiSC;
223 
224  float fPt;
225  float fVx;
226  float fVy;
227  float fVz;
228 
231 
233 
234  void initialize( Bool_t bApplyVeto, int iParticleType);
235 };
236 
237 #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)
float isChargedParticleVetoed(const reco::PFCandidate *pfIsoCand, edm::Handle< reco::VertexCollection > vertices)
void setApplyDzDxyVeto(Bool_t bValue=kTRUE)
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)
reco::VertexRef chargedHadronVertex(edm::Handle< reco::VertexCollection > verticies, const reco::PFCandidate &pfcand)
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)
std::vector< float > fGetIsolationInRings(const reco::PFCandidate *pfCandidate, const reco::PFCandidateCollection *pfParticlesColl, reco::VertexRef vtx, edm::Handle< reco::VertexCollection > vertices)
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:39
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)