ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.33
Committed: Sat Feb 9 15:17:23 2013 UTC (12 years, 2 months ago) by mingyang
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029c, Mit_029b, Mit_029a
Changes since 1.32: +3 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // M.Yang 2011/10/12
3 // $Id: PhotonPairSelector.h,v 1.32 2013/01/08 13:24:01 fabstoec Exp $
4 //
5 // PhotonPairSelector
6 //
7 // Authors: F. Stoeckli
8 //--------------------------------------------------------------------------------------------------
9
10 #ifndef MITPHYSICS_MODS_PHOTONPAIRSELECTOR_H
11 #define MITPHYSICS_MODS_PHOTONPAIRSELECTOR_H
12
13 #include "MitAna/TreeMod/interface/BaseMod.h"
14 #include "MitAna/DataTree/interface/PhotonFwd.h"
15 #include "MitAna/DataTree/interface/TrackCol.h"
16 #include "MitAna/DataTree/interface/VertexCol.h"
17 #include "MitAna/DataTree/interface/BeamSpotCol.h"
18 #include "MitAna/DataTree/interface/PFCandidateCol.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/DecayParticleCol.h"
23 #include "MitAna/DataTree/interface/PileupInfoCol.h"
24 #include "MitAna/DataTree/interface/MCParticleCol.h"
25 #include "MitAna/DataTree/interface/JetCol.h"
26 #include "MitAna/DataTree/interface/PFMetCol.h"
27
28 #include "MitPhysics/Utils/interface/PhotonTools.h"
29 #include "MitPhysics/Utils/interface/EGEnergyCorrector.h"
30
31 #include "MitPhysics/Utils/interface/MVATools.h"
32 #include "MitPhysics/Utils/interface/VertexTools.h"
33
34 #include "MitPhysics/Utils/interface/MVAMet.h"
35 #include "MitPhysics/Utils/interface/RhoUtilities.h"
36
37
38 class TNtuple;
39 class TRandom3;
40 class TH1D;
41
42 namespace mithep
43 {
44 class PhotonPairSelector : public BaseMod
45 {
46 public:
47 PhotonPairSelector(const char *name = "PhotonPairSelector",
48 const char *title = "Selecting PhotonPairs");
49
50 ~PhotonPairSelector();
51
52 enum PhotonSelection {
53 kNoPhSelection = 0,
54 kCiCPhSelection,
55 kCiCPFPhSelection,
56 kMVAPhSelection, //MVA
57 kMITPhSelection,
58 kMITPFPhSelection,
59 kMITPFPhSelectionNoEcal
60 };
61 enum VertexSelection {
62 kStdVtxSelection = 0,
63 kCiCVtxSelection,
64 kMITVtxSelection,
65 kCiCMVAVtxSelection,
66 kMetSigVtxSelection
67 };
68
69 // outsourced to MVATools (IdMVAType) (fab)
70 /* enum IdMVA { */
71 /* k2011IdMVA = 0, */
72 /* k2012IdMVA_globe */
73 /* }; */
74
75
76 // outsourced to PhotonTools (fab)
77 /* enum ShowerShape { */
78 /* k2011ShowerShape = 0, */
79 /* k2012ShowerShape */
80 /* }; */
81
82 // setting all the input Names
83 void SetInputPhotonsName(const char *n){ fPhotonBranchName= n; }
84 void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
85 void SetTrackName(const char *n) { fTrackBranchName = n; }
86 void SetElectronName(const char *n) { fElectronName = n; }
87 void SetConversionName(const char *n) { fConversionName = n; }
88 void SetPUDensityName(const char *n) { fPileUpDenName = n; }
89 void SetPVName(const char *n) { fPVName = n; }
90 void SetPVFromBranch(bool b) { fPVFromBranch = b; }
91 void SetMCParticle(const char *n) { fMCParticleName = n; }
92 void SetPUInfoName(const char *n) { fPileUpName = n; }
93 void SetBeamspotName(const char *n) { fBeamspotName = n; }
94 void SetPFCandName(const char *n) { fPFCandName = n; }
95
96 // set the type of selection
97 void SetPhotonSelType(const char *type){ fPhotonSelType = type; }
98 void SetVertexSelType(const char *type){ fVertexSelType = type; }
99 void SetIdMVAType(const char *type) { fIdMVAType = type; }
100 void SetShowerShapeType(const char *type) { fShowerShapeType = type; }
101
102 // get/set the Names for the output Photon Collection
103 const char *GetOutputName() const { return fGoodPhotonsName; }
104 void SetOutputName(const char *n) { fGoodPhotonsName=n; }
105
106 const char *GetOutputVtxName() const { return fChosenVtxName; }
107 void SetOutputVtxName(const char* n) { fChosenVtxName = n; }
108
109
110 // set basic Cut variables (FOR PRE-SELECTION)
111 void SetPtMin(Double_t pt) { fPhotonPtMin = pt; }
112 void SetAbsEtaMax(Double_t eta) { fPhotonEtaMax = eta; }
113
114 void SetLeadingPtMin(Double_t pt) { fLeadingPtMin = pt; }
115 void SetTrailingPtMin(Double_t pt) { fTrailingPtMin = pt; }
116
117 // is Data Or Not?
118 void SetIsData (Bool_t b) { fIsData = b;}
119
120 void Set2012HCP (Bool_t b) { f2012HCP = b;};
121
122
123 // methods to set the MC smearing/energy correction values
124 void AddEnCorrPerRun( UInt_t sRun, UInt_t eRun,
125 Double_t corr_EBlowEta_hR9central,
126 Double_t corr_EBlowEta_hR9gap,
127 Double_t corr_EBlowEta_lR9,
128 Double_t corr_EBhighEta_hR9,
129 Double_t corr_EBhighEta_lR9,
130 Double_t corr_EElowEta_hR9,
131 Double_t corr_EElowEta_lR9,
132 Double_t corr_EEhighEta_hR9,
133 Double_t corr_EEhighEta_lR9) {
134
135 fDataEnCorr_EBlowEta_hR9central.push_back(corr_EBlowEta_hR9central);
136 fDataEnCorr_EBlowEta_hR9gap.push_back(corr_EBlowEta_hR9gap);
137 fDataEnCorr_EBlowEta_lR9.push_back(corr_EBlowEta_lR9);
138 fDataEnCorr_EBhighEta_hR9.push_back(corr_EBhighEta_hR9);
139 fDataEnCorr_EBhighEta_lR9.push_back(corr_EBhighEta_lR9);
140 fDataEnCorr_EElowEta_hR9.push_back(corr_EElowEta_hR9);
141 fDataEnCorr_EElowEta_lR9.push_back(corr_EElowEta_lR9);
142 fDataEnCorr_EEhighEta_hR9.push_back(corr_EEhighEta_hR9);
143 fDataEnCorr_EEhighEta_lR9.push_back(corr_EEhighEta_lR9);
144 fRunStart.push_back (sRun);
145 fRunEnd.push_back (eRun);
146 };
147
148 void SetMCSmearFactors(Double_t _EBlowEta_hR9central,
149 Double_t _EBlowEta_hR9gap,
150 Double_t _EBlowEta_lR9,
151 Double_t _EBhighEta_hR9,
152 Double_t _EBhighEta_lR9,
153 Double_t _EElowEta_hR9,
154 Double_t _EElowEta_lR9,
155 Double_t _EEhighEta_hR9,
156 Double_t _EEhighEta_lR9) {
157 fMCSmear_EBlowEta_hR9central = _EBlowEta_hR9central;
158 fMCSmear_EBlowEta_hR9gap = _EBlowEta_hR9gap;
159 fMCSmear_EBlowEta_lR9 = _EBlowEta_lR9;
160 fMCSmear_EBhighEta_hR9 = _EBhighEta_hR9;
161 fMCSmear_EBhighEta_lR9 = _EBhighEta_lR9;
162 fMCSmear_EElowEta_hR9 = _EElowEta_hR9;
163 fMCSmear_EElowEta_lR9 = _EElowEta_lR9;
164 fMCSmear_EEhighEta_hR9 = _EEhighEta_hR9;
165 fMCSmear_EEhighEta_lR9 = _EEhighEta_lR9;
166 };
167
168 // special routine in ordetr to use different smearing to compute mass-error for di-photon MVA input
169 void SetMCSmearFactorsMVA(Double_t _EBlowEta_hR9central,
170 Double_t _EBlowEta_hR9gap,
171 Double_t _EBlowEta_lR9,
172 Double_t _EBhighEta_hR9,
173 Double_t _EBhighEta_lR9,
174 Double_t _EElowEta_hR9,
175 Double_t _EElowEta_lR9,
176 Double_t _EEhighEta_hR9,
177 Double_t _EEhighEta_lR9) {
178
179 fMCSmearMVA_EBlowEta_hR9central = _EBlowEta_hR9central;
180 fMCSmearMVA_EBlowEta_hR9gap = _EBlowEta_hR9gap;
181 fMCSmearMVA_EBlowEta_lR9 = _EBlowEta_lR9;
182 fMCSmearMVA_EBhighEta_hR9 = _EBhighEta_hR9;
183 fMCSmearMVA_EBhighEta_lR9 = _EBhighEta_lR9;
184 fMCSmearMVA_EElowEta_hR9 = _EElowEta_hR9;
185 fMCSmearMVA_EElowEta_lR9 = _EElowEta_lR9;
186 fMCSmearMVA_EEhighEta_hR9 = _EEhighEta_hR9;
187 fMCSmearMVA_EEhighEta_lR9 = _EEhighEta_lR9;
188 };
189
190
191 void AddEnCorrPerRun2012HCP( UInt_t sRun, UInt_t eRun,
192 Double_t corr_EBlowEta_hR9central,
193 Double_t corr_EBlowEta_hR9gap,
194 Double_t corr_EBlowEta_lR9central,
195 Double_t corr_EBlowEta_lR9gap,
196 Double_t corr_EBhighEta_hR9,
197 Double_t corr_EBhighEta_lR9,
198 Double_t corr_EElowEta_hR9,
199 Double_t corr_EElowEta_lR9,
200 Double_t corr_EEhighEta_hR9,
201 Double_t corr_EEhighEta_lR9) {
202 fDataEnCorr_EBlowEta_hR9central.push_back(corr_EBlowEta_hR9central);
203 fDataEnCorr_EBlowEta_hR9gap.push_back(corr_EBlowEta_hR9gap);
204 fDataEnCorr_EBlowEta_lR9central.push_back(corr_EBlowEta_lR9central);
205 fDataEnCorr_EBlowEta_lR9gap.push_back(corr_EBlowEta_lR9gap);
206 fDataEnCorr_EBhighEta_hR9.push_back(corr_EBhighEta_hR9);
207 fDataEnCorr_EBhighEta_lR9.push_back(corr_EBhighEta_lR9);
208 fDataEnCorr_EElowEta_hR9.push_back(corr_EElowEta_hR9);
209 fDataEnCorr_EElowEta_lR9.push_back(corr_EElowEta_lR9);
210 fDataEnCorr_EEhighEta_hR9.push_back(corr_EEhighEta_hR9);
211 fDataEnCorr_EEhighEta_lR9.push_back(corr_EEhighEta_lR9);
212 fRunStart.push_back (sRun);
213 fRunEnd.push_back (eRun);
214 };
215
216 void SetMCSmearFactors2012HCP(Double_t _EBlowEta_hR9central,
217 Double_t _EBlowEta_hR9gap,
218 Double_t _EBlowEta_lR9central,
219 Double_t _EBlowEta_lR9gap,
220 Double_t _EBhighEta_hR9,
221 Double_t _EBhighEta_lR9,
222 Double_t _EElowEta_hR9,
223 Double_t _EElowEta_lR9,
224 Double_t _EEhighEta_hR9,
225 Double_t _EEhighEta_lR9) {
226 fMCSmear_EBlowEta_hR9central = _EBlowEta_hR9central;
227 fMCSmear_EBlowEta_hR9gap = _EBlowEta_hR9gap;
228 fMCSmear_EBlowEta_lR9central = _EBlowEta_lR9central;
229 fMCSmear_EBlowEta_lR9gap = _EBlowEta_lR9gap;
230 fMCSmear_EBhighEta_hR9 = _EBhighEta_hR9;
231 fMCSmear_EBhighEta_lR9 = _EBhighEta_lR9;
232 fMCSmear_EElowEta_hR9 = _EElowEta_hR9;
233 fMCSmear_EElowEta_lR9 = _EElowEta_lR9;
234 fMCSmear_EEhighEta_hR9 = _EEhighEta_hR9;
235 fMCSmear_EEhighEta_lR9 = _EEhighEta_lR9;
236 };
237
238 // special routine in ordetr to use different smearing to compute mass-error for di-photon MVA input
239 void SetMCSmearFactors2012HCPMVA(Double_t _EBlowEta_hR9central,
240 Double_t _EBlowEta_hR9gap,
241 Double_t _EBlowEta_lR9central,
242 Double_t _EBlowEta_lR9gap,
243 Double_t _EBhighEta_hR9,
244 Double_t _EBhighEta_lR9,
245 Double_t _EElowEta_hR9,
246 Double_t _EElowEta_lR9,
247 Double_t _EEhighEta_hR9,
248 Double_t _EEhighEta_lR9) {
249 fMCSmearMVA_EBlowEta_hR9central = _EBlowEta_hR9central;
250 fMCSmearMVA_EBlowEta_hR9gap = _EBlowEta_hR9gap;
251 fMCSmearMVA_EBlowEta_lR9central = _EBlowEta_lR9central;
252 fMCSmearMVA_EBlowEta_lR9gap = _EBlowEta_lR9gap;
253 fMCSmearMVA_EBhighEta_hR9 = _EBhighEta_hR9;
254 fMCSmearMVA_EBhighEta_lR9 = _EBhighEta_lR9;
255 fMCSmearMVA_EElowEta_hR9 = _EElowEta_hR9;
256 fMCSmearMVA_EElowEta_lR9 = _EElowEta_lR9;
257 fMCSmearMVA_EEhighEta_hR9 = _EEhighEta_hR9;
258 fMCSmearMVA_EEhighEta_lR9 = _EEhighEta_lR9;
259 };
260
261
262 void SetApplyEleVeto(bool a) { fApplyEleVeto = a; }
263 void SetInvertElectronVeto(Bool_t b) { fInvertElectronVeto = b; }
264 void DoDataEneCorr(bool a) { fDoDataEneCorr = a; }
265 void DoMCSmear(bool a) { fDoMCSmear = a; }
266 void UseSpecialSmearForDPMVA(bool a) { fUseSpecialSmearForDPMVA = a; }
267
268 void SetGoodElectronsFromBranch(Bool_t b) { fGoodElectronsFromBranch = b; }
269 void SetGoodElectronName(TString name) { fGoodElectronName = name; }
270 void SetUseSingleLegConversions(Bool_t b) { fUseSingleLegConversions = b; }
271 void SetDoRegression(Bool_t b) { fDoRegression = b; }
272 void SetEtaCorrections(const TH1D *h) { fEtaCorrections = h; }
273 void SetBdtCutBarrel(Float_t x) { fbdtCutBarrel = x; }
274 void SetBdtCutEndcap(Float_t x) { fbdtCutEndcap = x; }
275
276 void SetDoShowerShapeScaling(Bool_t b) { fDoShowerShapeScaling = b; }
277
278 void SetJetsName(const char *n) { fJetsName = n; }
279
280 void SetRhoType(RhoUtilities::RhoType type) { fRhoType = type ; }
281
282 void SetApplyLeptonTag(bool a) { fApplyLeptonTag = a; }
283
284 void SetLeptonTagElectronsName(TString name) { fLeptonTagElectronsName = name; }
285 void SetLeptonTagMuonsName (TString name) { fLeptonTagMuonsName = name; }
286
287 protected:
288 void Process();
289 void SlaveBegin();
290
291 // private auxiliary methods...
292 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
293 Int_t FindRunRangeIdx(UInt_t run);
294 Double_t GetDataEnCorr(Int_t runRange, PhotonTools::eScaleCats cat);
295 Double_t GetMCSmearFac(PhotonTools::eScaleCats cat, bool useSpecialSmear = false); // last flag in case of special smearing for error computation
296 Double_t GetDataEnCorrHCP(Int_t runRange, PhotonTools::eScaleCats cat);
297 Double_t GetMCSmearFacHCP(PhotonTools::eScaleCats cat, bool useSpecialSmear = false); // last flag in case of special smearing for error computation
298 Float_t GetEventCat(PhotonTools::CiCBaseLineCats cat1, PhotonTools::CiCBaseLineCats cat2);
299
300 // Names for the input Collections
301 TString fPhotonBranchName;
302 TString fElectronName;
303 TString fGoodElectronName;
304 TString fConversionName;
305 TString fPFConversionName;
306 TString fTrackBranchName;
307 TString fPileUpDenName;
308 TString fPVName;
309 TString fBeamspotName;
310 TString fPFCandName;
311 TString fMCParticleName;
312 TString fPileUpName;
313 TString fJetsName;
314 TString fPFMetName;
315
316 TString fGoodPhotonsName; //name of exported "good photon" collection
317 TString fChosenVtxName; //name of exported "chosen Vtx" collection
318
319 TString fLeptonTagElectronsName;
320 TString fLeptonTagMuonsName;
321
322 // Selection Types
323 TString fPhotonSelType;
324 TString fVertexSelType;
325 PhotonSelection fPhSelType;
326 VertexSelection fVtxSelType;
327
328 // Id Type
329 TString fIdMVAType;
330 MVATools::IdMVAType fIdType;
331 //IdMVA fIdType;
332
333 // showershape
334 TString fShowerShapeType;
335 PhotonTools::ShowerShapeScales fSSType;
336
337 // Basic Pre-Selection kinematics
338 Double_t fPhotonPtMin; // min pt cut fro PRE-SELECTION!
339 Double_t fPhotonEtaMax; // max eta cut for PRE-SELECTION!
340
341 Double_t fLeadingPtMin;
342 Double_t fTrailingPtMin;
343
344 // is it Data or MC?
345 Bool_t fIsData;
346
347 // in case there's some PV pre-selection
348 Bool_t fPhotonsFromBranch;
349 Bool_t fPVFromBranch;
350 Bool_t fGoodElectronsFromBranch;
351 Bool_t fUseSingleLegConversions;
352
353 Bool_t f2012HCP;
354
355 const PhotonCol *fPhotons;
356 const ElectronCol *fElectrons;
357 const ElectronCol *fGoodElectrons;
358 const DecayParticleCol *fConversions;
359 const DecayParticleCol *fPFConversions;
360 const TrackCol *fTracks;
361 const PileupEnergyDensityCol *fPileUpDen;
362 const VertexCol *fPV;
363 const BeamSpotCol *fBeamspot;
364 const PFCandidateCol *fPFCands;
365 const MCParticleCol *fMCParticles;
366 const PileupInfoCol *fPileUp;
367 const JetCol *fJets;
368 const PFMetCol *fPFMet;
369 const ElectronCol *fLeptonTagElectrons;
370 const MuonCol *fLeptonTagMuons;
371
372 // Vectroes to hols smeraring/correction factors
373 std::vector<Double_t> fDataEnCorr_EBlowEta_hR9central;
374 std::vector<Double_t> fDataEnCorr_EBlowEta_hR9gap;
375 std::vector<Double_t> fDataEnCorr_EBlowEta_lR9;
376 std::vector<Double_t> fDataEnCorr_EBlowEta_lR9central;
377 std::vector<Double_t> fDataEnCorr_EBlowEta_lR9gap;
378 std::vector<Double_t> fDataEnCorr_EBhighEta_hR9;
379 std::vector<Double_t> fDataEnCorr_EBhighEta_lR9;
380 std::vector<Double_t> fDataEnCorr_EElowEta_hR9;
381 std::vector<Double_t> fDataEnCorr_EElowEta_lR9;
382 std::vector<Double_t> fDataEnCorr_EEhighEta_hR9;
383 std::vector<Double_t> fDataEnCorr_EEhighEta_lR9;
384
385 std::vector<UInt_t> fRunStart;
386 std::vector<UInt_t> fRunEnd;
387
388 Double_t fMCSmear_EBlowEta_hR9central;
389 Double_t fMCSmear_EBlowEta_hR9gap;
390 Double_t fMCSmear_EBlowEta_lR9;
391 Double_t fMCSmear_EBlowEta_lR9central;
392 Double_t fMCSmear_EBlowEta_lR9gap;
393 Double_t fMCSmear_EBhighEta_hR9;
394 Double_t fMCSmear_EBhighEta_lR9;
395 Double_t fMCSmear_EElowEta_hR9;
396 Double_t fMCSmear_EElowEta_lR9;
397 Double_t fMCSmear_EEhighEta_hR9;
398 Double_t fMCSmear_EEhighEta_lR9;
399
400 // special Smear factors for usage for diphoton MVA input, incase differrent from std smearing
401 Double_t fMCSmearMVA_EBlowEta_hR9central;
402 Double_t fMCSmearMVA_EBlowEta_hR9gap;
403 Double_t fMCSmearMVA_EBlowEta_lR9;
404 Double_t fMCSmearMVA_EBlowEta_lR9central;
405 Double_t fMCSmearMVA_EBlowEta_lR9gap;
406 Double_t fMCSmearMVA_EBhighEta_hR9;
407 Double_t fMCSmearMVA_EBhighEta_lR9;
408 Double_t fMCSmearMVA_EElowEta_hR9;
409 Double_t fMCSmearMVA_EElowEta_lR9;
410 Double_t fMCSmearMVA_EEhighEta_hR9;
411 Double_t fMCSmearMVA_EEhighEta_lR9;
412
413
414 // pointer to RNG ionstance for smearing
415 TRandom3* fRng;
416 EGEnergyCorrector fEgCor;
417 Bool_t fDoRegression;
418 TString fPhFixString;
419 TString fPhFixFile;
420 TString fRegWeights;
421
422 const TH1D *fEtaCorrections;
423
424 // --------------------------------
425 // some streagin flags, not adjustable yet (FIX-ME)
426 bool fDoDataEneCorr;
427 bool fDoMCSmear;
428 bool fUseSpecialSmearForDPMVA; // if set to true, the special smearing numbers set in fMCSmearMVA_* are used to compute the mass-errors (input to diphoton MVA)
429 bool fDoVtxSelection;
430 bool fApplyEleVeto;
431 Bool_t fInvertElectronVeto; //=true (invert ele veto, for cic sel only atm)
432
433 // --------------------------------
434 bool fApplyLeptonTag;
435
436 //MVA
437 int fVariableType_2011;
438 TString fEndcapWeights_2011;
439 TString fBarrelWeights_2011;
440 int fVariableType_2012_globe;
441 TString fEndcapWeights_2012_globe;
442 TString fBarrelWeights_2012_globe;
443 MVATools fTool;
444 Float_t fbdtCutBarrel;
445 Float_t fbdtCutEndcap;
446
447 VertexTools fVtxTools;
448
449 Bool_t fDoShowerShapeScaling;
450
451 Bool_t fDoMCErrScaling;
452 Double_t fMCErrScaleEB;
453 Double_t fMCErrScaleEE;
454 UInt_t fRegressionVersion;
455
456 Bool_t fRelativePtCuts;
457
458 MVAMet fMVAMet;
459
460 RhoUtilities::RhoType fRhoType;
461
462 ClassDef(PhotonPairSelector, 1) // Photon identification module
463 };
464 }
465 #endif