ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.13
Committed: Fri Nov 18 00:07:16 2011 UTC (13 years, 5 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.12: +72 -31 lines
Log Message:
8 cat energy smearing and scaling, bdt vertex selection and probability, scaled pt cuts for photons

File Contents

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