]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCComparison2.C
Debug msg
[u/mrichter/AliRoot.git] / TPC / AliTPCComparison2.C
index c9dc7e6592cbd1158bf8d31f34d204251f7b6b86..ba0b4ac2c6e3ba1863563ee354673676b6573bd7 100644 (file)
@@ -1,13 +1,12 @@
-/****************************************************************************
- *           Very important, delicate and rather obscure macro.             *
- *                                                                          *
- *               Creates list of "trackable" tracks,                        *
- *             sorts tracks for matching with the ITS,                      *
- *             calculates efficiency, resolutions etc.                      *
- *                                                                          *
- *           Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                 *
- * with several nice improvements by: M.Ivanov, GSI, m.ivanov@gsi.de        *
- ****************************************************************************/
+/// \file AliTPCComparison.C
+/// \brief Very important, delicate and rather obscure macro
+///
+/// Creates list of "trackable" tracks, sorts tracks for matching with the ITS,
+/// calculates efficiency, resolutions etc.
+///
+/// There is a possibility to run this macro over several events.
+///
+/// \author I.Belikov, CERN, Jouri.Belikov@cern.ch, M.Ivanov, GSI, m.ivanov@gsi.de
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
 #include<fstream.h>
@@ -24,7 +23,6 @@
 #include<TTree.h>
 #include <AliMagF.h>
 #include <AliRun.h>
-#include <AliTPCtracker.h>
 #include <alles.h>
 #endif
 
@@ -56,10 +54,12 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
   /***********************************************************************/
 
   TFile *inkin = TFile::Open("rfio:galice.root");
-  //  if(gAlice)delete gAlice;   COMMENTED BECAUSE OF A BUG (IN COMPILED MODE)
+// \file AliTPCComparison2.C
+//  if(gAlice)delete gAlice;   COMMENTED BECAUSE OF A BUG (IN COMPILED MODE)
+
   gAlice = (AliRun*)inkin->Get("gAlice");
   cout<<"AliRun object found on file "<<gAlice<<endl;
-  AliKalmanTrack::SetConvConst(1000/0.299792458/gAlice->Field()->SolenoidField());
+  AliKalmanTrack::SetFieldMap(gAlice->Field());
   inkin->Close();
   /*
     delete gAlice;  COMMENTED BECAUSE OF A BUG IN COMPILED MODE
@@ -78,8 +78,7 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
     digp= (AliTPCParam*)cf->Get("75x40_100x60_150x60");
     if (!digp) { cerr<<"TPC parameters have not been found !\n"; return 2; }
   }
-  ///////////
-  AliTPCtracker *tracker =0; 
+
   TObjArray tarray(MAX);
   AliTPCtrack *iotrack=0;
   Int_t nentr= 0;
@@ -93,12 +92,6 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
     cout<<"================================================"<<endl;
     cout<<"Processing event "<<event<<endl;
     cout<<"================================================"<<endl;
-    if(kOLD){
-      cf->cd();
-      tracker = new AliTPCtracker(digp,event);
-      tracker->LoadInnerSectors();
-      tracker->LoadOuterSectors();
-    }
     
     char   tname[100];
     if (eventn==-1) {
@@ -120,11 +113,9 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
       iotrack=new AliTPCtrack;
       tbranch->SetAddress(&iotrack);
       tracktree->GetEvent(i);
-      if(kOLD)tracker->CookLabel(iotrack,0.1);
       tarray.AddLast(iotrack);
     }   
     eventptr[event+1] = nentr;  //store end of the event
-    delete tracker;
     delete tracktree;
   }
   tf->Close();
@@ -387,7 +378,7 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
 
 
 Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn) {
-  //eventn  - number of events in file
+  //eventn  - number of events in file
 
   TFile *file=TFile::Open("galice.root");
   if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
@@ -396,7 +387,9 @@ Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn) {
     cerr<<"gAlice have not been found on galice.root !\n";
     exit(5);
   }
-   
+
+  TFile *fdigit = TFile::Open("digits.root");
+  file->cd();
 
   AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
   Int_t ver = TPC->IsVersion(); 
@@ -474,7 +467,8 @@ Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn) {
     case 2:
       {
         sprintf(treeName,"TreeD_75x40_100x60_150x60_%d",event);  
-        TD=(TTree*)gDirectory->Get(treeName);
+        TD=(TTree*)fdigit->Get(treeName); // To be revised according to
+                                          // NewIO schema M.Kowalski
         TD->GetBranch("Segment")->SetAddress(&digits);
         count = new Int_t[np];
         Int_t i;
@@ -485,12 +479,15 @@ Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn) {
           Int_t sec,row;
           digp->AdjustSectorRow(digits->GetID(),sec,row);
           digits->First();
+         digits->ExpandTrackBuffer();
           do { //Many thanks to J.Chudoba who noticed this
             Int_t it=digits->CurrentRow(), ip=digits->CurrentColumn();
-            Short_t dig = digits->GetDigit(it,ip);
-            Int_t idx0=digits->GetTrackID(it,ip,0); 
-            Int_t idx1=digits->GetTrackID(it,ip,1);
-            Int_t idx2=digits->GetTrackID(it,ip,2);
+           //            Short_t dig = digits->GetDigit(it,ip);
+            Short_t dig = digits->CurrentDigit();
+
+            Int_t idx0=digits->GetTrackIDFast(it,ip,0)-2; 
+            Int_t idx1=digits->GetTrackIDFast(it,ip,1)-2;
+            Int_t idx2=digits->GetTrackIDFast(it,ip,2)-2;
             if (idx0>=0 && dig>=zero && idx0<np ) count[idx0]+=1;   //background events - higher track ID's
             if (idx1>=0 && dig>=zero && idx1<np ) count[idx1]+=1;
             if (idx2>=0 && dig>=zero && idx2<np ) count[idx2]+=1;
@@ -611,6 +608,8 @@ Int_t FindPrimaries(Int_t nparticles){
   for(Int_t iprim = 0; iprim<nparticles; iprim++){   //loop on  tracks
 
     part = gAlice->Particle(iprim);
+    Double_t ptot=TMath::Sqrt(part->Px()*part->Px()+part->Py()*part->Py()+part->Pz()*part->Pz());
+    if (ptot<0.01) continue;
     char *xxx=strstr(part->GetName(),"XXX");
     if(xxx)continue;
 
@@ -622,7 +621,7 @@ Int_t FindPrimaries(Int_t nparticles){
 
     if(part->T()>timecut)continue;
 
-    Double_t ptot=TMath::Sqrt(part->Px()*part->Px()+part->Py()*part->Py()+part->Pz()*part->Pz());
+    //Double_t ptot=TMath::Sqrt(part->Px()*part->Px()+part->Py()*part->Py()+part->Pz()*part->Pz());
     if(ptot==(TMath::Abs(part->Pz())))continue; // no beam particles
 
     Bool_t prmch = kTRUE;   // candidate primary track
@@ -650,8 +649,3 @@ Int_t FindPrimaries(Int_t nparticles){
   return nprch1;
 }
 
-
-
-
-
-