ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.27
Committed: Tue Jul 24 11:41:22 2012 UTC (12 years, 9 months ago) by fabstoec
Content type: text/plain
Branch: MAIN
Changes since 1.26: +11 -15 lines
Log Message:
outsourced Photon shower-shape scaling to PhotonTools

File Contents

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