ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonPairSelector.h
Revision: 1.3
Committed: Sat Jul 23 01:42:41 2011 UTC (13 years, 9 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.2: +69 -2 lines
Log Message:
add fancy tree to PhotonPairSelector

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