]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDtrackV1.cxx
Coverity fixes
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackV1.cxx
index e7560118430dead11e12e66efb87db7e7c6c1864..626e9a346870b53d0e7d608d5bcd6a714002474f 100644 (file)
@@ -1,3 +1,4 @@
+
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
@@ -360,11 +361,11 @@ Bool_t AliTRDtrackV1::CookPID()
   for(Int_t iseed = 0; iseed < kNplane; iseed++){
     if(!fTracklet[iseed]) continue;
     trackletP[iseed] = fTracklet[iseed]->GetMomentum();
-    fTracklet[iseed]->CookdEdx(nslices);
     fTracklet[iseed]->SetPID();
     if(pidResponse->GetPIDmethod() == AliTRDPIDResponse::kLQ1D){
       dEdx[iseed] = fTracklet[iseed]->GetdQdl();
     } else {
+      fTracklet[iseed]->CookdEdx(nslices);
       const Float_t *trackletdEdx = fTracklet[iseed]->GetdEdx();
       for(Int_t islice = 0; islice < nslices; islice++){
         dEdx[iseed*nslices + islice] = trackletdEdx[islice];
@@ -582,7 +583,7 @@ Int_t AliTRDtrackV1::GetProlongation(Double_t xk, Double_t &y, Double_t &z) cons
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDtrackV1::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
+Bool_t AliTRDtrackV1::PropagateTo(Double_t xk, Double_t /*xx0*/, Double_t xrho)
 {
   //
   // Propagates this track to a reference plane defined by "xk" [cm] 
@@ -601,8 +602,9 @@ Bool_t AliTRDtrackV1::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
  
   // local track position AFTER propagation 
   Double_t xyz1[3] = {GetX(), GetY(), GetZ()};
+//  printf("x0[%6.2f] -> x1[%6.2f] dx[%6.2f] rho[%f]\n", xyz0[0], xyz1[0], xyz0[0]-xk, xrho/TMath::Abs(xyz0[0]-xk));
   if(xyz0[0] < xk) {
-    xrho = -xrho;
+    //xrho = -xrho;
     if (IsStartedTimeIntegral()) {
       Double_t l2  = TMath::Sqrt((xyz1[0]-xyz0[0])*(xyz1[0]-xyz0[0]) 
                                + (xyz1[1]-xyz0[1])*(xyz1[1]-xyz0[1]) 
@@ -619,7 +621,7 @@ Bool_t AliTRDtrackV1::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
     }
   }
 
-  if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0, xrho, GetMass())) return kFALSE;
+//   if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0, xrho, GetMass())) return kFALSE;
 
 
   {
@@ -855,7 +857,7 @@ void AliTRDtrackV1::UpdateESDtrack(AliESDtrack *track)
   // Update the TRD PID information in the ESD track
   //
 
-  Int_t nslices = AliTRDcalibDB::Instance()->GetPIDResponse(fkReconstructor->GetRecoParam()->GetPIDmethod())->GetNumberOfSlices();
+//   Int_t nslices = AliTRDcalibDB::Instance()->GetPIDResponse(fkReconstructor->GetRecoParam()->GetPIDmethod())->GetNumberOfSlices();
   // number of tracklets used for PID calculation
   UChar_t nPID = GetNumberOfTrackletsPID();
   // number of tracklets attached to the track
@@ -863,19 +865,25 @@ void AliTRDtrackV1::UpdateESDtrack(AliESDtrack *track)
   // pack the two numbers together and store them in the ESD
   track->SetTRDntracklets(nPID | (nTrk<<3));
   // allocate space to store raw PID signals dEdx & momentum
-  track->SetNumberOfTRDslices((nslices+2)*AliTRDgeometry::kNlayer);
+  track->SetNumberOfTRDslices((AliTRDPIDResponse::kNslicesNN+3)*AliTRDgeometry::kNlayer);
   // store raw signals
   Float_t p, sp; Double_t spd;
   for (Int_t ip = 0; ip < kNplane; ip++) {
     if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue;
     if(!fTracklet[ip]->HasPID()) continue;
+    //printf("Setting slices for tracklet %d\n", ip);
+    fTracklet[ip]->CookdEdx(AliTRDPIDResponse::kNslicesNN);
     const Float_t *dedx = fTracklet[ip]->GetdEdx();
-    for (Int_t js = 0; js < nslices; js++, dedx++) track->SetTRDslice(*dedx, ip, js+1);
+    for (Int_t js = 0; js < AliTRDPIDResponse::kNslicesNN; js++, dedx++){
+      //printf("Slice %d, dEdx %f\n", js, *dedx);
+      track->SetTRDslice(*dedx, ip, js+1);
+    }
     p = fTracklet[ip]->GetMomentum(&sp); 
     // 04.01.11 A.Bercuci
     // store global dQdl per tracklet instead of momentum error
     spd = sp;
     track->SetTRDmomentum(p, ip, &spd);
+    //printf("Total Charge %f\n", fTracklet[ip]->GetdQdl());
     track->SetTRDslice(fTracklet[ip]->GetdQdl(), ip, 0); // Set Summed dEdx into the first slice
   }
   // store PID probabilities