Smaller changes. A few lines in order to make filling an ntuppel
authorvestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Nov 2002 11:00:05 +0000 (11:00 +0000)
committervestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Nov 2002 11:00:05 +0000 (11:00 +0000)
work with the current version of ROOT (bug in ROOT).

HLT/src/AliL3Evaluate.cxx
HLT/src/AliL3Evaluate.h

index 9b792e10b80af4bf7e146b1420b62b4345c8effa..fc90b1992a06e2d510ff5a9d149cfd18d1d570f1 100644 (file)
@@ -9,6 +9,7 @@
 #include <TParticle.h>
 #include <TTree.h>
 #include <TClonesArray.h>
+#include <TNtupleD.h>
 
 #include <AliRun.h>
 #include <AliSimDigits.h>
@@ -277,7 +278,7 @@ void AliL3Evaluate::CreateHistos(Int_t nbin,Float_t xlow,Float_t xup)
     <<"Creating histograms..."<<ENDLOG;
   
   fNtuppel = new TNtuple("fNtuppel","Pt resolution","pt_gen:pt_found:nHits");
-
+  fNtuppel->SetDirectory(0);
   fPtRes = new TH1F("fPtRes","Relative Pt resolution",30,-10.,10.); 
   fNGoodTracksPt = new TH1F("fNGoodTracksPt","Good tracks vs pt",nbin,xlow,xup);    
   fNFoundTracksPt = new TH1F("fNFoundTracksPt","Found tracks vs pt",nbin,xlow,xup);
@@ -293,13 +294,16 @@ void AliL3Evaluate::CreateHistos(Int_t nbin,Float_t xlow,Float_t xup)
 
 }
 
-void AliL3Evaluate::GetGoodParticles(Char_t *path)
+void AliL3Evaluate::GetGoodParticles(Char_t *path,Bool_t sector)
 {
   //Read the good particles from file. This file should already have been
   //generated by macro AliTPCComparison.C.
   
   Char_t filename[1024];
-  sprintf(filename,"%s/good_tracks_tpc",path);
+  if(!sector)
+    sprintf(filename,"%s/good_tracks_tpc",path);
+  else
+    sprintf(filename,"%s/good_tracks_tpc_sector",path);//Sectorwise comparison.
   ifstream in(filename);
   if(!in)
     {
@@ -311,7 +315,7 @@ void AliL3Evaluate::GetGoodParticles(Char_t *path)
   
   while (in>>fGoodTracks[fGoodGen].label>>fGoodTracks[fGoodGen].code>>
         fGoodTracks[fGoodGen].px>>fGoodTracks[fGoodGen].py>>fGoodTracks[fGoodGen].pz>>
-        fGoodTracks[fGoodGen].x>>fGoodTracks[fGoodGen].y >>fGoodTracks[fGoodGen].z>>fGoodTracks[fGoodGen].nhits) 
+        fGoodTracks[fGoodGen].x>>fGoodTracks[fGoodGen].y >>fGoodTracks[fGoodGen].z>>fGoodTracks[fGoodGen].nhits>>fGoodTracks[fGoodGen].sector
 
     {
       fGoodGen++;
@@ -321,9 +325,9 @@ void AliL3Evaluate::GetGoodParticles(Char_t *path)
          break;
        }
     }  
-  
 }
 
+
 void AliL3Evaluate::FillEffHistos()
 {  
   if(!fGoodTracks)
@@ -331,12 +335,13 @@ void AliL3Evaluate::FillEffHistos()
       cerr<<"AliL3Evaluate::FillEffHistos : No good tracks"<<endl;
       return;
     }
-  cout<<"Comparing..."<<endl;
+  cout<<"Comparing "<<fGoodGen<<" good tracks ..."<<endl;
   for(Int_t i=0; i<fGoodGen; i++)
     {
       //cout<<"Checking particle "<<i<<endl;
       if(fGoodTracks[i].nhits < fMinHitsFromParticle) continue;
       Float_t ptg = TMath::Sqrt(fGoodTracks[i].px*fGoodTracks[i].px + fGoodTracks[i].py*fGoodTracks[i].py);
+      if(ptg < fMinGoodPt) continue;
       Float_t pzg=fGoodTracks[i].pz;
       Float_t dipangle=TMath::ATan2(pzg,ptg)*180./TMath::Pi();
 
@@ -359,10 +364,12 @@ void AliL3Evaluate::FillEffHistos()
          else {fNFakeTracksPt->Fill(ptg); fNFakeTracksEta->Fill(dipangle);}
          Float_t pt=track->GetPt();
          fPtRes->Fill((pt-ptg)/ptg*100.);
-         //fNtuppel->Fill(ptg,pt,nHits);
+         fNtuppel->Fill(ptg,pt,nHits);
          break;
          
        }
+      if(!found)
+       cout<<"Track "<<fGoodTracks[i].label<<" was not found"<<endl;
     }
 }
 
@@ -470,16 +477,17 @@ void AliL3Evaluate::Write2File(Char_t *outputfile)
 
 }
 
-TNtuple *AliL3Evaluate::CalculateResiduals()
+TNtupleD *AliL3Evaluate::CalculateResiduals(Char_t *datapath)
 {
 
-  TNtuple *ntuppel=new TNtuple("ntuppel","Residuals","residual_trans:residual_long:zHit:pt:dipangle:beta:padrow:nHits");
-
+  TNtupleD *ntuppel=new TNtupleD("ntuppel","Residuals","residual_trans:residual_long:zHit:pt:dipangle:beta:padrow:nHits");
+  ntuppel->SetDirectory(0);
+  
   for(int f=fMinSlice; f<=fMaxSlice; f++)
     {
       AliL3FileHandler *tfile = new AliL3FileHandler();
       char fname[256];
-      sprintf(fname,"tracks_tr_%d_0.raw",f);
+      sprintf(fname,"%s/tracks_tr_%d_0.raw",datapath,f);
       if(!tfile->SetBinaryInput(fname)){
        LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
          <<"Inputfile "<<fname<<" does not exist"<<ENDLOG; 
@@ -495,6 +503,7 @@ TNtuple *AliL3Evaluate::CalculateResiduals()
          
          AliL3Track *track = (AliL3Track*)fTracks->GetCheckedTrack(i);
          if(!track) continue;
+         if(track->GetNHits() < fMinPointsOnTrack) continue;
          
          track->CalculateHelix();
          UInt_t *hitnum = track->GetHitNumbers();
@@ -530,7 +539,7 @@ TNtuple *AliL3Evaluate::CalculateResiduals()
              xyz[1] = points[pos].fY;
              xyz[2] = points[pos].fZ;
              padrow = points[pos].fPadRow;
-             //AliL3Transform::Global2Local(xyz,slice);
+             AliL3Transform::Global2Local(xyz,slice);
              
              Float_t xyz_cross[3];
              track->GetCrossingPoint(padrow,xyz_cross);
index 1d8526898e152efe831e728ef2d7aaaf1626ce1e..bc191e8c89390b076716ff10f2ec93f18ad74822 100644 (file)
@@ -16,6 +16,7 @@ struct GoodTrack
   Double_t px,py,pz;
   Double_t x,y,z;
   Int_t nhits;
+  Int_t sector;
 };
 typedef struct GoodTrack GoodTrack;
 
@@ -31,6 +32,7 @@ class TTree;
 class AliSimDigits;
 class TObjArray;
 class TParticle;
+class TNtupleD;
 
 class AliL3Evaluate {
 
@@ -84,11 +86,11 @@ class AliL3Evaluate {
   void FillEffHistosNAIVE();
   void CalcEffHistos();
   void AssignIDs();
-  void GetGoodParticles(Char_t *particle_file);
+  void GetGoodParticles(Char_t *particle_file,Bool_t sector=kFALSE);
   void GetFastClusterIDs(Char_t *path);
   void GetCFeff(Char_t *outfile);
   Int_t GetMCTrackLabel(AliL3Track *track);
-  TNtuple *CalculateResiduals();
+  TNtupleD *CalculateResiduals(Char_t *datapath);
   TNtuple *EvaluatePoints(Char_t *rootfile);
   
   void SetMinPoints(Int_t f) {fMinPointsOnTrack = f;}