ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonIDMod.h
Revision: 1.29
Committed: Thu Aug 2 12:30:55 2012 UTC (12 years, 9 months ago) by fabstoec
Content type: text/plain
Branch: MAIN
Changes since 1.28: +12 -1 lines
Log Message:
updated MVATools

File Contents

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