]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
HLT TPC Conformal mapping tracker running in AliRoot
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Nov 2007 15:35:42 +0000 (15:35 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Nov 2007 15:35:42 +0000 (15:35 +0000)
- changes in conformal mapping tracker to postpone large memory allocation
  to the place where it's needed
- bugfix in FileHandler to deliver correct HLT raw TPC format
- bugfix in DigitReaderUnpacked to treat rows similar to other digut readers
- benchmark logging level introduced

12 files changed:
HLT/TPCLib/AliHLTTPCConfMapPoint.cxx
HLT/TPCLib/AliHLTTPCConfMapPoint.h
HLT/TPCLib/AliHLTTPCConfMapper.cxx
HLT/TPCLib/AliHLTTPCConfMapper.h
HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
HLT/TPCLib/AliHLTTPCFileHandler.cxx
HLT/TPCLib/AliHLTTPCLog.h
HLT/TPCLib/AliHLTTPCSliceTrackerComponent.cxx
HLT/TPCLib/AliHLTTPCTrackArray.cxx
HLT/TPCLib/AliHLTTPCTrackArray.h
HLT/TPCLib/AliHLTTPCTransform.cxx
HLT/TPCLib/offline/AliHLTTPCDigitPublisherComponent.cxx

index 421200df3742eae5e82da957c9b81242dfd5576f..a0bdbb0fd69202c691aeb9c7ae83960589e263aa 100644 (file)
@@ -24,6 +24,7 @@
     @brief  Hit class for conformal mapper
 */
 
+#include <cassert>
 #include "AliHLTTPCLogging.h"
 #include "AliHLTTPCConfMapPoint.h"
 #include "AliHLTTPCSpacePointData.h"
@@ -49,7 +50,7 @@ AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint()
   fHitNumber(-1),
   fTrackNumber(0),
   fNextHitNumber(0),
-  fUsed(0),
+  fUsed(kFALSE),
   fPadrow(0),
   fSector(0),
   fx(0),
@@ -79,20 +80,116 @@ AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint()
   fZverr(0),
   fPhi(0),
   fEta(0),
-  fNextVolumeHit(0),
-  fNextRowHit(0),
-  fNextTrackHit(0),
+  fNextVolumeHit(NULL),
+  fNextRowHit(NULL),
+  fNextTrackHit(NULL),
   fPhiIndex(0),
   fEtaIndex(0),
   fXYChi2(0),
   fSZChi2(0)
 {
   //Constructor
-  
-  SetUsage(false);
-  SetIntPoint(0., 0., 0., 0., 0., 0.);
-  SetShiftedCoord();
-  SetMCTrackID(0,0,0);
+  fMCTrackID[0]=-1;
+  fMCTrackID[1]=-1;
+  fMCTrackID[2]=-1;
+}
+
+AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint& src)
+  :
+  fHitNumber(src.fHitNumber),
+  fTrackNumber(src.fTrackNumber),
+  fNextHitNumber(src.fNextHitNumber),
+  fUsed(src.fUsed),
+  fPadrow(src.fPadrow),
+  fSector(src.fSector),
+  fx(src.fx),
+  fy(src.fy),
+  fz(src.fz),
+  fxerr(src.fxerr),
+  fyerr(src.fyerr),
+  fzerr(src.fzerr),
+  fWxy(src.fWxy),
+  fWz(src.fWz),
+  fs(src.fs),
+  fXt(src.fXt),
+  fYt(src.fYt),
+  fZt(src.fZt),
+  fXterr(src.fXterr),
+  fYterr(src.fYterr),
+  fZterr(src.fZterr),
+  fXprime(src.fXprime),
+  fYprime(src.fYprime),
+  fXprimeerr(src.fXprimeerr),
+  fYprimeerr(src.fYprimeerr),
+  fXv(src.fXv),
+  fYv(src.fYv),
+  fZv(src.fZv),
+  fXverr(src.fXverr),
+  fYverr(src.fYverr),
+  fZverr(src.fZverr),
+  fPhi(src.fPhi),
+  fEta(src.fEta),
+  fNextVolumeHit(src.fNextVolumeHit),
+  fNextRowHit(src.fNextRowHit),
+  fNextTrackHit(src.fNextTrackHit),
+  fPhiIndex(src.fPhiIndex),
+  fEtaIndex(src.fEtaIndex),
+  fXYChi2(src.fXYChi2),
+  fSZChi2(src.fSZChi2)
+{
+  //Copy Constructor
+  fMCTrackID[0]=src.fMCTrackID[0];
+  fMCTrackID[1]=src.fMCTrackID[1];
+  fMCTrackID[2]=src.fMCTrackID[2];
+}
+
+AliHLTTPCConfMapPoint& AliHLTTPCConfMapPoint::operator=(const AliHLTTPCConfMapPoint& src)
+{
+  fHitNumber=src.fHitNumber;
+  fTrackNumber=src.fTrackNumber;
+  fNextHitNumber=src.fNextHitNumber;
+  fUsed=src.fUsed;
+  fPadrow=src.fPadrow;
+  fSector=src.fSector;
+  fx=src.fx;
+  fy=src.fy;
+  fz=src.fz;
+  fxerr=src.fxerr;
+  fyerr=src.fyerr;
+  fzerr=src.fzerr;
+  fWxy=src.fWxy;
+  fWz=src.fWz;
+  fs=src.fs;
+  fXt=src.fXt;
+  fYt=src.fYt;
+  fZt=src.fZt;
+  fXterr=src.fXterr;
+  fYterr=src.fYterr;
+  fZterr=src.fZterr;
+  fXprime=src.fXprime;
+  fYprime=src.fYprime;
+  fXprimeerr=src.fXprimeerr;
+  fYprimeerr=src.fYprimeerr;
+  fXv=src.fXv;
+  fYv=src.fYv;
+  fZv=src.fZv;
+  fXverr=src.fXverr;
+  fYverr=src.fYverr;
+  fZverr=src.fZverr;
+  fPhi=src.fPhi;
+  fEta=src.fEta;
+  fNextVolumeHit=src.fNextVolumeHit;
+  fNextRowHit=src.fNextRowHit;
+  fNextTrackHit=src.fNextTrackHit;
+  fPhiIndex=src.fPhiIndex;
+  fEtaIndex=src.fEtaIndex;
+  fXYChi2=src.fXYChi2;
+  fSZChi2=src.fSZChi2;
+  fMCTrackID[0]=src.fMCTrackID[0];
+  fMCTrackID[1]=src.fMCTrackID[1];
+  fMCTrackID[2]=src.fMCTrackID[2];
+
+  return *this;
 }
 
 AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
@@ -100,19 +197,19 @@ AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
   // Destructor.
 }
 
-Bool_t AliHLTTPCConfMapPoint::ReadHits(AliHLTTPCSpacePointData* hits )
+Bool_t AliHLTTPCConfMapPoint::Read(const AliHLTTPCSpacePointData& hit)
 {
   //read the hits
-  SetHitNumber(hits->fID);
-  SetPadRow(hits->fPadRow);
-  Int_t slice = (hits->fID>>25) & 0x7f;
+  SetHitNumber(hit.fID);
+  SetPadRow(hit.fPadRow);
+  Int_t slice = (hit.fID>>25) & 0x7f;
   SetSector(slice);
-  SetX(hits->fX);
-  SetY(hits->fY);
-  SetZ(hits->fZ);
-  SetXerr(sqrt(hits->fSigmaY2));
-  SetYerr(sqrt(hits->fSigmaY2));
-  SetZerr(sqrt(hits->fSigmaZ2));
+  SetX(hit.fX);
+  SetY(hit.fY);
+  SetZ(hit.fZ);
+  SetXerr(sqrt(hit.fSigmaY2));
+  SetYerr(sqrt(hit.fSigmaY2));
+  SetZerr(sqrt(hit.fSigmaZ2));
   return kTRUE;
 }
 
@@ -121,9 +218,9 @@ void AliHLTTPCConfMapPoint::Reset()
   //Reset this point.
   SetUsage(kFALSE);
   SetS(0);
-  fNextRowHit = 0;
-  fNextVolumeHit=0;
-  fNextTrackHit=0;
+  fNextRowHit = NULL;
+  fNextVolumeHit=NULL;
+  fNextTrackHit=NULL;
 }
 
 void AliHLTTPCConfMapPoint::Setup(AliHLTTPCVertex *vertex)
index 082643e1430ad9f50de477b34d7abb5d9a838fe9..d030576a639fe8e00de986663c2b3d1a4e862099 100644 (file)
@@ -27,13 +27,26 @@ class AliHLTTPCVertex;
 class AliHLTTPCConfMapPoint {
 
  public:
-
+  /** constructor */
   AliHLTTPCConfMapPoint();
+  /** copy constructor */
+  AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint&);
+  /** assignment operator */
+  AliHLTTPCConfMapPoint& operator=(const AliHLTTPCConfMapPoint&);
   /** destructor */
   virtual ~AliHLTTPCConfMapPoint();
   
+  /**
+   * Reset this point.
+   * The usage flag will be cleared as well as variables are reset.
+   */
   void Reset();
-  Bool_t ReadHits(AliHLTTPCSpacePointData* hits );
+
+  /**
+   * Read one hit.
+   * Set members from AliHLTTPCSpacePointData.
+   */
+  Bool_t Read(const AliHLTTPCSpacePointData& hit);
   
    // getter
   Double_t GetX() const {return fx;}
@@ -84,7 +97,6 @@ class AliHLTTPCConfMapPoint {
   Short_t GetEtaIndex() const {return fEtaIndex;}
   Double_t GetXYChi2() const {return fXYChi2;}
   Double_t GetSZChi2() const {return fSZChi2;}
-  //Int_t fMCTrackID[3]; //MClabel of tracks, may overlap
 
   // setter
   void SetNextVolumeHit(AliHLTTPCConfMapPoint* p){fNextVolumeHit=p;}
@@ -145,10 +157,6 @@ class AliHLTTPCConfMapPoint {
   void SetConfCoord();// conformal mapping
 
  private:
-  /** copy constructor prohibited */
-  AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint&);
-  /** assignment operator prohibited */
-  AliHLTTPCConfMapPoint& operator=(const AliHLTTPCConfMapPoint&);
 
   Int_t fHitNumber;     //hit number
   Int_t fTrackNumber;   //track number
index 27b72fc0ac1e71d05312c477075a86f5e6b7ed40..289de257398784667799c7adb207bbaee5c8ccf5 100644 (file)
@@ -13,6 +13,7 @@
 </pre>
 */
 
+#include <cassert>
 #include <sys/time.h>
  
 #include "AliHLTTPCRootTypes.h"
@@ -37,7 +38,7 @@ AliHLTTPCConfMapper::AliHLTTPCConfMapper()
   fNTracks(0),
   fVertex(NULL),
   fVertexFinder(kFALSE),
-  fHit(NULL),
+  fHit(),
   fTrack(NULL),
   fMaxDca(0.0), // no clue whether this is reasonable, but at least better than without initialization
   fVolume(NULL),
@@ -68,15 +69,9 @@ AliHLTTPCConfMapper::AliHLTTPCConfMapper()
 AliHLTTPCConfMapper::~AliHLTTPCConfMapper()
 {
   // Destructor.
-  if(fVolume) {
-    delete [] fVolume;
-  }
   if(fRow) {
     delete [] fRow;
   }
-  if(fHit) {
-    delete [] fHit;
-  }
   if(fTrack) {
     delete fTrack;
   }
@@ -94,32 +89,21 @@ void AliHLTTPCConfMapper::InitVolumes()
   fNumEtaSegmentPlusOne = fNumEtaSegment+1;
   fNumPhiEtaSegmentPlusOne = fNumPhiSegmentPlusOne*fNumEtaSegmentPlusOne;
   fBounds = fNumRowSegmentPlusOne * fNumPhiSegmentPlusOne * fNumEtaSegmentPlusOne;
+
+  Reset();
   
-  //Allocate volumes:
+  fTrack = new AliHLTTPCTrackArray("AliHLTTPCConfMapTrack",10);
+}
+
+void AliHLTTPCConfMapper::Reset()
+{
   if(fVolume) delete [] fVolume;
+  fVolume=NULL;
   if(fRow) delete [] fRow;
+  fRow=NULL;
   
-  LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::InitVolumes","Memory")<<AliHLTTPCLog::kDec<<
-    "Allocating "<<fBounds*sizeof(AliHLTTPCConfMapContainer)<<" Bytes to fVolume"<<ENDLOG;
-  LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::InitVolumes","Memory")<<AliHLTTPCLog::kDec<<
-    "Allocating "<<fNumRowSegmentPlusOne*sizeof(AliHLTTPCConfMapContainer)<<" Bytes to fRow"<<ENDLOG;
-  
-  fVolume = new AliHLTTPCConfMapContainer[fBounds];
-  fRow = new AliHLTTPCConfMapContainer[fNumRowSegmentPlusOne];
-  
-  memset(fVolume,0,fBounds*sizeof(AliHLTTPCConfMapContainer));
-  memset(fRow,0,fNumRowSegmentPlusOne*sizeof(AliHLTTPCConfMapContainer));
-  
-  Int_t maxnumoftracks = 2000;
-  Int_t maxnumofhits = 120000;
-  
-  if(fHit)
-    delete [] fHit;
-  if(fTrack)
-    delete fTrack;
-    
-  fHit = new AliHLTTPCConfMapPoint[maxnumofhits];
-  fTrack = new AliHLTTPCTrackArray("AliHLTTPCConfMapTrack",maxnumoftracks);
+  fClustersUnused=0;
+  fHit.clear();
 }
 
 void AliHLTTPCConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etarange)
@@ -173,16 +157,17 @@ void AliHLTTPCConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etara
 Bool_t AliHLTTPCConfMapper::ReadHits(UInt_t count, AliHLTTPCSpacePointData* hits )
 {
   //read hits
-  Int_t nhit=(Int_t)count; 
-  for (Int_t i=0;i<nhit;i++)
+  if (fHit.size()<fClustersUnused+count) fHit.resize(fClustersUnused+count);
+  assert(fHit.size()>=fClustersUnused+count);
+  for (Int_t i=0;(UInt_t)i<count;i++)
     {  
       fHit[i+fClustersUnused].Reset();
-      fHit[i+fClustersUnused].ReadHits(&(hits[i]));
+      fHit[i+fClustersUnused].Read(hits[i]);
     }
-  fClustersUnused += nhit;
+  fClustersUnused += count;
 
   LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::ReadHits","#hits")
-    <<AliHLTTPCLog::kDec<<"hit_counter: "<<nhit<<" count: "<<count<<ENDLOG;
+    <<AliHLTTPCLog::kDec<<"#hits: "<<count<<" total: "<<fClustersUnused<<ENDLOG;
   
   return true;
 }
@@ -195,7 +180,19 @@ void AliHLTTPCConfMapper::SetPointers()
   if(fClustersUnused < fMinPoints[fVertexConstraint])
     return;
   
-  //Reset detector volumes
+  //Allocate detector volumes
+  if (fVolume==NULL) {
+    LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::InitVolumes","Memory")<<AliHLTTPCLog::kDec<<
+      "Allocating "<<fBounds*sizeof(AliHLTTPCConfMapContainer)<<" Bytes to fVolume"<<ENDLOG;
+    fVolume = new AliHLTTPCConfMapContainer[fBounds];
+  }
+
+  if (fRow==NULL) {
+    LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::InitVolumes","Memory")<<AliHLTTPCLog::kDec<<
+      "Allocating "<<fNumRowSegmentPlusOne*sizeof(AliHLTTPCConfMapContainer)<<" Bytes to fRow"<<ENDLOG;
+    fRow = new AliHLTTPCConfMapContainer[fNumRowSegmentPlusOne];
+  }
+  
   memset(fVolume,0,fBounds*sizeof(AliHLTTPCConfMapContainer));
   memset(fRow,0,fNumRowSegmentPlusOne*sizeof(AliHLTTPCConfMapContainer));
   
@@ -204,9 +201,9 @@ void AliHLTTPCConfMapper::SetPointers()
 
   Int_t volumeIndex;
   Int_t localcounter=0;
+  assert(fHit.size()>=fClustersUnused);
   for(Int_t j=0; j<fClustersUnused; j++)
     {
-      //AliHLTTPCConfMapPoint *thisHit = (AliHLTTPCConfMapPoint*)fHit->At(j);
       AliHLTTPCConfMapPoint *thisHit = &(fHit[j]);
 
       thisHit->Setup(fVertex);
@@ -259,7 +256,7 @@ void AliHLTTPCConfMapper::SetPointers()
       <<fEtaHitsOutOfRange+fPhiHitsOutOfRange<<ENDLOG;
 
   Int_t hits_accepted=fClustersUnused-(fEtaHitsOutOfRange+fPhiHitsOutOfRange);
-  LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::SetPointers","Setup")
+  LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::SetPointers","Setup")
     <<"Setup finished, hits out of range: "<<fEtaHitsOutOfRange+fPhiHitsOutOfRange
     <<" hits accepted "<<hits_accepted<<ENDLOG;
 }
@@ -282,7 +279,7 @@ void AliHLTTPCConfMapper::MainVertexTrackingA()
   SetVertexConstraint(true);
   cpuTime = CpuTime() - initCpuTime;
   if(fBench)
-    LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::MainVertexTrackingA","Timing")
+    LOG(AliHLTTPCLog::kBenchmark,"AliHLTTPCConfMapper::MainVertexTrackingA","Timing")
       <<AliHLTTPCLog::kDec<<"Setup finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
   
 }
@@ -304,7 +301,7 @@ void AliHLTTPCConfMapper::MainVertexTrackingB()
  
   cpuTime = CpuTime() - initCpuTime;
   if(fBench)
-    LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::MainVertexTrackingB","Timing")
+    LOG(AliHLTTPCLog::kBenchmark,"AliHLTTPCConfMapper::MainVertexTrackingB","Timing")
       <<AliHLTTPCLog::kDec<<"Main Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
 }
 
@@ -330,7 +327,7 @@ void AliHLTTPCConfMapper::MainVertexTracking()
 
   cpuTime = CpuTime() - initCpuTime;
   if(fBench)
-    LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::MainVertexTracking","Timing")<<AliHLTTPCLog::kDec<<
+    LOG(AliHLTTPCLog::kBenchmark,"AliHLTTPCConfMapper::MainVertexTracking","Timing")<<AliHLTTPCLog::kDec<<
       "Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
   
   return;
@@ -672,6 +669,7 @@ AliHLTTPCConfMapPoint *AliHLTTPCConfMapper::GetNextNeighbor(AliHLTTPCConfMapPoin
                    "VolumeIndex error "<<volumeIndex<<ENDLOG;
                }
              
+             assert(fVolume!=NULL);
              for(hit = (AliHLTTPCConfMapPoint*)fVolume[volumeIndex].first;
                  hit!=0; hit = hit->GetNextVolumeHit())
                {
@@ -895,7 +893,7 @@ Int_t AliHLTTPCConfMapper::FillTracks()
       return 0;
     }
 
-  LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::FillTracks","fNTracks")<<AliHLTTPCLog::kDec<<
+  LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::FillTracks","fNTracks")<<AliHLTTPCLog::kDec<<
     "Number of found tracks: "<<fNTracks<<ENDLOG;
   
   //  fTrack->Sort();
index d13a66fabe9e356d9f558058de9c08eada8d77d9..a4e7104d3228a3fb8d612423f1f5629423a879af 100644 (file)
@@ -10,6 +10,7 @@
 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
 //*-- Copyright &copy ALICE HLT Group
 
+#include <vector>
 
 class AliHLTTPCConfMapPoint;
 class AliHLTTPCConfMapTrack;
@@ -27,7 +28,16 @@ class AliHLTTPCConfMapper {
   /** destructor */
   virtual ~AliHLTTPCConfMapper();
   
+  /**
+   * Init and calculate bounds for the internal arrays.
+   */
   void InitVolumes();
+
+  /**
+   * Reset internal arrays and free memory.
+   */
+  void Reset();
+
   void InitSector(Int_t sector,Int_t *rowrange=0,Float_t *etarange=0);
   void SetVertex(AliHLTTPCVertex *vertex){fVertex = vertex;}
   void MainVertexTrackingA();
@@ -38,6 +48,13 @@ class AliHLTTPCConfMapper {
                          Int_t rowscopetracklet, Int_t rowscopetrack,Double_t maxphi=0.1,Double_t maxeta=0.1);
   void NonVertexSettings(Int_t trackletlength, Int_t tracklength, 
                         Int_t rowscopetracklet, Int_t rowscopetrack);
+
+  /**
+   * Read an array of space point data.
+   * @param count    array size
+   * @param hits     array
+   * @return kTRUE if success.
+   */
   Bool_t ReadHits(UInt_t count, AliHLTTPCSpacePointData* hits );
   void ClusterLoop();
   void CreateTrack(AliHLTTPCConfMapPoint *hit);
@@ -98,7 +115,8 @@ class AliHLTTPCConfMapper {
   Bool_t fVertexFinder; //Include vertexfinding or not 
                         //(latter case vertex=(0,0,0))
 
-  AliHLTTPCConfMapPoint *fHit;  //!
+  /** the list of hits */
+  vector<AliHLTTPCConfMapPoint> fHit;  //!
   AliHLTTPCTrackArray *fTrack;  //!
   Double_t fMaxDca;      //cut value for momentum fit
   
index 146a12ff93e39b4c8064d5f5ddfca4a03d4cecb0..9dfe2fda3a6511e8b8c2a7a84593b46a16dda876 100644 (file)
@@ -70,8 +70,9 @@ int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t
 
   fBin = -1;
 
-  fFirstRow=AliHLTTPCTransform::GetFirstRow(patch);
-  fLastRow=AliHLTTPCTransform::GetLastRow(patch);
+  int dummy=0;
+  AliHLTTPCTransform::Slice2Sector(slice, AliHLTTPCTransform::GetFirstRow(patch), dummy, fFirstRow);
+  AliHLTTPCTransform::Slice2Sector(slice, AliHLTTPCTransform::GetLastRow(patch), dummy, fLastRow);
 
   fRow = fFirstRow; 
 
index 4a155895d1a77da6efebf5c3251074a1eb2a7d67..16c677b4b7c0cf176cc70705f9d2fd2f08164f2b 100644 (file)
@@ -31,7 +31,7 @@
 // or
 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
                                                                           */
-
+#include <cassert>
 #include <TClonesArray.h>
 #include <TSystem.h>
 #include <TMath.h>
@@ -383,6 +383,7 @@ Bool_t AliHLTTPCFileHandler::CreateIndex()
     LOG(AliHLTTPCLog::kInformational,"AliHLTTPCFileHandler::CreateIndex","Index")
       <<"Starting to create index, this can take a while."<<ENDLOG;
 
+    Int_t lslice,lrow;
     for(Int_t n=0; n<fDigitsTree->GetEntries(); n++) {
       Int_t sector, row;
       Int_t lslice,lrow;
@@ -442,7 +443,6 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
 
   UShort_t dig;
   Int_t time,pad,sector,row;
-  Int_t lslice,lrow;
   Int_t nrows=0;
   Int_t ndigitcount=0;
   Int_t entries = (Int_t)fDigitsTree->GetEntries();
@@ -483,9 +483,12 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
   for(Int_t r=fRowMin;r<=fRowMax;r++){
     Int_t n=fIndex[fSlice][r];
     if(n!=-1){ // there is data on that row available
+      Int_t lslice,lrow;
       fDigitsTree->GetEvent(n);
       fParam->AdjustSectorRow(fDigits->GetID(),sector,row);
       AliHLTTPCTransform::Sector2Slice(lslice,lrow,sector,row);
+//       LOG(AliHLTTPCLog::kInformational,"AliHLTTPCFileHandler::AliDigits2Memory","Digits")
+//     << "Sector "<<sector<<" Row " << row << " Slice " << lslice << " lrow " << lrow<<ENDLOG;
 
       if(lrow!=r){
        LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::AliDigits2Memory","Row")
@@ -513,34 +516,49 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
       } while (fDigits->Next());
       //cout << lrow << " " << ndigits[lrow] << " - " << ndigitcount << endl;
     }
-    nrows++;
+    //see comment below//nrows++;
   }
-
-  UInt_t size = sizeof(AliHLTTPCDigitData)*ndigitcount
+  // Matthias 05.11.2007
+  // The question is whether we should always return a AliHLTTPCDigitRowData
+  // for each row, even the empty ones or only for the ones filled with data.
+  // the AliHLTTPCDigitReaderUnpacked as the counnterpart so far assumes 
+  // empty RawData structs for empty rows. But some of the code here implies
+  // the latter approach, e.g. the count of nrows in the loop above (now
+  // commented). At least the two loops were not consistent, it's fixed now.
+  nrows=fRowMax-fRowMin+1;
+
+  UInt_t bufferSize = sizeof(AliHLTTPCDigitData)*ndigitcount
     + nrows*sizeof(AliHLTTPCDigitRowData);
 
   LOG(AliHLTTPCLog::kDebug,"AliHLTTPCFileHandler::AliDigits2Memory","Digits")
-    <<AliHLTTPCLog::kDec<<"Found "<<ndigitcount<<" Digits"<<ENDLOG;
-  
+    << "Found "<<ndigitcount<<" Digits in " << nrows << " rows out of [" << fRowMin << "," << fRowMax <<"]"<<ENDLOG;
+
   if (tgtBuffer!=NULL && pTgtSize!=NULL && *pTgtSize>0) {
-    if (size<=*pTgtSize) {
+    if (bufferSize<=*pTgtSize) {
       data=reinterpret_cast<AliHLTTPCDigitRowData*>(tgtBuffer);
     } else {
     }
-  } else {
-    data=reinterpret_cast<AliHLTTPCDigitRowData*>(Allocate(size));
+  } else if (bufferSize>0) {
+    data=reinterpret_cast<AliHLTTPCDigitRowData*>(Allocate(bufferSize));
+  }
+  if (pTgtSize) *pTgtSize=bufferSize;
+  if (data==NULL) {
+    delete [] ndigits;
+    return NULL;
   }
-  if (pTgtSize) *pTgtSize=size;
-  if (data==NULL) return NULL;
   nrow = (UInt_t)nrows;
   AliHLTTPCDigitRowData *tempPt = data;
+  memset(data, 0, bufferSize);
 
   for(Int_t r=fRowMin;r<=fRowMax;r++){
     Int_t n=fIndex[fSlice][r];
-    tempPt->fRow = r;
+
+    AliHLTTPCTransform::Slice2Sector(fSlice,r,sector,row);
+    tempPt->fRow = row;
     tempPt->fNDigit = 0;
 
     if(n!=-1){//data on that row
+      Int_t lslice,lrow;
       fDigitsTree->GetEvent(n);
       fParam->AdjustSectorRow(fDigits->GetID(),sector,row);
       AliHLTTPCTransform::Sector2Slice(lslice,lrow,sector,row);
@@ -550,6 +568,8 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
        continue;
       }
 
+      // set the correct row no and digit count
+      tempPt->fRow = row;
       tempPt->fNDigit = ndigits[lrow];
 
       Int_t localcount=0;
@@ -580,13 +600,15 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
        tempPt->fDigitData[localcount].fTrackID[2] = fDigits->GetTrackID(time,pad,2);
        localcount++;
       } while (fDigits->Next());
-      Byte_t *tmp = (Byte_t*)tempPt;
-      Int_t size = sizeof(AliHLTTPCDigitRowData)
-       + ndigits[lrow]*sizeof(AliHLTTPCDigitData);
-      tmp += size;
-      tempPt = (AliHLTTPCDigitRowData*)tmp;
     }
+
+    Byte_t *tmp = (Byte_t*)tempPt;
+    Int_t blockSize = sizeof(AliHLTTPCDigitRowData)
+      + tempPt->fNDigit*sizeof(AliHLTTPCDigitData);
+    tmp += blockSize;
+    tempPt = (AliHLTTPCDigitRowData*)tmp;
   }
+  assert((Byte_t*)tempPt==((Byte_t*)data)+bufferSize);
   delete [] ndigits;
   return data;
 }
index e9aa393a255f35c612227cf43f900d716abd8383..ae056ea287aae30b8524ee5c9a56f807633eb224 100644 (file)
@@ -33,7 +33,7 @@ using namespace std;
  */
 class AliHLTTPCLog  {
   public:
-  enum TLogLevel { kNone = 0, kDebug= 0x01, kInformational = 0x02, kWarning = 0x04, kError = 0x08 , kFatal = 0x10, kPrimary = 0x80, kAll = 0x9F };
+  enum TLogLevel { kNone = 0, kBenchmark=0x01,kDebug= 0x02, kInformational = 0x04, kWarning = 0x08, kError = 0x10 , kFatal = 0x20, kPrimary = 0x80, kAll = 0xBF };
 
   /** not used */
   static const char* kEnd;                                         //! transient
index e4b2aed66488df89fa78c0416b0faeb3ef69fe0b..d18af9729b026d5ff0444350cda5ad2befb3bf1e 100644 (file)
@@ -684,6 +684,8 @@ int AliHLTTPCSliceTrackerComponent::DoEvent( const AliHLTComponentEventData& evt
             "Input: Number of tracks: %lu Slice/MinPatch/MaxPatch/RowMin/RowMax: %lu/%lu/%lu/%lu/%lu.", 
             ntracks0, slice, minPatch, maxPatch, row[0], row[1] );
 
+    fTracker->Reset();
+
     tSize += mysize+sizeof(AliHLTTPCTrackletData);
     outBPtr += mysize+sizeof(AliHLTTPCTrackletData);
     
index 024a8d544d1e4454156a0fb72504afdb7b4087c3..55ffa213e232cfac02834583579db113b25d7b0b 100644 (file)
@@ -131,6 +131,7 @@ void AliHLTTPCTrackArray::DeleteArray()
     delete fTrack[i];
   delete[] fIsPresent;
   delete[] fTrack;
+  fSize=0;
 }
 
 Bool_t AliHLTTPCTrackArray::SetSize(Int_t newsize)
index 34ca5f0d3d95e052c4e56b065786416e247ac114..1f6e65c7a9de59ec27f30bde9513720f3a5cd163 100644 (file)
@@ -80,6 +80,11 @@ class AliHLTTPCTrackArray {
 
   Int_t GetNPresent() const {return (fNTracks- fNAbsent);}
   Int_t GetNTracks() const {return fNTracks;}
+
+  /**
+   * Return pointer to next free track object.
+   * The array is grown if necessary.
+   */
   AliHLTTPCTrack *NextTrack();
   AliHLTTPCTrack *GetCheckedTrack(Int_t t){if(fIsPresent[t]) return fTrack[t]; return 0;}
   AliHLTTPCTrack *GetTrack(Int_t t){return fTrack[t];}
@@ -120,7 +125,7 @@ class AliHLTTPCTrackArray {
   AliHLTTPCTrackArray& operator=(const AliHLTTPCTrackArray&);
 
   Char_t fTrackType; //track type
-  Int_t fSize; //size of arra
+  Int_t fSize; //size of array
   Bool_t *fIsPresent;//!
   Int_t fNAbsent; //ntracks absent
 
index bc015fa4cde6bd0b916ea6d4a31233dbf478c7d9..34c5604c60a0b02cc43c0cf10fecc07893c524be 100644 (file)
@@ -1746,7 +1746,8 @@ Double_t AliHLTTPCTransform::GetPhi(Float_t *xyz)
 
 Bool_t AliHLTTPCTransform::Slice2Sector(Int_t slice, Int_t slicerow, Int_t & sector, Int_t &row)
 {
-  //slice to sector number
+  //slice no to sector number
+  //row no to local sector row no
   if(slicerow<0&&slicerow>=fgNRow){
     LOG(AliHLTTPCLog::kError,"AliHLTTPCTransform::Slice2Sector","Slicerow")
       <<AliHLTTPCLog::kDec<<"Wrong slicerow "<<slicerow<<ENDLOG;
index 4078f221ad692b68471cfa42d2f518612875a4f7..39c00f2cccca96ecd9f71d191b0893e7733cf623 100644 (file)
@@ -150,7 +150,7 @@ int AliHLTTPCDigitPublisherComponent::DoInit( int argc, const char** argv )
       fFileHandlerInstances=1;
     } else {
       fFileHandlerInstances++;
-      //HLTInfo("publisher %p: %d references to file handler instance", this, fFileHandlerInstances);
+      //HLTDebug("publisher %p: %d references to file handler instance", this, fFileHandlerInstances);
     }
     if (fpFileHandler) {
       if (!fpFileHandler->SetAliInput(pRunLoader)) {
@@ -175,7 +175,7 @@ int AliHLTTPCDigitPublisherComponent::DoDeinit()
     fpFileHandler->FreeDigitsTree();
     fCurrEvent=-1;
   }
-  //HLTInfo("publisher %p: %d references to file handler instance", this, fFileHandlerInstances);
+  //HLTDebug("publisher %p: %d references to file handler instance", this, fFileHandlerInstances);
   if (--fFileHandlerInstances==0 && fpFileHandler!=NULL) {
     try {
       if (fpFileHandler) {
@@ -211,14 +211,15 @@ int AliHLTTPCDigitPublisherComponent::GetEvent(const AliHLTComponentEventData& e
       UInt_t nrow=0;
       UInt_t tgtSize=size-sizeof(AliHLTTPCUnpackedRawData);
       if (fCurrEvent>=0 && fCurrEvent!=event) {
-       HLTInfo("new event %d, free digit tree for event %d", event, fCurrEvent);
+       HLTDebug("new event %d, free digit tree for event %d", event, fCurrEvent);
        fpFileHandler->FreeDigitsTree();
       }
       fCurrEvent=event;
-      fpFileHandler->Init(fMinSlice,fMinPart);    
+      HLTDebug("converting digits for slice %d partition %d", fMinSlice, fMinPart);
+      fpFileHandler->Init(fMinSlice,fMinPart);
       AliHLTTPCDigitRowData* pData=fpFileHandler->AliDigits2Memory(nrow, event, reinterpret_cast<Byte_t*>(pTgt->fDigits), &tgtSize);
       if (pData==NULL && tgtSize>0 && tgtSize>fMaxSize) {
-       HLTInfo("target buffer too small: %d byte required, %d available", tgtSize+sizeof(AliHLTTPCUnpackedRawData), size);
+       HLTDebug("target buffer too small: %d byte required, %d available", tgtSize+sizeof(AliHLTTPCUnpackedRawData), size);
        // indicate insufficient buffer size, on occasion the frameworks calls
        // again with the corrected buffer 
        fMaxSize=tgtSize;
@@ -236,6 +237,7 @@ int AliHLTTPCDigitPublisherComponent::GetEvent(const AliHLTComponentEventData& e
        bd.fSize = size;
        bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(fMinSlice, fMinSlice, fMinPart, fMinPart);
        outputBlocks.push_back( bd );
+       HLTDebug("added AliHLTTPCUnpackedRawData size %d, first row %d nof digits %d", size, pTgt->fDigits->fRow, pTgt->fDigits->fNDigit);
       }
     }
   } else {