ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonIDMod.h
Revision: 1.31
Committed: Fri Jun 21 13:11:09 2013 UTC (11 years, 10 months ago) by mingyang
Content type: text/plain
Branch: MAIN
Changes since 1.30: +2 -1 lines
Log Message:
PhotonIDMod.h

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: PhotonIDMod.h,v 1.30 2012/08/02 12:59:31 fabstoec Exp $
3 //
4 // PhotonIDMod
5 //
6 // This module applies photon identification criteria and exports a pointer to a collection
7 // of "good photons" according to the specified identification scheme.
8 //
9 // Authors: S.Xie, C.Loizides
10 //--------------------------------------------------------------------------------------------------
11
12 #ifndef MITPHYSICS_MODS_PHOTONIDMOD_H
13 #define MITPHYSICS_MODS_PHOTONIDMOD_H
14
15 #include "MitAna/TreeMod/interface/BaseMod.h"
16 #include "MitAna/DataTree/interface/PhotonFwd.h"
17 #include "MitAna/DataTree/interface/TrackCol.h"
18 #include "MitAna/DataTree/interface/BeamSpotCol.h"
19 #include "MitAna/DataTree/interface/PileupEnergyDensityCol.h"
20 #include "MitAna/DataTree/interface/DecayParticleCol.h"
21 #include "MitAna/DataTree/interface/ElectronCol.h"
22 #include "MitAna/DataTree/interface/VertexCol.h"
23 #include "MitAna/DataTree/interface/DecayParticleCol.h"
24 #include "MitAna/DataTree/interface/PileupInfoCol.h"
25 #include "MitAna/DataTree/interface/MCParticleCol.h"
26 #include "MitAna/DataTree/interface/PFCandidateCol.h"
27
28 #include "MitPhysics/Utils/interface/MVATools.h"
29 #include "MitPhysics/Utils/interface/PhotonTools.h"
30 #include "MitPhysics/Utils/interface/RhoUtilities.h"
31
32 class TRandom3;
33
34 namespace mithep
35 {
36 class PhotonIDMod : public BaseMod
37 {
38 public:
39 PhotonIDMod(const char *name="PhotonIDMod",
40 const char *title="Photon identification module");
41
42 Bool_t GetApplySpikeRemoval() const { return fApplySpikeRemoval; }
43 Bool_t GetApplyPixelSeed() const { return fApplyPixelSeed; }
44 const char *GetGoodName() const { return GetGoodPhotonsName(); }
45 const char *GetGoodPhotonsName() const { return fGoodPhotonsName; }
46 Double_t GetHadOverEmMax() const { return fHadOverEmMax; }
47 const char *GetIDType() const { return fPhotonIDType; }
48 const char *GetInputName() const { return fPhotonBranchName; }
49 const char *GetIsoType() const { return fPhotonIsoType; }
50 const char *GetOutputName() const { return GetGoodPhotonsName(); }
51 Double_t GetPtMin() const { return fPhotonPtMin; }
52 Bool_t GetApplyFiduciality() const { return fFiduciality; }
53 Double_t GetEtaWidthEB() const { return fEtaWidthEB; }
54 Double_t GetEtaWidthEE() const { return fEtaWidthEE; }
55 Double_t GetAbsEtaMax() const { return fAbsEtaMax; }
56 void SetApplySpikeRemoval(Bool_t b) { fApplySpikeRemoval = b; }
57 void SetApplyPixelSeed(Bool_t b) { fApplyPixelSeed = b; }
58 void SetApplyElectronVeto(Bool_t b) { fApplyElectronVeto = b; }
59 void SetInvertElectronVeto(Bool_t b) { fInvertElectronVeto = b; }
60 void SetApplyElectronVetoConvRecovery(Bool_t b) { fApplyElectronVetoConvRecovery = b; }
61 void SetApplyConversionId(Bool_t b) { fApplyConversionId = b; }
62 void SetApplyTriggerMatching(Bool_t b) { fApplyTriggerMatching = b; }
63 void SetGoodName(const char *n) { SetGoodPhotonsName(n); }
64 void SetGoodPhotonsName(const char *n) { fGoodPhotonsName = n; }
65 void SetHadOverEmMax(Double_t hoe) { fHadOverEmMax = hoe; }
66 void SetIDType(const char *type) { fPhotonIDType = type; }
67 void SetInputName(const char *n) { fPhotonBranchName= n; }
68 void SetTrackName(const char *n) { fTrackBranchName = n; }
69 void SetBeamspotName(const char *n) { fBeamspotBranchName = n; }
70 void SetIsoType(const char *type) { fPhotonIsoType = type; }
71 void SetOutputName(const char *n) { SetGoodPhotonsName(n); }
72 void SetPtMin(Double_t pt) { fPhotonPtMin = pt; }
73 void SetR9Min(Double_t x) { fPhotonR9Min = x; }
74 void SetEtaWidthEB(Double_t x) { fEtaWidthEB = x; }
75 void SetEtaWidthEE(Double_t x) { fEtaWidthEE = x; }
76 void SetAbsEtaMax(Double_t x) { fAbsEtaMax = x; }
77 void SetApplyR9Min(Bool_t b) { fApplyR9Min = b; }
78 void SetApplyFiduciality(Bool_t b) { fFiduciality = b; }
79 void SetEffAreas(Double_t ecal, Double_t hcal, Double_t track) {
80 fEffAreaEcalEE = ecal; fEffAreaHcalEE = hcal; fEffAreaTrackEE = track;
81 fEffAreaEcalEB = ecal; fEffAreaHcalEB = hcal; fEffAreaTrackEB = track;
82 }
83 void SetEffAreasEEEB(Double_t ecalEE, Double_t hcalEE, Double_t trackEE,
84 Double_t ecalEB, Double_t hcalEB, Double_t trackEB) {
85 fEffAreaEcalEE = ecalEE; fEffAreaHcalEE = hcalEE; fEffAreaTrackEE = trackEE;
86 fEffAreaEcalEB = ecalEB; fEffAreaHcalEB = hcalEB; fEffAreaTrackEB = trackEB;
87 }
88 void SetTriggerObjectsName(const char *n) { fTrigObjectsName = n; }
89
90
91 void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
92
93 void SetPVName(const char *n) { fPVName = n; }
94 void SetPVFromBranch(bool b) { fPVFromBranch = b; }
95 void SetIsData (Bool_t b) { fIsData = b;};
96
97
98 void SetShowerShapeType(const char *type) { fShowerShapeType = type; }
99
100 // methods to set the MC smearing/energy correction values
101 void AddEnCorrPerRun( UInt_t sRun, UInt_t eRun,
102 Double_t corr_EBlowEta_hR9central,
103 Double_t corr_EBlowEta_hR9gap,
104 Double_t corr_EBlowEta_lR9,
105 Double_t corr_EBhighEta_hR9,
106 Double_t corr_EBhighEta_lR9,
107 Double_t corr_EElowEta_hR9,
108 Double_t corr_EElowEta_lR9,
109 Double_t corr_EEhighEta_hR9,
110 Double_t corr_EEhighEta_lR9) {
111
112 fDataEnCorr_EBlowEta_hR9central.push_back(corr_EBlowEta_hR9central);
113 fDataEnCorr_EBlowEta_hR9gap.push_back(corr_EBlowEta_hR9gap);
114 fDataEnCorr_EBlowEta_lR9.push_back(corr_EBlowEta_lR9);
115 fDataEnCorr_EBhighEta_hR9.push_back(corr_EBhighEta_hR9);
116 fDataEnCorr_EBhighEta_lR9.push_back(corr_EBhighEta_lR9);
117 fDataEnCorr_EElowEta_hR9.push_back(corr_EElowEta_hR9);
118 fDataEnCorr_EElowEta_lR9.push_back(corr_EElowEta_lR9);
119 fDataEnCorr_EEhighEta_hR9.push_back(corr_EEhighEta_hR9);
120 fDataEnCorr_EEhighEta_lR9.push_back(corr_EEhighEta_lR9);
121 fRunStart.push_back (sRun);
122 fRunEnd.push_back (eRun);
123 };
124
125 void SetMCSmearFactors(Double_t _EBlowEta_hR9central,
126 Double_t _EBlowEta_hR9gap,
127 Double_t _EBlowEta_lR9,
128 Double_t _EBhighEta_hR9,
129 Double_t _EBhighEta_lR9,
130 Double_t _EElowEta_hR9,
131 Double_t _EElowEta_lR9,
132 Double_t _EEhighEta_hR9,
133 Double_t _EEhighEta_lR9) {
134 fMCSmear_EBlowEta_hR9central = _EBlowEta_hR9central;
135 fMCSmear_EBlowEta_hR9gap = _EBlowEta_hR9gap;
136 fMCSmear_EBlowEta_lR9 = _EBlowEta_lR9;
137 fMCSmear_EBhighEta_hR9 = _EBhighEta_hR9;
138 fMCSmear_EBhighEta_lR9 = _EBhighEta_lR9;
139 fMCSmear_EElowEta_hR9 = _EElowEta_hR9;
140 fMCSmear_EElowEta_lR9 = _EElowEta_lR9;
141 fMCSmear_EEhighEta_hR9 = _EEhighEta_hR9;
142 fMCSmear_EEhighEta_lR9 = _EEhighEta_lR9;
143 };
144
145 void SetGoodElectronsFromBranch(Bool_t b) { fGoodElectronsFromBranch = b; }
146 void SetGoodElectronName(TString name) { fGoodElectronName = name; }
147
148 void SetBdtCutBarrel(double a) {fbdtCutBarrel = a; }
149 void SetBdtCutEndcap(double a) {fbdtCutEndcap = a; }
150
151
152 void DoDataEneCorr(bool a) { fDoDataEneCorr = a; }
153 void DoMCSmear(bool a) { fDoMCSmear = a; }
154 void SetDoShowerShapeScaling(Bool_t b) { fDoShowerShapeScaling = b; }
155
156 // replaced by ShowerShapeScaling (fab)
157 /* void SetDoMCR9Scaling(Bool_t b) { fDoMCR9Scaling = b; } */
158 /* void SetMCR9Scale(Double_t ebscale, Double_t eescale) { fMCR9ScaleEB = ebscale; fMCR9ScaleEE = eescale; } */
159 /* void SetDoMCSigIEtaIEtaScaling(Bool_t b) { fDoMCSigIEtaIEtaScaling = b; } */
160 /* void SetDoMCWidthScaling(Bool_t b) { fDoMCWidthScaling = b; } */
161
162 void SetDoMCErrScaling(Bool_t b) { fDoMCErrScaling = b; }
163 void SetMCErrScale(Double_t ebscale, Double_t eescale) { fMCErrScaleEB = ebscale; fMCErrScaleEE = eescale; }
164
165 void SetIdMVAType(const char *type) { fIdMVATypeName = type; }
166
167 void SetRhoType(RhoUtilities::RhoType type) { fRhoType = type ; }
168
169 enum EPhIdType {
170 kIdUndef = 0, //not defined
171 kTight, //"Tight"
172 kLoose, //"Loose"
173 kLooseEM, //"LooseEM"
174 kBaseLineCiC, //"2011" Hgg BaseLine CiC
175 kBaseLineCiCPF, //"2012" Hgg BaseLine CiC
176 kBaseLineCiCPFNoPresel, //"2012" Hgg BaseLine CiC plus eleveto -- for mono photon
177 kMITMVAId, // MingMing MVA ID
178 kMITPhSelection, //MIT loose preselection (for mva)
179 kMITPFPhSelection, //MIT loose preselection (for mva)
180 kMITPFPhSelection_NoTrigger, //MIT loose preselection (for mva, no Trigger)
181 kVgamma2011Selection, // Vgamma 2011 Photon ID
182 kTrivialSelection, // only pt & eta cuts
183 kCustomId //"Custom"
184 };
185
186 enum EPhIsoType {
187 kIsoUndef = 0, //not defined
188 kNoIso, //"NoIso"
189 kCombinedIso, //"CombinedIso"
190 kCustomIso, //"Custom"
191 kMITPUCorrected //PileUp Corrected Hgg Isolation
192 };
193
194 protected:
195 void Process();
196 void SlaveBegin();
197
198 Int_t FindRunRangeIdx(UInt_t run);
199 Double_t GetDataEnCorr(Int_t runRange, PhotonTools::eScaleCats cat);
200 Double_t GetMCSmearFac(PhotonTools::eScaleCats cat);
201
202 TString fPhotonBranchName; //name of photon collection (input)
203 TString fGoodPhotonsName; //name of exported "good photon" collection
204 TString fTrackBranchName; // name of the track collection (only needed for PU corrected isolation)
205 TString fBeamspotBranchName; //name of the Beamspot collection (only needed for PU corrected isolation)
206 TString fPileUpDenName; //name of the PU density collection
207 TString fConversionName; //name of conversion branch
208 TString fElectronName;
209 TString fGoodElectronName;
210 TString fTrigObjectsName; //name of trigger object collection
211 TString fPVName;
212 TString fMCParticleName;
213 TString fPileUpName;
214 TString fPFCandsName;
215 TString fPhotonIDType; //type of photon identification we impose
216 TString fPhotonIsoType; //type of photon isolation we impose
217 Double_t fPhotonPtMin; //min pt cut
218 Double_t fHadOverEmMax; //maximum of hadronic/em energy
219 Bool_t fApplySpikeRemoval; //whether apply spike removal
220 Bool_t fApplyPixelSeed; //=true then apply pixel seed constraint
221 Bool_t fApplyElectronVeto; //=true then apply electron veto (with no conversion recovery)
222 Bool_t fInvertElectronVeto; //=true then invert electron veto (for cic selection only atm)
223 Bool_t fApplyElectronVetoConvRecovery; //=true then apply electron veto with conversion recovery
224 Bool_t fApplyConversionId; //=true then apply conversion id cuts
225 Bool_t fApplyTriggerMatching; //match to hlt photon (default=0)
226 Double_t fPhotonR9Min; //min R9 value
227 EPhIdType fPhIdType; //!identification scheme
228 EPhIsoType fPhIsoType; //!isolation scheme
229 Bool_t fFiduciality; //=true then apply fiducual requirement
230
231 Double_t fEtaWidthEB; //max Eta Width in ECAL Barrel
232 Double_t fEtaWidthEE; //max Eta Width in ECAL End Cap
233 Double_t fAbsEtaMax; //max Abs Eta
234 Bool_t fApplyR9Min; //apply R9 min
235 Double_t fEffAreaEcalEE;
236 Double_t fEffAreaHcalEE;
237 Double_t fEffAreaTrackEE;
238 Double_t fEffAreaEcalEB;
239 Double_t fEffAreaHcalEB;
240 Double_t fEffAreaTrackEB;
241 const PhotonCol *fPhotons; //!photon branch
242 const TrackCol *fTracks; //!track branch
243 const BeamSpotCol *fBeamspots; //!beamspot branch
244 const PileupEnergyDensityCol *fPileUpDen; //!rho branch
245 const DecayParticleCol *fConversions; //!conversion branch
246 const ElectronCol *fElectrons; //!electron branch
247 const ElectronCol *fGoodElectrons; //!electron branch
248 const VertexCol* fPV; //!
249 const MCParticleCol *fMCParticles;//!
250 const PileupInfoCol *fPileUp; //!
251 const PFCandidateCol *fPFCands; //!
252
253 Double_t fbdtCutBarrel;
254 Double_t fbdtCutEndcap;
255
256 // ----------------------------------------------------------------
257 // these guys should go away.... (let MVATools handle this) (fab)
258 int fVariableType;
259 TString fEndcapWeights;
260 TString fBarrelWeights;
261 // ----------------------------------------------------------------
262 MVATools fTool;
263 TString fIdMVATypeName;
264 MVATools::IdMVAType fIdMVAType;
265 // ----------------------------------------------------------------
266
267 Bool_t fDoMCR9Scaling;
268 Double_t fMCR9ScaleEB;
269 Double_t fMCR9ScaleEE;
270
271 Bool_t fDoMCSigIEtaIEtaScaling;
272 Bool_t fDoMCWidthScaling;
273
274 Bool_t fDoMCErrScaling;
275 Double_t fMCErrScaleEB;
276 Double_t fMCErrScaleEE;
277
278 Bool_t fPhotonsFromBranch;
279 Bool_t fPVFromBranch;
280 Bool_t fGoodElectronsFromBranch;
281 Bool_t fIsData;
282
283
284 // showershape
285 TString fShowerShapeType;
286 PhotonTools::ShowerShapeScales fSSType;
287
288 bool fDoDataEneCorr;
289 bool fDoMCSmear;
290 Bool_t fDoShowerShapeScaling;
291
292
293 // Vectroes to hols smeraring/correction factors
294 std::vector<Double_t> fDataEnCorr_EBlowEta_hR9central;
295 std::vector<Double_t> fDataEnCorr_EBlowEta_hR9gap;
296 std::vector<Double_t> fDataEnCorr_EBlowEta_lR9;
297 std::vector<Double_t> fDataEnCorr_EBhighEta_hR9;
298 std::vector<Double_t> fDataEnCorr_EBhighEta_lR9;
299 std::vector<Double_t> fDataEnCorr_EElowEta_hR9;
300 std::vector<Double_t> fDataEnCorr_EElowEta_lR9;
301 std::vector<Double_t> fDataEnCorr_EEhighEta_hR9;
302 std::vector<Double_t> fDataEnCorr_EEhighEta_lR9;
303
304 std::vector<UInt_t> fRunStart;
305 std::vector<UInt_t> fRunEnd;
306
307 Double_t fMCSmear_EBlowEta_hR9central;
308 Double_t fMCSmear_EBlowEta_hR9gap;
309 Double_t fMCSmear_EBlowEta_lR9;
310 Double_t fMCSmear_EBhighEta_hR9;
311 Double_t fMCSmear_EBhighEta_lR9;
312 Double_t fMCSmear_EElowEta_hR9;
313 Double_t fMCSmear_EElowEta_lR9;
314 Double_t fMCSmear_EEhighEta_hR9;
315 Double_t fMCSmear_EEhighEta_lR9;
316
317 TRandom3* fRng;
318
319 RhoUtilities::RhoType fRhoType;
320
321 ClassDef(PhotonIDMod, 1) // Photon identification module
322 };
323 }
324 #endif