]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding track parameters with vertex constraint to ESD (Yu.Belikov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Jan 2004 09:13:12 +0000 (09:13 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Jan 2004 09:13:12 +0000 (09:13 +0000)
ITS/AliITSComparisonV2.C
ITS/AliITStrackV2.cxx
ITS/AliITStrackV2.h
ITS/AliITStrackerV2.cxx
STEER/AliESDtrack.cxx
STEER/AliESDtrack.h

index ddb30c8257c8511b417324944bf4832ea92188cd..3a295655eab519afa6548e8a4d5b43e9242fc6c4 100644 (file)
@@ -122,9 +122,18 @@ Int_t AliITSComparisonV2() {
         AliESDtrack *t=event->GetTrack(i);
        UInt_t status=t->GetStatus();
        UInt_t flags=AliESDtrack::kTPCin|AliESDtrack::kITSin;
+
         if ((status&AliESDtrack::kITSrefit)==0)
-           if ((status&flags)!=status) continue;
-        AliITStrackV2 *iotrack=new AliITStrackV2(*t);
+         if ((status&flags)!=status) continue;
+
+        AliITStrackV2 *iotrack=0;
+        iotrack=new AliITStrackV2(*t);
+        //if (t->GetConstrainedChi2()>=20) continue;   //  constrained 
+        //else iotrack=new AliITStrackV2(*t,kTRUE);    //     track
+        if ((status&flags)==status) {
+           iotrack->PropagateTo(3.,0.0028,65.19);
+           iotrack->PropagateToVertex();
+        }
         tarray.AddLast(iotrack);
      }
      delete event;
@@ -201,9 +210,6 @@ Int_t AliITSComparisonV2() {
         }
       }
 
-      track->PropagateTo(3.,0.0028,65.19);
-      track->PropagateToVertex();
-
       Double_t xv,par[5]; track->GetExternalParameters(xv,par);
       Float_t phi=TMath::ASin(par[2]) + track->GetAlpha();
       if (phi<-TMath::Pi()) phi+=2*TMath::Pi();
index 05df21ede935b0e0f6a96fb00dc448d6259f772e..6b1d2e137cc588a81a00d99a8c9e29db0ff4f7d1 100644 (file)
@@ -103,10 +103,11 @@ AliKalmanTrack(t) {
 }
 
 //____________________________________________________________________________
-AliITStrackV2::AliITStrackV2(AliESDtrack& t) throw (const Char_t *) :
+AliITStrackV2::AliITStrackV2(AliESDtrack& t,Bool_t c) throw (const Char_t *) :
 AliKalmanTrack() {
   //------------------------------------------------------------------
-  //Conversion ESD track -> ITS track
+  // Conversion ESD track -> ITS track.
+  // If c==kTRUE, create the ITS track out of the constrained params.
   //------------------------------------------------------------------
   SetNumberOfClusters(t.GetITSclusters(fIndex));
   SetLabel(t.GetLabel());
@@ -118,7 +119,9 @@ AliKalmanTrack() {
   else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
 
   //Conversion of the track parameters
-  Double_t x,p[5]; t.GetExternalParameters(x,p);
+  Double_t x,p[5]; 
+  if (c) t.GetConstrainedExternalParameters(x,p);
+  else t.GetExternalParameters(x,p);
   fX=x;    x=GetConvConst();
   fP0=p[0]; 
   fP1=p[1]; 
@@ -127,13 +130,14 @@ AliKalmanTrack() {
   fP4=p[4]/x; 
 
   //Conversion of the covariance matrix
-  Double_t c[15]; t.GetExternalCovariance(c);
-
-  fC00=c[0 ];
-  fC10=c[1 ];   fC11=c[2 ];
-  fC20=c[3 ];   fC21=c[4 ];   fC22=c[5 ];
-  fC30=c[6 ];   fC31=c[7 ];   fC32=c[8 ];   fC33=c[9 ];
-  fC40=c[10]/x; fC41=c[11]/x; fC42=c[12]/x; fC43=c[13]/x; fC44=c[14]/x/x;
+  Double_t cv[15]; 
+  if (c) t.GetConstrainedExternalCovariance(cv);
+  else t.GetExternalCovariance(cv);
+  fC00=cv[0 ];
+  fC10=cv[1 ];   fC11=cv[2 ];
+  fC20=cv[3 ];   fC21=cv[4 ];   fC22=cv[5 ];
+  fC30=cv[6 ];   fC31=cv[7 ];   fC32=cv[8 ];   fC33=cv[9 ];
+  fC40=cv[10]/x; fC41=cv[11]/x; fC42=cv[12]/x; fC43=cv[13]/x; fC44=cv[14]/x/x;
 
   if (t.GetStatus()&AliESDtrack::kTIME) {
     StartTimeIntegral();
@@ -149,6 +153,9 @@ AliKalmanTrack() {
 void AliITStrackV2::UpdateESDtrack(ULong_t flags) {
   fESDtrack->UpdateTrackParams(this,flags);
 }
+void AliITStrackV2::SetConstrainedESDtrack(Double_t chi2) {
+  fESDtrack->SetConstrainedTrackParams(this,chi2);
+}
 
 //____________________________________________________________________________
 AliITStrackV2::AliITStrackV2(const AliITStrackV2& t) : AliKalmanTrack(t) {
@@ -441,6 +448,8 @@ Int_t AliITStrackV2::Update(const AliCluster* c, Double_t chi2, UInt_t index) {
      return 0;
   }
 
+  if (chi2<0) return 1;
+
   Int_t n=GetNumberOfClusters();
   fIndex[n]=index;
   SetNumberOfClusters(n+1);
index f79a565bd24f47eb94db19bd3753e8756fe4faea..e9c75eb5b3ae448244e745a84dc0de36b87dd634 100644 (file)
@@ -37,10 +37,9 @@ class AliITStrackV2 : public AliKalmanTrack {
 public:
   AliITStrackV2();
   AliITStrackV2(const AliTPCtrack& t) throw (const Char_t *);
-  AliITStrackV2(AliESDtrack& t) throw (const Char_t *);
+  AliITStrackV2(AliESDtrack& t,Bool_t c=kFALSE) throw (const Char_t *);
   AliITStrackV2(const AliITStrackV2& t);
   Int_t PropagateToVertex(Double_t d=0., Double_t x0=0.);
-  Int_t PropagateToPrimVertex(Double_t x0,Double_t rho){return PropagateToVertex(rho,x0);}
   Int_t Propagate(Double_t alpha, Double_t xr);
   Int_t CorrectForMaterial(Double_t d, Double_t x0=21.82);
   Int_t PropagateTo(Double_t xr, Double_t d, Double_t x0=21.82);
@@ -53,6 +52,7 @@ public:
   void ResetCovariance();
   void ResetClusters() { SetChi2(0.); SetNumberOfClusters(0); }
   void UpdateESDtrack(ULong_t flags);
+  void SetConstrainedESDtrack(Double_t chi2);
   
   void *operator new(size_t /* s */,void *p) { return p; }
   void *operator new(size_t s) { return ::operator new(s); }
@@ -66,6 +66,7 @@ public:
   Double_t GetZ()    const {return fP1;}
   Double_t GetSnp()  const {return fP2;}
   Double_t GetTgl()  const {return fP3;}
+  Double_t GetC()    const {return fP4;}
   Double_t
     Get1Pt() const { return (1e-9*TMath::Abs(fP4)/fP4 + fP4)*GetConvConst(); }
   Double_t GetD(Double_t x=0, Double_t y=0) const;
index ad23d4f440f1500cecfad2b7a032f3a69f213406..33ca6f78ea7a9c833618cc2cbeec0265a5a647cc 100644 (file)
@@ -444,12 +444,36 @@ Int_t AliITStrackerV2::RefitInward(AliESD *event) {
        fTrackToFollow.CookdEdx();
        CookLabel(&fTrackToFollow,0.); //For comparison only
 
-       if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) //The beam pipe    
-        if (fTrackToFollow.PropagateToVertex()) {
+       if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) {//The beam pipe    
+         Double_t a=fTrackToFollow.GetAlpha();
+         Double_t cs=TMath::Cos(a),sn=TMath::Sin(a);
+         Double_t xv= GetX()*cs + GetY()*sn;
+         Double_t yv=-GetX()*sn + GetY()*cs;
+         
+         Double_t c=fTrackToFollow.GetC(), snp=fTrackToFollow.GetSnp();
+         Double_t x=fTrackToFollow.GetX(), y=fTrackToFollow.GetY();
+         Double_t tgfv=-(c*(x-xv)-snp)/(c*(y-yv) + TMath::Sqrt(1.-snp*snp));
+         Double_t fv=TMath::ATan(tgfv);
+
+         cs=TMath::Cos(fv); sn=TMath::Sin(fv);
+         x = xv*cs + yv*sn;
+         yv=-xv*sn + yv*cs; xv=x;
+
+        if (fTrackToFollow.Propagate(fv+a,xv)) {
             fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSrefit);
             UseClusters(&fTrackToFollow);
+            {
+            AliITSclusterV2 c; c.SetY(yv); c.SetZ(GetZ());
+            c.SetSigmaY2(GetSigmaY()*GetSigmaY());
+            c.SetSigmaZ2(GetSigmaZ()*GetSigmaZ());
+            Double_t chi2=fTrackToFollow.GetPredictedChi2(&c);
+            if (chi2<kMaxChi2)
+              if (fTrackToFollow.Update(&c,-chi2,0))
+                   fTrackToFollow.SetConstrainedESDtrack(chi2);            
+            }
             ntrk++;
          }
+       }
     }
     delete t;
   }
index 6fbe66e8a6ac5844bdc1cf9efa14b4dfb50ae566..aabab660761026cdb9b1604cd601ad3df87f23e9 100644 (file)
@@ -36,6 +36,7 @@ fTrackLength(0),
 fStopVertex(0),
 fRalpha(0),
 fRx(0),
+fCchi2(1e10),
 fITSchi2(0),
 fITSncls(0),
 fITSsignal(0),
@@ -155,6 +156,19 @@ Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
   return kTRUE;
 }
 
+//_______________________________________________________________________
+void 
+AliESDtrack::SetConstrainedTrackParams(AliKalmanTrack *t, Double_t chi2) {
+  //
+  // This function sets the constrained track parameters 
+  //
+  fCalpha=t->GetAlpha();
+  t->GetExternalParameters(fCx,fCp);
+  t->GetExternalCovariance(fCc);
+  fCchi2=chi2;
+}
+
+
 //_______________________________________________________________________
 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
   //---------------------------------------------------------------------
@@ -163,6 +177,33 @@ 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];
 }
+//_______________________________________________________________________
+void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
+  //---------------------------------------------------------------------
+  // This function returns external representation of the cov. matrix
+  //---------------------------------------------------------------------
+  for (Int_t i=0; i<15; i++) c[i]=fRc[i];
+}
+
+
+//_______________________________________________________________________
+void 
+AliESDtrack::GetConstrainedExternalParameters(Double_t &x, Double_t p[5])const{
+  //---------------------------------------------------------------------
+  // This function returns the constrained external track parameters
+  //---------------------------------------------------------------------
+  x=fCx;
+  for (Int_t i=0; i<5; i++) p[i]=fCp[i];
+}
+//_______________________________________________________________________
+void 
+AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
+  //---------------------------------------------------------------------
+  // This function returns the constrained external cov. matrix
+  //---------------------------------------------------------------------
+  for (Int_t i=0; i<15; i++) c[i]=fCc[i];
+}
+
 
 Double_t AliESDtrack::GetP() const {
   //---------------------------------------------------------------------
@@ -173,6 +214,23 @@ Double_t AliESDtrack::GetP() const {
   return pt/TMath::Cos(lam);
 }
 
+void AliESDtrack::GetConstrainedPxPyPz(Double_t *p) const {
+  //---------------------------------------------------------------------
+  // This function returns the constrained global track momentum components
+  //---------------------------------------------------------------------
+  Double_t phi=TMath::ASin(fCp[2]) + fCalpha;
+  Double_t pt=1./TMath::Abs(fCp[4]);
+  p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fCp[3]; 
+}
+void AliESDtrack::GetConstrainedXYZ(Double_t *xyz) const {
+  //---------------------------------------------------------------------
+  // This function returns the global track position
+  //---------------------------------------------------------------------
+  Double_t phi=TMath::ATan2(fCp[0],fCx) + fCalpha;
+  Double_t r=TMath::Sqrt(fCx*fCx + fCp[0]*fCp[0]);
+  xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fCp[1]; 
+}
+
 void AliESDtrack::GetPxPyPz(Double_t *p) const {
   //---------------------------------------------------------------------
   // This function returns the global track momentum components
@@ -181,7 +239,6 @@ void AliESDtrack::GetPxPyPz(Double_t *p) const {
   Double_t pt=1./TMath::Abs(fRp[4]);
   p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3]; 
 }
-
 void AliESDtrack::GetXYZ(Double_t *xyz) const {
   //---------------------------------------------------------------------
   // This function returns the global track position
@@ -191,6 +248,7 @@ void AliESDtrack::GetXYZ(Double_t *xyz) const {
   xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1]; 
 }
 
+
 void AliESDtrack::GetInnerPxPyPz(Double_t *p) const {
   //---------------------------------------------------------------------
   // This function returns the global track momentum components
@@ -231,14 +289,6 @@ void AliESDtrack::GetOuterXYZ(Double_t *xyz) const {
   xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fOp[1]; 
 }
 
-//_______________________________________________________________________
-void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
-  //---------------------------------------------------------------------
-  // This function returns external representation of the cov. matrix
-  //---------------------------------------------------------------------
-  for (Int_t i=0; i<15; i++) c[i]=fRc[i];
-}
-
 //_______________________________________________________________________
 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
   // Returns the array with integrated times for each particle hypothesis
index 48e75a303bbd13379256453136a8d5d3d970c392..2ec43397f9b180b379e5ccb4361aeb0749337f5d 100644 (file)
@@ -38,6 +38,16 @@ public:
   void GetXYZ(Double_t *r) const;
   Int_t GetSign() const {return (fRp[4]<0) ? 1 : -1;} 
 
+  void SetConstrainedTrackParams(AliKalmanTrack *t, Double_t chi2);
+
+  Double_t GetConstrainedAlpha() const {return fCalpha;}
+  Double_t GetConstrainedChi2() const {return fCchi2;}
+  void GetConstrainedExternalParameters(Double_t &x, Double_t p[5]) const;
+  void GetConstrainedExternalCovariance(Double_t cov[15]) const;
+
+  void GetConstrainedPxPyPz(Double_t *p) const;
+  void GetConstrainedXYZ(Double_t *r) const;
+
   void GetInnerPxPyPz(Double_t *p) const;
   void GetInnerXYZ(Double_t *r) const;
 
@@ -98,6 +108,10 @@ protected:
   Double_t fRp[5];   // external track parameters  
   Double_t fRc[15];  // external cov. matrix of the track parameters
 
+//Track parameters constrained to the primary vertex
+  Double_t fCalpha,fCx,fCp[5],fCc[15];
+  Double_t fCchi2; //chi2 at the primary vertex
+
 //Track parameters at the inner wall of the TPC
   Double_t fIalpha,fIx,fIp[5],fIc[15];