]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
minor changes, bugfix for FastSim
authorfranken <franken@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Apr 2001 12:04:37 +0000 (12:04 +0000)
committerfranken <franken@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Apr 2001 12:04:37 +0000 (12:04 +0000)
HLT/src/AliL3Evaluate.cxx
HLT/src/AliL3Evaluate.h

index 356be2973a37663477958aa633ae612271bc3038..6da45d54d871ce062237f98eb6c070fd5b9441cf 100644 (file)
@@ -97,26 +97,26 @@ AliL3Evaluate::~AliL3Evaluate()
     delete fFakeTrackEffEta;
 }
 
-void AliL3Evaluate::Setup(Char_t *trackfile,Char_t *clustfile)
+void AliL3Evaluate::Setup(Char_t *trackfile,Char_t *path)
 {
-  //Setup for using the slow simulator.
   //Read in the hit and track information from produced files.
   
-  fIsSlow = true;
-
   Char_t fname[256];
   AliL3FileHandler *clusterfile[36][5];
   for(Int_t s=fMinSlice; s<=fMaxSlice; s++)
     {
       for(Int_t p=0; p<5; p++)
        {
+          fClusters[s][p] = 0;
          clusterfile[s][p] = new AliL3FileHandler();
-         sprintf(fname,"points_%d_%d.raw",s,p);
+         sprintf(fname,"%s/points_%d_%d.raw",path,s,p);
          if(!clusterfile[s][p]->SetBinaryInput(fname))
            {
              LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
                <<"Inputfile "<<fname<<" does not exist"<<ENDLOG; 
-             return;
+              delete clusterfile[s][p];
+              clusterfile[s][p] = 0; 
+             continue;
            }
          fClusters[s][p] = (AliL3SpacePointData*)clusterfile[s][p]->Allocate();
          clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]);
@@ -126,27 +126,33 @@ void AliL3Evaluate::Setup(Char_t *trackfile,Char_t *clustfile)
   
   
   AliL3FileHandler *tfile = new AliL3FileHandler();
-  if(!tfile->SetBinaryInput(trackfile))
-    {
-      LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
-       <<"Inputfile "<<trackfile<<" does not exist"<<ENDLOG; 
-      return;
-    }
+  if(!tfile->SetBinaryInput(trackfile)){
+    LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
+    <<"Inputfile "<<trackfile<<" does not exist"<<ENDLOG; 
+    return;
+  }
   fTracks = new AliL3TrackArray();
   tfile->Binary2TrackArray(fTracks);
   tfile->CloseBinaryInput();
   delete tfile;
+}
+
+void AliL3Evaluate::SetupSlow(Char_t *trackfile,Char_t *path)
+{
+  //Setup for using the slow simulator.
+  
+  fIsSlow = true;
+  Setup(trackfile,path);
   
   if(!SetDigitsTree())
-    LOG(AliL3Log::kError,"AliL3Evaluation::Setup","Digits Tree")
-      <<"Error setting up digits tree"<<ENDLOG;
+    LOG(AliL3Log::kError,"AliL3Evaluation::SetupSlow","Digits Tree")
+    <<"Error setting up digits tree"<<ENDLOG;
   if(!SetMCParticleArray())
     LOG(AliL3Log::kError,"AliL3Evaluation::Setup","Particle array")
-      <<"Error setting up particle array"<<ENDLOG;
-  
+    <<"Error setting up particle array"<<ENDLOG;
 }
 
-void AliL3Evaluate::SetupFast(Char_t *trackfile,Char_t *clustfile,Char_t *mcClusterfile)
+void AliL3Evaluate::SetupFast(Char_t *trackfile,Char_t *mcClusterfile,Char_t *path)
 {
   //Setup for using the fast simulator.
 
@@ -157,39 +163,8 @@ void AliL3Evaluate::SetupFast(Char_t *trackfile,Char_t *clustfile,Char_t *mcClus
     LOG(AliL3Log::kError,"AliL3Evaluation::SetupFast","File Open")
       <<"Inputfile "<<mcClusterfile<<" does not exist"<<ENDLOG; 
 
-  Char_t fname[256];
-  AliL3FileHandler *clusterfile[36][5];
-  for(Int_t s=fMinSlice; s<=fMaxSlice; s++)
-    {
-      for(Int_t p=0; p<5; p++)
-       {
-         clusterfile[s][p] = new AliL3FileHandler();
-         sprintf(fname,"points_%d_%d.raw",s,p);
-         if(!clusterfile[s][p]->SetBinaryInput(fname))
-           {
-             LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
-               <<"Inputfile "<<fname<<" does not exist"<<ENDLOG; 
-             return;
-           }
-         fClusters[s][p] = (AliL3SpacePointData*)clusterfile[s][p]->Allocate();
-         clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]);
-         clusterfile[s][p]->CloseBinaryInput();
-       }
-    }
-  
-  
-  AliL3FileHandler *tfile = new AliL3FileHandler();
-  if(!tfile->SetBinaryInput(trackfile))
-    {
-      LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
-       <<"Inputfile "<<trackfile<<" does not exist"<<ENDLOG; 
-      return;
-    }
-  fTracks = new AliL3TrackArray();
-  tfile->Binary2TrackArray(fTracks);
-  tfile->CloseBinaryInput();
-  delete tfile;
-  
+  Setup(trackfile,path);
+
   if(!SetMCParticleArray())
     LOG(AliL3Log::kError,"AliL3Evaluation::SetupFast","Particle array")
       <<"Error setting up particle array"<<ENDLOG;
@@ -285,8 +260,8 @@ TObjArray *AliL3Evaluate::DefineGoodTracks(Int_t slice,Int_t *padrow,Int_t good_
       if(!clusterok) 
        LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","Cluster Array")
          <<"Error loading clusters from rootfile"<<ENDLOG;
-      
-      for(Int_t i=padrow[0]; i<=padrow[1]; i++)
+            
+      for(Int_t i=0; i<carray.GetTree()->GetEntries(); i++)  
        {
          Int_t sec,row,sl,lr;
          AliSegmentID *s = carray.LoadEntry(i);
@@ -294,7 +269,8 @@ TObjArray *AliL3Evaluate::DefineGoodTracks(Int_t slice,Int_t *padrow,Int_t good_
          fTransform->Sector2Slice(sl,lr,sec,row);
          
          if(sl != slice) {carray.ClearRow(sec,row); continue;}
-         if(lr != i) {carray.ClearRow(sec,row); continue;}
+         if(lr < padrow[0]) {carray.ClearRow(sec,row); continue;}
+         if(lr > padrow[1]) {carray.ClearRow(sec,row); continue;}
          AliTPCClustersRow *cRow = carray.GetRow(sec,row);
          for(Int_t j=0; j<cRow->GetArray()->GetEntriesFast(); j++)
            {
@@ -373,6 +349,10 @@ TObjArray *AliL3Evaluate::DefineGoodTracks(Int_t slice,Int_t *padrow,Int_t good_
      particle_id[entries] = i;
    }
   delete [] good;
+  LOG(AliL3Log::kInformational,"AliL3Evaluate::DefineGoodTracks","NPart")
+  <<AliL3Log::kDec<<"Found "<<good_part->GetEntriesFast()
+  <<" good Particles (Tracks) out of "<<fParticles->GetEntriesFast()<<ENDLOG;
+
   return good_part;
 }
 
@@ -385,7 +365,9 @@ void AliL3Evaluate::EvaluatePatch(Int_t slice,Int_t patch,Int_t min_points,Int_t
   TObjArray *good_particles = DefineGoodTracks(slice,row[patch],good_number,particle_id);
   SetMinPoints(min_points);
   AssignIDs();
+  CreateHistos();
   FillEffHistos(good_particles,particle_id);
+  CalcEffHistos();
   delete good_particles;
   delete [] particle_id;
 }
@@ -396,34 +378,39 @@ void AliL3Evaluate::EvaluateSlice(Int_t slice,Int_t min_points,Int_t good_number
   //min_points = minimum points on track to be considered for evaluation
   //good_number = minimum hits (padrows) produced by simulated track for consideration.
 
-  Int_t row[174] = {0,173};
+  Int_t row[2] = {0,173};
   Int_t *particle_id = new Int_t[fParticles->GetEntriesFast()];
   TObjArray *good_particles = DefineGoodTracks(slice,row,good_number,particle_id);
   SetMinPoints(min_points);
   AssignIDs();
+  CreateHistos();
   FillEffHistos(good_particles,particle_id);
+  CalcEffHistos();
   delete good_particles;
   delete [] particle_id;
 }
 
-void AliL3Evaluate::EvaluateGlobal()
+void AliL3Evaluate::EvaluateGlobal(Int_t min_points,Int_t good_number)
 {
   //Make efficiency plots for tracking on several slices.
-  /*
-  Int_t row[174] = {0,173};
-  TObjArray *good_particles = DefineGoodTracks(slice,row,good_number);
-  FillEffHistos(good_particles);
-  delete good_particles;
-  */
+  
+  Int_t row[2] = {0,173};
+  Int_t *particle_id = new Int_t[fParticles->GetEntriesFast()];
+  SetMinPoints(min_points);
+  AssignIDs();
+  CreateHistos();
+  for(Int_t slice=fMinSlice;slice<=fMaxSlice;slice++){
+    TObjArray *good_particles = DefineGoodTracks(slice,row,good_number,particle_id);
+    FillEffHistos(good_particles,particle_id);
+    delete good_particles;
+  }
+  CalcEffHistos();
 }
 
 void AliL3Evaluate::FillEffHistos(TObjArray *good_particles,Int_t *particle_id)
 {  
   //Fill the efficiency histograms.
 
-  
-  CreateHistos();
-
   for(Int_t i=0; i<good_particles->GetEntriesFast(); i++)
     {
       TParticle *p = (TParticle*)good_particles->UncheckedAt(i);
@@ -452,7 +439,9 @@ void AliL3Evaluate::FillEffHistos(TObjArray *good_particles,Int_t *particle_id)
          
        }
     }
-  
+}
+
+void AliL3Evaluate::CalcEffHistos(){  
   
   Stat_t ngood=fNGoodTracksPt->GetEntries();
   Stat_t nfound=fNFoundTracksPt->GetEntries();
@@ -524,12 +513,8 @@ void AliL3Evaluate::AssignIDs()
       printf("track %i id %d\n",i,tID);
     }
   
-  if(!fIsSlow)
-    {
-      delete [] pID;
-      delete [] index;
-    }
+  if(pID)   delete [] pID;
+  if(index) delete [] index;
 }
 
 
index 24d53b75194bf8211ba93c5f0b3f86477318a6ca..1533b8d250527ecb4081faa9e83f6e9c71a1318a 100644 (file)
@@ -55,6 +55,7 @@ class AliL3Evaluate : public TObject {
   TH1F *fFakeTrackEffEta;
   
   void FillEffHistos(TObjArray *good_particles,Int_t *particle_id);
+  void CalcEffHistos();
   void AssignIDs();
   Bool_t SetDigitsTree();
   Bool_t SetMCParticleArray();
@@ -62,19 +63,20 @@ class AliL3Evaluate : public TObject {
   Int_t GetMCTrackLabel(AliL3Track *track,UInt_t *index=0,Int_t *pID=0,Int_t npoints=0);
   Int_t **GetClusterIDs(AliL3Track *track,UInt_t *index=0,Int_t *pID=0,Int_t npoints=0);
   Int_t *GetFastIDs(UInt_t &tmp_ind,Int_t &npoints);
+  void Setup(Char_t *trackfile,Char_t *path);
+
  public:
   AliL3Evaluate();
   AliL3Evaluate(Char_t *mcfile,Int_t *slice);
 
   virtual ~AliL3Evaluate();
 
-  void Setup(Char_t *trackfile,Char_t *clustfile);
-  void SetupFast(Char_t *trackfile,Char_t *clustfile,Char_t *mcClusterfile);
+  void SetupFast(Char_t *trackfile,Char_t *mcClusterfile,Char_t *path="./");
+  void SetupSlow(Char_t *trackfile,Char_t *path="./");
   void CreateHistos(Int_t nbin=20,Int_t xlow=0,Int_t xup=4);
   void EvaluatePatch(Int_t slice,Int_t patch,Int_t min_points,Int_t good_number);
   void EvaluateSlice(Int_t slice,Int_t min_points,Int_t good_number);
-  void EvaluateGlobal();
+  void EvaluateGlobal(Int_t min_points,Int_t good_number);
   void Write2File(Char_t *outputfile);
     
   TH1F *GetTrackEffPt() {return fTrackEffPt;}