ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Electron.h
Revision: 1.21
Committed: Wed Dec 3 16:58:17 2008 UTC (16 years, 5 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.20: +4 -4 lines
Log Message:
Make add and set functions for referencing objects accept const pointers

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: Electron.h,v 1.20 2008/11/27 16:14:37 loizides Exp $
3 //
4 // Electron
5 //
6 // Details to be worked out...
7 //
8 // Authors: C.Loizides, J.Bendavid, S.Xie
9 //--------------------------------------------------------------------------------------------------
10
11 #ifndef DATATREE_ELECTRON_H
12 #define DATATREE_ELECTRON_H
13
14 #include "MitAna/DataTree/interface/SuperCluster.h"
15 #include "MitAna/DataTree/interface/ChargedParticle.h"
16
17 namespace mithep
18 {
19 class Electron : public ChargedParticle
20 {
21 public:
22 Electron() {}
23 ~Electron() {}
24
25 const Track *BestTrk() const;
26 const Track *GsfTrk() const;
27 const Track *TrackerTrk() const;
28 const SuperCluster *SCluster() const;
29 FourVector Mom() const;
30 const Track *Trk() const { return BestTrk(); }
31 Double_t E() const;
32 Double_t P() const;
33 Double_t Pt() const;
34 Double_t Px() const;
35 Double_t Py() const;
36 Double_t Pz() const;
37
38 Double_t Mass() const { return 0.51099892e-3; }
39 Double_t ESuperClusterOverP() const { return fESuperClusterOverP; }
40 Double_t ESeedClusterOverPout() const { return fESeedClusterOverPout; }
41 Double_t ESeedClusterOverPIn() const;
42 Double_t PIn() const { return fPIn; }
43 Double_t POut() const { return fPOut; }
44 Double_t DeltaEtaSuperClusterTrackAtVtx() const { return fDeltaEtaSuperClTrkAtVtx; }
45 Double_t DeltaEtaSeedClusterTrackAtCalo() const { return fDeltaEtaSeedClTrkAtCalo; }
46 Double_t DeltaPhiSuperClusterTrackAtVtx() const { return fDeltaPhiSuperClTrkAtVtx; }
47 Double_t DeltaPhiSeedClusterTrackAtCalo() const { return fDeltaPhiSeedClTrkAtCalo; }
48 Double_t HadronicOverEm() const { return fHadronicOverEm; }
49 Double_t IsEnergyScaleCorrected() const { return fIsEnergyScaleCorrected; }
50 Double_t IsMomentumCorrected() const { return fIsMomentumCorrected; }
51 Double_t NumberOfClusters() const { return fNumberOfClusters; }
52 Double_t Classification() const { return fClassification; }
53 Double_t E33() const { return fE33; }
54 Double_t E55() const { return fE55; }
55 Double_t CovEtaEta() const { return fCovEtaEta; }
56 Double_t CovEtaPhi() const { return fCovEtaPhi; }
57 Double_t CovPhiPhi() const { return fCovPhiPhi; }
58 Double_t CoviEtaiEta() const { return fCoviEtaiEta; }
59 Double_t CaloIsolation() const { return fCaloIsolation; }
60 Double_t CaloTowerIsolation() const { return fCaloTowerIsolation; }
61 Double_t TrackIsolation() const { return fTrackIsolation; }
62 Double_t EcalJurassicIsolation() const { return fEcalJurassicIsolation; }
63 Double_t HcalIsolation() const { return fHcalJurassicIsolation; }
64 Double_t PassLooseID() const { return fPassLooseID; }
65 Double_t PassTightID() const { return fPassTightID; }
66 Double_t IDLikelihood() const { return fIDLikelihood; }
67
68 void SetGsfTrk(const Track* t) { fGsfTrackRef = const_cast<Track*>(t); }
69 void SetTrackerTrk(const Track* t) { fTrackerTrackRef = const_cast<Track*>(t); }
70 void SetSuperCluster(const SuperCluster* sc) { fSuperClusterRef = const_cast<SuperCluster*>(sc); }
71 void SetESuperClusterOverP(Double_t x) { fESuperClusterOverP = x; }
72 void SetESeedClusterOverPout(Double_t x) { fESeedClusterOverPout = x; }
73 void SetPIn(Double_t PIn) { fPIn = PIn; }
74 void SetPOut(Double_t POut) { fPOut = POut; }
75 void SetDeltaEtaSuperClusterTrackAtVtx(Double_t x) { fDeltaEtaSuperClTrkAtVtx = x; }
76 void SetDeltaEtaSeedClusterTrackAtCalo(Double_t x) { fDeltaEtaSeedClTrkAtCalo = x; }
77 void SetDeltaPhiSuperClusterTrackAtVtx(Double_t x) { fDeltaPhiSuperClTrkAtVtx = x; }
78 void SetDeltaPhiSeedClusterTrackAtCalo(Double_t x) { fDeltaPhiSeedClTrkAtCalo = x; }
79 void SetHadronicOverEm(Double_t x) { fHadronicOverEm = x; }
80 void SetIsEnergyScaleCorrected(Double_t x) { fIsEnergyScaleCorrected = x; }
81 void SetIsMomentumCorrected(Double_t x) { fIsMomentumCorrected = x; }
82 void SetNumberOfClusters(Double_t x) { fNumberOfClusters = x; }
83 void SetClassification(Double_t x) { fClassification = x; }
84 void SetE33(Double_t E33) { fE33 = E33; }
85 void SetE55(Double_t E55) { fE55 = E55; }
86 void SetCovEtaEta(Double_t CovEtaEta) { fCovEtaEta = CovEtaEta; }
87 void SetCovEtaPhi(Double_t CovEtaPhi) { fCovEtaPhi = CovEtaPhi; }
88 void SetCovPhiPhi(Double_t CovPhiPhi) { fCovPhiPhi = CovPhiPhi; }
89 void SetCoviEtaiEta(Double_t CoviEtaiEta) { fCoviEtaiEta = CoviEtaiEta; }
90 void SetCaloIsolation(Double_t CaloIsolation) { fCaloIsolation = CaloIsolation; }
91 void SetCaloTowerIsolation(Double_t TowerIso) { fCaloTowerIsolation = TowerIso; }
92 void SetTrackIsolation(Double_t TrackIsolation) { fTrackIsolation = TrackIsolation;}
93 void SetEcalJurassicIsolation(Double_t iso ) { fEcalJurassicIsolation = iso; }
94 void SetHcalIsolation(Double_t iso ) { fHcalJurassicIsolation = iso; }
95 void SetPassLooseID(Double_t passLooseID) { fPassLooseID = passLooseID; }
96 void SetPassTightID(Double_t passTightID) { fPassTightID = passTightID; }
97 void SetIDLikelihood(Double_t likelihood) { fIDLikelihood = likelihood; }
98
99 protected:
100 TRef fGsfTrackRef; //global combined track reference
101 TRef fTrackerTrackRef; //tracker track reference
102 TRef fSuperClusterRef; //superCluster
103
104 Double_t fESuperClusterOverP;
105 Double_t fESeedClusterOverPout;
106 Double_t fDeltaEtaSuperClTrkAtVtx;
107 Double_t fDeltaEtaSeedClTrkAtCalo;
108 Double_t fDeltaPhiSuperClTrkAtVtx;
109 Double_t fDeltaPhiSeedClTrkAtCalo;
110 Double_t fHadronicOverEm;
111 Double_t fIsEnergyScaleCorrected;
112 Double_t fIsMomentumCorrected;
113 Double_t fNumberOfClusters;
114 Double_t fClassification;
115 Double_t fE33;
116 Double_t fE55;
117 Double_t fCovEtaEta;
118 Double_t fCoviEtaiEta;
119 Double_t fCovEtaPhi;
120 Double_t fCovPhiPhi;
121 Double_t fCaloIsolation;
122 Double_t fCaloTowerIsolation;
123 Double_t fTrackIsolation;
124 Double_t fEcalJurassicIsolation;
125 Double_t fHcalJurassicIsolation;
126 Double_t fPassLooseID;
127 Double_t fPassTightID;
128 Double_t fIDLikelihood;
129 Double_t fPIn;
130 Double_t fPOut;
131
132 ClassDef(Electron, 1) // Electron class
133 };
134 }
135
136 //--------------------------------------------------------------------------------------------------
137 inline const mithep::Track *mithep::Electron::BestTrk() const
138 {
139 // Return "best" track.
140
141 if (GsfTrk())
142 return GsfTrk();
143 else if (TrackerTrk())
144 return TrackerTrk();
145
146 return 0;
147 }
148
149 //--------------------------------------------------------------------------------------------------
150 inline const mithep::Track *mithep::Electron::GsfTrk() const
151 {
152 // Return global combined track.
153
154 return static_cast<const Track*>(fGsfTrackRef.GetObject());
155 }
156
157 //--------------------------------------------------------------------------------------------------
158 inline const mithep::Track *mithep::Electron::TrackerTrk() const
159 {
160 // Return tracker track.
161
162 return static_cast<const Track*>(fTrackerTrackRef.GetObject());
163 }
164 //--------------------------------------------------------------------------------------------------
165 inline const mithep::SuperCluster *mithep::Electron::SCluster() const
166 {
167 // Return Super cluster
168
169 return static_cast<const SuperCluster*>(fSuperClusterRef.GetObject());
170 }
171
172 //-------------------------------------------------------------------------------------------------
173 inline mithep::FourVector mithep::Electron::Mom() const
174 {
175 // Return Momentum of the electron. We use the direction of the
176 // Track and the Energy of the Super Cluster
177
178 return FourVector(Px(), Py(), Pz(), E());
179 }
180
181 //-------------------------------------------------------------------------------------------------
182 inline Double_t mithep::Electron::ESeedClusterOverPIn() const
183 {
184 // Return Energy of the SuperCluster Seed Divided by the magnitude
185 // of the track momentum at the vertex
186
187 return SCluster()->Seed()->Energy() / PIn();
188 }
189
190 //-------------------------------------------------------------------------------------------------
191 inline Double_t mithep::Electron::E() const
192 {
193 // Return Energy of the SuperCluster if present
194 // or else return energy derived from the track
195
196 const mithep::SuperCluster *sc = SCluster();
197 if (sc)
198 return sc->Energy();
199 else
200 return TMath::Sqrt(Trk()->P()*Trk()->P() + Mass()*Mass());
201 }
202
203 //-------------------------------------------------------------------------------------------------
204 inline Double_t mithep::Electron::P() const
205 {
206 // Return momentum derived from the SuperCluster if present
207 // or else return momentum from the track
208
209 const mithep::SuperCluster *sc = SCluster();
210 if (sc)
211 return TMath::Sqrt(sc->Energy()*sc->Energy() - Mass()*Mass());
212 else
213 return Trk()->P();
214 }
215
216 //-------------------------------------------------------------------------------------------------
217 inline Double_t mithep::Electron::Px() const
218 {
219 return Pt()*TMath::Cos(Trk()->Phi());
220 }
221
222 //-------------------------------------------------------------------------------------------------
223 inline Double_t mithep::Electron::Py() const
224 {
225 return Pt()*TMath::Sin(Trk()->Phi());
226 }
227
228 //-------------------------------------------------------------------------------------------------
229 inline Double_t mithep::Electron::Pz() const
230 {
231 return P()*TMath::Sin(Trk()->Lambda());
232 }
233
234 //-------------------------------------------------------------------------------------------------
235 inline Double_t mithep::Electron::Pt() const
236 {
237 return TMath::Abs(P()*TMath::Cos(Trk()->Lambda()));
238 }
239 #endif