ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.29
Committed: Thu Aug 2 12:30:55 2012 UTC (12 years, 9 months ago) by fabstoec
Content type: text/plain
Branch: MAIN
Changes since 1.28: +9 -6 lines
Log Message:
updated MVATools

File Contents

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