ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Electron.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/Electron.h (file contents):
Revision 1.24 by bendavid, Tue Feb 17 15:09:45 2009 UTC vs.
Revision 1.25 by loizides, Wed Feb 18 15:38:54 2009 UTC

# Line 28 | Line 28 | namespace mithep
28                     fCaloIsolation(0), fCaloTowerIsolation(0), fTrackIsolation(0),
29                     fEcalJurassicIsolation(0), fHcalJurassicIsolation(0), fPassLooseID(0),
30                     fPassTightID(0), fIDLikelihood(0), fPIn(0), fPOut(0) {}
31      ~Electron() {}
31        
32        const Track         *BestTrk()               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();   }
37      FourVector           Mom()                   const;
36        const Track         *Trk()                   const { return BestTrk();                }
37        Double_t    CaloIsolation()                  const { return fCaloIsolation;           }
38        Double_t    CaloTowerIsolation()             const { return fCaloTowerIsolation;      }
# Line 47 | Line 45 | namespace mithep
45        Double_t    DeltaEtaSeedClusterTrackAtCalo() const { return fDeltaEtaSeedClTrkAtCalo; }
46        Double_t    DeltaPhiSuperClusterTrackAtVtx() const { return fDeltaPhiSuperClTrkAtVtx; }
47        Double_t    DeltaPhiSeedClusterTrackAtCalo() const { return fDeltaPhiSeedClTrkAtCalo; }
50      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;   }
# Line 62 | Line 59 | namespace mithep
59        Bool_t      HasTrackerTrk()                  const { return fTrackerTrackRef.IsValid(); }
60        Bool_t      HasSuperCluster()                const { return fSuperClusterRef.IsValid(); }
61        Double_t    HcalIsolation()                  const { return fHcalJurassicIsolation;   }
65      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;                    }
72      Double_t    P()                              const;
73      Double_t    Pt()                             const;
74      Double_t    Px()                             const;
75      Double_t    Py()                             const;
76      Double_t    Pz()                             const;
68        Double_t    TrackIsolation()                 const { return fTrackIsolation;          }
69 <      void        SetGsfTrk(const Track* t)              { fGsfTrackRef = t;                }
70 <      void        SetTrackerTrk(const Track* t)          { fTrackerTrackRef = t;            }
71 <      void        SetSuperCluster(const SuperCluster* sc) { fSuperClusterRef = sc;          }
69 >      void        SetGsfTrk(const Track* t)                     { fGsfTrackRef = t;                }
70 >      void        SetTrackerTrk(const Track* t)                 { fTrackerTrackRef = t;            }
71 >      void        SetSuperCluster(const SuperCluster* sc)       { fSuperClusterRef = sc;           }
72        void        SetCaloIsolation(Double_t CaloIsolation)      { fCaloIsolation = CaloIsolation;  }
73        void        SetCaloTowerIsolation(Double_t TowerIso)      { fCaloTowerIsolation = TowerIso;  }
74        void        SetClassification(Double_t x)                 { fClassification = x;             }
# Line 104 | Line 95 | namespace mithep
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 +      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
# Line 155 | Line 149 | inline const mithep::Track *mithep::Elec
149    return 0;
150   }
151  
152 < //-------------------------------------------------------------------------------------------------
153 < inline mithep::FourVector mithep::Electron::Mom() const
152 > //--------------------------------------------------------------------------------------------------
153 > inline void mithep::Electron::GetMom() const
154   {
155 <  // Return momentum of the electron. We use the direction of the
155 >  // Get momentum of the electron. We use the direction of the
156    // track and the energy of the SuperCluster.
157  
158 <  return FourVector(Px(), Py(), Pz(), E());
165 < }
158 >  const mithep::Track *trk = Trk();
159  
160 < //-------------------------------------------------------------------------------------------------
161 < inline Double_t mithep::Electron::ESeedClusterOverPIn() const
162 < {
163 <  // Return energy of the SuperCluster seed divided by the magnitude
171 <  // of the track momentum at the vertex.
172 <  
173 <  return SCluster()->Seed()->Energy() / PIn();
174 < }
160 >  if (!trk) {
161 >    fCachedMom.SetCoordinates(0,0,0,0);
162 >    return;
163 >  }
164  
165 < //-------------------------------------------------------------------------------------------------
166 < inline Double_t mithep::Electron::E() const
178 < {
179 <  // Return energy of the SuperCluster if present
180 <  // or else return energy derived from the track.
181 <  
182 <  const mithep::SuperCluster *sc = SCluster();
183 <  if (sc)
184 <    return sc->Energy();
185 <  else
186 <    return TMath::Sqrt(Trk()->P()*Trk()->P() + Mass()*Mass());
187 < }
165 >  Double_t p = 0;
166 >  Double_t mass = GetMass();
167  
189 //-------------------------------------------------------------------------------------------------
190 inline Double_t mithep::Electron::P() const
191 {
192  // Return momentum derived from the SuperCluster if present
193  // or else return momentum from the track.
194  
168    const mithep::SuperCluster *sc = SCluster();
169    if (sc)
170 <    return TMath::Sqrt(sc->Energy()*sc->Energy() - Mass()*Mass());
170 >    p = TMath::Sqrt(sc->Energy()*sc->Energy() - mass*mass);
171    else
172 <    return Trk()->P();
200 < }
201 <
202 < //-------------------------------------------------------------------------------------------------
203 < inline Double_t mithep::Electron::Px() const
204 < {
205 <  // Return px.
172 >    p = trk->P();
173  
174 <  return Pt()*TMath::Cos(Trk()->Phi());
174 >  Double_t pt = TMath::Abs(p*TMath::Cos(trk->Lambda()));
175 >  fCachedMom.SetCoordinates(pt,trk->Eta(),trk->Phi(),mass);
176   }
177  
178   //-------------------------------------------------------------------------------------------------
179 < inline Double_t mithep::Electron::Py() const
212 < {
213 <  // Return py.
214 <
215 <  return Pt()*TMath::Sin(Trk()->Phi());
216 < }
217 <
218 < //-------------------------------------------------------------------------------------------------
219 < inline Double_t mithep::Electron::Pz() const
220 < {
221 <  // Return pz.
222 <
223 <  return P()*TMath::Sin(Trk()->Lambda());
224 < }
225 <
226 < //-------------------------------------------------------------------------------------------------
227 < inline Double_t mithep::Electron::Pt() const
179 > inline Double_t mithep::Electron::ESeedClusterOverPIn() const
180   {
181 <  // Return pt.
182 <
183 <  return TMath::Abs(P()*TMath::Cos(Trk()->Lambda()));
181 >  // Return energy of the SuperCluster seed divided by the magnitude
182 >  // of the track momentum at the vertex.
183 >  
184 >  return SCluster()->Seed()->Energy() / PIn();
185   }
186   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines