ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.23
Committed: Mon May 28 02:14:29 2012 UTC (12 years, 11 months ago) by mingyang
Content type: text/plain
Branch: MAIN
Changes since 1.22: +10 -1 lines
Log Message:
configurable shower shape scale added

File Contents

# User Rev Content
1 fabstoec 1.1 //--------------------------------------------------------------------------------------------------
2 mingyang 1.10 // M.Yang 2011/10/12
3 mingyang 1.23 // $Id: PhotonPairSelector.h,v 1.22 2012/05/27 19:40:18 mingyang 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    
36 fabstoec 1.1 class TNtuple;
37     class TRandom3;
38 bendavid 1.8 class TH1D;
39 fabstoec 1.1
40     namespace mithep
41 bendavid 1.7 {
42 fabstoec 1.1 class PhotonPairSelector : public BaseMod
43     {
44     public:
45 paus 1.18 PhotonPairSelector(const char *name = "PhotonPairSelector",
46     const char *title = "Selecting PhotonPairs");
47 fabstoec 1.1
48     ~PhotonPairSelector();
49    
50     enum PhotonSelection {
51     kNoPhSelection = 0,
52     kCiCPhSelection,
53 bendavid 1.21 kCiCPFPhSelection,
54 mingyang 1.10 kMVAPhSelection, //MVA
55 bendavid 1.21 kMITPhSelection,
56     kMITPFPhSelection
57 fabstoec 1.1 };
58     enum VertexSelection {
59     kStdVtxSelection = 0,
60     kCiCVtxSelection,
61 bendavid 1.13 kMITVtxSelection,
62 bendavid 1.20 kCiCMVAVtxSelection,
63     kMetSigVtxSelection
64 fabstoec 1.1 };
65 mingyang 1.22 enum IdMVA {
66     k2011IdMVA = 0,
67     k2012IdMVA_globe
68     };
69 fabstoec 1.1
70     // setting all the input Names
71     void SetInputPhotonsName(const char *n){ fPhotonBranchName= n; }
72     void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
73     void SetTrackName(const char *n) { fTrackBranchName = n; }
74     void SetElectronName(const char *n) { fElectronName = n; }
75     void SetConversionName(const char *n) { fConversionName = n; }
76     void SetPUDensityName(const char *n) { fPileUpDenName = n; }
77     void SetPVName(const char *n) { fPVName = n; }
78     void SetPVFromBranch(bool b) { fPVFromBranch = b; }
79     void SetMCParticle(const char *n) { fMCParticleName = n; }
80     void SetPUInfoName(const char *n) { fPileUpName = n; }
81     void SetBeamspotName(const char *n) { fBeamspotName = n; }
82     void SetPFCandName(const char *n) { fPFCandName = n; }
83    
84     // set the type of selection
85     void SetPhotonSelType(const char *type){ fPhotonSelType = type; }
86     void SetVertexSelType(const char *type){ fVertexSelType = type; }
87 mingyang 1.22 void SetIdMVAType(const char *type) { fIdMVAType = type; }
88 fabstoec 1.1
89     // get/set the Names for the output Photon Collection
90     const char *GetOutputName() const { return fGoodPhotonsName; }
91     void SetOutputName(const char *n) { fGoodPhotonsName=n; }
92    
93 fabstoec 1.19 const char *GetOutputVtxName() const { return fChosenVtxName; }
94     void SetOutputVtxName(const char* n) { fChosenVtxName = n; }
95    
96    
97 fabstoec 1.1 // set basic Cut variables (FOR PRE-SELECTION)
98     void SetPtMin(Double_t pt) { fPhotonPtMin = pt; }
99     void SetAbsEtaMax(Double_t eta) { fPhotonEtaMax = eta; }
100    
101     void SetLeadingPtMin(Double_t pt) { fLeadingPtMin = pt; }
102 fabstoec 1.6 void SetTrailingPtMin(Double_t pt) { fTrailingPtMin = pt; }
103 fabstoec 1.1
104     // is Data Or Not?
105     void SetIsData (Bool_t b) { fIsData = b;};
106    
107     // methods to set the MC smearing/energy correction values
108     void AddEnCorrPerRun( UInt_t sRun, UInt_t eRun,
109 bendavid 1.14 Double_t corr_EBlowEta_hR9central,
110     Double_t corr_EBlowEta_hR9gap,
111 bendavid 1.13 Double_t corr_EBlowEta_lR9,
112     Double_t corr_EBhighEta_hR9,
113     Double_t corr_EBhighEta_lR9,
114     Double_t corr_EElowEta_hR9,
115     Double_t corr_EElowEta_lR9,
116     Double_t corr_EEhighEta_hR9,
117     Double_t corr_EEhighEta_lR9) {
118    
119 bendavid 1.14 fDataEnCorr_EBlowEta_hR9central.push_back(corr_EBlowEta_hR9central);
120     fDataEnCorr_EBlowEta_hR9gap.push_back(corr_EBlowEta_hR9gap);
121 bendavid 1.13 fDataEnCorr_EBlowEta_lR9.push_back(corr_EBlowEta_lR9);
122     fDataEnCorr_EBhighEta_hR9.push_back(corr_EBhighEta_hR9);
123     fDataEnCorr_EBhighEta_lR9.push_back(corr_EBhighEta_lR9);
124     fDataEnCorr_EElowEta_hR9.push_back(corr_EElowEta_hR9);
125     fDataEnCorr_EElowEta_lR9.push_back(corr_EElowEta_lR9);
126     fDataEnCorr_EEhighEta_hR9.push_back(corr_EEhighEta_hR9);
127     fDataEnCorr_EEhighEta_lR9.push_back(corr_EEhighEta_lR9);
128 fabstoec 1.1 fRunStart.push_back (sRun);
129     fRunEnd.push_back (eRun);
130     };
131    
132 bendavid 1.14 void SetMCSmearFactors(Double_t _EBlowEta_hR9central,
133     Double_t _EBlowEta_hR9gap,
134 bendavid 1.13 Double_t _EBlowEta_lR9,
135     Double_t _EBhighEta_hR9,
136     Double_t _EBhighEta_lR9,
137     Double_t _EElowEta_hR9,
138     Double_t _EElowEta_lR9,
139     Double_t _EEhighEta_hR9,
140     Double_t _EEhighEta_lR9) {
141 bendavid 1.14 fMCSmear_EBlowEta_hR9central = _EBlowEta_hR9central;
142     fMCSmear_EBlowEta_hR9gap = _EBlowEta_hR9gap;
143 bendavid 1.13 fMCSmear_EBlowEta_lR9 = _EBlowEta_lR9;
144     fMCSmear_EBhighEta_hR9 = _EBhighEta_hR9;
145     fMCSmear_EBhighEta_lR9 = _EBhighEta_lR9;
146     fMCSmear_EElowEta_hR9 = _EElowEta_hR9;
147     fMCSmear_EElowEta_lR9 = _EElowEta_lR9;
148     fMCSmear_EEhighEta_hR9 = _EEhighEta_hR9;
149     fMCSmear_EEhighEta_lR9 = _EEhighEta_lR9;
150 fabstoec 1.1 };
151 fabstoec 1.2
152 bendavid 1.15 void SetApplyEleVeto(bool a) { fApplyEleVeto = a; }
153 bendavid 1.7 void SetInvertElectronVeto(Bool_t b) { fInvertElectronVeto = b; }
154 fabstoec 1.2 void DoDataEneCorr(bool a) { fDoDataEneCorr = a; }
155     void DoMCSmear(bool a) { fDoMCSmear = a; }
156    
157 bendavid 1.7 void SetGoodElectronsFromBranch(Bool_t b) { fGoodElectronsFromBranch = b; }
158     void SetGoodElectronName(TString name) { fGoodElectronName = name; }
159 bendavid 1.8 void SetDoRegression(Bool_t b) { fDoRegression = b; }
160     void SetEtaCorrections(const TH1D *h) { fEtaCorrections = h; }
161 mingyang 1.12 void SetBdtCutBarrel(Float_t x) { fbdtCutBarrel = x; }
162     void SetBdtCutEndcap(Float_t x) { fbdtCutEndcap = x; }
163 bendavid 1.13
164     void SetDoMCR9Scaling(Bool_t b) { fDoMCR9Scaling = b; }
165     void SetMCR9Scale(Double_t ebscale, Double_t eescale) { fMCR9ScaleEB = ebscale; fMCR9ScaleEE = eescale; }
166 bendavid 1.16 void SetDoMCSigIEtaIEtaScaling(Bool_t b) { fDoMCSigIEtaIEtaScaling = b; }
167 bendavid 1.17 void SetDoMCWidthScaling(Bool_t b) { fDoMCWidthScaling = b; }
168 mingyang 1.23 void SetMCSigIEtaIEtaScale(Double_t ebscale,Double_t ebshift,Double_t eescale,Double_t eeshift) {fMCSigIEtaIEtaScaleEB=ebscale;fMCSigIEtaIEtaShiftEB=ebshift;fMCSigIEtaIEtaScaleEE=eescale;fMCSigIEtaIEtaShiftEE=eeshift;}
169     void SetMCWidthScale(Double_t scale,Double_t shift) {fMCWidthScale=scale;fMCWidthShift=shift;}
170 bendavid 1.13 void SetDoMCErrScaling(Bool_t b) { fDoMCErrScaling = b; }
171     void SetMCErrScale(Double_t ebscale, Double_t eescale) { fMCErrScaleEB = ebscale; fMCErrScaleEE = eescale; }
172    
173 bendavid 1.20 void SetJetsName(const char *n) { fJetsName = n; }
174    
175 fabstoec 1.1 protected:
176     void Process();
177     void SlaveBegin();
178    
179     // private auxiliary methods...
180 bendavid 1.7 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
181 fabstoec 1.1 Int_t FindRunRangeIdx(UInt_t run);
182 bendavid 1.13 Double_t GetDataEnCorr(Int_t runRange, PhotonTools::eScaleCats cat);
183     Double_t GetMCSmearFac(PhotonTools::eScaleCats cat);
184 fabstoec 1.1 Float_t GetEventCat(PhotonTools::CiCBaseLineCats cat1, PhotonTools::CiCBaseLineCats cat2);
185    
186     // Names for the input Collections
187     TString fPhotonBranchName;
188     TString fElectronName;
189 bendavid 1.7 TString fGoodElectronName;
190 fabstoec 1.1 TString fConversionName;
191     TString fTrackBranchName;
192     TString fPileUpDenName;
193     TString fPVName;
194     TString fBeamspotName;
195     TString fPFCandName;
196     TString fMCParticleName;
197     TString fPileUpName;
198 bendavid 1.20 TString fJetsName;
199     TString fPFMetName;
200 fabstoec 1.1
201     TString fGoodPhotonsName; //name of exported "good photon" collection
202 fabstoec 1.19 TString fChosenVtxName; //name of exported "chosen Vtx" collection
203 fabstoec 1.1
204     // Selection Types
205     TString fPhotonSelType;
206     TString fVertexSelType;
207     PhotonSelection fPhSelType;
208     VertexSelection fVtxSelType;
209    
210 mingyang 1.22 // Id Type
211     TString fIdMVAType;
212     IdMVA fIdType;
213    
214 fabstoec 1.1 // Basic Pre-Selection kinematics
215     Double_t fPhotonPtMin; // min pt cut fro PRE-SELECTION!
216     Double_t fPhotonEtaMax; // max eta cut for PRE-SELECTION!
217    
218     Double_t fLeadingPtMin;
219     Double_t fTrailingPtMin;
220    
221     // is it Data or MC?
222     Bool_t fIsData;
223    
224     // in case there's some PV pre-selection
225     Bool_t fPhotonsFromBranch;
226     Bool_t fPVFromBranch;
227 bendavid 1.7 Bool_t fGoodElectronsFromBranch;
228 fabstoec 1.1
229     const PhotonCol *fPhotons;
230     const ElectronCol *fElectrons;
231 bendavid 1.7 const ElectronCol *fGoodElectrons;
232 fabstoec 1.1 const DecayParticleCol *fConversions;
233     const TrackCol *fTracks;
234     const PileupEnergyDensityCol *fPileUpDen;
235     const VertexCol *fPV;
236     const BeamSpotCol *fBeamspot;
237     const PFCandidateCol *fPFCands;
238     const MCParticleCol *fMCParticles;
239     const PileupInfoCol *fPileUp;
240 bendavid 1.20 const JetCol *fJets;
241     const PFMetCol *fPFMet;
242    
243    
244 fabstoec 1.1 // Vectroes to hols smeraring/correction factors
245 bendavid 1.14 std::vector<Double_t> fDataEnCorr_EBlowEta_hR9central;
246     std::vector<Double_t> fDataEnCorr_EBlowEta_hR9gap;
247 bendavid 1.13 std::vector<Double_t> fDataEnCorr_EBlowEta_lR9;
248     std::vector<Double_t> fDataEnCorr_EBhighEta_hR9;
249     std::vector<Double_t> fDataEnCorr_EBhighEta_lR9;
250     std::vector<Double_t> fDataEnCorr_EElowEta_hR9;
251     std::vector<Double_t> fDataEnCorr_EElowEta_lR9;
252     std::vector<Double_t> fDataEnCorr_EEhighEta_hR9;
253     std::vector<Double_t> fDataEnCorr_EEhighEta_lR9;
254 fabstoec 1.1
255 paus 1.18 std::vector<UInt_t> fRunStart;
256     std::vector<UInt_t> fRunEnd;
257 fabstoec 1.1
258 paus 1.18 Double_t fMCSmear_EBlowEta_hR9central;
259     Double_t fMCSmear_EBlowEta_hR9gap;
260     Double_t fMCSmear_EBlowEta_lR9;
261     Double_t fMCSmear_EBhighEta_hR9;
262     Double_t fMCSmear_EBhighEta_lR9;
263     Double_t fMCSmear_EElowEta_hR9;
264     Double_t fMCSmear_EElowEta_lR9;
265     Double_t fMCSmear_EEhighEta_hR9;
266     Double_t fMCSmear_EEhighEta_lR9;
267 fabstoec 1.1
268     // pointer to RNG ionstance for smearing
269 paus 1.18 TRandom3* fRng;
270     EGEnergyCorrector fEgCor;
271     Bool_t fDoRegression;
272     TString fPhFixString;
273     TString fPhFixFile;
274     TString fRegWeights;
275    
276     const TH1D *fEtaCorrections;
277 bendavid 1.8
278 fabstoec 1.1 // --------------------------------
279     // some streagin flags, not adjustable yet (FIX-ME)
280 paus 1.18 bool fDoDataEneCorr;
281     bool fDoMCSmear;
282     bool fDoVtxSelection;
283     bool fApplyEleVeto;
284     Bool_t fInvertElectronVeto; //=true (invert ele veto, for cic sel only atm)
285 mingyang 1.10
286     //MVA
287 mingyang 1.22 int fVariableType_2011;
288     TString fEndcapWeights_2011;
289     TString fBarrelWeights_2011;
290     int fVariableType_2012_globe;
291     TString fEndcapWeights_2012_globe;
292     TString fBarrelWeights_2012_globe;
293 paus 1.18 MVATools fTool;
294     Float_t fbdtCutBarrel;
295     Float_t fbdtCutEndcap;
296    
297     VertexTools fVtxTools;
298    
299     Bool_t fDoMCR9Scaling;
300     Double_t fMCR9ScaleEB;
301     Double_t fMCR9ScaleEE;
302    
303     Bool_t fDoMCSigIEtaIEtaScaling;
304     Bool_t fDoMCWidthScaling;
305 mingyang 1.23
306     Double_t fMCSigIEtaIEtaScaleEB;
307     Double_t fMCSigIEtaIEtaShiftEB;
308     Double_t fMCSigIEtaIEtaScaleEE;
309     Double_t fMCSigIEtaIEtaShiftEE;
310     Double_t fMCWidthScale;
311     Double_t fMCWidthShift;
312 paus 1.18
313     Bool_t fDoMCErrScaling;
314     Double_t fMCErrScaleEB;
315     Double_t fMCErrScaleEE;
316     UInt_t fRegressionVersion;
317    
318     Bool_t fRelativePtCuts;
319 bendavid 1.13
320 bendavid 1.20 MVAMet fMVAMet;
321    
322 fabstoec 1.1 ClassDef(PhotonPairSelector, 1) // Photon identification module
323     };
324     }
325     #endif