ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.24
Committed: Mon May 28 14:24:48 2012 UTC (12 years, 11 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.23: +5 -1 lines
Log Message:
Add single leg conversion option for diphoton vertex selection

File Contents

# User Rev Content
1 fabstoec 1.1 //--------------------------------------------------------------------------------------------------
2 mingyang 1.10 // M.Yang 2011/10/12
3 bendavid 1.24 // $Id: PhotonPairSelector.h,v 1.23 2012/05/28 02:14:29 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.24 void SetUseSingleLegConversions(Bool_t b) { fUseSingleLegConversions = b; }
160 bendavid 1.8 void SetDoRegression(Bool_t b) { fDoRegression = b; }
161     void SetEtaCorrections(const TH1D *h) { fEtaCorrections = h; }
162 mingyang 1.12 void SetBdtCutBarrel(Float_t x) { fbdtCutBarrel = x; }
163     void SetBdtCutEndcap(Float_t x) { fbdtCutEndcap = x; }
164 bendavid 1.13
165     void SetDoMCR9Scaling(Bool_t b) { fDoMCR9Scaling = b; }
166     void SetMCR9Scale(Double_t ebscale, Double_t eescale) { fMCR9ScaleEB = ebscale; fMCR9ScaleEE = eescale; }
167 bendavid 1.16 void SetDoMCSigIEtaIEtaScaling(Bool_t b) { fDoMCSigIEtaIEtaScaling = b; }
168 bendavid 1.17 void SetDoMCWidthScaling(Bool_t b) { fDoMCWidthScaling = b; }
169 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;}
170     void SetMCWidthScale(Double_t scale,Double_t shift) {fMCWidthScale=scale;fMCWidthShift=shift;}
171 bendavid 1.13 void SetDoMCErrScaling(Bool_t b) { fDoMCErrScaling = b; }
172     void SetMCErrScale(Double_t ebscale, Double_t eescale) { fMCErrScaleEB = ebscale; fMCErrScaleEE = eescale; }
173    
174 bendavid 1.20 void SetJetsName(const char *n) { fJetsName = n; }
175    
176 fabstoec 1.1 protected:
177     void Process();
178     void SlaveBegin();
179    
180     // private auxiliary methods...
181 bendavid 1.7 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
182 fabstoec 1.1 Int_t FindRunRangeIdx(UInt_t run);
183 bendavid 1.13 Double_t GetDataEnCorr(Int_t runRange, PhotonTools::eScaleCats cat);
184     Double_t GetMCSmearFac(PhotonTools::eScaleCats cat);
185 fabstoec 1.1 Float_t GetEventCat(PhotonTools::CiCBaseLineCats cat1, PhotonTools::CiCBaseLineCats cat2);
186    
187     // Names for the input Collections
188     TString fPhotonBranchName;
189     TString fElectronName;
190 bendavid 1.7 TString fGoodElectronName;
191 fabstoec 1.1 TString fConversionName;
192 bendavid 1.24 TString fPFConversionName;
193 fabstoec 1.1 TString fTrackBranchName;
194     TString fPileUpDenName;
195     TString fPVName;
196     TString fBeamspotName;
197     TString fPFCandName;
198     TString fMCParticleName;
199     TString fPileUpName;
200 bendavid 1.20 TString fJetsName;
201     TString fPFMetName;
202 fabstoec 1.1
203     TString fGoodPhotonsName; //name of exported "good photon" collection
204 fabstoec 1.19 TString fChosenVtxName; //name of exported "chosen Vtx" collection
205 fabstoec 1.1
206     // Selection Types
207     TString fPhotonSelType;
208     TString fVertexSelType;
209     PhotonSelection fPhSelType;
210     VertexSelection fVtxSelType;
211    
212 mingyang 1.22 // Id Type
213     TString fIdMVAType;
214     IdMVA fIdType;
215    
216 fabstoec 1.1 // Basic Pre-Selection kinematics
217     Double_t fPhotonPtMin; // min pt cut fro PRE-SELECTION!
218     Double_t fPhotonEtaMax; // max eta cut for PRE-SELECTION!
219    
220     Double_t fLeadingPtMin;
221     Double_t fTrailingPtMin;
222    
223     // is it Data or MC?
224     Bool_t fIsData;
225    
226     // in case there's some PV pre-selection
227     Bool_t fPhotonsFromBranch;
228     Bool_t fPVFromBranch;
229 bendavid 1.7 Bool_t fGoodElectronsFromBranch;
230 bendavid 1.24 Bool_t fUseSingleLegConversions;
231 fabstoec 1.1
232     const PhotonCol *fPhotons;
233     const ElectronCol *fElectrons;
234 bendavid 1.7 const ElectronCol *fGoodElectrons;
235 fabstoec 1.1 const DecayParticleCol *fConversions;
236 bendavid 1.24 const DecayParticleCol *fPFConversions;
237 fabstoec 1.1 const TrackCol *fTracks;
238     const PileupEnergyDensityCol *fPileUpDen;
239     const VertexCol *fPV;
240     const BeamSpotCol *fBeamspot;
241     const PFCandidateCol *fPFCands;
242     const MCParticleCol *fMCParticles;
243     const PileupInfoCol *fPileUp;
244 bendavid 1.20 const JetCol *fJets;
245     const PFMetCol *fPFMet;
246    
247    
248 fabstoec 1.1 // Vectroes to hols smeraring/correction factors
249 bendavid 1.14 std::vector<Double_t> fDataEnCorr_EBlowEta_hR9central;
250     std::vector<Double_t> fDataEnCorr_EBlowEta_hR9gap;
251 bendavid 1.13 std::vector<Double_t> fDataEnCorr_EBlowEta_lR9;
252     std::vector<Double_t> fDataEnCorr_EBhighEta_hR9;
253     std::vector<Double_t> fDataEnCorr_EBhighEta_lR9;
254     std::vector<Double_t> fDataEnCorr_EElowEta_hR9;
255     std::vector<Double_t> fDataEnCorr_EElowEta_lR9;
256     std::vector<Double_t> fDataEnCorr_EEhighEta_hR9;
257     std::vector<Double_t> fDataEnCorr_EEhighEta_lR9;
258 fabstoec 1.1
259 paus 1.18 std::vector<UInt_t> fRunStart;
260     std::vector<UInt_t> fRunEnd;
261 fabstoec 1.1
262 paus 1.18 Double_t fMCSmear_EBlowEta_hR9central;
263     Double_t fMCSmear_EBlowEta_hR9gap;
264     Double_t fMCSmear_EBlowEta_lR9;
265     Double_t fMCSmear_EBhighEta_hR9;
266     Double_t fMCSmear_EBhighEta_lR9;
267     Double_t fMCSmear_EElowEta_hR9;
268     Double_t fMCSmear_EElowEta_lR9;
269     Double_t fMCSmear_EEhighEta_hR9;
270     Double_t fMCSmear_EEhighEta_lR9;
271 fabstoec 1.1
272     // pointer to RNG ionstance for smearing
273 paus 1.18 TRandom3* fRng;
274     EGEnergyCorrector fEgCor;
275     Bool_t fDoRegression;
276     TString fPhFixString;
277     TString fPhFixFile;
278     TString fRegWeights;
279    
280     const TH1D *fEtaCorrections;
281 bendavid 1.8
282 fabstoec 1.1 // --------------------------------
283     // some streagin flags, not adjustable yet (FIX-ME)
284 paus 1.18 bool fDoDataEneCorr;
285     bool fDoMCSmear;
286     bool fDoVtxSelection;
287     bool fApplyEleVeto;
288     Bool_t fInvertElectronVeto; //=true (invert ele veto, for cic sel only atm)
289 mingyang 1.10
290     //MVA
291 mingyang 1.22 int fVariableType_2011;
292     TString fEndcapWeights_2011;
293     TString fBarrelWeights_2011;
294     int fVariableType_2012_globe;
295     TString fEndcapWeights_2012_globe;
296     TString fBarrelWeights_2012_globe;
297 paus 1.18 MVATools fTool;
298     Float_t fbdtCutBarrel;
299     Float_t fbdtCutEndcap;
300    
301     VertexTools fVtxTools;
302    
303     Bool_t fDoMCR9Scaling;
304     Double_t fMCR9ScaleEB;
305     Double_t fMCR9ScaleEE;
306    
307     Bool_t fDoMCSigIEtaIEtaScaling;
308     Bool_t fDoMCWidthScaling;
309 mingyang 1.23
310     Double_t fMCSigIEtaIEtaScaleEB;
311     Double_t fMCSigIEtaIEtaShiftEB;
312     Double_t fMCSigIEtaIEtaScaleEE;
313     Double_t fMCSigIEtaIEtaShiftEE;
314     Double_t fMCWidthScale;
315     Double_t fMCWidthShift;
316 paus 1.18
317     Bool_t fDoMCErrScaling;
318     Double_t fMCErrScaleEB;
319     Double_t fMCErrScaleEE;
320     UInt_t fRegressionVersion;
321    
322     Bool_t fRelativePtCuts;
323 bendavid 1.13
324 bendavid 1.20 MVAMet fMVAMet;
325    
326 fabstoec 1.1 ClassDef(PhotonPairSelector, 1) // Photon identification module
327     };
328     }
329     #endif