From aad8d4351811da9476e0d6d477ab0a76baa9b255 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 7 Aug 2007 20:58:00 +0000 Subject: [PATCH] Add required AliVParticle functionality (Markus) --- STEER/AliESDtrack.cxx | 26 ++++++++++++++++++++++++++ STEER/AliESDtrack.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/STEER/AliESDtrack.cxx b/STEER/AliESDtrack.cxx index 2b40838cb84..b2eb9dbc68d 100644 --- a/STEER/AliESDtrack.cxx +++ b/STEER/AliESDtrack.cxx @@ -549,6 +549,32 @@ Double_t AliESDtrack::GetMass() const { return AliPID::ParticleMass(AliPID::kPion); } +//______________________________________________________________________________ +Double_t AliESDtrack::E() const +{ + // Returns the energy of the particle given its assumed mass. + // Assumes the pion mass if the particle can't be identified properly. + + Double_t m = M(); + Double_t p = P(); + return TMath::Sqrt(p*p + m*m); +} + +//______________________________________________________________________________ +Double_t AliESDtrack::Y() const +{ + // Returns the rapidity of a particle given its assumed mass. + // Assumes the pion mass if the particle can't be identified properly. + + Double_t e = E(); + Double_t pz = Pz(); + if (e!=pz) { // energy was not equal to pz + return 0.5*TMath::Log((e+pz)/(e-pz)); + } else { // energy was equal to pz + return -999.; + } +} + //_______________________________________________________________________ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ // diff --git a/STEER/AliESDtrack.h b/STEER/AliESDtrack.h index 5b5fe49c421..56d668fda4f 100644 --- a/STEER/AliESDtrack.h +++ b/STEER/AliESDtrack.h @@ -68,6 +68,9 @@ public: Double_t GetIntegratedLength() const {return fTrackLength;} void GetIntegratedTimes(Double_t *times) const; Double_t GetMass() const; + Double_t M() const { return GetMass(); } + Double_t E() const; + Double_t Y() const; Bool_t GetConstrainedPxPyPz(Double_t *p) const { if (!fCp) return kFALSE; -- 2.39.3