ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.8
Committed: Thu Sep 8 15:51:23 2011 UTC (13 years, 7 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025pre2, Mit_025pre1
Changes since 1.7: +16 -2 lines
Log Message:
Add tool and required changes for photon energy regression

File Contents

# User Rev Content
1 fabstoec 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.8 // $Id: PhotonPairSelector.h,v 1.7 2011/08/03 17:15:43 bendavid Exp $
3 fabstoec 1.1 //
4     // PhotonPairSelector
5     //
6     // Authors: F. Stoeckli
7     //--------------------------------------------------------------------------------------------------
8    
9     #ifndef MITPHYSICS_MODS_PHOTONPAIRSELECTOR_H
10     #define MITPHYSICS_MODS_PHOTONPAIRSELECTOR_H
11    
12     #include "MitAna/TreeMod/interface/BaseMod.h"
13     #include "MitAna/DataTree/interface/PhotonFwd.h"
14     #include "MitAna/DataTree/interface/TrackCol.h"
15     #include "MitAna/DataTree/interface/VertexCol.h"
16     #include "MitAna/DataTree/interface/BeamSpotCol.h"
17     #include "MitAna/DataTree/interface/PFCandidateCol.h"
18     #include "MitAna/DataTree/interface/PileupEnergyDensityCol.h"
19     #include "MitAna/DataTree/interface/DecayParticleCol.h"
20     #include "MitAna/DataTree/interface/ElectronCol.h"
21     #include "MitAna/DataTree/interface/DecayParticleCol.h"
22     #include "MitAna/DataTree/interface/PileupInfoCol.h"
23     #include "MitAna/DataTree/interface/MCParticleCol.h"
24    
25     #include "MitPhysics/Utils/interface/PhotonTools.h"
26 bendavid 1.8 #include "MitPhysics/Utils/interface/EGEnergyCorrector.h"
27 fabstoec 1.1
28     class TNtuple;
29     class TRandom3;
30 bendavid 1.8 class TH1D;
31 fabstoec 1.1
32     namespace mithep
33 bendavid 1.7 {
34 fabstoec 1.1 class PhotonPairSelector : public BaseMod
35     {
36     public:
37     PhotonPairSelector(const char *name ="PhotonPairSelector",
38     const char *title="Selecting PhotonPairs");
39    
40     ~PhotonPairSelector();
41    
42     enum PhotonSelection {
43     kNoPhSelection = 0,
44     kCiCPhSelection,
45     kMITPhSelection
46     };
47     enum VertexSelection {
48     kStdVtxSelection = 0,
49     kCiCVtxSelection,
50     kMITVtxSelection
51     };
52    
53     // setting all the input Names
54     void SetInputPhotonsName(const char *n){ fPhotonBranchName= n; }
55     void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
56     void SetTrackName(const char *n) { fTrackBranchName = n; }
57     void SetElectronName(const char *n) { fElectronName = n; }
58     void SetConversionName(const char *n) { fConversionName = n; }
59     void SetPUDensityName(const char *n) { fPileUpDenName = n; }
60     void SetPVName(const char *n) { fPVName = n; }
61     void SetPVFromBranch(bool b) { fPVFromBranch = b; }
62     void SetMCParticle(const char *n) { fMCParticleName = n; }
63     void SetPUInfoName(const char *n) { fPileUpName = n; }
64     void SetBeamspotName(const char *n) { fBeamspotName = n; }
65     void SetPFCandName(const char *n) { fPFCandName = n; }
66    
67     // set the type of selection
68     void SetPhotonSelType(const char *type){ fPhotonSelType = type; }
69     void SetVertexSelType(const char *type){ fVertexSelType = type; }
70    
71     // get/set the Names for the output Photon Collection
72     const char *GetOutputName() const { return fGoodPhotonsName; }
73     void SetOutputName(const char *n) { fGoodPhotonsName=n; }
74    
75     // set basic Cut variables (FOR PRE-SELECTION)
76     void SetPtMin(Double_t pt) { fPhotonPtMin = pt; }
77     void SetAbsEtaMax(Double_t eta) { fPhotonEtaMax = eta; }
78    
79     void SetLeadingPtMin(Double_t pt) { fLeadingPtMin = pt; }
80 fabstoec 1.6 void SetTrailingPtMin(Double_t pt) { fTrailingPtMin = pt; }
81 fabstoec 1.1
82     // is Data Or Not?
83     void SetIsData (Bool_t b) { fIsData = b;};
84    
85     // methods to set the MC smearing/energy correction values
86     void AddEnCorrPerRun( UInt_t sRun, UInt_t eRun,
87     Double_t corr_EB_hR9,
88     Double_t corr_EB_lR9,
89     Double_t corr_EE_hR9,
90     Double_t corr_EE_lR9) {
91    
92     fDataEnCorr_EB_hR9.push_back(corr_EB_hR9);
93     fDataEnCorr_EB_lR9.push_back(corr_EB_lR9);
94     fDataEnCorr_EE_hR9.push_back(corr_EE_hR9);
95     fDataEnCorr_EE_lR9.push_back(corr_EE_lR9);
96     fRunStart.push_back (sRun);
97     fRunEnd.push_back (eRun);
98     };
99    
100     void SetMCSmearFactors(Double_t _EB_hR9,
101     Double_t _EB_lR9,
102     Double_t _EE_hR9,
103     Double_t _EE_lR9) {
104     fMCSmear_EB_hR9 = _EB_hR9;
105     fMCSmear_EB_lR9 = _EB_lR9;
106     fMCSmear_EE_hR9 = _EE_hR9;
107     fMCSmear_EE_lR9 = _EE_lR9;
108     };
109 fabstoec 1.2
110     void ApplyEleVeto(bool a) { fApplyEleVeto = a; }
111 bendavid 1.7 void SetInvertElectronVeto(Bool_t b) { fInvertElectronVeto = b; }
112 fabstoec 1.2 void DoDataEneCorr(bool a) { fDoDataEneCorr = a; }
113     void DoMCSmear(bool a) { fDoMCSmear = a; }
114    
115 bendavid 1.7 void SetGoodElectronsFromBranch(Bool_t b) { fGoodElectronsFromBranch = b; }
116     void SetGoodElectronName(TString name) { fGoodElectronName = name; }
117 bendavid 1.8 void SetDoRegression(Bool_t b) { fDoRegression = b; }
118     void SetEtaCorrections(const TH1D *h) { fEtaCorrections = h; }
119 fabstoec 1.2
120 fabstoec 1.1 protected:
121     void Process();
122     void SlaveBegin();
123    
124     // private auxiliary methods...
125 bendavid 1.7 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
126 fabstoec 1.1 Int_t FindRunRangeIdx(UInt_t run);
127     Double_t GetDataEnCorr(Int_t runRange, PhotonTools::CiCBaseLineCats cat);
128     Double_t GetMCSmearFac(PhotonTools::CiCBaseLineCats cat);
129     Float_t GetEventCat(PhotonTools::CiCBaseLineCats cat1, PhotonTools::CiCBaseLineCats cat2);
130    
131     // Names for the input Collections
132     TString fPhotonBranchName;
133     TString fElectronName;
134 bendavid 1.7 TString fGoodElectronName;
135 fabstoec 1.1 TString fConversionName;
136     TString fTrackBranchName;
137     TString fPileUpDenName;
138     TString fPVName;
139     TString fBeamspotName;
140     TString fPFCandName;
141     TString fMCParticleName;
142     TString fPileUpName;
143    
144     TString fGoodPhotonsName; //name of exported "good photon" collection
145    
146     // Selection Types
147     TString fPhotonSelType;
148     TString fVertexSelType;
149     PhotonSelection fPhSelType;
150     VertexSelection fVtxSelType;
151    
152     // Basic Pre-Selection kinematics
153     Double_t fPhotonPtMin; // min pt cut fro PRE-SELECTION!
154     Double_t fPhotonEtaMax; // max eta cut for PRE-SELECTION!
155    
156     Double_t fLeadingPtMin;
157     Double_t fTrailingPtMin;
158    
159     // is it Data or MC?
160     Bool_t fIsData;
161    
162     // in case there's some PV pre-selection
163     Bool_t fPhotonsFromBranch;
164     Bool_t fPVFromBranch;
165 bendavid 1.7 Bool_t fGoodElectronsFromBranch;
166 fabstoec 1.1
167     const PhotonCol *fPhotons;
168     const ElectronCol *fElectrons;
169 bendavid 1.7 const ElectronCol *fGoodElectrons;
170 fabstoec 1.1 const DecayParticleCol *fConversions;
171     const TrackCol *fTracks;
172     const PileupEnergyDensityCol *fPileUpDen;
173     const VertexCol *fPV;
174     const BeamSpotCol *fBeamspot;
175     const PFCandidateCol *fPFCands;
176     const MCParticleCol *fMCParticles;
177     const PileupInfoCol *fPileUp;
178    
179     // Vectroes to hols smeraring/correction factors
180     std::vector<Double_t> fDataEnCorr_EB_hR9;
181     std::vector<Double_t> fDataEnCorr_EB_lR9;
182     std::vector<Double_t> fDataEnCorr_EE_hR9;
183     std::vector<Double_t> fDataEnCorr_EE_lR9;
184    
185     std::vector<UInt_t> fRunStart;
186     std::vector<UInt_t> fRunEnd;
187    
188     Double_t fMCSmear_EB_hR9;
189     Double_t fMCSmear_EB_lR9;
190     Double_t fMCSmear_EE_hR9;
191     Double_t fMCSmear_EE_lR9;
192    
193     // pointer to RNG ionstance for smearing
194     TRandom3* rng;
195 bendavid 1.8 EGEnergyCorrector egcor;
196     Bool_t fDoRegression;
197     TString fPhFixString;
198     TString fPhFixFile;
199     TString fEBWeights;
200     TString fEBVarWeights;
201     TString fEEWeights;
202     TString fEEVarWeights;
203    
204     const TH1D *fEtaCorrections;
205    
206 fabstoec 1.1 // --------------------------------
207     // some streagin flags, not adjustable yet (FIX-ME)
208     bool fDoDataEneCorr;
209     bool fDoMCSmear;
210     bool fDoVtxSelection;
211 fabstoec 1.2 bool fApplyEleVeto;
212 bendavid 1.7 Bool_t fInvertElectronVeto; //=true then invert electron veto (for cic selection only atm)
213 fabstoec 1.1
214     ClassDef(PhotonPairSelector, 1) // Photon identification module
215     };
216     }
217     #endif