ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Photon.h
Revision: 1.44
Committed: Sun Dec 11 00:00:28 2011 UTC (13 years, 4 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.43: +7 -4 lines
Log Message:
add mva output to photon

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.44 // $Id: Photon.h,v 1.43 2011/11/18 00:02:02 bendavid Exp $
3 loizides 1.1 //
4     // Photon
5     //
6 loizides 1.24 // This class holds the reconstructed photon quantities.
7 loizides 1.1 //
8 loizides 1.2 // Authors: J.Bendavid, C.Loizides
9 loizides 1.1 //--------------------------------------------------------------------------------------------------
10    
11 loizides 1.12 #ifndef MITANA_DATATREE_PHOTON_H
12     #define MITANA_DATATREE_PHOTON_H
13 loizides 1.1
14 loizides 1.24 #include "MitCommon/DataFormats/interface/Vect4M.h"
15 bendavid 1.3 #include "MitAna/DataTree/interface/Particle.h"
16     #include "MitAna/DataTree/interface/Conversion.h"
17 bendavid 1.38 #include "MitAna/DataTree/interface/Vertex.h"
18 loizides 1.11 #include "MitAna/DataCont/interface/RefArray.h"
19 loizides 1.1
20     namespace mithep
21     {
22 bendavid 1.3 class Photon : public Particle
23 loizides 1.1 {
24     public:
25 loizides 1.29 Photon() :
26 bendavid 1.33 fR9(0),fHadOverEm(0),fHcalDepth1OverEcal(0),
27     fHcalDepth2OverEcal(0), fMaxEnergyXtal(0), fE15(0), fE25(0), fE33(0),
28     fE55(0), fCovEtaEta(0), fCoviEtaiEta(0),
29     fEcalRecHitIso(0),fHcalRecHitIso(0), fHcalTowerSumEtDr04(0),
30 loizides 1.29 fHcalDepth1TowerSumEtDr04(0), fHcalDepth2TowerSumEtDr04(0), fSolidConeTrkIso(0),
31     fHollowConeTrkIso(0),fSolidConeNTrk(0),fHollowConeNTrk(0), fEcalRecHitIsoDr03(0),
32     fHcalTowerSumEtDr03(0), fHcalDepth1TowerSumEtDr03(0), fHcalDepth2TowerSumEtDr03(0),
33     fSolidConeTrkIsoDr03(0), fHollowConeTrkIsoDr03(0),fSolidConeNTrkDr03(0),
34 bendavid 1.36 fHollowConeNTrkDr03(0), fPFChargedHadronIso(0), fPFNeutralHadronIso(0), fPFPhotonIso(0),
35     fHasPixelSeed(0), fIsEB(0), fIsEE(0), fIsEBGap(0),
36 loizides 1.29 fIsEEGap(0),fIsEBEEGap(0), fIsLooseEM(0),fIsLoosePhoton(0), fIsTightPhoton(0),
37 bendavid 1.41 fIsConverted(0), fEnergyErr(-99.), fEnergyErrSmeared(-99.), fEnergySmearing(0.),
38 bendavid 1.44 fEnergyRegr(0.), fEnergyErrRegr(0.), fEnergyPhoFix(0.), fEnergyErrPhoFix(0.), fVtxProb(1.0), fIdMva(-99.) {}
39 loizides 1.21 Photon(Double_t px, Double_t py, Double_t pz, Double_t e) :
40 loizides 1.24 fMom(FourVector(px,py,pz,e)),
41 bendavid 1.33 fR9(0),fHadOverEm(0),fHcalDepth1OverEcal(0),
42     fHcalDepth2OverEcal(0), fMaxEnergyXtal(0), fE15(0), fE25(0), fE33(0),
43     fE55(0), fCovEtaEta(0), fCoviEtaiEta(0),
44     fEcalRecHitIso(0),fHcalRecHitIso(0), fHcalTowerSumEtDr04(0),
45 bendavid 1.25 fHcalDepth1TowerSumEtDr04(0), fHcalDepth2TowerSumEtDr04(0), fSolidConeTrkIso(0),
46     fHollowConeTrkIso(0),fSolidConeNTrk(0),fHollowConeNTrk(0), fEcalRecHitIsoDr03(0),
47     fHcalTowerSumEtDr03(0), fHcalDepth1TowerSumEtDr03(0), fHcalDepth2TowerSumEtDr03(0),
48     fSolidConeTrkIsoDr03(0), fHollowConeTrkIsoDr03(0),fSolidConeNTrkDr03(0),
49 bendavid 1.36 fHollowConeNTrkDr03(0), fPFChargedHadronIso(0), fPFNeutralHadronIso(0), fPFPhotonIso(0),
50     fHasPixelSeed(0), fIsEB(0), fIsEE(0), fIsEBGap(0),
51 bendavid 1.26 fIsEEGap(0),fIsEBEEGap(0), fIsLooseEM(0),fIsLoosePhoton(0), fIsTightPhoton(0),
52 bendavid 1.41 fIsConverted(0), fEnergyErr(-99.), fEnergyErrSmeared(-99.), fEnergySmearing(0.),
53 bendavid 1.44 fEnergyRegr(0.), fEnergyErrRegr(0.), fEnergyPhoFix(0.), fEnergyErrPhoFix(0.), fVtxProb(1.0), fIdMva(-99.) {}
54 loizides 1.2
55 paus 1.42 const Conversion *ConvCand(UInt_t i) const { return fConversions.At(i); }
56     Double_t EcalRecHitIsoDr03() const { return fEcalRecHitIsoDr03; }
57     Double_t EcalRecHitIsoDr04() const { return fEcalRecHitIso; }
58     Double_t EnergyErr() const { return fEnergyErr; }
59     Double_t EnergyErrSmeared() const { return fEnergyErrSmeared; }
60     Double_t EnergySmearing() const { return fEnergySmearing; }
61     Double_t EnergyRegr() const { return fEnergyRegr; }
62     Double_t EnergyErrRegr() const { return fEnergyErrRegr; }
63     Double_t EnergyPhoFix() const { return fEnergyPhoFix; }
64     Double_t EnergyErrPhoFix() const { return fEnergyErrPhoFix; }
65     Double_t HadOverEm() const { return fHadOverEm; }
66     Double_t HcalDepth1OverEcal() const { return fHcalDepth1OverEcal; }
67     Double_t HcalDepth2OverEcal() const { return fHcalDepth2OverEcal; }
68     Double_t MaxEnergyXtal() const { return fMaxEnergyXtal; }
69     Double_t E15() const { return fE15; }
70     Double_t E25() const { return fE25; }
71     Double_t E33() const { return fE33; }
72     Double_t E55() const { return fE55; }
73     ThreeVectorC CaloPos() const;
74     Double_t CovEtaEta() const { return fCovEtaEta; }
75     Double_t CoviEtaiEta() const { return fCoviEtaiEta; }
76     Bool_t HasPixelSeed() const { return fHasPixelSeed; }
77 loizides 1.29 Double_t HcalDepth1TowerSumEtDr03() const { return fHcalDepth1TowerSumEtDr03; }
78     Double_t HcalDepth1TowerSumEtDr04() const { return fHcalDepth1TowerSumEtDr04; }
79     Double_t HcalDepth2TowerSumEtDr03() const { return fHcalDepth2TowerSumEtDr03; }
80 bendavid 1.32 Double_t HcalDepth2TowerSumEtDr04() const { return fHcalDepth2TowerSumEtDr04; }
81 paus 1.42 Double_t HcalRecHitIso() const { return fHcalRecHitIso; } // *DEPRECATED*
82     Double_t HcalTowerSumEtDr03() const { return fHcalTowerSumEtDr03; }
83     Double_t HcalTowerSumEtDr04() const { return fHcalTowerSumEtDr04; }
84     UShort_t HollowConeNTrkDr03() const { return fHollowConeNTrkDr03; }
85     UShort_t HollowConeNTrkDr04() const { return fHollowConeNTrk; }
86     Double_t HollowConeTrkIsoDr03() const { return fHollowConeTrkIsoDr03; }
87     Double_t HollowConeTrkIsoDr04() const { return fHollowConeTrkIso; }
88     Double_t PFChargedHadronIso() const { return fPFChargedHadronIso; }
89     Double_t PFNeutralHadronIso() const { return fPFNeutralHadronIso; }
90     Double_t PFPhotonIso() const { return fPFPhotonIso; }
91     Bool_t IsEB() const { return fIsEB; }
92     Bool_t IsEE() const { return fIsEE; }
93     Bool_t IsEBGap() const { return fIsEBGap; }
94     Bool_t IsEEGap() const { return fIsEEGap; }
95     Bool_t IsEBEEGap() const { return fIsEBEEGap; }
96     Bool_t IsLooseEM() const { return fIsLooseEM; } // *DEPRECATED*
97     Bool_t IsLoosePhoton() const { return fIsLoosePhoton; }
98     Bool_t IsTightPhoton() const { return fIsTightPhoton; }
99     Bool_t IsConverted() const { return fIsConverted; }
100     ThreeVector Mom3(const ThreeVector &v) const { return E()*(ThreeVector(CaloPos()) - v).Unit(); }
101 bendavid 1.35 FourVectorM MomVtx(const ThreeVector &vtx) const;
102 paus 1.42 UInt_t NConversions() const { return fConversions.Entries(); }
103     EObjType ObjType() const { return kPhoton; }
104     Double_t R9() const { return fR9; }
105     const SuperCluster *SCluster() const { return fSuperClusterRef.Obj(); }
106     Double_t SolidConeTrkIsoDr03() const { return fSolidConeTrkIsoDr03; }
107     Double_t SolidConeTrkIsoDr04() const { return fSolidConeTrkIso; }
108     UShort_t SolidConeNTrkDr03() const { return fSolidConeNTrkDr03; }
109     UShort_t SolidConeNTrkDr04() const { return fSolidConeNTrk; }
110    
111     void AddConversion(const Conversion *c) { fConversions.Add(c); }
112     void SetEnergyErr(Double_t x) { fEnergyErr = x; }
113     void SetEnergyErrSmeared(Double_t x) { fEnergyErrSmeared = x; }
114     void SetEnergySmearing(Double_t x) { fEnergySmearing = x; }
115     void SetEnergyRegr(Double_t x) { fEnergyRegr = x; }
116     void SetEnergyErrRegr(Double_t x) { fEnergyErrRegr = x; }
117     void SetEnergyPhoFix(Double_t x) { fEnergyPhoFix = x; }
118     void SetEnergyErrPhoFix(Double_t x) { fEnergyErrPhoFix = x; }
119     void SetIsConverted(Bool_t b) { fIsConverted = b; }
120 loizides 1.29 void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
121     void SetSuperCluster(const SuperCluster* sc) { fSuperClusterRef = sc; }
122     void SetR9(Double_t x) { fR9 = x; }
123     void SetHadOverEm(Double_t x) { fHadOverEm = x; }
124 bendavid 1.33 void SetHcalDepth1OverEcal(Double_t x) { fHcalDepth1OverEcal = x; }
125     void SetHcalDepth2OverEcal(Double_t x) { fHcalDepth2OverEcal = x; }
126     void SetMaxEnergyXtal(Double_t x) { fMaxEnergyXtal = x; }
127     void SetE15(Double_t x) { fE15 = x; }
128     void SetE25(Double_t x) { fE25 = x; }
129     void SetE33(Double_t x) { fE33 = x; }
130     void SetE55(Double_t x) { fE55 = x; }
131 paus 1.42 void SetCovEtaEta(Double_t x) { fCovEtaEta = x; }
132     void SetCoviEtaiEta(Double_t x) { fCoviEtaiEta = x; }
133 loizides 1.29 void SetHasPixelSeed(Bool_t x) { fHasPixelSeed = x; }
134     void SetEcalRecHitIsoDr04(Double_t x) { fEcalRecHitIso = x; }
135     void SetHcalTowerSumEtDr04(Double_t x) { fHcalTowerSumEtDr04 = x; }
136     void SetHcalDepth1TowerSumEtDr04(Double_t x) { fHcalDepth1TowerSumEtDr04 = x; }
137     void SetHcalDepth2TowerSumEtDr04(Double_t x) { fHcalDepth2TowerSumEtDr04 = x; }
138     void SetSolidConeTrkIsoDr04(Double_t x) { fSolidConeTrkIso = x; }
139     void SetHollowConeTrkIsoDr04(Double_t x) { fHollowConeTrkIso = x; }
140     void SetSolidConeNTrkDr04(UShort_t x) { fSolidConeNTrk = x; }
141     void SetHollowConeNTrkDr04(UShort_t x) { fHollowConeNTrk = x; }
142     void SetEcalRecHitIsoDr03(Double_t x) { fEcalRecHitIsoDr03 = x; }
143     void SetHcalTowerSumEtDr03(Double_t x) { fHcalTowerSumEtDr03 = x; }
144     void SetHcalDepth1TowerSumEtDr03(Double_t x) { fHcalDepth1TowerSumEtDr03 = x; }
145     void SetHcalDepth2TowerSumEtDr03(Double_t x) { fHcalDepth2TowerSumEtDr03 = x; }
146     void SetSolidConeTrkIsoDr03(Double_t x) { fSolidConeTrkIsoDr03 = x; }
147     void SetHollowConeTrkIsoDr03(Double_t x) { fHollowConeTrkIsoDr03 = x; }
148     void SetSolidConeNTrkDr03(UShort_t x) { fSolidConeNTrkDr03 = x; }
149     void SetHollowConeNTrkDr03(UShort_t x) { fHollowConeNTrkDr03 = x; }
150 bendavid 1.43 void SetPFChargedHadronIso(Double_t x) { fPFChargedHadronIso = x; }
151     void SetPFNeutralHadronIso(Double_t x) { fPFNeutralHadronIso = x; }
152     void SetPFPhotonIso(Double_t x) { fPFPhotonIso = x; }
153     void SetIsEB(Bool_t x) { fIsEB = x; }
154     void SetIsEE(Bool_t x) { fIsEE = x; }
155     void SetIsEBGap(Bool_t x) { fIsEBGap = x; }
156     void SetIsEEGap(Bool_t x) { fIsEEGap = x; }
157     void SetIsEBEEGap(Bool_t x) { fIsEBEEGap = x; }
158     void SetIsLooseEM(Bool_t x) { fIsLooseEM = x; }
159     void SetIsLoosePhoton(Bool_t x) { fIsLoosePhoton = x; }
160     void SetIsTightPhoton(Bool_t x) { fIsTightPhoton = x; }
161     void SetCaloPosXYZ(Double_t x, Double_t y, Double_t z) { fCaloPos.SetXYZ(x,y,z); }
162     void SetPV(const Vertex *v) { fPVRef = v; }
163     void SetVtxProb(Double_t x) { fVtxProb = x; }
164 bendavid 1.44 void SetIdMva(Double_t x) { fIdMva = x; }
165 bendavid 1.43 Bool_t HasPV() const { return fPVRef.IsValid(); }
166     const Vertex *PV() const { return fPVRef.Obj(); }
167     Double_t VtxProb() const { return fVtxProb; }
168 bendavid 1.44 Double_t IdMva() const { return fIdMva; }
169 sixie 1.16
170 loizides 1.1 protected:
171 paus 1.42 void GetMom() const;
172 loizides 1.21
173 paus 1.42 Vect4M fMom; //four momentum vector
174     Vect3C fCaloPos; //shower position
175     Double32_t fR9; //[0,0,14]r9=e3x3/etotal variable
176     Double32_t fHadOverEm; //[0,0,14]hadronic over em fraction
177     Double32_t fHcalDepth1OverEcal; //[0,0,14]hadronic over em fraction depth1
178     Double32_t fHcalDepth2OverEcal; //[0,0,14]hadronic over em fraction depth2
179     Double32_t fMaxEnergyXtal; //[0,0,14]maximum single crystal energy
180     Double32_t fE15; //[0,0,14]1x5 crystal energy
181     Double32_t fE25; //[0,0,14]2x5 crystal energy
182     Double32_t fE33; //[0,0,14]3x3 crystal energy
183     Double32_t fE55; //[0,0,14]5x5 crystal energy
184     Double32_t fCovEtaEta; //[0,0,14]variance eta-eta
185     Double32_t fCoviEtaiEta; //[0,0,14]covariance eta-eta (in crystals)
186     Double32_t fEcalRecHitIso; //[0,0,14]ecal rechit based isolation dR 0.4 *RENAMING*
187     Double32_t fHcalRecHitIso; //[0,0,14]hcal rechit based isolation dR 0.4 - *DEPRECATED*
188     Double32_t fHcalTowerSumEtDr04; //[0,0,14]hcal tower based isolation dR 0.4
189 loizides 1.29 Double32_t fHcalDepth1TowerSumEtDr04; //[0,0,14]hcal depth1 tower based isolation dR 0.4
190     Double32_t fHcalDepth2TowerSumEtDr04; //[0,0,14]hcal depth2 tower based isolation dR 0.4
191 paus 1.42 Double32_t fSolidConeTrkIso; //[0,0,14]sum track pT in cone of dR 0.4 *RENAMING*
192     Double32_t fHollowConeTrkIso; //[0,0,14]as above excluding the core, dR 0.4 *RENAMING*
193     UShort_t fSolidConeNTrk; //number of tracks in a cone of dR 0.4 *RENAMING*
194     UShort_t fHollowConeNTrk; //as above excluding the core, dR 0.4 *RENAMING*
195     Double32_t fEcalRecHitIsoDr03; //[0,0,14]ecal rechit based isolation dR 0.3
196     Double32_t fHcalTowerSumEtDr03; //[0,0,14] hcal tower based isolation dR 0.3
197 loizides 1.29 Double32_t fHcalDepth1TowerSumEtDr03; //[0,0,14]hcal depth1 tower based isolation dR 0.3
198     Double32_t fHcalDepth2TowerSumEtDr03; //[0,0,14]hcal depth2 tower based isolation dR 0.3
199     Double32_t fSolidConeTrkIsoDr03; //[0,0,14]sum track pT in cone of dR 0.3
200     Double32_t fHollowConeTrkIsoDr03; //[0,0,14]as above excluding the core, dR 0.3
201 bendavid 1.43 UShort_t fSolidConeNTrkDr03; //number of tracks in a cone of dR 0.3
202     UShort_t fHollowConeNTrkDr03; //as above excluding the core, dR 0.3
203     Double32_t fPFChargedHadronIso; //[0,0,14]pf isolation, charged hadrons
204     Double32_t fPFNeutralHadronIso; //[0,0,14]pf isolation, neutral hadrons
205     Double32_t fPFPhotonIso; //[0,0,14]pf isolation, photons
206     Bool_t fHasPixelSeed; //=true if super cluster has matched seed
207     Bool_t fIsEB; //=true if photon is ECal barrel
208     Bool_t fIsEE; //=true if photon is ECAL endcap
209     Bool_t fIsEBGap; //=true photon is in ECAL barrel crystal gap
210     Bool_t fIsEEGap; //=true photon is in ECAL endcap crystal gap
211     Bool_t fIsEBEEGap; //=true photon is in boundary between EB/EE
212     Bool_t fIsLooseEM; //=true if loose em cuts are passed *DEPRECATED*
213     // LooseEM corresponds to supercluster preselection in 3_1_X
214     //so this variable is now always true for photon objects
215     Bool_t fIsLoosePhoton; //=true if loose photon cuts are passed
216     Bool_t fIsTightPhoton; //=true if tight photon cuts are passed
217     Bool_t fIsConverted; //=true if photon converted
218     RefArray<Conversion> fConversions; //refs to associated conversion candidates
219     Ref<SuperCluster> fSuperClusterRef; //ref to associated super cluster
220     Ref<Vertex> fPVRef; //ref to associated primary vertex
221     Double32_t fEnergyErr; //[0,0,14]uncertainty on energy measurement (in GeV), eg from variance regression
222     Double32_t fEnergyErrSmeared; //[0,0,14]uncertainty on energy measurement (in GeV), eg from variance regression with added smearing
223     Double32_t fEnergySmearing; //[0,0,14]additional energy smearing applied or required wrt MC
224     Double32_t fEnergyRegr; //[0,0,14]regression energy (computed at filler time)
225     Double32_t fEnergyErrRegr; //[0,0,14]regression energy uncertainty (computed at filler time)
226     Double32_t fEnergyPhoFix; //[0,0,14]PhotonFix energy (computed at filler time)
227     Double32_t fEnergyErrPhoFix; //[0,0,14]PhotonFix energy uncertainty (computed at filler time)
228     Double32_t fVtxProb; //[0,0,14]Probability that linked primary vertex is the correct one
229 bendavid 1.44 Double32_t fIdMva; //[0,0,14]output of photon id mva
230 bendavid 1.43
231 bendavid 1.40
232 bendavid 1.44 ClassDef(Photon,12) // Photon class
233 loizides 1.1 };
234     }
235 loizides 1.2
236     //--------------------------------------------------------------------------------------------------
237 bendavid 1.37 inline mithep::ThreeVectorC mithep::Photon::CaloPos() const
238     {
239     // Get caloposition
240     mithep::ThreeVectorC calopos = fCaloPos.V();
241     if (calopos.Rho()>1.0) {
242     return calopos;
243     }
244     else {
245     return SCluster()->Point();
246     }
247    
248     }
249    
250     //--------------------------------------------------------------------------------------------------
251 loizides 1.21 inline void mithep::Photon::GetMom() const
252     {
253     // Get momentum values from stored values.
254    
255 loizides 1.24 fCachedMom.SetCoordinates(fMom.Pt(),fMom.Eta(),fMom.Phi(),fMom.M());
256 loizides 1.21 }
257    
258     //--------------------------------------------------------------------------------------------------
259 loizides 1.2 inline void mithep::Photon::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
260     {
261 loizides 1.21 // Set momentum vector.
262 loizides 1.2
263 loizides 1.21 fMom.SetXYZT(px, py, pz, e);
264 bendavid 1.22 ClearMom();
265 loizides 1.2 }
266 bendavid 1.34
267     //--------------------------------------------------------------------------------------------------
268 bendavid 1.35 inline mithep::FourVectorM mithep::Photon::MomVtx(const ThreeVector &vtx) const
269 bendavid 1.34 {
270     // Get momentum values from stored values.
271     ThreeVector momv = Mom3(vtx);
272     FourVectorM newmom;
273    
274     newmom.SetCoordinates(momv.Rho(),momv.Eta(),momv.Phi(),0.);
275    
276     return newmom;
277     }
278    
279 loizides 1.1 #endif