From 15614b8bafa12ca6e927750351dce56aca1b4fbd Mon Sep 17 00:00:00 2001 From: hristov Date: Thu, 7 Oct 2004 10:34:07 +0000 Subject: [PATCH] Using const pointer to AliKalmanTrack to avoid incorrect update (Yu.Belikov) --- STEER/AliESDtrack.cxx | 68 ++++++++++++++++++++++++++++--------------- STEER/AliESDtrack.h | 23 ++++++++------- 2 files changed, 56 insertions(+), 35 deletions(-) diff --git a/STEER/AliESDtrack.cxx b/STEER/AliESDtrack.cxx index fe331e1ed38..bbaf3f1b117 100644 --- a/STEER/AliESDtrack.cxx +++ b/STEER/AliESDtrack.cxx @@ -15,7 +15,7 @@ //----------------------------------------------------------------- // Implementation of the ESD track class // ESD = Event Summary Data -// This is the class to deal with during the phisical analysis of data +// This is the class to deal with during the phisics analysis of data // Origin: Iouri Belikov, CERN // e-mail: Jouri.Belikov@cern.ch //----------------------------------------------------------------- @@ -85,8 +85,12 @@ fRICHsignal(-1) fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.; fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.; Int_t i; - for (i=0; i<5; i++) { fRp[i]=0.; fCp[i]=0.; fIp[i]=0.; fOp[i]=0.; fTp[i]=0.;} - for (i=0; i<15; i++) { fRc[i]=0.; fCc[i]=0.; fIc[i]=0.; fOc[i]=0.; fTc[i]=0.; } + for (i=0; i<5; i++) { + fRp[i]=fCp[i]=fIp[i]=fOp[i]=fXp[i]=fTp[i]=0.; + } + for (i=0; i<15; i++) { + fRc[i]=fCc[i]=fIc[i]=fOc[i]=fXc[i]=fTc[i]=0.; + } for (i=0; i<6; i++) { fITSindex[i]=0; } for (i=0; i<180; i++){ fTPCindex[i]=0; } for (i=0; i<130; i++) { fTRDindex[i]=0; } @@ -221,10 +225,12 @@ Double_t AliESDtrack::GetMass() const { } //_______________________________________________________________________ -Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) { +Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) { // // This function updates track's running parameters // + Bool_t rc=kTRUE; + SetStatus(flags); fLabel=t->GetLabel(); @@ -321,25 +327,17 @@ Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) { break; case kTRDout: - { //requested by the PHOS/EMCAL ("temporary solution") - Int_t i; - Double_t x=460.,buf[15]; - if (t->PropagateTo(x,30.,0.)) { - fOalpha=t->GetAlpha(); - t->GetExternalParameters(x,buf); fOx=x; - for (i=0; i<5; i++) fOp[i]=buf[i]; - t->GetExternalCovariance(buf); - for (i=0; i<15; i++) fOc[i]=buf[i]; - } - x=450.; - if (t->PropagateTo(x,30.,0.)) { - fXalpha=t->GetAlpha(); - t->GetExternalParameters(x,buf); fXx=x; - for (i=0; i<5; i++) fXp[i]=buf[i]; - t->GetExternalCovariance(buf); - for (i=0; i<15; i++) fXc[i]=buf[i]; - } - } + //requested by the PHOS/EMCAL ("temporary solution") + fOalpha=t->GetAlpha(); + fOx=460.; + rc=GetExternalParametersAt(fOx,fOp); + t->GetExternalCovariance(fOc); //can be done better + + fXalpha=t->GetAlpha(); + fXx=450.; + rc=GetExternalParametersAt(fXx,fXp); + t->GetExternalCovariance(fXc); //can be done better + case kTRDin: case kTRDrefit: fTRDLabel = t->GetLabel(); @@ -364,7 +362,7 @@ Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) { return kFALSE; } - return kTRUE; + return rc; } //_______________________________________________________________________ @@ -392,6 +390,28 @@ void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const { x=fRx; for (Int_t i=0; i<5; i++) p[i]=fRp[i]; } + +//_______________________________________________________________________ +Bool_t AliESDtrack::GetExternalParametersAt(Double_t x, Double_t p[5]) const { + //--------------------------------------------------------------------- + // This function returns external representation of the track parameters + // at the position given by the first argument + //--------------------------------------------------------------------- + Double_t dx=x-fRx; + Double_t f1=fRp[2], f2=f1 + dx*fRp[4]/AliKalmanTrack::GetConvConst(); + + if (TMath::Abs(f2) >= 0.9999) return kFALSE; + + Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2); + p[0] = fRp[0] + dx*(f1+f2)/(r1+r2); + p[1] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3]; + p[2] = f2; + p[3] = fRp[3]; + p[4] = fRp[4]; + + return kTRUE; +} + //_______________________________________________________________________ void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const { //--------------------------------------------------------------------- diff --git a/STEER/AliESDtrack.h b/STEER/AliESDtrack.h index 20ce2927688..378602ae9b2 100644 --- a/STEER/AliESDtrack.h +++ b/STEER/AliESDtrack.h @@ -7,7 +7,7 @@ //------------------------------------------------------------------------- // Class AliESDtrack -// This is the class to deal with during the physical analysis of data +// This is the class to deal with during the physics analysis of data // // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //------------------------------------------------------------------------- @@ -23,7 +23,7 @@ public: virtual ~AliESDtrack(); void SetStatus(ULong_t flags) {fFlags|=flags;} void ResetStatus(ULong_t flags) {fFlags&=~flags;} - Bool_t UpdateTrackParams(AliKalmanTrack *t, ULong_t flags); + Bool_t UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags); void SetIntegratedLength(Double_t l) {fTrackLength=l;} void SetIntegratedTimes(const Double_t *times); void SetESDpid(const Double_t *p); @@ -33,6 +33,7 @@ public: Int_t GetLabel() const {return fLabel;} Double_t GetAlpha() const {return fRalpha;} void GetExternalParameters(Double_t &x, Double_t p[5]) const; + Bool_t GetExternalParametersAt(Double_t x, Double_t p[5]) const; void GetExternalCovariance(Double_t cov[15]) const; Double_t GetIntegratedLength() const {return fTrackLength;} void GetIntegratedTimes(Double_t *times) const; @@ -190,16 +191,16 @@ protected: Double_t fTc[15]; // external cov. matrix of the track parameters //Track parameters at the radius of the PHOS - Double_t fOalpha; // Track rotation angle - Double_t fOx; // x-coordinate of the track reference plane - Double_t fOp[5]; // external track parameters - Double_t fOc[15]; // external cov. matrix of the track parameters + Double_t fOalpha; //! Track rotation angle + Double_t fOx; //! x-coordinate of the track reference plane + Double_t fOp[5]; //! external track parameters + Double_t fOc[15]; //! external cov. matrix of the track parameters //Track parameters at the radius of the EMCAL - Double_t fXalpha; // Track rotation angle - Double_t fXx; // x-coordinate of the track reference plane - Double_t fXp[5]; // external track parameters - Double_t fXc[15]; // external cov. matrix of the track parameters + Double_t fXalpha; //! Track rotation angle + Double_t fXx; //! x-coordinate of the track reference plane + Double_t fXp[5]; //! external track parameters + Double_t fXc[15]; //! external cov. matrix of the track parameters // ITS related track information Float_t fITSchi2; // chi2 in the ITS @@ -249,7 +250,7 @@ protected: Float_t fRICHsignal; // detector's PID signal (beta for RICH) Float_t fRICHr[kSPECIES];// "detector response probabilities" (for the PID) - ClassDef(AliESDtrack,7) //ESDtrack + ClassDef(AliESDtrack,8) //ESDtrack }; #endif -- 2.39.3