]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCComparison2.C
Fix for coverity (AdC)
[u/mrichter/AliRoot.git] / TPC / AliTPCComparison2.C
index 39a730fb86add628fde8b377b4b28562096e668f..0ca82850f43316491d4e5e48a56a19d3421eaf42 100644 (file)
@@ -24,7 +24,6 @@
 #include<TTree.h>
 #include <AliMagF.h>
 #include <AliRun.h>
-#include <AliTPCtracker.h>
 #include <alles.h>
 #endif
 
@@ -59,7 +58,7 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
   //  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
@@ -79,7 +78,6 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
     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 +91,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 +112,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();
@@ -396,7 +386,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 +466,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 +478,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;
@@ -547,7 +543,7 @@ Int_t good_tracks(GoodTrackTPC *gt, Int_t max, Int_t firstev, Int_t eventn) {
       gt[nt].lab=i;
       gt[nt].code=p->GetPdgCode();
       gt[nt].px=0.; gt[nt].py=0.; gt[nt].pz=0.;
-      gt[nt].x=0.; gt[nt].z=0.; gt[nt].z=0.;
+      gt[nt].x=0.; gt[nt].y=0.; gt[nt].z=0.;
       nt++;
       if (nt==max) {cerr<<"Too many good tracks !\n"; break;}
       cerr<<np-i<<"        \r";    
@@ -611,6 +607,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 +620,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 +648,3 @@ Int_t FindPrimaries(Int_t nparticles){
   return nprch1;
 }
 
-
-
-
-
-