ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.4
Committed: Sun Jul 24 20:08:26 2011 UTC (13 years, 9 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.3: +7 -15 lines
Log Message:
go back to flat trees, but now dynamically generated

File Contents

# User Rev Content
1 fabstoec 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.3 // $Id: PhotonPairSelector.h,v 1.2 2011/07/15 17:24:37 fabstoec 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    
27     class TNtuple;
28     class TRandom3;
29    
30     namespace mithep
31     {
32 bendavid 1.4
33     class PhotonPairSelectorPhoton
34 bendavid 1.3 {
35     public:
36     void SetVars(const Photon *p, const MCParticle *m = 0);
37    
38     private:
39     Float_t e;
40     Float_t pt;
41     Float_t eta;
42     Float_t phi;
43     Float_t r9;
44     Float_t e5x5;
45     Float_t sce;
46     Float_t scrawe;
47     Float_t scpse;
48     Float_t sceta;
49     Float_t scphi;
50     Bool_t isbarrel;
51     Bool_t isr9reco;
52     Bool_t isr9cat;
53     UChar_t phcat;
54     Bool_t ispromptgen;
55     Float_t gene;
56     Float_t genpt;
57     Float_t geneta;
58     Float_t genphi;
59    
60    
61    
62     };
63    
64 bendavid 1.4 class PhotonPairSelectorDiphotonEvent
65 bendavid 1.3 {
66     public:
67     Float_t rho;
68     Float_t genHiggspt;
69     Float_t genHiggsZ;
70     Float_t gencostheta;
71     Float_t vtxZ;
72     Int_t numPU;
73     Int_t numPUminus;
74     Int_t numPUplus;
75     Float_t mass;
76     Float_t ptgg;
77     Float_t costheta;
78     UInt_t evt;
79     UInt_t run;
80     UInt_t lumi;
81     UChar_t evtcat;
82 bendavid 1.4 PhotonPairSelectorPhoton photons[2];
83    
84 bendavid 1.3
85     };
86    
87 fabstoec 1.1 class PhotonPairSelector : public BaseMod
88     {
89     public:
90     PhotonPairSelector(const char *name ="PhotonPairSelector",
91     const char *title="Selecting PhotonPairs");
92    
93     ~PhotonPairSelector();
94    
95     enum PhotonSelection {
96     kNoPhSelection = 0,
97     kCiCPhSelection,
98     kMITPhSelection
99     };
100     enum VertexSelection {
101     kStdVtxSelection = 0,
102     kCiCVtxSelection,
103     kMITVtxSelection
104     };
105    
106     // setting all the input Names
107     void SetInputPhotonsName(const char *n){ fPhotonBranchName= n; }
108     void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
109     void SetTrackName(const char *n) { fTrackBranchName = n; }
110     void SetElectronName(const char *n) { fElectronName = n; }
111     void SetConversionName(const char *n) { fConversionName = n; }
112     void SetPUDensityName(const char *n) { fPileUpDenName = n; }
113     void SetPVName(const char *n) { fPVName = n; }
114     void SetPVFromBranch(bool b) { fPVFromBranch = b; }
115     void SetMCParticle(const char *n) { fMCParticleName = n; }
116     void SetPUInfoName(const char *n) { fPileUpName = n; }
117     void SetBeamspotName(const char *n) { fBeamspotName = n; }
118     void SetPFCandName(const char *n) { fPFCandName = n; }
119    
120     // set the type of selection
121     void SetPhotonSelType(const char *type){ fPhotonSelType = type; }
122     void SetVertexSelType(const char *type){ fVertexSelType = type; }
123    
124     // get/set the Names for the output Photon Collection
125     const char *GetOutputName() const { return fGoodPhotonsName; }
126     void SetOutputName(const char *n) { fGoodPhotonsName=n; }
127    
128     // set basic Cut variables (FOR PRE-SELECTION)
129     void SetPtMin(Double_t pt) { fPhotonPtMin = pt; }
130     void SetAbsEtaMax(Double_t eta) { fPhotonEtaMax = eta; }
131    
132     void SetLeadingPtMin(Double_t pt) { fLeadingPtMin = pt; }
133     void SetTrainingPtMin(Double_t pt) { fTrailingPtMin = pt; }
134    
135     // is Data Or Not?
136     void SetIsData (Bool_t b) { fIsData = b;};
137    
138     // methods to set the MC smearing/energy correction values
139     void AddEnCorrPerRun( UInt_t sRun, UInt_t eRun,
140     Double_t corr_EB_hR9,
141     Double_t corr_EB_lR9,
142     Double_t corr_EE_hR9,
143     Double_t corr_EE_lR9) {
144    
145     fDataEnCorr_EB_hR9.push_back(corr_EB_hR9);
146     fDataEnCorr_EB_lR9.push_back(corr_EB_lR9);
147     fDataEnCorr_EE_hR9.push_back(corr_EE_hR9);
148     fDataEnCorr_EE_lR9.push_back(corr_EE_lR9);
149     fRunStart.push_back (sRun);
150     fRunEnd.push_back (eRun);
151     };
152    
153     void SetMCSmearFactors(Double_t _EB_hR9,
154     Double_t _EB_lR9,
155     Double_t _EE_hR9,
156     Double_t _EE_lR9) {
157     fMCSmear_EB_hR9 = _EB_hR9;
158     fMCSmear_EB_lR9 = _EB_lR9;
159     fMCSmear_EE_hR9 = _EE_hR9;
160     fMCSmear_EE_lR9 = _EE_lR9;
161     };
162 fabstoec 1.2
163     void ApplyEleVeto(bool a) { fApplyEleVeto = a; }
164     void DoDataEneCorr(bool a) { fDoDataEneCorr = a; }
165     void DoMCSmear(bool a) { fDoMCSmear = a; }
166    
167     void SetTupleName(const char* c) { fTupleName = c; }
168    
169 fabstoec 1.1 protected:
170     void Process();
171     void SlaveBegin();
172    
173     // private auxiliary methods...
174     void FindHiggsPtAndZ(Float_t& pt, Float_t& z);
175     Int_t FindRunRangeIdx(UInt_t run);
176     Double_t GetDataEnCorr(Int_t runRange, PhotonTools::CiCBaseLineCats cat);
177     Double_t GetMCSmearFac(PhotonTools::CiCBaseLineCats cat);
178     Float_t GetEventCat(PhotonTools::CiCBaseLineCats cat1, PhotonTools::CiCBaseLineCats cat2);
179 bendavid 1.3 const MCParticle *MatchMC(const Photon *ph) const;
180 fabstoec 1.1
181     // Names for the input Collections
182     TString fPhotonBranchName;
183     TString fElectronName;
184     TString fConversionName;
185     TString fTrackBranchName;
186     TString fPileUpDenName;
187     TString fPVName;
188     TString fBeamspotName;
189     TString fPFCandName;
190     TString fMCParticleName;
191     TString fPileUpName;
192    
193     TString fGoodPhotonsName; //name of exported "good photon" collection
194    
195     // Selection Types
196     TString fPhotonSelType;
197     TString fVertexSelType;
198     PhotonSelection fPhSelType;
199     VertexSelection fVtxSelType;
200    
201     // Basic Pre-Selection kinematics
202     Double_t fPhotonPtMin; // min pt cut fro PRE-SELECTION!
203     Double_t fPhotonEtaMax; // max eta cut for PRE-SELECTION!
204    
205     Double_t fLeadingPtMin;
206     Double_t fTrailingPtMin;
207    
208     // is it Data or MC?
209     Bool_t fIsData;
210    
211     // in case there's some PV pre-selection
212     Bool_t fPhotonsFromBranch;
213     Bool_t fPVFromBranch;
214    
215     const PhotonCol *fPhotons;
216     const ElectronCol *fElectrons;
217     const DecayParticleCol *fConversions;
218     const TrackCol *fTracks;
219     const PileupEnergyDensityCol *fPileUpDen;
220     const VertexCol *fPV;
221     const BeamSpotCol *fBeamspot;
222     const PFCandidateCol *fPFCands;
223     const MCParticleCol *fMCParticles;
224     const PileupInfoCol *fPileUp;
225    
226     // Vectroes to hols smeraring/correction factors
227     std::vector<Double_t> fDataEnCorr_EB_hR9;
228     std::vector<Double_t> fDataEnCorr_EB_lR9;
229     std::vector<Double_t> fDataEnCorr_EE_hR9;
230     std::vector<Double_t> fDataEnCorr_EE_lR9;
231    
232     std::vector<UInt_t> fRunStart;
233     std::vector<UInt_t> fRunEnd;
234    
235     Double_t fMCSmear_EB_hR9;
236     Double_t fMCSmear_EB_lR9;
237     Double_t fMCSmear_EE_hR9;
238     Double_t fMCSmear_EE_lR9;
239    
240     // pointer to RNG ionstance for smearing
241     TRandom3* rng;
242    
243     // --------------------------------
244     // some streagin flags, not adjustable yet (FIX-ME)
245     bool fDoDataEneCorr;
246     bool fDoMCSmear;
247     bool fDoVtxSelection;
248 fabstoec 1.2 bool fApplyEleVeto;
249 fabstoec 1.1
250     // --------------------------------
251     // validation Tuple
252 fabstoec 1.2 TString fTupleName;
253 bendavid 1.3 PhotonPairSelectorDiphotonEvent* fDiphotonEvent;
254 bendavid 1.4 PhotonPairSelectorPhoton* fSinglePhoton;
255 bendavid 1.3 TTree* hCiCTuple;
256 bendavid 1.4 TTree* hCiCTupleSingle;
257 fabstoec 1.1
258     ClassDef(PhotonPairSelector, 1) // Photon identification module
259     };
260     }
261     #endif