ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Electron.h
Revision: 1.22
Committed: Tue Dec 9 17:47:00 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.21: +105 -89 lines
Log Message:
Added ObjType to retrieve type of object.

File Contents

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