]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDtrackerV1.cxx
Modifications needed to use PID framework based mass during tracking and
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackerV1.cxx
index 7f166c88a568d057275f8afcd0cb0d6630e8286a..4ab9e5d8829e64d33abbeac45b3a6f05cc7cb35b 100644 (file)
@@ -133,7 +133,7 @@ AliTRDtrackerV1::~AliTRDtrackerV1()
   //
   // Destructor
   //
-  
+
   if(fgRieman) delete fgRieman; fgRieman = NULL;
   if(fgTiltedRieman) delete fgTiltedRieman; fgTiltedRieman = NULL;
   if(fgTiltedRiemanConstrained) delete fgTiltedRiemanConstrained; fgTiltedRiemanConstrained = NULL;
@@ -141,7 +141,8 @@ AliTRDtrackerV1::~AliTRDtrackerV1()
   if(fTracksESD){ fTracksESD->Delete(); delete fTracksESD; }
   if(fTracks) {fTracks->Delete(); delete fTracks;}
   if(fTracklets) {fTracklets->Delete(); delete fTracklets;}
-  if(fClusters) {
+  if(IsClustersOwner() && fClusters) {
+    AliInfo(Form("tracker[%p] removing %d own clusters @ %p", (void*)this, fClusters->GetEntries(), (void*)fClusters));
     fClusters->Delete(); delete fClusters;
   }
   if(fGeom) delete fGeom;
@@ -314,8 +315,21 @@ Int_t AliTRDtrackerV1::PropagateBack(AliESDEvent *event)
   
     // Check the seed status
     ULong_t status = seed->GetStatus();
-    if ((status & AliESDtrack::kTPCout) == 0) continue;
     if ((status & AliESDtrack::kTRDout) != 0) continue;
+    if ((status & AliESDtrack::kTPCout)){
+      AliDebug(3, Form("Prolongate seed[%2d] which is TPC.", iSeed));
+      // set steering parameters for TPC
+      //fkRecoParam->SetTrackParam(kTPC);
+/*    } else {
+      if ((status & AliESDtrack::kITSout)){
+        AliDebug(3, Form("Prolongate seed[%2d] which is ITS.", iSeed));
+        // set steering parameters for ITS
+        //fkRecoParam->SetTrackParam(kITS);
+        // rotate
+        Float_t  globalToTracking = AliTRDgeometry::GetAlpha()*(Int_t(seed->GetAlpha()/AliTRDgeometry::GetAlpha()) + (seed->GetAlpha()>0. ? 0.5 : -0.5));
+        if(!seed->Rotate(globalToTracking)) continue;
+      } else continue;*/
+    } else continue;
 
     // Propagate to the entrance in the TRD mother volume
     track.~AliTRDtrackV1();
@@ -1324,13 +1338,13 @@ Float_t AliTRDtrackerV1::FitTiltedRieman(AliTRDseedV1 *tracklets, Bool_t sigErro
   covarPolZ.Invert();
 
   // Update the tracklets
-  Double_t x1, dy, dz;
+  Double_t dy, dz;
   Double_t cov[15];
   memset(cov, 0, sizeof(Double_t) * 15);
   for(Int_t iLayer = 0; iLayer < AliTRDtrackerV1::kNPlanes; iLayer++) {
 
     x  = tracklets[iLayer].GetX0();
-    x1 = x - xref;
+//    x1 = x - xref;
     y  = 0;
     z  = 0;
     dy = 0;
@@ -1853,7 +1867,7 @@ Int_t AliTRDtrackerV1::PropagateToX(AliTRDtrackV1 &t, Double_t xToGo, Double_t m
 
 /*    // Correct for mean material budget
     Double_t dEdx(0.),
-             bg(t.GetP()/mass);
+             bg(TMath::Abs(t.GetP()/mass));
     if(AliLog::GetDebugLevel("TRD", "AliTRDtrackerV1")>=3){
       const char *pn[] = {"rho", "x/X0", "<A>", "<Z>", "L", "<Z/A>", "Nb"};
       printf("D-AliTRDtrackerV1::PropagateTo(): x[%6.2f] bg[%6.2f]\n", xpos, bg);
@@ -1916,12 +1930,14 @@ Bool_t AliTRDtrackerV1::ReadClusters(TTree *clusterTree)
     return kFALSE;
   }
   branch->SetAddress(&clusterArray); 
-  
+
   if(!fClusters){ 
     Float_t nclusters =  fkRecoParam->GetNClusters();
     if(fkReconstructor->IsHLT()) nclusters /= AliTRDgeometry::kNsector;
     fClusters = new TClonesArray("AliTRDcluster", Int_t(nclusters));
     fClusters->SetOwner(kTRUE);
+    SetClustersOwner();
+    AliInfo(Form("Tracker owning clusters @ %p", (void*)fClusters));
   }
   
   // Loop through all entries in the tree
@@ -1955,27 +1971,26 @@ Int_t AliTRDtrackerV1::LoadClusters(TTree *cTree)
   
   fkRecoParam = fkReconstructor->GetRecoParam(); // load reco param for this event
 
-  if(!fkReconstructor->IsWritingClusters()){ 
-    fClusters = AliTRDReconstructor::GetClusters();
+//  if(!fkReconstructor->IsWritingClusters()) AliInfo(Form("IsWritingClusters[%c]", fkReconstructor->IsWritingClusters()?'y':'n'));
+  if(!(fClusters = AliTRDReconstructor::GetClusters())){
+    AliWarning("Clusters unavailable from TRD reconstructor. Trying reading from tree ...");
   } else {
     if(!ReadClusters(cTree)) {
-      AliError("Problem with reading the clusters !");
+      AliError("Reading clusters from tree failed.");
       return 1;
     }
   }
-  SetClustersOwner();
 
   if(!fClusters || !fClusters->GetEntriesFast()){ 
     AliInfo("No TRD clusters");
     return 1;
-  }
+  } else AliInfo(Form("Using :: clusters[%d] onl.tracklets[%d] onl.tracks[%d]",
+    fClusters?fClusters->GetEntriesFast():0,
+    AliTRDReconstructor::GetTracklets()?AliTRDReconstructor::GetTracklets()->GetEntriesFast():0,
+    AliTRDReconstructor::GetTracks()?AliTRDReconstructor::GetTracks()->GetEntriesFast():0));
 
-  //Int_t nin = 
   BuildTrackingContainers();  
 
-  //Int_t ncl  = fClusters->GetEntriesFast();
-  //AliInfo(Form("Clusters %d [%6.2f %% in the active volume]", ncl, 100.*float(nin)/ncl));
-
   return 0;
 }
 
@@ -1989,17 +2004,14 @@ Int_t AliTRDtrackerV1::LoadClusters(TClonesArray * const clusters)
   if(!clusters || !clusters->GetEntriesFast()){ 
     AliInfo("No TRD clusters");
     return 1;
-  }
+  } else AliInfo(Form("Using :: external.clusters[%d]", clusters->GetEntriesFast()));
+
 
   fClusters = clusters;
-  SetClustersOwner();
 
   fkRecoParam = fkReconstructor->GetRecoParam(); // load reco param for this event
   BuildTrackingContainers();  
 
-  //Int_t ncl  = fClusters->GetEntriesFast();
-  //AliInfo(Form("Clusters %d [%6.2f %% in the active volume]", ncl, 100.*float(nin)/ncl));
-
   return 0;
 }
 
@@ -2048,14 +2060,15 @@ void AliTRDtrackerV1::UnloadClusters()
     fTracklets->Delete();
     if(HasRemoveContainers()){delete fTracklets; fTracklets = NULL;}
   }
-  if(fClusters){ 
-    if(IsClustersOwner()) fClusters->Delete();
-    
-    // save clusters array in the reconstructor for further use.
-    if(!fkReconstructor->IsWritingClusters()){
-      AliTRDReconstructor::SetClusters(fClusters);
-      SetClustersOwner(kFALSE);
-    } else AliTRDReconstructor::SetClusters(NULL);
+  if(fClusters && IsClustersOwner()){
+    AliInfo(Form("tracker[%p] clearing %d own clusters @ %p", (void*)this, fClusters->GetEntries(), (void*)fClusters));
+    fClusters->Delete();
+//     
+//     // save clusters array in the reconstructor for further use.
+//     if(!fkReconstructor->IsWritingClusters()){
+//       AliTRDReconstructor::SetClusters(fClusters);
+//       SetClustersOwner(kFALSE);
+//     } else AliTRDReconstructor::SetClusters(NULL);
   }
 
   for (int i = 0; i < AliTRDgeometry::kNsector; i++) fTrSec[i].Clear();
@@ -2631,7 +2644,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 * c
   Double_t chi2[4];
 
   // this should be data member of AliTRDtrack TODO
-  Double_t seedQuality[kMaxTracksStack];
+//  Double_t seedQuality[kMaxTracksStack];
   
   // unpack control parameters
   Int_t config  = ipar[0];
@@ -2855,8 +2868,8 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 * c
         }
         //AliInfo(Form("Passed likelihood %f[%e].", TMath::Log(1.E-9 + like), like));
       
-        // book preliminary results
-        seedQuality[ntracks] = like;
+        // book preliminry results
+        //seedQuality[ntracks] = like;
         fSeedLayer[ntracks]  = config;/*sLayer;*/
       
         // attach clusters to the extrapolation seeds