Changes and optimization for pp-running
authorvestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Mar 2002 09:46:48 +0000 (09:46 +0000)
committervestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Mar 2002 09:46:48 +0000 (09:46 +0000)
HLT/src/AliL3ClustFinderNew.cxx
HLT/src/AliL3ConfMapPoint.cxx
HLT/src/AliL3ConfMapPoint.h
HLT/src/AliL3ConfMapTrack.cxx
HLT/src/AliL3ConfMapper.cxx
HLT/src/AliL3Evaluate.cxx
HLT/src/AliL3Evaluate.h
HLT/src/AliL3Fitter.cxx

index 7768654..c25b425 100644 (file)
@@ -93,6 +93,11 @@ void AliL3ClustFinderNew::ProcessDigits()
       tmp += size;
       tempPt = (AliL3DigitRowData*)tmp;
     }
+  LOG(AliL3Log::kInformational,"AliL3ClustFinderNew::WriteClusters","Space points")
+    <<"Cluster finder found "<<fNClusters<<" clusters in slice "<<fCurrentSlice
+    <<" patch "<<fCurrentPatch<<ENDLOG;
+
+
 }
 
 
@@ -332,6 +337,7 @@ void AliL3ClustFinderNew::WriteClusters(Int_t n_clusters,ClusterData *list)
 #ifdef do_mc
       Int_t trackID[3];
       GetTrackID((Int_t)rint(fpad),(Int_t)rint(ftime),trackID);
+      //cout<<"padrow "<<fCurrentRow<<" pad "<<(Int_t)rint(fpad)<<" time "<<(Int_t)rint(ftime)<<" Trackid "<<trackID[0]<<endl;
       fSpacePointData[counter].fTrackID[0] = trackID[0];
       fSpacePointData[counter].fTrackID[1] = trackID[1];
       fSpacePointData[counter].fTrackID[2] = trackID[2];
@@ -341,6 +347,7 @@ void AliL3ClustFinderNew::WriteClusters(Int_t n_clusters,ClusterData *list)
 
     }
 
+  
 }
 
 #ifdef do_mc
@@ -348,7 +355,7 @@ void AliL3ClustFinderNew::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
 {
   AliL3DigitRowData *rowPt = (AliL3DigitRowData*)fDigitRowData;
   
-  trackID[0]=trackID[1]=trackID[2]=-1;
+  trackID[0]=trackID[1]=trackID[2]=-2;
   //cout<<"Looking for pad "<<pad<<" time "<<time<<endl;
   for(Int_t i=fFirstRow; i<=fLastRow; i++)
     {
@@ -362,13 +369,14 @@ void AliL3ClustFinderNew::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
        {
          Int_t cpad = digPt[j].fPad;
          Int_t ctime = digPt[j].fTime;
-         if(cpad < pad) continue;
-         if(ctime < time) continue;
-         if(cpad != pad && ctime != ctime) break;
+         if(cpad != pad) continue;
+         if(ctime != time) continue;
+         //if(cpad != pad && ctime != ctime) continue;
          //cout<<"Reading row "<<fCurrentRow<<" pad "<<cpad<<" time "<<ctime<<" trackID "<<digPt[j].fTrackID[0]<<endl;
          trackID[0] = digPt[j].fTrackID[0];
          trackID[1] = digPt[j].fTrackID[1];
          trackID[2] = digPt[j].fTrackID[2];
+         break;
          //cout<<"Reading trackID "<<trackID[0]<<endl;
        }
       break;
index b942e6d..a2a1ff3 100644 (file)
@@ -49,6 +49,7 @@ AliL3ConfMapPoint::~AliL3ConfMapPoint()
 }
 
 Bool_t AliL3ConfMapPoint::ReadHits(AliL3SpacePointData* hits ){
+  
   SetHitNumber(hits->fID);
   SetPadRow(hits->fPadRow);
   Int_t slice = (hits->fID>>25) & 0x7f;
@@ -62,6 +63,16 @@ Bool_t AliL3ConfMapPoint::ReadHits(AliL3SpacePointData* hits ){
   return kTRUE;
 }
 
+void AliL3ConfMapPoint::Reset()
+{
+  //Reset this point.
+  SetUsage(kFALSE);
+  SetS(0);
+  nextRowHit = 0;
+  nextVolumeHit=0;
+  nextTrackHit=0;
+}
+
 void AliL3ConfMapPoint::Setup(AliL3Vertex *vertex)
 {
   //Setup. Sets the vertex, conformal coordinates, and phi and eta of each hit.
index 2574f0f..4d614fe 100644 (file)
@@ -15,8 +15,7 @@ class AliL3ConfMapPoint {
   Int_t fTrackNumber;
   Int_t fNextHitNumber;
   Bool_t fUsed;
-  
-  Int_t fPadrow;
+    Int_t fPadrow;
   Int_t fSector;
 
   //global coordinates and their errors
@@ -67,9 +66,10 @@ class AliL3ConfMapPoint {
 
   AliL3ConfMapPoint();
   virtual ~AliL3ConfMapPoint();
-
+  
+  void Reset();
   Bool_t ReadHits(AliL3SpacePointData* hits ); //!
+  
   AliL3ConfMapPoint *nextVolumeHit; //!
   AliL3ConfMapPoint *nextRowHit;  //!
   
@@ -124,7 +124,7 @@ class AliL3ConfMapPoint {
   Int_t GetNextHitNumber() const {return fNextHitNumber;}
   Int_t GetTrackNumber() const {return fTrackNumber;}
   //  Int_t const *GetMCTrackID()     const {return fMCTrackID;}
-
+  
   // setter
   void SetX(Double_t f) {x=f;}
   void SetY(Double_t f) {y=f;}
index ec0f246..fc6447f 100644 (file)
@@ -101,7 +101,7 @@ void AliL3ConfMapTrack::Reset()
   g2Sz  = 0;
   fChiSq[1] = 0; 
   SetLength(0);
-  
+  SetNHits(0);
   
 }
 
index 8dc4b05..d0aff87 100644 (file)
@@ -6,10 +6,11 @@
 #include <iostream.h>
 #include <time.h>
 #include <math.h>
+#include <sys/time.h>
 #include "AliL3ConfMapper.h"
 
 #include "AliL3Defs.h"
-#include "AliL3Logging.h"
+#include "AliL3Logging.h" 
 #include "AliL3Transform.h"
 #include "AliL3Vertex.h"
 #include "AliL3ConfMapTrack.h"
@@ -60,6 +61,46 @@ AliL3ConfMapper::~AliL3ConfMapper()
   }
 
 }
+void AliL3ConfMapper::InitVolumes()
+{
+  //Data organization.
+  //Allocate volumes, set conformal coordinates and pointers.
+  
+  //Should be done after setting the track parameters
+  
+  fNumRowSegmentPlusOne = 176;//NumRows[0]; //Maximum 32.
+  fNumPhiSegmentPlusOne = fNumPhiSegment+1;
+  fNumEtaSegmentPlusOne = fNumEtaSegment+1;
+  fNumPhiEtaSegmentPlusOne = fNumPhiSegmentPlusOne*fNumEtaSegmentPlusOne;
+  fBounds = fNumRowSegmentPlusOne * fNumPhiSegmentPlusOne * fNumEtaSegmentPlusOne;
+  
+  //Allocate volumes:
+  if(fVolume) delete [] fVolume;
+  if(fRow) delete [] fRow;
+  
+  LOG(AliL3Log::kInformational,"AliL3ConfMapper::InitVolumes","Memory")<<AliL3Log::kDec<<
+    "Allocating "<<fBounds*sizeof(AliL3ConfMapContainer)<<" Bytes to fVolume"<<ENDLOG;
+  LOG(AliL3Log::kInformational,"AliL3ConfMapper::InitVolumes","Memory")<<AliL3Log::kDec<<
+    "Allocating "<<fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer)<<" Bytes to fRow"<<ENDLOG;
+  
+  fVolume = new AliL3ConfMapContainer[fBounds];
+  fRow = new AliL3ConfMapContainer[fNumRowSegmentPlusOne];
+  
+  memset(fVolume,0,fBounds*sizeof(AliL3ConfMapContainer));
+  memset(fRow,0,fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer));
+  
+  Int_t max_num_of_tracks = 150;
+  Int_t max_num_of_hits = 3000;
+  
+  if(fHit)
+    delete [] fHit;
+  if(fTrack)
+    delete fTrack;
+    
+  fHit = new AliL3ConfMapPoint[max_num_of_hits];
+  fTrack = new AliL3TrackArray("AliL3ConfMapTrack",max_num_of_tracks);
+}
 
 void AliL3ConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etarange)
 {
@@ -69,17 +110,7 @@ void AliL3ConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etarange)
   //rowrange[0]=innermost row;
   //rowrange[1]=outermostrow;
   //Finally you can specify etaslices to save time (assuming a good seed from TRD...)
-  
-  if(fHit)
-    {
-      delete [] fHit;
-    }
-  
-  if(fTrack) 
-    {
-      delete fTrack;
-    }
-
+    
   //Define tracking area:
   if(rowrange)
     {
@@ -107,15 +138,6 @@ void AliL3ConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etarange)
   fPhiMin = -1.*10/todeg;//fParam->GetAngle(sector) - 10/todeg;
   fPhiMax = 10/todeg;//fParam->GetAngle(sector) + 10/todeg;
 
-  //rotation angles for sector 2:
-  //cos: 0.766044 sin: 0.642788
-  
-  Int_t max_num_of_tracks = 3000;
-  Int_t max_num_of_hits = 150000;
-
-  fHit = new AliL3ConfMapPoint[max_num_of_hits];
-  fTrack = new AliL3TrackArray("AliL3ConfMapTrack",max_num_of_tracks);
-  
   nTracks=0;
   fMainVertexTracks = 0;
   fClustersUnused = 0;
@@ -123,6 +145,8 @@ void AliL3ConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etarange)
   fNumRowSegment = fRowMax - fRowMin; //number of rows to be considered by tracker
   LOG(AliL3Log::kInformational,"AliL3ConfMapper::InitSector","B-field")
     <<"Tracker initializing assuming magnetic field of "<<BField<<ENDLOG;
+  
+  fTrack->Reset();
 }
 
 
@@ -131,44 +155,28 @@ Bool_t AliL3ConfMapper::ReadHits(UInt_t count, AliL3SpacePointData* hits )
 {
   Int_t nhit=(Int_t)count; 
   for (Int_t i=0;i<nhit;i++)
-    fHit[i].ReadHits(&(hits[i]));
+    {
+      fHit[i].Reset();
+      fHit[i].ReadHits(&(hits[i]));
+    }
   fClustersUnused += nhit;
-  LOG(AliL3Log::kInformational,"AliL3ConfMapper::ReadHits","#hits")<<AliL3Log::kDec
-  <<"hit_counter: "<<nhit<<" count: "<<count<<ENDLOG;
-
+  LOG(AliL3Log::kInformational,"AliL3ConfMapper::ReadHits","#hits")
+    <<AliL3Log::kDec<<"hit_counter: "<<nhit<<" count: "<<count<<ENDLOG;
+  
   return true;
 }
 
 
 void AliL3ConfMapper::SetPointers()
 {
-  //Data organization.
-  //Allocate volumes, set conformal coordinates and pointers.
-  fNumRowSegmentPlusOne = 176;//fNumRowSegment+1;
-  fNumPhiSegmentPlusOne = fNumPhiSegment+1;
-  fNumEtaSegmentPlusOne = fNumEtaSegment+1;
-  fNumPhiEtaSegmentPlusOne = fNumPhiSegmentPlusOne*fNumEtaSegmentPlusOne;
-  fBounds = fNumRowSegmentPlusOne * fNumPhiSegmentPlusOne * fNumEtaSegmentPlusOne;
-  
-  //Allocate volumes:
-  if(fVolume) delete [] fVolume;
-  if(fRow) delete [] fRow;
-  
-  LOG(AliL3Log::kInformational,"AliL3ConfMapper::SetPointers","Memory")<<AliL3Log::kDec<<
-    "Allocating "<<fBounds*sizeof(AliL3ConfMapContainer)<<" Bytes to fVolume"<<ENDLOG;
-  LOG(AliL3Log::kInformational,"AliL3ConfMapper::SetPointers","Memory")<<AliL3Log::kDec<<
-    "Allocating "<<fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer)<<" Bytes to fRow"<<ENDLOG;
   
-  fVolume = new AliL3ConfMapContainer[fBounds];
-  fRow = new AliL3ConfMapContainer[fNumRowSegmentPlusOne];
-
-  //set volumes to zero:
+  //Reset detector volumes
   memset(fVolume,0,fBounds*sizeof(AliL3ConfMapContainer));
   memset(fRow,0,fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer));
   
   Float_t phiSlice = (fPhiMax-fPhiMin)/fNumPhiSegment;
   Float_t etaSlice = (fEtaMax-fEtaMin)/fNumEtaSegment;
-  
+
   Int_t volumeIndex;
   Int_t local_counter=0;
   for(Int_t j=0; j<fClustersUnused; j++)
@@ -181,12 +189,8 @@ void AliL3ConfMapper::SetPointers()
       
       Int_t localrow = thisHit->GetPadRow();
       
-      //reset pointers:
-      thisHit->nextVolumeHit=thisHit->nextRowHit=0;
-      
       if(localrow < fRowMin || localrow > fRowMax)
        continue;
-      
 
       //Get indexes:
       thisHit->phiIndex=(Int_t)((thisHit->GetPhi()-fPhiMin)/phiSlice +1);
@@ -204,30 +208,34 @@ void AliL3ConfMapper::SetPointers()
          continue;
        }
       local_counter++;
-            
-      //set volume pointers
-      volumeIndex = localrow*fNumPhiEtaSegmentPlusOne+thisHit->phiIndex*fNumEtaSegmentPlusOne+thisHit->etaIndex;
+      
+      volumeIndex = (localrow-fRowMin)*fNumPhiEtaSegmentPlusOne+thisHit->phiIndex*fNumEtaSegmentPlusOne+thisHit->etaIndex;
+      
       if(fVolume[volumeIndex].first == NULL)
        fVolume[volumeIndex].first = (void *)thisHit;
       else
-       ((AliL3ConfMapPoint *)fVolume[volumeIndex].last)->nextVolumeHit=thisHit;
+       ((AliL3ConfMapPoint *)fVolume[volumeIndex].last)->nextVolumeHit=thisHit;
       fVolume[volumeIndex].last = (void *)thisHit;
       
       
       //set row pointers
-      if(fRow[localrow].first == NULL)
-       fRow[localrow].first = (void *)thisHit;
+      if(fRow[(localrow-fRowMin)].first == NULL)
+       fRow[(localrow-fRowMin)].first = (void *)thisHit;
       else
-       ((AliL3ConfMapPoint *)(fRow[localrow].last))->nextRowHit = thisHit;
-      fRow[localrow].last = (void *)thisHit;
-      
+       ((AliL3ConfMapPoint *)(fRow[(localrow-fRowMin)].last))->nextRowHit = thisHit;
+       fRow[(localrow-fRowMin)].last = (void *)thisHit;
+       
+       
     }
   
   if(fClustersUnused>0 && local_counter==0)
     LOG(AliL3Log::kError,"AliL3ConfMapper::SetPointers","Parameters")
       <<AliL3Log::kDec<<"No points passed to track finder, hits out of range: "
       <<fEtaHitsOutOfRange+fPhiHitsOutOfRange<<ENDLOG;
-  
+
+  LOG(AliL3Log::kInformational,"AliL3ConfMapper::SetPointers","Setup")
+    <<"Setup finished, hits out of range: "<<fEtaHitsOutOfRange+fPhiHitsOutOfRange
+    <<" hits accepted "<<fClustersUnused<<ENDLOG;
 }
 
 void AliL3ConfMapper::MainVertexTracking_a()
@@ -241,9 +249,15 @@ void AliL3ConfMapper::MainVertexTracking_a()
       return;
     }
 
-  
+  Double_t initCpuTime,cpuTime;
+  initCpuTime = CpuTime();
   SetPointers();
   SetVertexConstraint(true);
+  cpuTime = CpuTime() - initCpuTime;
+  if(fBench)
+    LOG(AliL3Log::kInformational,"AliL3ConfMapper::MainVertexTracking_a","Timing")
+      <<AliL3Log::kDec<<"Setup finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
+  
 }
 
 void AliL3ConfMapper::MainVertexTracking_b()
@@ -256,8 +270,15 @@ void AliL3ConfMapper::MainVertexTracking_b()
        "Tracking parameters not set!"<<ENDLOG;
       return;
     }
-
+  Double_t initCpuTime,cpuTime;
+  initCpuTime = CpuTime();
+  
   ClusterLoop();
+  cpuTime = CpuTime() - initCpuTime;
+  if(fBench)
+    LOG(AliL3Log::kInformational,"AliL3ConfMapper::MainVertexTracking_b","Timing")
+      <<AliL3Log::kDec<<"Main Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
 }
 
 void AliL3ConfMapper::MainVertexTracking()
@@ -283,7 +304,7 @@ void AliL3ConfMapper::MainVertexTracking()
   if(fBench)
     LOG(AliL3Log::kInformational,"AliL3ConfMapper::MainVertexTracking","Timing")<<AliL3Log::kDec<<
       "Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
-    
+  
   return;
 }
 
@@ -364,9 +385,9 @@ void AliL3ConfMapper::ClusterLoop()
   
   for(row_segm = fRowMax; row_segm >= lastrow; row_segm--)
     {
-      if(fRow[row_segm].first && ((AliL3ConfMapPoint*)fRow[row_segm].first)->GetPadRow() < fRowMin + 1)
+      if(fRow[(row_segm-fRowMin)].first && ((AliL3ConfMapPoint*)fRow[(row_segm-fRowMin)].first)->GetPadRow() < fRowMin + 1)
        break;
-      for(hit = (AliL3ConfMapPoint*)fRow[row_segm].first; hit!=0; hit=hit->nextRowHit)
+      for(hit = (AliL3ConfMapPoint*)fRow[(row_segm-fRowMin)].first; hit!=0; hit=hit->nextRowHit)
        {
          if(hit->GetUsage() == true)
            continue;
@@ -449,7 +470,6 @@ void AliL3ConfMapper::CreateTrack(AliL3ConfMapPoint *hit)
             
       if(TrackletAngle(track) > fMaxAngleTracklet[fVertexConstraint])
        {//proof if the first points seem to be a beginning of a track
-       
          track->SetProperties(false);
          track->DeleteCandidate();
          fTrack->RemoveLast();
@@ -596,7 +616,7 @@ AliL3ConfMapPoint *AliL3ConfMapper::GetNextNeighbor(AliL3ConfMapPoint *start_hit
                continue;//segment exceeds bounds->skip it
              
              //loop over hits in this sub segment:
-             volumeIndex= sub_row_segm*fNumPhiEtaSegmentPlusOne +
+             volumeIndex= (sub_row_segm-fRowMin)*fNumPhiEtaSegmentPlusOne +
                sub_phi_segm*fNumEtaSegmentPlusOne + sub_eta_segm;
              
              if(volumeIndex<0)
@@ -804,6 +824,8 @@ Int_t AliL3ConfMapper::FillTracks()
 Double_t AliL3ConfMapper::CpuTime()
 {
   //Return the Cputime in seconds.
-
-  return (Double_t)(clock()) / CLOCKS_PER_SEC;
+ struct timeval tv;
+ gettimeofday( &tv, NULL );
+ return tv.tv_sec+(((Double_t)tv.tv_usec)/1000000.);
+ //return (Double_t)(clock()) / CLOCKS_PER_SEC;
 }
index d266959..03a1430 100644 (file)
@@ -308,6 +308,7 @@ void AliL3Evaluate::DefineGoodTracks(Int_t *slice,Int_t *padrow,Int_t good_numbe
          <<"TPC version "<<ver<<" does not match."<<ENDLOG;
       Int_t *count = new Int_t[np]; //np number of particles.
       Int_t i;
+      Float_t xyz[3];
       for (i=0; i<np; i++) count[i]=0;
       for(Int_t sl=slice[0]; sl<=slice[1]; sl++)
        {
@@ -320,6 +321,17 @@ void AliL3Evaluate::DefineGoodTracks(Int_t *slice,Int_t *padrow,Int_t good_numbe
            do {
              Int_t it=fDigits->CurrentRow(), ip=fDigits->CurrentColumn();
              Short_t dig = fDigits->GetDigit(it,ip);
+             
+             if(dig<=fParam->GetZeroSup()) continue;
+             if(it < fParam->GetMaxTBin()-1 && it > 0)
+               if(fDigits->GetDigit(it+1,ip) <= fParam->GetZeroSup()
+                  && fDigits->GetDigit(it-1,ip) <= fParam->GetZeroSup())
+                 continue;
+             
+             fTransform->Raw2Local(xyz,sec,row,ip,it);
+             if(fParam->GetPadRowRadii(sec,row)<230./250.*fabs(xyz[2]))
+               continue;
+             
              Int_t idx0=fDigits->GetTrackID(it,ip,0); 
              Int_t idx1=fDigits->GetTrackID(it,ip,1);
              Int_t idx2=fDigits->GetTrackID(it,ip,2);
@@ -377,7 +389,7 @@ void AliL3Evaluate::DefineGoodTracks(Int_t *slice,Int_t *padrow,Int_t good_numbe
     
     //printf("Checking particle %d with code %d\n",i,p->GetPdgCode());
     if (p->GetFirstMother()>=0) continue;  //secondary particle
-    if (good[i] < good_number) continue;
+    if (good[i] < good_number || good[i]>176) continue;
     if (p->Pt()<fMinGoodPt) continue;
     if (TMath::Abs(p->Pz()/p->Pt())>0.999) continue;
     printf("Found good particle %d, nHits %d\n",i,good[i]);
@@ -456,7 +468,7 @@ void AliL3Evaluate::EvaluateGlobal(Int_t min_points,Int_t good_number,Char_t *fn
   Int_t slice[2] = {fMinSlice,fMaxSlice};
   DefineGoodTracks(slice,row,good_number,fname);
   AssignIDs();
-  CreateHistos(20,0,5);
+  CreateHistos(5,0,2);
   printf("filling histos\n");
   FillEffHistos();
   printf("done fillling\n");
@@ -497,7 +509,7 @@ Int_t AliL3Evaluate::GetMCTrackLabel(AliL3Track *track){
   UInt_t *hitnum = track->GetHitNumbers();  
   UInt_t id;
     
-  Int_t **trackID = GetClusterIDs(track);
+  //Int_t **trackID = GetClusterIDs(track);
 
   Int_t lab=123456789;
   for (i=0; i<num_of_clusters; i++) 
@@ -518,8 +530,8 @@ Int_t AliL3Evaluate::GetMCTrackLabel(AliL3Track *track){
        }
       
       //Get the label of the cluster:
-      //printf("label %d %d %d\n",trackID[i][0],trackID[i][1],trackID[i][2]);
-      lab=abs(trackID[i][0]);
+      
+      lab=abs(points[pos].fTrackID[0]);
       Int_t j;
       for (j=0; j<num_of_clusters; j++)
         if (s[j].lab==lab || s[j].max==0) break;
@@ -549,8 +561,8 @@ Int_t AliL3Evaluate::GetMCTrackLabel(AliL3Track *track){
          continue;
        }
       
-      if (abs(trackID[i][1]) == lab || 
-         abs(trackID[i][2]) == lab ) max++;
+      if (abs(points[pos].fTrackID[1]) == lab || 
+         abs(points[pos].fTrackID[2]) == lab ) max++;
     }
   
   //check if more than 10% of the clusters are incorrectly assigned (fake track):
@@ -559,9 +571,6 @@ Int_t AliL3Evaluate::GetMCTrackLabel(AliL3Track *track){
       return -lab;
     }
   
-  for(Int_t j=0; j<track->GetNumberOfPoints(); j++)
-    delete [] trackID[j];
-  delete [] trackID;
   return lab;
 }
 
@@ -695,16 +704,16 @@ void AliL3Evaluate::CreateHistos(Int_t nbin,Int_t xlow,Int_t xup)
   fFakeTrackEffEta = new TH1F("fFakeTrackEffEta","Efficiency for fake tracks vs eta",20,-50,50);
   printf("finished creating histos\n");
 }
-
+/*
 void AliL3Evaluate::FillEffHistos()
 {  
   //Fill the efficiency histograms.
-
+  
   for(Int_t i=0; i<fGoodGen; i++)
     {
       Double_t ptg=fGoodTracks[i].pt,pzg=fGoodTracks[i].pz;
       Float_t dipangle=TMath::ATan2(pzg,ptg)*180./TMath::Pi();
-      printf("filling particle with pt %f and dipangle %f\n",ptg,dipangle);
+      //printf("filling particle with pt %f and dipangle %f\n",ptg,dipangle);
       fNGoodTracksPt->Fill(ptg);
       fNGoodTracksEta->Fill(dipangle);
       Int_t found = 0;
@@ -717,7 +726,7 @@ void AliL3Evaluate::FillEffHistos()
          
          Int_t tracklabel;
          tracklabel = track->GetMCid();
-         printf("evaluating track id %d\n",tracklabel);
+         //printf("evaluating track id %d\n",tracklabel);
          if(TMath::Abs(tracklabel) != fGoodTracks[i].label) continue;
          found=1;
          if(tracklabel == fGoodTracks[i].label) {fNFoundTracksPt->Fill(ptg); fNFoundTracksEta->Fill(dipangle);}
@@ -730,6 +739,38 @@ void AliL3Evaluate::FillEffHistos()
        }
     }
 }
+*/
+void AliL3Evaluate::FillEffHistos()
+{  
+  //Fill the efficiency histograms.
+  
+  cout<<endl<<"Note: Doing NAIVE evaluation "<<endl;
+  for(Int_t i=0; i<fGoodGen; i++)
+    {
+      Double_t ptg=fGoodTracks[i].pt,pzg=fGoodTracks[i].pz;
+      Float_t dipangle=TMath::ATan2(pzg,ptg)*180./TMath::Pi();
+      //printf("filling particle with pt %f and dipangle %f\n",ptg,dipangle);
+      fNGoodTracksPt->Fill(ptg);
+      fNGoodTracksEta->Fill(dipangle);
+      
+    }
+  
+  for(Int_t k=0; k<fTracks->GetNTracks(); k++)
+    {
+      AliL3Track *track = fTracks->GetCheckedTrack(k);
+      if(!track) continue;
+      Int_t nHits = track->GetNumberOfPoints();
+      if(nHits < fMinPointsOnTrack) break;
+      if(track->GetPt()<fMinGoodPt) continue;
+      if(fabs(track->GetPseudoRapidity())>0.9) continue;
+
+      fNFoundTracksPt->Fill(track->GetPt()); fNFoundTracksEta->Fill(track->GetPseudoRapidity());
+      //Float_t pt=track->GetPt();
+      //fPtRes->Fill((pt-ptg)/ptg*100.);
+      //fNtuppel->Fill(ptg,pt,nHits);
+            
+    }
+}
 
 void AliL3Evaluate::CalcEffHistos(){  
   
@@ -746,6 +787,10 @@ void AliL3Evaluate::CalcEffHistos(){
   LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
     <<AliL3Log::kDec<<"Fake tracks relative is about "<<nfake/ngood*100<<ENDLOG;
   
+  LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
+    <<AliL3Log::kDec<<"Naive efficiency "<<(Double_t)fGoodFound/(Double_t)fGoodGen<<ENDLOG;
+
+  
   fNFoundTracksPt->Sumw2(); fNGoodTracksPt->Sumw2();
   fTrackEffPt->Divide(fNFoundTracksPt,fNGoodTracksPt,1,1.,"b");
   fFakeTrackEffPt->Divide(fNFakeTracksPt,fNGoodTracksPt,1,1.,"b");
@@ -885,11 +930,16 @@ TNtuple *AliL3Evaluate::EvaluatePoints(Char_t *rootfile)
   //The input file to this function, contains the exact clusters calculated
   //in AliTPC::Hits2ExactClusters.
     
+  cout<<"Evaluating points"<<endl;
   TNtuple *ntuppel = new TNtuple("ntuppel","residuals","slice:padrow:resy:resz:zHit:pt");
   
-  TFile *exfile = new TFile(rootfile);
-  
+  TFile *exfile = TFile::Open(rootfile);
+  if(!exfile)
+    {
+      cerr<<"Error opening rootfile "<<rootfile<<endl;
+      return 0;
+    }
+
   AliTPCParam *param = (AliTPCParam*)exfile->Get("75x40_100x60");
   
   //Get the exact clusters from file:
@@ -901,6 +951,7 @@ TNtuple *AliL3Evaluate::EvaluatePoints(Char_t *rootfile)
   Bool_t clusterok = arr->ConnectTree(treeName);//Segment Tree (for offline clusters)
   if(!clusterok) {printf("AliL3Evaluate::EvaluatePoints : Error in clusterloading\n"); return 0;}
   
+  cout<<"Entering loop with "<<(Int_t)arr->GetTree()->GetEntries()<<endl;
   for(Int_t i=0; i<arr->GetTree()->GetEntries(); i++)
     {
       //Get the exact clusters for this row:
@@ -954,74 +1005,87 @@ TNtuple *AliL3Evaluate::EvaluatePoints(Char_t *rootfile)
 
   return ntuppel;
 }
-/*
-TNtuple *AliL3Evaluate::EvaluateGEANT()
+
+void AliL3Evaluate::GetCFeff(Char_t *outfile)
 {
-  TNtuple *ntuppel = new TNtuple("ntuppel","residuals","resy:ptgen:padrow:zHit:slice");
   
-  Int_t good_number=175;
-  Int_t row[2] = {0,175};
-      
-  Float_t xyz_cross[3];
-  Float_t xyz_cl[3];
+  TNtuple *ntuppel = new TNtuple("ntuppel","Cluster finder efficiency","row:ncrossings:nclusters");
+  
+  AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
+  
+  TPC->SetParam(fParam);
   
-  for(Int_t slice=fMinSlice; slice<=fMaxSlice; slice++)
+  Int_t ver = TPC->IsVersion();
+  LOG(AliL3Log::kInformational,"AliL3Evaluate::DefineGoodTracks","TPC version")
+    <<"TPC version "<<ver<<" found on file"<<ENDLOG;
+  
+  Int_t zero=TPC->GetParam()->GetZeroSup();
+  
+  Int_t np = gAlice->GetNtrack();
+  
+  Int_t crossed,recs;
+  Int_t *count = new Int_t[np]; //np number of particles.
+  Int_t i;
+  Float_t xyz[3];
+  for (i=0; i<np; i++) count[i]=0;
+  for(Int_t sl=fMinSlice; sl<=fMaxSlice; sl++)
     {
-      Int_t *particle_id = new Int_t[fParticles->GetEntriesFast()];
-      TObjArray *good_particles = DefineGoodTracks(slice,row,good_number,particle_id);
-      
-      if(fMCclusterfile)
+      for (i=0; i<=175; i++) 
        {
-         fMCclusterfile->Close();
-         delete fMCclusterfile;
-         fMCclusterfile = new TFile("/nfs/david/subatom/alice/data/V3.04/fast/clusters/hg_8k_v0_s1-3_e0_cl.root");
-         fMCclusterfile->cd();
-       }
-      AliTPCClustersArray arr;
-      arr.Setup(fParam);
-      arr.SetClusterType("AliTPCcluster");
-      Bool_t clusterok = arr.ConnectTree("Segment Tree");
-      if(!clusterok) 
-       LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","Cluster Array")
-         <<"Error loading clusters from rootfile"<<ENDLOG;
-      
-      for(Int_t ci=0; ci<arr.GetTree()->GetEntries(); ci++)  
-       {
-         Int_t sec,row,sl,lr;
-         AliSegmentID *s = arr.LoadEntry(ci);
-         fParam->AdjustSectorRow(s->GetID(),sec,row);
-         fTransform->Sector2Slice(sl,lr,sec,row);
-         if(sl != slice) {arr.ClearRow(sec,row); continue;}
-         //if(lr!=pr) {carray.ClearRow(sec,row); continue;}
-         AliTPCClustersRow *cRow = arr.GetRow(sec,row);
-         printf("evaluating slice %d row %d\n",slice,lr);
-         for(Int_t j=0; j<cRow->GetArray()->GetEntriesFast(); j++)
+         crossed=0;
+         recs=0;
+         Int_t index = fRowid[sl][i];
+         if (!fDigitsTree->GetEvent(index)) continue;
+         Int_t sec,row;
+         fParam->AdjustSectorRow(fDigits->GetID(),sec,row);
+         fDigits->First();
+         do {
+           Int_t it=fDigits->CurrentRow(), ip=fDigits->CurrentColumn();
+           Short_t dig = fDigits->GetDigit(it,ip);
+           
+           if(dig<=fParam->GetZeroSup()) continue;
+           if(it < fParam->GetMaxTBin()-1 && it > 0)
+             if(fDigits->GetDigit(it+1,ip) <= fParam->GetZeroSup()
+                && fDigits->GetDigit(it-1,ip) <= fParam->GetZeroSup())
+               continue;
+           
+           fTransform->Raw2Local(xyz,sec,row,ip,it);
+           if(fParam->GetPadRowRadii(sec,row)<230./250.*fabs(xyz[2]))
+             continue;
+           
+           
+           Int_t idx0=fDigits->GetTrackID(it,ip,0); 
+           Int_t idx1=fDigits->GetTrackID(it,ip,1);
+           Int_t idx2=fDigits->GetTrackID(it,ip,2);
+           
+           if (idx0>=0 && dig>=zero) count[idx0]+=1;
+           if (idx1>=0 && dig>=zero) count[idx1]+=1;
+           if (idx2>=0 && dig>=zero) count[idx2]+=1;
+         } while (fDigits->Next());
+         
+         for (Int_t j=0; j<np; j++) 
            {
-             
-             AliTPCcluster *cluster=(AliTPCcluster*)(*cRow)[j];
-             xyz_cl[1] = cluster->GetY();
-             xyz_cl[2] = cluster->GetZ();
-             Int_t lab=cluster->GetLabel(0);
-             if(lab<0) continue;
-             
-             for(Int_t pa=0; pa<good_particles->GetEntriesFast(); pa++)
-               {
-                 if(particle_id[pa]!=lab) continue;
-                 TParticle *part = (TParticle*)good_particles->UncheckedAt(pa);
-                 GetParticleCrossingPoint(part,slice,lr,xyz_cross);
-                 Double_t yres = xyz_cl[1] - xyz_cross[1];
-                 ntuppel->Fill(yres,part->Pt(),lr,xyz_cl[2],slice);
-               }
+             if (count[j]>1) //at least two digits at this padrow 
+               crossed++;
+             count[j]=0;
+           }
+         AliL3SpacePointData *points = fClusters[sl][0];
+         for(Int_t l=0; l<fNcl[sl][0]; l++)
+           {
+             if(points[l].fPadRow != i) continue;
+             recs++;
            }
-         if(arr.GetRow(sec,row)) 
-           arr.ClearRow(sec,row);
+         ntuppel->Fill(i,crossed,recs);
        }
-      delete [] particle_id;
-      delete good_particles;
     }
-  return ntuppel;
+  delete[] count;
+  
+  TFile *file = TFile::Open(outfile,"RECREATE");
+  ntuppel->Write();
+  file->Close();
+  
 }
-*/
+
 Bool_t AliL3Evaluate::GetParticleCrossingPoint(TParticle *part,Int_t slice,Int_t padrow,Float_t *xyz)
 {
   //Calcluate the crossing point between a generated particle and given padrow.
index 1848942..7c49a9e 100644 (file)
@@ -10,7 +10,6 @@
 
 struct GoodTrack 
 {
-
   Int_t label;
   Double_t eta;
   Int_t code;
@@ -114,7 +113,7 @@ class AliL3Evaluate : public TObject {
   TNtuple *CalculateResiduals();
   TNtuple *EvaluatePoints(Char_t *rootfile);
   Bool_t GetParticleCrossingPoint(TParticle *part,Int_t slice,Int_t padrow,Float_t *xyz);
-  //TNtuple *EvaluateGEANT();
+  void GetCFeff(Char_t *outfile);
 
   ClassDef(AliL3Evaluate,1) //Tracking evaluation class
 };
index fd2084c..6f33c60 100644 (file)
@@ -11,7 +11,7 @@
 #include "AliL3Vertex.h"
 #include "AliL3Track.h"
 #include "AliL3SpacePointData.h"
-#include "AliL3FileHandler.h"
+#include "AliL3MemHandler.h"
 
 //_____________________________________________________________
 // AliL3Fitter
@@ -32,12 +32,12 @@ AliL3Fitter::AliL3Fitter(AliL3Vertex *vertex)
 void AliL3Fitter::LoadClusters(Char_t *path)
 {
   Char_t fname[256];
-  AliL3FileHandler *clusterfile[36][6];
+  AliL3MemHandler *clusterfile[36][6];
   for(Int_t s=0; s<=35; s++)
     {
       for(Int_t p=0; p<6; p++)
        {
-         clusterfile[s][p] = new AliL3FileHandler();
+         clusterfile[s][p] = new AliL3MemHandler();
          sprintf(fname,"%spoints_%d_%d.raw",path,s,p);
          if(!clusterfile[s][p]->SetBinaryInput(fname))
            {