ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.16
Committed: Sat Dec 17 22:29:30 2011 UTC (13 years, 4 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.15: +4 -1 lines
Log Message:
further small gamma gamma updates

File Contents

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