13 |
|
|
14 |
|
#include "MitAna/DataTree/interface/SuperCluster.h" |
15 |
|
#include "MitAna/DataTree/interface/ChargedParticle.h" |
16 |
+ |
#include "MitAna/DataCont/interface/Ref.h" |
17 |
|
|
18 |
|
namespace mithep |
19 |
|
{ |
28 |
|
fCaloIsolation(0), fCaloTowerIsolation(0), fTrackIsolation(0), |
29 |
|
fEcalJurassicIsolation(0), fHcalJurassicIsolation(0), fPassLooseID(0), |
30 |
|
fPassTightID(0), fIDLikelihood(0), fPIn(0), fPOut(0) {} |
30 |
– |
~Electron() {} |
31 |
|
|
32 |
|
const Track *BestTrk() const; |
33 |
< |
const Track *GsfTrk() const; |
34 |
< |
const Track *TrackerTrk() const; |
35 |
< |
const SuperCluster *SCluster() const; |
36 |
< |
FourVector Mom() const; |
33 |
> |
const Track *GsfTrk() const { return fGsfTrackRef.Obj(); } |
34 |
> |
const Track *TrackerTrk() const { return fTrackerTrackRef.Obj(); } |
35 |
> |
const SuperCluster *SCluster() const { return fSuperClusterRef.Obj(); } |
36 |
|
const Track *Trk() const { return BestTrk(); } |
37 |
|
Double_t CaloIsolation() const { return fCaloIsolation; } |
38 |
|
Double_t CaloTowerIsolation() const { return fCaloTowerIsolation; } |
45 |
|
Double_t DeltaEtaSeedClusterTrackAtCalo() const { return fDeltaEtaSeedClTrkAtCalo; } |
46 |
|
Double_t DeltaPhiSuperClusterTrackAtVtx() const { return fDeltaPhiSuperClTrkAtVtx; } |
47 |
|
Double_t DeltaPhiSeedClusterTrackAtCalo() const { return fDeltaPhiSeedClTrkAtCalo; } |
49 |
– |
Double_t E() const; |
48 |
|
Double_t E33() const { return fE33; } |
49 |
|
Double_t E55() const { return fE55; } |
50 |
|
Double_t EcalJurassicIsolation() const { return fEcalJurassicIsolation; } |
55 |
|
Double_t IsEnergyScaleCorrected() const { return fIsEnergyScaleCorrected; } |
56 |
|
Double_t IsMomentumCorrected() const { return fIsMomentumCorrected; } |
57 |
|
Double_t HadronicOverEm() const { return fHadronicOverEm; } |
58 |
+ |
Bool_t HasGsfTrk() const { return fGsfTrackRef.IsValid(); } |
59 |
+ |
Bool_t HasTrackerTrk() const { return fTrackerTrackRef.IsValid(); } |
60 |
+ |
Bool_t HasSuperCluster() const { return fSuperClusterRef.IsValid(); } |
61 |
|
Double_t HcalIsolation() const { return fHcalJurassicIsolation; } |
61 |
– |
Double_t Mass() const { return 0.51099892e-3; } |
62 |
|
Double_t NumberOfClusters() const { return fNumberOfClusters; } |
63 |
|
EObjType ObjType() const { return kElectron; } |
64 |
|
Double_t PassLooseID() const { return fPassLooseID; } |
65 |
|
Double_t PassTightID() const { return fPassTightID; } |
66 |
|
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; |
68 |
|
Double_t TrackIsolation() const { return fTrackIsolation; } |
69 |
< |
void SetGsfTrk(const Track* t) |
70 |
< |
{ fGsfTrackRef = const_cast<Track*>(t); } |
71 |
< |
void SetTrackerTrk(const Track* t) |
77 |
< |
{ fTrackerTrackRef = const_cast<Track*>(t); } |
78 |
< |
void SetSuperCluster(const SuperCluster* sc) |
79 |
< |
{ fSuperClusterRef = const_cast<SuperCluster*>(sc); } |
69 |
> |
void SetGsfTrk(const Track* t) { fGsfTrackRef = t; ClearMom(); ClearCharge(); } |
70 |
> |
void SetTrackerTrk(const Track* t) { fTrackerTrackRef = t; ClearMom(); ClearCharge(); } |
71 |
> |
void SetSuperCluster(const SuperCluster* sc) { fSuperClusterRef = sc; ClearMom(); } |
72 |
|
void SetCaloIsolation(Double_t CaloIsolation) { fCaloIsolation = CaloIsolation; } |
73 |
|
void SetCaloTowerIsolation(Double_t TowerIso) { fCaloTowerIsolation = TowerIso; } |
74 |
|
void SetClassification(Double_t x) { fClassification = x; } |
95 |
|
void SetPassTightID(Double_t passTightID) { fPassTightID = passTightID; } |
96 |
|
void SetPIn(Double_t PIn) { fPIn = PIn; } |
97 |
|
void SetPOut(Double_t POut) { fPOut = POut; } |
98 |
< |
void SetTrackIsolation(Double_t TrackIsolation) { fTrackIsolation = TrackIsolation;} |
98 |
> |
void SetTrackIsolation(Double_t trkiso) { fTrackIsolation = trkiso; } |
99 |
|
|
100 |
|
protected: |
101 |
< |
TRef fGsfTrackRef; //global combined track reference |
102 |
< |
TRef fTrackerTrackRef; //tracker track reference |
103 |
< |
TRef fSuperClusterRef; //reference to SuperCluster |
101 |
> |
Double_t GetMass() const { return 0.51099892e-3; } |
102 |
> |
void GetMom() const; |
103 |
> |
|
104 |
> |
Ref<Track> fGsfTrackRef; //gsf track reference |
105 |
> |
Ref<Track> fTrackerTrackRef; //tracker track reference |
106 |
> |
Ref<SuperCluster> fSuperClusterRef; //reference to SuperCluster |
107 |
|
Double_t fESuperClusterOverP; // |
108 |
|
Double_t fESeedClusterOverPout; // |
109 |
|
Double_t fDeltaEtaSuperClTrkAtVtx; // |
141 |
|
{ |
142 |
|
// Return "best" track. |
143 |
|
|
144 |
< |
if (GsfTrk()) |
144 |
> |
if (HasGsfTrk()) |
145 |
|
return GsfTrk(); |
146 |
< |
else if (TrackerTrk()) |
146 |
> |
else if (HasTrackerTrk()) |
147 |
|
return TrackerTrk(); |
148 |
|
|
149 |
|
return 0; |
150 |
|
} |
151 |
|
|
152 |
|
//-------------------------------------------------------------------------------------------------- |
153 |
< |
inline const mithep::Track *mithep::Electron::GsfTrk() const |
153 |
> |
inline void mithep::Electron::GetMom() const |
154 |
|
{ |
155 |
< |
// Return global combined track. |
155 |
> |
// Get momentum of the electron. We use the direction of the |
156 |
> |
// track and the energy of the SuperCluster. |
157 |
|
|
158 |
< |
return static_cast<const Track*>(fGsfTrackRef.GetObject()); |
163 |
< |
} |
158 |
> |
const mithep::Track *trk = Trk(); |
159 |
|
|
160 |
< |
//-------------------------------------------------------------------------------------------------- |
161 |
< |
inline const mithep::Track *mithep::Electron::TrackerTrk() const |
162 |
< |
{ |
163 |
< |
// Return tracker track. |
160 |
> |
if (!trk) { |
161 |
> |
fCachedMom.SetCoordinates(0,0,0,0); |
162 |
> |
return; |
163 |
> |
} |
164 |
|
|
165 |
< |
return static_cast<const Track*>(fTrackerTrackRef.GetObject()); |
166 |
< |
} |
172 |
< |
//-------------------------------------------------------------------------------------------------- |
173 |
< |
inline const mithep::SuperCluster *mithep::Electron::SCluster() const |
174 |
< |
{ |
175 |
< |
// Return super cluster. |
176 |
< |
|
177 |
< |
return static_cast<const SuperCluster*>(fSuperClusterRef.GetObject()); |
178 |
< |
} |
165 |
> |
Double_t p = 0; |
166 |
> |
Double_t mass = GetMass(); |
167 |
|
|
168 |
< |
//------------------------------------------------------------------------------------------------- |
169 |
< |
inline mithep::FourVector mithep::Electron::Mom() const |
170 |
< |
{ |
171 |
< |
// Return momentum of the electron. We use the direction of the |
172 |
< |
// track and the energy of the SuperCluster. |
168 |
> |
const mithep::SuperCluster *sc = SCluster(); |
169 |
> |
if (sc) |
170 |
> |
p = TMath::Sqrt(sc->Energy()*sc->Energy() - mass*mass); |
171 |
> |
else |
172 |
> |
p = trk->P(); |
173 |
|
|
174 |
< |
return FourVector(Px(), Py(), Pz(), E()); |
174 |
> |
Double_t pt = TMath::Abs(p*TMath::Cos(trk->Lambda())); |
175 |
> |
fCachedMom.SetCoordinates(pt,trk->Eta(),trk->Phi(),mass); |
176 |
|
} |
177 |
|
|
178 |
|
//------------------------------------------------------------------------------------------------- |
183 |
|
|
184 |
|
return SCluster()->Seed()->Energy() / PIn(); |
185 |
|
} |
197 |
– |
|
198 |
– |
//------------------------------------------------------------------------------------------------- |
199 |
– |
inline Double_t mithep::Electron::E() const |
200 |
– |
{ |
201 |
– |
// Return energy of the SuperCluster if present |
202 |
– |
// or else return energy derived from the track. |
203 |
– |
|
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 |
– |
// or else return momentum from the track. |
216 |
– |
|
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 |
– |
// Return px. |
228 |
– |
|
229 |
– |
return Pt()*TMath::Cos(Trk()->Phi()); |
230 |
– |
} |
231 |
– |
|
232 |
– |
//------------------------------------------------------------------------------------------------- |
233 |
– |
inline Double_t mithep::Electron::Py() const |
234 |
– |
{ |
235 |
– |
// Return py. |
236 |
– |
|
237 |
– |
return Pt()*TMath::Sin(Trk()->Phi()); |
238 |
– |
} |
239 |
– |
|
240 |
– |
//------------------------------------------------------------------------------------------------- |
241 |
– |
inline Double_t mithep::Electron::Pz() const |
242 |
– |
{ |
243 |
– |
// Return pz. |
244 |
– |
|
245 |
– |
return P()*TMath::Sin(Trk()->Lambda()); |
246 |
– |
} |
247 |
– |
|
248 |
– |
//------------------------------------------------------------------------------------------------- |
249 |
– |
inline Double_t mithep::Electron::Pt() const |
250 |
– |
{ |
251 |
– |
// Return pt. |
252 |
– |
|
253 |
– |
return TMath::Abs(P()*TMath::Cos(Trk()->Lambda())); |
254 |
– |
} |
186 |
|
#endif |