]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFtrack.cxx
add check on overlap of pi0 decays for pi0 primaries and fill histogram in case of...
[u/mrichter/AliRoot.git] / TOF / AliTOFtrack.cxx
index ac26bd4b5968a384bbf87921674e72d0efb8b060..dfca90b9d9082498219ee713cb999181401be774 100644 (file)
@@ -55,6 +55,30 @@ AliTOFtrack::AliTOFtrack(const AliTOFtrack& t) :
   //
 }                                
 
+//____________________________________________________________________________
+AliTOFtrack& AliTOFtrack::operator=(const AliESDtrack& t)
+{
+  // ass. op.
+  SetLabel(t.GetLabel());
+  SetChi2(0.);
+  SetMass(t.GetMassForTracking());
+
+  Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
+
+  if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return *this;
+  StartTimeIntegral();
+  Double_t times[10]; 
+  for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){
+    times[isp] = t.GetIntegratedTimesOld(isp); // in ps
+  }
+
+  SetIntegratedTimes(times);
+  SetIntegratedLength(t.GetIntegratedLengthOld());
+
+  return *this;
+
+}
+
 //_____________________________________________________________________________
 AliTOFtrack::AliTOFtrack(const AliESDtrack& t) :
   AliKalmanTrack(), 
@@ -66,14 +90,19 @@ AliTOFtrack::AliTOFtrack(const AliESDtrack& t) :
   //
   SetLabel(t.GetLabel());
   SetChi2(0.);
-  SetMass(t.GetMass());
+  SetMass(t.GetMassForTracking());
 
   Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
 
   if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
   StartTimeIntegral();
-  Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
-  SetIntegratedLength(t.GetIntegratedLength());
+  Double_t times[10]; 
+  for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){
+    times[isp] = t.GetIntegratedTimesOld(isp); // in ps
+  }
+
+  SetIntegratedTimes(times);
+  SetIntegratedLength(t.GetIntegratedLengthOld());
 
 }              
 
@@ -87,28 +116,60 @@ AliTOFtrack& AliTOFtrack::operator=(const AliTOFtrack &/*source*/)
 }
 
 //_____________________________________________________________________________
-Bool_t AliTOFtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho)
-{
+Bool_t AliTOFtrack::PropagateTo(Double_t xk,Double_t /*x0*/,Double_t /*rho*/)
+ {
+  //
   // Propagates a track of particle with mass=pm to a reference plane 
   // defined by x=xk through media of density=rho and radiationLength=x0
+  //
 
   if (xk == GetX()) return kTRUE;
   
-  Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
+  Double_t oldX=GetX();//, oldY=GetY(), oldZ=GetZ();
+  Double_t start[3], end[3], mparam[7];
 
+  /* get start position */
+  GetXYZ(start);
+
+  /* propagate the track */
   Double_t b[3];GetBxByBz(b);
   if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE;
   // OLD used code
   //Double_t bz=GetBz();
   //if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE;
 
+  /* get end position */
+  GetXYZ(end);
+
+  /* add time step to integral */
+#if 0 /*** OLD ***/
   Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + 
                            (GetY()-oldY)*(GetY()-oldY) + 
                            (GetZ()-oldZ)*(GetZ()-oldZ));
   if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
+#endif
+  Double_t d = TMath::Sqrt((end[0]-start[0])*(end[0]-start[0]) + 
+                           (end[1]-start[1])*(end[1]-start[1]) + 
+                           (end[2]-start[2])*(end[2]-start[2]));
+  if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
+
+  /* get material budget from tracker */
+  AliTracker::MeanMaterialBudget(start, end, mparam);
+  Double_t xTimesRho = mparam[4]*mparam[0];
+  if (oldX < xk) { // CZ
+    xTimesRho = -xTimesRho; // it should be negative in case of outward
+                            // propagation (--> energy decreases)
+  } // CZ
+  Double_t xOverX0   = mparam[1];
+
+  /* correct for mean material */
+  if (!AliExternalTrackParam::CorrectForMeanMaterial(xOverX0,xTimesRho,GetMass())) return kFALSE;
 
+
+#if 0 /*** OLD ***/
   if (!AliExternalTrackParam::CorrectForMaterial(d*rho/x0,x0,GetMass())) 
      return kFALSE;
+#endif
 
   /*
   //Energy losses************************
@@ -131,6 +192,77 @@ Bool_t AliTOFtrack::PropagateToInnerTOF()
   // Propagates a track of particle with mass=pm to a reference plane 
   // defined by x=xk through media of density=rho and radiationLength=x0
 
+  //const Double_t kAlphac  = TMath::Pi()/9.0; // 20 degree
+  const Double_t kAlphac  = AliTOFGeometry::GetAlpha(); // 20 degree
+  const Double_t kTalphac = TMath::Tan(kAlphac*0.5);
+
+  //const Double_t kStepSize = 0.1; // [cm] Step size
+  const Double_t kStepSize = 0.5; // [cm] Step size
+
+  Double_t x = GetX();
+  //Double_t bz = GetBz();
+
+  //Double_t xyz0[3];
+  //Double_t xyz1[3];
+  //Double_t y;
+  //Double_t z;
+
+  Int_t nsteps = (Int_t)((AliTOFGeometry::Rmin()-x)/kStepSize);
+  for (Int_t istep=0; istep<nsteps; istep++){
+
+    // Critical alpha  - cross sector indication
+
+    Double_t dir = (GetX() > AliTOFGeometry::Rmin()) ? -1.0 : 1.0;
+
+    x = GetX()+dir*kStepSize;
+    if ( x<GetX() && GetX()<AliTOFGeometry::Rmin()) {
+      AliDebug(1,Form("Track doesn't reach rho=%f",AliTOFGeometry::Rmin()));
+      return kFALSE;
+    }
+
+    //GetXYZ(xyz0);
+    //bz = GetBz();
+    //GetXYZAt(x,bz,xyz1);
+    //AliExternalTrackParam::GetYAt(x,bz,y);
+    //AliExternalTrackParam::GetZAt(x,bz,z);
+    if (!(PropagateTo(x,0.,0.))) { /* passing 0.,0. as arguments since now
+                                     this method queries TGeo for material budget
+                                  */
+      return kFALSE;
+    }
+    
+    if (GetY() >  GetX()*kTalphac) {
+      if (!(Rotate(kAlphac))) return kFALSE;
+    } else if (GetY() < -GetX()*kTalphac) {
+      if (!(Rotate(-kAlphac))) return kFALSE;
+    }
+
+  }
+
+  //Bool_t check = PropagateTo(AliTOFGeometry::RinTOF());
+  Bool_t check = PropagateTo(AliTOFGeometry::RinTOF(),0.,0.); /* passing 0.,0. as arguments since now
+                                                                this method queries TGeo for material budget
+                                                             */
+
+  if (!check) return kFALSE;
+
+  if (GetY() >  GetX()*kTalphac) {
+    if (!(Rotate(kAlphac))) return kFALSE;
+  } else if (GetY() < -GetX()*kTalphac) {
+    if (!(Rotate(-kAlphac))) return kFALSE;
+  }
+
+  return kTRUE;
+  
+}     
+
+//_____________________________________________________________________________
+Bool_t AliTOFtrack::PropagateToInnerTOFold()
+{
+  // Propagates a track of particle with mass=pm to a reference plane 
+  // defined by x=xk through media of density=rho and radiationLength=x0
+
 
   Double_t ymax=AliTOFGeometry::RinTOF()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
   Bool_t skip = kFALSE;
@@ -139,28 +271,26 @@ Bool_t AliTOFtrack::PropagateToInnerTOF()
     return kFALSE;
   }
   if (y > ymax) {
-    if (!Rotate(AliTOFGeometry::GetAlpha())) {
-      return kFALSE;
-    }
+    if (!Rotate(AliTOFGeometry::GetAlpha())) return kFALSE;
   } else if (y <-ymax) {
-    if (!Rotate(-AliTOFGeometry::GetAlpha())) {
-      return kFALSE;
-    }
+    if (!Rotate(-AliTOFGeometry::GetAlpha())) return kFALSE;
   }
   
-  
   Double_t x = GetX();
   Int_t nsteps=Int_t((AliTOFGeometry::Rmin()-x)/0.5); // 0.5 cm Steps
   for (Int_t istep=0;istep<nsteps;istep++){
     Float_t xp = x+istep*0.5; 
-    Double_t param[2];  
-    GetPropagationParameters(param);  
-    PropagateTo(xp,param[0],param[1]);
+    //    GetPropagationParameters(param);  
+    if (!(PropagateTo(xp,0.,0.))) { /* passing 0.,0. as arguments since now
+                                      this method queries TGeo for material budget
+                                   */
+      return kFALSE;
+    }
     
   }
   
-  if(!PropagateTo(AliTOFGeometry::RinTOF()))return 0;
-  
+  if (!(PropagateTo(AliTOFGeometry::RinTOF()))) return kFALSE;
+
   return kTRUE;
   
 }     
@@ -168,8 +298,9 @@ Bool_t AliTOFtrack::PropagateToInnerTOF()
 //_________________________________________________________________________
 Double_t AliTOFtrack::GetPredictedChi2(const AliCluster3D *c) const {
   //
+  // Estimate the chi2 of the space point "c" with its cov. matrix elements
   //
-  //
+
   Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
   Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
   Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
@@ -178,7 +309,7 @@ Double_t AliTOFtrack::GetPredictedChi2(const AliCluster3D *c) const {
 //_________________________________________________________________________
 Bool_t AliTOFtrack::PropagateTo(const AliCluster3D *c) {
   //
-  //
+  // Propagates a track to the plane containing cluster 'c'
   //
   Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
   Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
@@ -192,7 +323,15 @@ Bool_t AliTOFtrack::PropagateTo(const AliCluster3D *c) {
                             (GetZ()-oldZ)*(GetZ()-oldZ));
     if (GetX()<oldX) d=-d;
     AddTimeStep(d);
+
+  }
+
+  if (GetY() >  GetX()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha())) {
+    if (!(Rotate(AliTOFGeometry::GetAlpha()))) return kFALSE;
+  } else if (GetY() < -GetX()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha())) {
+    if (!(Rotate(-AliTOFGeometry::GetAlpha()))) return kFALSE;
   }
+
   return kTRUE;
 }
 //_________________________________________________________________________