ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.31
Committed: Mon Oct 8 16:32:40 2012 UTC (12 years, 7 months ago) by mingyang
Content type: text/plain
Branch: MAIN
Changes since 1.30: +75 -4 lines
Log Message:
scale/smear changed

File Contents

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