ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.19
Committed: Thu May 3 08:45:29 2012 UTC (13 years ago) by fabstoec
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_028, Mit_027, Mit_027a
Changes since 1.18: +6 -1 lines
Log Message:
small update on RhoUtilities (changed default from NONE to DEFAULT)

File Contents

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