ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.14
Committed: Sun Dec 11 00:03:04 2011 UTC (13 years, 4 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.13: +18 -7 lines
Log Message:
more photon updates for mva plus id analysis

File Contents

# User Rev Content
1 fabstoec 1.1 //--------------------------------------------------------------------------------------------------
2 mingyang 1.10 // M.Yang 2011/10/12
3 bendavid 1.14 // $Id: PhotonPairSelector.h,v 1.13 2011/11/18 00:07:16 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     void ApplyEleVeto(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     void SetDoMCErrScaling(Bool_t b) { fDoMCErrScaling = b; }
151     void SetMCErrScale(Double_t ebscale, Double_t eescale) { fMCErrScaleEB = ebscale; fMCErrScaleEE = eescale; }
152 bendavid 1.14 void SetRegressionVersion(UInt_t v) { fRegressionVersion = v; }
153     void SetRegressionWeights(TString f) { fRegWeights = f; }
154 bendavid 1.13
155 fabstoec 1.1 protected:
156     void Process();
157     void SlaveBegin();
158    
159     // private auxiliary methods...
160 bendavid 1.7 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
161 fabstoec 1.1 Int_t FindRunRangeIdx(UInt_t run);
162 bendavid 1.13 Double_t GetDataEnCorr(Int_t runRange, PhotonTools::eScaleCats cat);
163     Double_t GetMCSmearFac(PhotonTools::eScaleCats cat);
164 fabstoec 1.1 Float_t GetEventCat(PhotonTools::CiCBaseLineCats cat1, PhotonTools::CiCBaseLineCats cat2);
165    
166     // Names for the input Collections
167     TString fPhotonBranchName;
168     TString fElectronName;
169 bendavid 1.7 TString fGoodElectronName;
170 fabstoec 1.1 TString fConversionName;
171     TString fTrackBranchName;
172     TString fPileUpDenName;
173     TString fPVName;
174     TString fBeamspotName;
175     TString fPFCandName;
176     TString fMCParticleName;
177     TString fPileUpName;
178    
179     TString fGoodPhotonsName; //name of exported "good photon" collection
180    
181     // Selection Types
182     TString fPhotonSelType;
183     TString fVertexSelType;
184     PhotonSelection fPhSelType;
185     VertexSelection fVtxSelType;
186    
187     // Basic Pre-Selection kinematics
188     Double_t fPhotonPtMin; // min pt cut fro PRE-SELECTION!
189     Double_t fPhotonEtaMax; // max eta cut for PRE-SELECTION!
190    
191     Double_t fLeadingPtMin;
192     Double_t fTrailingPtMin;
193    
194     // is it Data or MC?
195     Bool_t fIsData;
196    
197     // in case there's some PV pre-selection
198     Bool_t fPhotonsFromBranch;
199     Bool_t fPVFromBranch;
200 bendavid 1.7 Bool_t fGoodElectronsFromBranch;
201 fabstoec 1.1
202     const PhotonCol *fPhotons;
203     const ElectronCol *fElectrons;
204 bendavid 1.7 const ElectronCol *fGoodElectrons;
205 fabstoec 1.1 const DecayParticleCol *fConversions;
206     const TrackCol *fTracks;
207     const PileupEnergyDensityCol *fPileUpDen;
208     const VertexCol *fPV;
209     const BeamSpotCol *fBeamspot;
210     const PFCandidateCol *fPFCands;
211     const MCParticleCol *fMCParticles;
212     const PileupInfoCol *fPileUp;
213    
214     // Vectroes to hols smeraring/correction factors
215 bendavid 1.14 std::vector<Double_t> fDataEnCorr_EBlowEta_hR9central;
216     std::vector<Double_t> fDataEnCorr_EBlowEta_hR9gap;
217 bendavid 1.13 std::vector<Double_t> fDataEnCorr_EBlowEta_lR9;
218     std::vector<Double_t> fDataEnCorr_EBhighEta_hR9;
219     std::vector<Double_t> fDataEnCorr_EBhighEta_lR9;
220     std::vector<Double_t> fDataEnCorr_EElowEta_hR9;
221     std::vector<Double_t> fDataEnCorr_EElowEta_lR9;
222     std::vector<Double_t> fDataEnCorr_EEhighEta_hR9;
223     std::vector<Double_t> fDataEnCorr_EEhighEta_lR9;
224 fabstoec 1.1
225     std::vector<UInt_t> fRunStart;
226     std::vector<UInt_t> fRunEnd;
227    
228 bendavid 1.14 Double_t fMCSmear_EBlowEta_hR9central;
229     Double_t fMCSmear_EBlowEta_hR9gap;
230 bendavid 1.13 Double_t fMCSmear_EBlowEta_lR9;
231     Double_t fMCSmear_EBhighEta_hR9;
232     Double_t fMCSmear_EBhighEta_lR9;
233     Double_t fMCSmear_EElowEta_hR9;
234     Double_t fMCSmear_EElowEta_lR9;
235     Double_t fMCSmear_EEhighEta_hR9;
236     Double_t fMCSmear_EEhighEta_lR9;
237 fabstoec 1.1
238     // pointer to RNG ionstance for smearing
239     TRandom3* rng;
240 bendavid 1.8 EGEnergyCorrector egcor;
241     Bool_t fDoRegression;
242     TString fPhFixString;
243     TString fPhFixFile;
244 bendavid 1.9 TString fRegWeights;
245 mingyang 1.10
246 bendavid 1.8 const TH1D *fEtaCorrections;
247    
248 fabstoec 1.1 // --------------------------------
249     // some streagin flags, not adjustable yet (FIX-ME)
250     bool fDoDataEneCorr;
251     bool fDoMCSmear;
252     bool fDoVtxSelection;
253 fabstoec 1.2 bool fApplyEleVeto;
254 mingyang 1.10 Bool_t fInvertElectronVeto; //=true then invert electron veto (for cic selection only atm)
255    
256     //MVA
257     int fVariableType;
258     TString fEndcapWeights;
259     TString fBarrelWeights;
260     MVATools fTool;
261 mingyang 1.11 Float_t fbdtCutBarrel;
262     Float_t fbdtCutEndcap;
263 bendavid 1.13
264     VertexTools fVtxTools;
265    
266     Bool_t fDoMCR9Scaling;
267     Double_t fMCR9ScaleEB;
268     Double_t fMCR9ScaleEE;
269    
270     Bool_t fDoMCErrScaling;
271     Double_t fMCErrScaleEB;
272     Double_t fMCErrScaleEE;
273 bendavid 1.14 UInt_t fRegressionVersion;
274    
275     Bool_t fRelativePtCuts;
276 bendavid 1.13
277 fabstoec 1.1 ClassDef(PhotonPairSelector, 1) // Photon identification module
278     };
279     }
280     #endif