From: nick Date: Thu, 14 Jun 2001 10:37:48 +0000 (+0000) Subject: 14-jun-2001 NvE Memberfunction GetRapidity() introduced for AliTrack and AliJet X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=8adaf5975193512a596cbd3fa74337c410443dc4;hp=f3f777b87466ceb5f65c7a73b42d752c5cd1f8dd 14-jun-2001 NvE Memberfunction GetRapidity() introduced for AliTrack and AliJet and accuracy improved in Ali3Vector::GetPseudoRapidity(). --- diff --git a/RALICE/Ali3Vector.cxx b/RALICE/Ali3Vector.cxx index cdf6d31e141..a4cbdcb0160 100644 --- a/RALICE/Ali3Vector.cxx +++ b/RALICE/Ali3Vector.cxx @@ -443,11 +443,13 @@ Double_t Ali3Vector::GetPseudoRapidity() // Provide the pseudo-rapidity w.r.t. the z-axis. // In other words : eta=-log(tan(theta/2)) // The error on the scalar result (pseudo-rap.) is updated accordingly + Double_t pi=acos(-1.); Double_t v[3]; GetVector(v,"sph"); Double_t thetahalf=v[1]/2.; - Double_t arg=tan(thetahalf); - Double_t eta=0; + Double_t arg=0; + if (v[1]0) eta=-log(arg); Double_t e[3]; GetErrors(e,"sph"); diff --git a/RALICE/AliJet.cxx b/RALICE/AliJet.cxx index 7e41e7c3134..2d65bc28d40 100644 --- a/RALICE/AliJet.cxx +++ b/RALICE/AliJet.cxx @@ -262,14 +262,20 @@ Double_t AliJet::GetPt() Double_t AliJet::GetPl() { // Provide long. momentum value w.r.t. z-axis. +// Note : the returned value can also be negative. // The error on the value can be obtained by GetResultError() // after invokation of GetPl(). Ali3Vector v; v=GetVecLong(); - Double_t norm=v.GetNorm(); + + Double_t pl=v.GetNorm(); fDresult=v.GetResultError(); - return norm; + Double_t a[3]; + v.GetVector(a,"sph"); + if (cos(a[1])<0) pl=-pl; + + return pl; } /////////////////////////////////////////////////////////////////////////// Double_t AliJet::GetEt() @@ -285,6 +291,7 @@ Double_t AliJet::GetEt() Double_t AliJet::GetEl() { // Provide long. energy value w.r.t. z-axis. +// Note : the returned value can also be negative. // The error on the value can be obtained by GetResultError() // after invokation of GetEl(). Double_t el=GetScaLong(); @@ -310,3 +317,26 @@ Double_t AliJet::GetMt() return mt; } /////////////////////////////////////////////////////////////////////////// +Double_t AliJet::GetRapidity() +{ +// Provide rapidity value w.r.t. z-axis. +// The error on the value can be obtained by GetResultError() +// after invokation of GetRapidity(). +// Note : Also GetPseudoRapidity() is available since this class is +// derived from Ali4Vector. + Double_t e=GetEnergy(); + Double_t de=GetResultError(); + Double_t pl=GetPl(); + Double_t dpl=GetResultError(); + Double_t sum=e+pl; + Double_t dif=e-pl; + + Double_t y=9999,dy2=0; + if (sum && dif) y=0.5*log(sum/dif); + + if (sum*dif) dy2=(1./(sum*dif))*(pow((pl*de),2)+pow((e*dpl),2)); + + fDresult=sqrt(dy2); + return y; +} +/////////////////////////////////////////////////////////////////////////// diff --git a/RALICE/AliJet.h b/RALICE/AliJet.h index 6ee693faac0..a71ec51b730 100644 --- a/RALICE/AliJet.h +++ b/RALICE/AliJet.h @@ -38,6 +38,7 @@ class AliJet : public TObject,public Ali4Vector Double_t GetEt(); // Provide trans. energy w.r.t. z-axis Double_t GetEl(); // Provide long. energy w.r.t. z-axis Double_t GetMt(); // Provide trans. mass w.r.t. z-axis + Double_t GetRapidity(); // Provide rapidity value w.r.t. z-axis protected: void SetNtinit(Int_t n=2); // Set the initial max. number of tracks for this Jet diff --git a/RALICE/AliTrack.cxx b/RALICE/AliTrack.cxx index 1d66ae3ee9a..191300dec63 100644 --- a/RALICE/AliTrack.cxx +++ b/RALICE/AliTrack.cxx @@ -681,14 +681,20 @@ Double_t AliTrack::GetPt() Double_t AliTrack::GetPl() { // Provide long. momentum value w.r.t. z-axis. +// Note : the returned value can also be negative. // The error on the value can be obtained by GetResultError() // after invokation of GetPl(). Ali3Vector v; v=GetVecLong(); - Double_t norm=v.GetNorm(); + + Double_t pl=v.GetNorm(); fDresult=v.GetResultError(); - return norm; + Double_t a[3]; + v.GetVector(a,"sph"); + if (cos(a[1])<0) pl=-pl; + + return pl; } /////////////////////////////////////////////////////////////////////////// Double_t AliTrack::GetEt() @@ -704,6 +710,7 @@ Double_t AliTrack::GetEt() Double_t AliTrack::GetEl() { // Provide long. energy value w.r.t. z-axis. +// Note : the returned value can also be negative. // The error on the value can be obtained by GetResultError() // after invokation of GetEl(). Double_t el=GetScaLong(); @@ -749,3 +756,26 @@ Double_t AliTrack::GetMt(Int_t j) return mt; } /////////////////////////////////////////////////////////////////////////// +Double_t AliTrack::GetRapidity() +{ +// Provide rapidity value w.r.t. z-axis. +// The error on the value can be obtained by GetResultError() +// after invokation of GetRapidity(). +// Note : Also GetPseudoRapidity() is available since this class is +// derived from Ali4Vector. + Double_t e=GetEnergy(); + Double_t de=GetResultError(); + Double_t pl=GetPl(); + Double_t dpl=GetResultError(); + Double_t sum=e+pl; + Double_t dif=e-pl; + + Double_t y=9999,dy2=0; + if (sum && dif) y=0.5*log(sum/dif); + + if (sum*dif) dy2=(1./(sum*dif))*(pow((pl*de),2)+pow((e*dpl),2)); + + fDresult=sqrt(dy2); + return y; +} +/////////////////////////////////////////////////////////////////////////// diff --git a/RALICE/AliTrack.h b/RALICE/AliTrack.h index 60c757243cb..eff2b9eadda 100644 --- a/RALICE/AliTrack.h +++ b/RALICE/AliTrack.h @@ -56,6 +56,7 @@ class AliTrack : public TObject,public Ali4Vector Double_t GetEl(); // Provide long. energy w.r.t. z-axis Double_t GetMt(); // Provide trans. mass w.r.t. z-axis Double_t GetMt(Int_t j); // Provide trans. mass w.r.t. z-axis and jth mass hypothesis + Double_t GetRapidity(); // Provide rapidity value w.r.t. z-axis protected: Float_t fQ; // The charge of the particle diff --git a/RALICE/history.txt b/RALICE/history.txt index 7488abb7145..8d8864d83ba 100644 --- a/RALICE/history.txt +++ b/RALICE/history.txt @@ -266,3 +266,5 @@ introduced for AliTrack and AliJet. For AliTrack there is an additional GetMt(j) to provide the Mt value for the jth mass hypothesis. +14-jun-2001 NvE Memberfunction GetRapidity() introduced for AliTrack and AliJet + and accuracy improved in Ali3Vector::GetPseudoRapidity().