LCOV - code coverage report
Current view: top level - TOF/TOFrec - AliTOFtrack.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 68 149 45.6 %
Date: 2016-06-14 17:26:59 Functions: 8 17 47.1 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : /////////////////////////////////////////////////////////////////////////////
      19             : //                                                                         //
      20             : // AliTOFtrack class                                                       //
      21             : //                                                                         //
      22             : // Authors: Bologna-CERN-ITEP-Salerno Group                                //
      23             : //                                                                         //
      24             : // Description: class for handling ESD extracted tracks for TOF matching.  //
      25             : //                                                                         //
      26             : /////////////////////////////////////////////////////////////////////////////
      27             : 
      28             : #include "AliESDtrack.h" 
      29             : #include "AliTracker.h" 
      30             : 
      31             : #include "AliTOFGeometry.h"
      32             : #include "AliTOFtrack.h" 
      33             : 
      34          26 : ClassImp(AliTOFtrack)
      35             : 
      36             : //_____________________________________________________________________________
      37             : AliTOFtrack::AliTOFtrack() : 
      38           0 :   AliKalmanTrack(),
      39           0 :   fSeedInd(-1),
      40           0 :   fSeedLab(-1)
      41           0 : {
      42             :   //
      43             :   // Default constructor.
      44             :   //
      45           0 : }                                
      46             : 
      47             : //_____________________________________________________________________________
      48             : AliTOFtrack::AliTOFtrack(const AliTOFtrack& t) : 
      49         353 :   AliKalmanTrack(t),
      50         353 :   fSeedInd(t.fSeedInd),
      51         353 :   fSeedLab(t.fSeedLab) 
      52        1765 : {
      53             :   //
      54             :   // Copy constructor.
      55             :   //
      56         706 : }                                
      57             : 
      58             : //____________________________________________________________________________
      59             : AliTOFtrack& AliTOFtrack::operator=(const AliESDtrack& t)
      60             : {
      61             :   // ass. op.
      62           0 :   SetLabel(t.GetLabel());
      63           0 :   SetChi2(0.);
      64           0 :   SetMass(t.GetMassForTracking());
      65             : 
      66           0 :   Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
      67             : 
      68           0 :   if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return *this;
      69           0 :   StartTimeIntegral();
      70           0 :   Double_t times[10]; 
      71           0 :   for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){
      72           0 :     times[isp] = t.GetIntegratedTimesOld(isp); // in ps
      73             :   }
      74             : 
      75           0 :   SetIntegratedTimes(times);
      76           0 :   SetIntegratedLength(t.GetIntegratedLengthOld());
      77             : 
      78             :   return *this;
      79             : 
      80           0 : }
      81             : 
      82             : //_____________________________________________________________________________
      83             : AliTOFtrack::AliTOFtrack(const AliESDtrack& t) :
      84         297 :   AliKalmanTrack(), 
      85         297 :   fSeedInd(-1),
      86         297 :   fSeedLab(-1) 
      87        1485 : {
      88             :   //
      89             :   // Constructor from AliESDtrack
      90             :   //
      91         594 :   SetLabel(t.GetLabel());
      92         297 :   SetChi2(0.);
      93         594 :   SetMass(t.GetMassForTracking());
      94             : 
      95        1188 :   Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
      96             : 
      97         594 :   if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
      98         297 :   StartTimeIntegral();
      99         297 :   Double_t times[10]; 
     100        5940 :   for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){
     101        2673 :     times[isp] = t.GetIntegratedTimesOld(isp); // in ps
     102             :   }
     103             : 
     104         297 :   SetIntegratedTimes(times);
     105         297 :   SetIntegratedLength(t.GetIntegratedLengthOld());
     106             : 
     107         891 : }              
     108             : 
     109             : //____________________________________________________________________________
     110             : AliTOFtrack& AliTOFtrack::operator=(const AliTOFtrack &/*source*/)
     111             : {
     112             :   // ass. op.
     113             : 
     114           0 :   return *this;
     115             : 
     116             : }
     117             : 
     118             : //_____________________________________________________________________________
     119             : Bool_t AliTOFtrack::PropagateTo(Double_t xk,Double_t /*x0*/,Double_t /*rho*/)
     120             :  {
     121             :   //
     122             :   // Propagates a track of particle with mass=pm to a reference plane 
     123             :   // defined by x=xk through media of density=rho and radiationLength=x0
     124             :   //
     125             : 
     126       72911 :   if (xk == GetX()) return kTRUE;
     127             :   
     128       36055 :   Double_t oldX=GetX();//, oldY=GetY(), oldZ=GetZ();
     129       36055 :   Double_t start[3], end[3], mparam[7];
     130             : 
     131             :   /* get start position */
     132       36055 :   GetXYZ(start);
     133             : 
     134             :   /* propagate the track */
     135       36055 :   Double_t b[3];GetBxByBz(b);
     136       36086 :   if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE;
     137             :   // OLD used code
     138             :   //Double_t bz=GetBz();
     139             :   //if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE;
     140             : 
     141             :   /* get end position */
     142       36024 :   GetXYZ(end);
     143             : 
     144             :   /* add time step to integral */
     145             : #if 0 /*** OLD ***/
     146             :   Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + 
     147             :                            (GetY()-oldY)*(GetY()-oldY) + 
     148             :                            (GetZ()-oldZ)*(GetZ()-oldZ));
     149             :   if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
     150             : #endif
     151      108072 :   Double_t d = TMath::Sqrt((end[0]-start[0])*(end[0]-start[0]) + 
     152       72048 :                            (end[1]-start[1])*(end[1]-start[1]) + 
     153       36024 :                            (end[2]-start[2])*(end[2]-start[2]));
     154      108069 :   if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
     155             : 
     156             :   /* get material budget from tracker */
     157       36024 :   AliTracker::MeanMaterialBudget(start, end, mparam);
     158       36024 :   Double_t xTimesRho = mparam[4]*mparam[0];
     159       36024 :   if (oldX < xk) { // CZ
     160       36021 :     xTimesRho = -xTimesRho; // it should be negative in case of outward
     161             :                             // propagation (--> energy decreases)
     162       36021 :   } // CZ
     163       36024 :   Double_t xOverX0   = mparam[1];
     164             : 
     165             :   /* correct for mean material */
     166       36027 :   if (!AliExternalTrackParam::CorrectForMeanMaterial(xOverX0,xTimesRho,GetMass())) return kFALSE;
     167             : 
     168             : 
     169             : #if 0 /*** OLD ***/
     170             :   if (!AliExternalTrackParam::CorrectForMaterial(d*rho/x0,x0,GetMass())) 
     171             :      return kFALSE;
     172             : #endif
     173             : 
     174             :   /*
     175             :   //Energy losses************************
     176             :   if((5940*beta2/(1-beta2+1e-10) - beta2) < 0){return 0;}
     177             : 
     178             :   Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2+1e-10)) - beta2)*d*rho;
     179             :   //
     180             :   // suspicious part - think about it ?
     181             :   Double_t kinE =  TMath::Sqrt(p2);
     182             :   if (dE>0.8*kinE) dE = 0.8*kinE;  //      
     183             :   if (dE<0)        dE = 0.0;       // not valid region for Bethe bloch 
     184             :   */
     185             : 
     186       36021 :   return kTRUE;            
     187       72377 : }     
     188             : 
     189             : //_____________________________________________________________________________
     190             : Bool_t AliTOFtrack::PropagateToInnerTOF()
     191             : {
     192             :   // Propagates a track of particle with mass=pm to a reference plane 
     193             :   // defined by x=xk through media of density=rho and radiationLength=x0
     194             : 
     195             :   //const Double_t kAlphac  = TMath::Pi()/9.0; // 20 degree
     196         268 :   const Double_t kAlphac  = AliTOFGeometry::GetAlpha(); // 20 degree
     197         134 :   const Double_t kTalphac = TMath::Tan(kAlphac*0.5);
     198             : 
     199             :   //const Double_t kStepSize = 0.1; // [cm] Step size
     200             :   const Double_t kStepSize = 0.5; // [cm] Step size
     201             : 
     202         134 :   Double_t x = GetX();
     203             :   //Double_t bz = GetBz();
     204             : 
     205             :   //Double_t xyz0[3];
     206             :   //Double_t xyz1[3];
     207             :   //Double_t y;
     208             :   //Double_t z;
     209             : 
     210         134 :   Int_t nsteps = (Int_t)((AliTOFGeometry::Rmin()-x)/kStepSize);
     211        5054 :   for (Int_t istep=0; istep<nsteps; istep++){
     212             : 
     213             :     // Critical alpha  - cross sector indication
     214             : 
     215        2371 :     Double_t dir = (GetX() > AliTOFGeometry::Rmin()) ? -1.0 : 1.0;
     216             : 
     217        2371 :     x = GetX()+dir*kStepSize;
     218        2371 :     if ( x<GetX() && GetX()<AliTOFGeometry::Rmin()) {
     219           0 :       AliDebug(1,Form("Track doesn't reach rho=%f",AliTOFGeometry::Rmin()));
     220           0 :       return kFALSE;
     221             :     }
     222             : 
     223             :     //GetXYZ(xyz0);
     224             :     //bz = GetBz();
     225             :     //GetXYZAt(x,bz,xyz1);
     226             :     //AliExternalTrackParam::GetYAt(x,bz,y);
     227             :     //AliExternalTrackParam::GetZAt(x,bz,z);
     228             :  
     229        2371 :     if (!(PropagateTo(x,0.,0.))) { /* passing 0.,0. as arguments since now
     230             :                                       this method queries TGeo for material budget
     231             :                                    */
     232          30 :       return kFALSE;
     233             :     }
     234             :     
     235        2341 :     if (GetY() >  GetX()*kTalphac) {
     236           0 :       if (!(Rotate(kAlphac))) return kFALSE;
     237        2341 :     } else if (GetY() < -GetX()*kTalphac) {
     238           6 :       if (!(Rotate(-kAlphac))) return kFALSE;
     239             :     }
     240             : 
     241        2341 :   }
     242             : 
     243             :   //Bool_t check = PropagateTo(AliTOFGeometry::RinTOF());
     244         104 :   Bool_t check = PropagateTo(AliTOFGeometry::RinTOF(),0.,0.); /* passing 0.,0. as arguments since now
     245             :                                                                  this method queries TGeo for material budget
     246             :                                                               */
     247             : 
     248         105 :   if (!check) return kFALSE;
     249             : 
     250         103 :   if (GetY() >  GetX()*kTalphac) {
     251           0 :     if (!(Rotate(kAlphac))) return kFALSE;
     252         103 :   } else if (GetY() < -GetX()*kTalphac) {
     253           0 :     if (!(Rotate(-kAlphac))) return kFALSE;
     254             :   }
     255             : 
     256         103 :   return kTRUE;
     257             :   
     258         134 : }     
     259             : 
     260             : //_____________________________________________________________________________
     261             : Bool_t AliTOFtrack::PropagateToInnerTOFold()
     262             : {
     263             :   // Propagates a track of particle with mass=pm to a reference plane 
     264             :   // defined by x=xk through media of density=rho and radiationLength=x0
     265             : 
     266             : 
     267           0 :   Double_t ymax=AliTOFGeometry::RinTOF()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
     268           0 :   Bool_t skip = kFALSE;
     269           0 :   Double_t y=GetYat(AliTOFGeometry::RinTOF(),skip);
     270           0 :   if (skip) {
     271           0 :     return kFALSE;
     272             :   }
     273           0 :   if (y > ymax) {
     274           0 :     if (!Rotate(AliTOFGeometry::GetAlpha())) return kFALSE;
     275           0 :   } else if (y <-ymax) {
     276           0 :     if (!Rotate(-AliTOFGeometry::GetAlpha())) return kFALSE;
     277             :   }
     278             :   
     279           0 :   Double_t x = GetX();
     280           0 :   Int_t nsteps=Int_t((AliTOFGeometry::Rmin()-x)/0.5); // 0.5 cm Steps
     281           0 :   for (Int_t istep=0;istep<nsteps;istep++){
     282           0 :     Float_t xp = x+istep*0.5; 
     283             :     //    GetPropagationParameters(param);  
     284           0 :     if (!(PropagateTo(xp,0.,0.))) { /* passing 0.,0. as arguments since now
     285             :                                        this method queries TGeo for material budget
     286             :                                     */
     287           0 :       return kFALSE;
     288             :     }
     289             :     
     290           0 :   }
     291             :   
     292           0 :   if (!(PropagateTo(AliTOFGeometry::RinTOF()))) return kFALSE;
     293             : 
     294           0 :   return kTRUE;
     295             :   
     296           0 : }     
     297             : 
     298             : //_________________________________________________________________________
     299             : Double_t AliTOFtrack::GetPredictedChi2(const AliCluster3D *c) const {
     300             :   //
     301             :   // Estimate the chi2 of the space point "c" with its cov. matrix elements
     302             :   //
     303             : 
     304           0 :   Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
     305           0 :   Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
     306           0 :   Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
     307           0 :   return AliExternalTrackParam::GetPredictedChi2(p, covyz, covxyz);
     308           0 : }
     309             : //_________________________________________________________________________
     310             : Bool_t AliTOFtrack::PropagateTo(const AliCluster3D *c) {
     311             :   //
     312             :   // Propagates a track to the plane containing cluster 'c'
     313             :   //
     314           0 :   Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
     315           0 :   Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
     316           0 :   Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
     317           0 :   Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
     318           0 :   Double_t bz=GetBz();
     319           0 :   if (!AliExternalTrackParam::PropagateTo(p, covyz, covxyz, bz)) return kFALSE;
     320           0 :   if (IsStartedTimeIntegral()) {
     321           0 :     Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) +
     322           0 :                              (GetY()-oldY)*(GetY()-oldY) +
     323           0 :                              (GetZ()-oldZ)*(GetZ()-oldZ));
     324           0 :     if (GetX()<oldX) d=-d;
     325           0 :     AddTimeStep(d);
     326             : 
     327           0 :   }
     328             : 
     329           0 :   if (GetY() >  GetX()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha())) {
     330           0 :     if (!(Rotate(AliTOFGeometry::GetAlpha()))) return kFALSE;
     331           0 :   } else if (GetY() < -GetX()*TMath::Tan(0.5*AliTOFGeometry::GetAlpha())) {
     332           0 :     if (!(Rotate(-AliTOFGeometry::GetAlpha()))) return kFALSE;
     333             :   }
     334             : 
     335           0 :   return kTRUE;
     336           0 : }
     337             : //_________________________________________________________________________
     338             : Double_t AliTOFtrack::GetYat(Double_t xk, Bool_t & skip) const {     
     339             : //-----------------------------------------------------------------
     340             : // This function calculates the Y-coordinate of a track at the plane x=xk.
     341             : // Needed for matching with the TOF (I.Belikov)
     342             : //-----------------------------------------------------------------
     343           0 :      Double_t y=0.;
     344           0 :      skip=(!GetYAt(xk,GetBz(),y));
     345           0 :      return y;
     346           0 : }
     347             : 
     348             : //_____________________________________________________________________________
     349             : Int_t AliTOFtrack::Compare(const TObject *o) const {
     350             :   //-----------------------------------------------------------------
     351             :   // This function compares tracks according to the their curvature
     352             :   //-----------------------------------------------------------------
     353         754 :   AliTOFtrack *t=(AliTOFtrack*)o;
     354         377 :   Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
     355         377 :   Double_t c =GetSigmaY2()*GetSigmaZ2();
     356         545 :   if (c>co) return 1;
     357         418 :   else if (c<co) return -1;
     358           0 :   return 0;
     359         377 : }
     360             : 
     361             : 
     362             : //_____________________________________________________________________________
     363             : void AliTOFtrack::GetPropagationParameters(Double_t *param) {
     364             : 
     365             :  //Get average medium density, x0 while propagating the track
     366             : 
     367             :   //For TRD holes description
     368             :   /*
     369             :   Double_t thetamin = (90.-31.1) * TMath::Pi()/180.;
     370             :   Double_t thetamax = (90.+31.1) * TMath::Pi()/180.;
     371             : 
     372             :   Double_t zmin = -55.;
     373             :   Double_t zmax =  55.;
     374             :   */
     375             : 
     376             :   // Detector inner/outer radii
     377             :   Double_t rTPC    = 261.53;
     378             :   Double_t rTPCTRD = 294.5;
     379             :   Double_t rTRD    = 369.1;
     380             : 
     381             :   // Medium parameters
     382             :   Double_t x0TPC = 40.;
     383             :   Double_t rhoTPC =0.06124;
     384             : 
     385             :   Double_t x0Air = 36.66;
     386             :   Double_t rhoAir =1.2931e-3;
     387             : 
     388             :   Double_t x0TRD = 171.7;
     389             :   Double_t rhoTRD =0.33;
     390             : 
     391             :   //  Int_t isec = GetSector();
     392           0 :   Double_t r[3]; GetXYZ(r);
     393             :   //  Float_t thetatr = TMath::ATan2(TMath::Sqrt(r[0]*r[0]+r[1]*r[1]),r[2]);
     394             : 
     395             :   /*
     396             :   if(holes){
     397             :     if (isec == 0 || isec == 1 || isec == 2 ) {
     398             :       if( thetatr>=thetamin && thetatr<=thetamax){ 
     399             :         x0TRD= x0Air;
     400             :         rhoTRD = rhoAir;
     401             :       }
     402             :     }
     403             :     if (isec == 11 || isec == 12 || isec == 13 || isec == 14 || isec == 15 ) {
     404             :       if( r[2]>=zmin && r[2]<=zmax){ 
     405             :         x0TRD= x0Air;
     406             :         rhoTRD = rhoAir;
     407             :       }
     408             :     }
     409             :   }
     410             :   */
     411           0 :   if(GetX() <= rTPC)
     412           0 :     {param[0]=x0TPC;param[1]=rhoTPC;}
     413           0 :   else if(GetX() > rTPC &&  GetX() < rTPCTRD)
     414           0 :     {param[0]=x0Air;param[1]=rhoAir;}
     415           0 :   else if(GetX() >= rTPCTRD &&  GetX() < rTRD)
     416           0 :     {param[0]=x0TRD;param[1]=rhoTRD;}
     417           0 :   else if(GetX() >= rTRD )
     418           0 :     {param[0]=x0Air;param[1]=rhoAir;}
     419           0 : }

Generated by: LCOV version 1.11