]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
coding violations and compilation warnings fixed (Sergey)
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Mar 2008 21:58:38 +0000 (21:58 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Mar 2008 21:58:38 +0000 (21:58 +0000)
21 files changed:
HLT/TPCLib/tracking-ca/AliHLT3DTrackParam.cxx
HLT/TPCLib/tracking-ca/AliHLT3DTrackParam.h
HLT/TPCLib/tracking-ca/AliHLTTPCCACell.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCACell.h
HLT/TPCLib/tracking-ca/AliHLTTPCCADisplay.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCADisplay.h
HLT/TPCLib/tracking-ca/AliHLTTPCCAHit.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCAHit.h
HLT/TPCLib/tracking-ca/AliHLTTPCCAOutTrack.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCAOutTrack.h
HLT/TPCLib/tracking-ca/AliHLTTPCCAParam.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCAParam.h
HLT/TPCLib/tracking-ca/AliHLTTPCCARow.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCARow.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATrack.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCATrack.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackPar.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackPar.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATracker.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCATracker.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerComponent.cxx

index 8809ce6382a4f7dd76a3099b4df0f9fa3866dc37..b6f0beac3e709ff89d1fc69d449d5c2df4b619d5 100644 (file)
@@ -19,7 +19,7 @@
 #include "AliHLT3DTrackParam.h"
 #include "TMath.h"
 
-ClassImp(AliHLT3DTrackParam);
+ClassImp(AliHLT3DTrackParam)
 
 //* Transport utilities
   
index 7ccabef45f42e16ddb7a67a16eff3db5e4649677..e818440f7a54263ae5d1dda5126cdb11a3da2baa 100644 (file)
@@ -1,9 +1,13 @@
 //-*- Mode: C++ -*-
 // @(#) $Id$
 
-//* This file is property of and copyright by the ALICE HLT Project        * 
-//* ALICE Experiment at CERN, All rights reserved.                         *
-//* See cxx source for full Copyright notice                               *
+//* This file is property of and copyright by the ALICE HLT Project           * 
+//* ALICE Experiment at CERN, All rights reserved.                            *
+//* See cxx source for full Copyright notice                                  *
+
+//*                                                                           *
+//* AliHLT3DTrackParam class is under development and currently not in use    *
+//*                                                                           *
 
 #ifndef ALIHLT3DTRACKPARAM_H
 #define ALIHLT3DTRACKPARAM_H
@@ -45,9 +49,9 @@ class AliHLT3DTrackParam{
   Int_t    GetNDF()    const { return fNDF;   }
   Int_t    GetCharge() const { return fSignQ; }
   
-  Double_t GetParameter ( int i ) const ;
-  Double_t GetCovariance( int i ) const ;
-  Double_t GetCovariance( int i, int j ) const ;
+  Double_t GetParameter ( int i ) const { return fParam[i]; }
+  Double_t GetCovariance( int i ) const { return fCov[i]; }
+  Double_t GetCovariance( int i, int j ) const { return fCov[( j<=i ) ? i*(i+1)/2+j :j*(j+1)/2+i]; }
 
   //* Accessors with calculations( &value, &estimated sigma )
   //* error flag returned (0 means no error during calculations) 
index 41499a4ac33293383f57c64b4b8a48dc750e54e8..92dadeea02e71a439eba37a352ea9d730f792d06 100644 (file)
@@ -19,4 +19,8 @@
 #include "AliHLTTPCCACell.h"
 
 
-ClassImp(AliHLTTPCCACell);
+ClassImp(AliHLTTPCCACell)
+
+void AliHLTTPCCACell::Dummy()
+{
+}
index c54b8c3cb1871218ecdd6ba2cfbc5eb74c32a360..c5c0103ae05395ada6a30802cdf99ca3ec7641fe 100644 (file)
@@ -5,6 +5,13 @@
 //* ALICE Experiment at CERN, All rights reserved.                         *
 //* See cxx source for full Copyright notice                               *
 
+//*                                                                        *
+//* The AliHLTTPCCACell class describes the "Cell" object ---              *
+//* the set of neghbouring clusters in the same TPC row.                   *
+//* The cells are used as the minimal data units                           *
+//* by the Cellular Automaton tracking algorithm.                          *
+//*                                                                        *
+
 #ifndef ALIHLTTPCCACELL_H
 #define ALIHLTTPCCACELL_H
 
 
 /**
  * @class AliHLTTPCCACell
+ *
+ * The AliHLTTPCCACell class describes the "Cell" object ---
+ * the set of neghbouring clusters in the same TPC row.
+ * Cells are used as the minimal data units 
+ * by the Cellular Automaton tracking algorithm. 
+ *
  */
 class AliHLTTPCCACell
 {
@@ -20,6 +33,8 @@ class AliHLTTPCCACell
 
   AliHLTTPCCACell(): fFirstHitRef(0),fNHits(0),fY(0),fZ(0),fErrY(0),fErrZ(0),fIDown(0),fIUp(0),fIUsed(0){}
 
+  virtual ~AliHLTTPCCACell(){}
+
   Float_t &Y(){ return fY; }
   Float_t &Z(){ return fZ; }
   Float_t &ErrY(){ return fErrY; } 
@@ -40,6 +55,10 @@ class AliHLTTPCCACell
   Int_t fIDown, fIUp;   // indices of 2 neighboring cells in up & down directions
   Int_t fIUsed;         // if it is used by a reconstructed track
 
+ private:
+
+  void Dummy(); // to make rulechecker happy by having something in .cxx file
+
   ClassDef(AliHLTTPCCACell,1);
 };
 
index 11beea3e180cc69816b5110f6d24e2da050d895b..4f994471d59fd9fcbb1273c797d8306c300f7a5a 100644 (file)
 #include "AliHLTTPCCADisplay.h"
 
 #include "AliHLTTPCCATracker.h"
-#include "TString.h"
+  //#include "TString.h"
 #include "Riostream.h"
 #include "TMath.h"
 #include "TStyle.h"
 #include "TCanvas.h"
-#include <vector>
+#include <algorithm>
 
-ClassImp(AliHLTTPCCADisplay);
+ClassImp(AliHLTTPCCADisplay)
 
 AliHLTTPCCADisplay &AliHLTTPCCADisplay::Instance()
 {
@@ -35,7 +35,7 @@ AliHLTTPCCADisplay &AliHLTTPCCADisplay::Instance()
   return gAliHLTTPCCADisplay; 
 }
 
-AliHLTTPCCADisplay::AliHLTTPCCADisplay() : fXY(0), fZY(0), fAsk(1), fSectorView(1), fSector(0), 
+AliHLTTPCCADisplay::AliHLTTPCCADisplay() : fYX(0), fZX(0), fAsk(1), fSectorView(1), fSector(0), 
                                           fCos(1), fSin(0), fZMin(-250), fZMax(250),
                                           fRInnerMin(83.65), fRInnerMax(133.3), fROuterMin(133.5), fROuterMax(247.7),
                                           fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex()
@@ -44,7 +44,7 @@ AliHLTTPCCADisplay::AliHLTTPCCADisplay() : fXY(0), fZY(0), fAsk(1), fSectorView(
 }
 
 AliHLTTPCCADisplay::AliHLTTPCCADisplay( const AliHLTTPCCADisplay& ) 
-  : fXY(0), fZY(0), fAsk(1), fSectorView(1), fSector(0), 
+  : fYX(0), fZX(0), fAsk(1), fSectorView(1), fSector(0), 
     fCos(1), fSin(0), fZMin(-250), fZMax(250),
     fRInnerMin(83.65), fRInnerMax(133.3), fROuterMin(133.5), fROuterMax(247.7),
     fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex()
@@ -61,8 +61,8 @@ AliHLTTPCCADisplay& AliHLTTPCCADisplay::operator=( const AliHLTTPCCADisplay& )
 AliHLTTPCCADisplay::~AliHLTTPCCADisplay()
 {
   // destructor
-  delete fXY
-  delete fZY;
+  delete fYX
+  delete fZX;
 }
 
 void AliHLTTPCCADisplay::Init()
@@ -71,8 +71,8 @@ void AliHLTTPCCADisplay::Init()
   gStyle->SetCanvasBorderMode(0);
   gStyle->SetCanvasBorderSize(1);
   gStyle->SetCanvasColor(0);
-  fXY = new TCanvas ("XY", "XY window", -1, 0, 600, 600);
-  fZY = new TCanvas ("ZY", "ZY window", -610, 0, 590, 600);  
+  fYX = new TCanvas ("YX", "YX window", -1, 0, 600, 600);
+  fZX = new TCanvas ("ZX", "ZX window", -610, 0, 590, 600);  
   fMarker = TMarker(0.0, 0.0, 6);
 }
 
@@ -80,15 +80,15 @@ void AliHLTTPCCADisplay::Update()
 {
   // update windows
   if( !fAsk ) return;
-  fXY->Update();
-  fZY->Update();
+  fYX->Update();
+  fZX->Update();
 }
 
 void AliHLTTPCCADisplay::Clear()
 {
   // clear windows
-  fXY->Clear();
-  fZY->Clear();
+  fYX->Clear();
+  fZX->Clear();
 }
 
 void AliHLTTPCCADisplay::Ask()
@@ -97,9 +97,9 @@ void AliHLTTPCCADisplay::Ask()
   char symbol;
   if (fAsk){
     Update();
-    cout<<"ask> "<<endl;
+    std::cout<<"ask> "<<std::endl;
     do{
-      cin.get(symbol);
+      std::cin.get(symbol);
       if (symbol == 'r')
        fAsk = false;
     } while (symbol != '\n');
@@ -138,10 +138,10 @@ void AliHLTTPCCADisplay::SetCurrentSector( AliHLTTPCCATracker *sec )
     Double_t cx = 0;
     Double_t cy = r0;
 
-    fXY->Range(cx-dr, cy-dr, cx+dr, cy+dr);
+    fYX->Range(cx-dr, cy-dr, cx+dr, cy+dr);
     Double_t cz = .5*(sec->Param().ZMax()+sec->Param().ZMin());
     Double_t dz = .5*(sec->Param().ZMax()-sec->Param().ZMin())*1.2;
-    fZY->Range(cz-dz, cy-dr, cz+dz, cy+dr);
+    fZX->Range(cz-dz, cy-dr, cz+dz, cy+dr);
   }
 }
 
@@ -149,13 +149,13 @@ Int_t AliHLTTPCCADisplay::GetColor( Double_t z ) const
 {
   // Get color with respect to Z coordinate
   const Color_t kMyColor[11] = { kGreen, kBlue, kYellow, kMagenta, kCyan, 
-                               kOrange, kSpring, kTeal, kAzure, kViolet, kPink };
+                                kOrange, kSpring, kTeal, kAzure, kViolet, kPink };
 
   Double_t zz = (z-fZMin)/(fZMax-fZMin);    
   Int_t iz = (int) (zz*11);
   if( iz<0 ) iz = 0;
   if( iz>10 ) iz = 10;
-  return kMyColor[iz]-4;
+  return kMyColor[iz];
 }
 
 void AliHLTTPCCADisplay::Global2View( Double_t x, Double_t y, Double_t *xv, Double_t *yv ) const
@@ -178,12 +178,12 @@ void AliHLTTPCCADisplay::Sec2View( Double_t x, Double_t y, Double_t *xv, Double_
 void AliHLTTPCCADisplay::DrawTPC()
 {
   // schematically draw TPC detector
-  fXY->Range(-fROuterMax, -fROuterMax, fROuterMax, fROuterMax);
-  fXY->Clear();
+  fYX->Range(-fROuterMax, -fROuterMax, fROuterMax, fROuterMax);
+  fYX->Clear();
   {
     fArc.SetLineColor(kBlack);
     fArc.SetFillStyle(0);
-    fXY->cd();    
+    fYX->cd();    
     for( Int_t iSec=0; iSec<18; iSec++){
       fCrown.SetLineColor(kBlack);
       fCrown.SetFillStyle(0);
@@ -191,15 +191,15 @@ void AliHLTTPCCADisplay::DrawTPC()
       fCrown.DrawCrown(0,0,fROuterMin, fROuterMax, 360./18.*iSec, 360./18.*(iSec+1) );
     }
   }
-  fZY->cd();
-  fZY->Range( fTPCZMin, -fROuterMax, fTPCZMax, fROuterMax );
-  fZY->Clear();
+  fZX->cd();
+  fZX->Range( fTPCZMin, -fROuterMax, fTPCZMax, fROuterMax );
+  fZX->Clear();
 }
 
 void AliHLTTPCCADisplay::DrawSector( AliHLTTPCCATracker *sec )
 {     
   // draw current the TPC sector
-  fXY->cd();
+  fYX->cd();
   Double_t r0 = .5*(sec->Param().RMax()+sec->Param().RMin());
   Double_t dr = .5*(sec->Param().RMax()-sec->Param().RMin());
   Double_t cx = r0*sec->Param().CosAlpha();
@@ -221,7 +221,7 @@ void AliHLTTPCCADisplay::DrawSector( AliHLTTPCCATracker *sec )
 
   fLine.SetLineColor(kBlack);
  
-  fZY->cd();
+  fZX->cd();
 
   Double_t cz = .5*(sec->Param().ZMax()+sec->Param().ZMin());
   Double_t dz = .5*(sec->Param().ZMax()-sec->Param().ZMin())*1.2;
@@ -238,23 +238,23 @@ void AliHLTTPCCADisplay::DrawHit( Int_t iRow, Int_t iHit, Int_t color )
   AliHLTTPCCAHit *h = &(row.Hits()[iHit]);
   if( color<0 ) color = GetColor( h->Z() );
 
-  Double_t dgy = 3.*TMath::Abs(h->ErrY()*fSector->Param().CosAlpha() - fSector->Param().ErrX()*fSector->Param().SinAlpha() );
-  Double_t dx = fSector->Param().ErrX()*TMath::Sqrt(12.)/2.;
-  Double_t dy = h->ErrY()*3.;
-  Double_t dz = h->ErrZ()*3.;
+  //Double_t dgy = 3.*TMath::Abs(h->ErrY()*fSector->Param().CosAlpha() - fSector->Param().ErrX()*fSector->Param().SinAlpha() );
+  //Double_t dx = fSector->Param().ErrX()*TMath::Sqrt(12.)/2.;
+  //Double_t dy = h->ErrY()*3.;
+  //Double_t dz = h->ErrZ()*3.;
   fMarker.SetMarkerColor(color);
   fArc.SetLineColor(color);
   fArc.SetFillStyle(0);
   Double_t vx, vy;
   Sec2View( row.X(), h->Y(), &vx, &vy );
   
-  fXY->cd();
-  if( fSectorView ) fArc.DrawEllipse( vx, vy, dx, dy, 0,360, 90);
-  else  fArc.DrawEllipse( vx, vy, dx, dy, 0,360, fSector->Param().Alpha()*180./3.1415);
+  fYX->cd();
+  //if( fSectorView ) fArc.DrawEllipse( vx, vy, dx, dy, 0,360, 90);
+  //else  fArc.DrawEllipse( vx, vy, dx, dy, 0,360, fSector->Param().Alpha()*180./3.1415);
   fMarker.DrawMarker(vx, vy);
-  fZY->cd();
-  if( fSectorView ) fArc.DrawEllipse( h->Z(), vy, dz, dx, 0,360, 90 );
-  else fArc.DrawEllipse( h->Z(), vy, dz, dgy, 0,360, fSector->Param().Alpha()*180./3.1415);
+  fZX->cd();
+  //if( fSectorView ) fArc.DrawEllipse( h->Z(), vy, dz, dx, 0,360, 90 );
+  //else fArc.DrawEllipse( h->Z(), vy, dz, dgy, 0,360, fSector->Param().Alpha()*180./3.1415);
   fMarker.DrawMarker(h->Z(), vy); 
 }
 
@@ -268,9 +268,9 @@ void AliHLTTPCCADisplay::DrawCell( Int_t iRow, AliHLTTPCCACell &cell, Int_t widt
   if( color<0 ) color = GetColor(cell.Z());
   fLine.SetLineColor(color);
   fLine.SetLineWidth(width);
-  fXY->cd();
+  fYX->cd();
   fLine.DrawLine(vx-vdx,vy-vdy, vx+vdx, vy+vdy );
-  fZY->cd();
+  fZX->cd();
   fLine.DrawLine(cell.Z()-3*cell.ErrZ(),vy-vdy, cell.Z()+3*cell.ErrZ(), vy+vdy ); 
   fLine.SetLineWidth(1);
 }
@@ -324,39 +324,35 @@ void AliHLTTPCCADisplay::ConnectCells( Int_t iRow1, AliHLTTPCCACell &cell1,
   //fPLine.SetFillColor(color);
   fPLine.SetFillStyle(-1);
  
-  fXY->cd();
+  fYX->cd();
   fPLine.DrawPolyLine(5, lx, ly );
-  fZY->cd();
+  fZX->cd();
   fPLine.DrawPolyLine(5, lz, ly );   
   DrawCell( iRow1, cell1, 1, color );
   DrawCell( iRow2, cell2, 1, color );
 }
 
 
-Bool_t CompareCellDS( const pair<int,double> &a, const pair<int,double> &b )
-{
-  // function used to sort cells track along trajectory, pair<cell index, track length>
-  return (a.second<b.second);
-}
-
 void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, Int_t color )
 {
   // draw track
-  if( track.NCells()<2 ) return;
 
+  if( track.NCells()<2 ) return;
+  int width = 3;
   Double_t b = -5;    
 
-  std::vector<pair<int,double> > vCells;
+  AliHLTTPCCADisplayTmpCell *vCells = new AliHLTTPCCADisplayTmpCell[track.NCells()];
+
   AliHLTTPCCATrackPar t = track.Param();
   for( Int_t iCell=0; iCell<track.NCells(); iCell++ ){
     AliHLTTPCCACell &c = fSector->GetTrackCell(track,iCell);
     AliHLTTPCCARow &row = fSector->GetTrackCellRow(track,iCell);
     Double_t xyz[3] = {row.X(), c.Y(), c.Z()};
-    if( iCell==0 ) t.TransportBz(-5, xyz);
-    pair<int,double> tmp(iCell, t.GetDsToPointBz(-5.,xyz));
-    vCells.push_back(tmp);
+    if( iCell==0 ) t.TransportBz(-5, xyz);    
+    vCells[iCell].Index() = iCell;
+    vCells[iCell].S() = t.GetDsToPointBz(-5.,xyz);
   }
-  sort(vCells.begin(), vCells.end(), CompareCellDS );
+  sort(vCells, vCells + track.NCells(), AliHLTTPCCADisplayTmpCell::CompareCellDS );
   t.Normalize();
   const Double_t kCLight = 0.000299792458;
   Double_t bc = b*kCLight;
@@ -366,17 +362,29 @@ void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, Int_t color )
 
   //for( Int_t iCell=0; iCell<track.fNCells-1; iCell++ )
   {    
-    AliHLTTPCCACell &c1 = fSector->GetTrackCell(track,vCells[0].first);
-    AliHLTTPCCACell &c2 = fSector->GetTrackCell(track,vCells[track.NCells()-1].first);
-    AliHLTTPCCARow &row1 = fSector->GetTrackCellRow(track,vCells[0].first);
-    AliHLTTPCCARow &row2 = fSector->GetTrackCellRow(track,vCells[track.NCells()-1].first);
-    if( color<0 ) color = GetColor( (c1.Z()+c2.Z())/2. );
+    AliHLTTPCCACell &c1 = fSector->GetTrackCell(track,vCells[0].Index());
+    AliHLTTPCCACell &c2 = fSector->GetTrackCell(track,vCells[track.NCells()-1].Index());
+    AliHLTTPCCARow &row1 = fSector->GetTrackCellRow(track,vCells[0].Index());
+    AliHLTTPCCARow &row2 = fSector->GetTrackCellRow(track,vCells[track.NCells()-1].Index());
+    Double_t x1, y1, z1, x2, y2, z2;
+    {
+      Double_t xyz[3] = {row1.X(), c1.Y(), c1.Z()};
+      t.TransportBz(-5, xyz);
+      x1 = t.Par()[0]; y1 = t.Par()[1]; z1 = t.Par()[2];
+    }
+    {
+      Double_t xyz[3] = {row2.X(), c2.Y(), c2.Z()};
+      t.TransportBz(-5, xyz);
+      x2 = t.Par()[0]; y2 = t.Par()[1]; z2 = t.Par()[2];
+    }
+
+    if( color<0 ) color = GetColor( (z1+z2)/2. );
     Double_t vx1, vy1, vx2, vy2;
-    Sec2View(row1.X(), c1.Y(), &vx1, &vy1 );
-    Sec2View(row2.X(), c2.Y(), &vx2, &vy2 );
+    Sec2View(x1, y1, &vx1, &vy1 );
+    Sec2View(x2, y2, &vx2, &vy2 );
     
     fLine.SetLineColor( color );
-    fLine.SetLineWidth(3);
+    fLine.SetLineWidth( width );
     
     if( TMath::Abs(q)>.1 ){
       Double_t qq = pt/q;
@@ -396,23 +404,26 @@ void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, Int_t color )
       a1 = a2-da;
       fArc.SetFillStyle(0);
       fArc.SetLineColor(color);    
-      fArc.SetLineWidth(3);        
+      fArc.SetLineWidth(width);        
       
-      fXY->cd();
+      fYX->cd();
       
       fArc.DrawArc(vx,vy,r, a1,a2,"only");
     } else {
-      fXY->cd();
+      fYX->cd();
       fLine.DrawLine(vx1,vy1, vx2, vy2 );
     }
+    
   }
 
   for( Int_t iCell=0; iCell<track.NCells()-1; iCell++ ){
     
-    AliHLTTPCCACell &c1 = fSector->GetTrackCell(track,vCells[iCell].first);
-    AliHLTTPCCACell &c2 = fSector->GetTrackCell(track,vCells[iCell+1].first);
-    AliHLTTPCCARow &row1 = fSector->GetTrackCellRow(track,vCells[iCell].first);
-    AliHLTTPCCARow &row2 = fSector->GetTrackCellRow(track,vCells[iCell+1].first);
+    AliHLTTPCCACell &c1 = fSector->GetTrackCell(track,vCells[iCell].Index());
+    AliHLTTPCCACell &c2 = fSector->GetTrackCell(track,vCells[iCell+1].Index());
+    AliHLTTPCCARow &row1 = fSector->GetTrackCellRow(track,vCells[iCell].Index());
+    AliHLTTPCCARow &row2 = fSector->GetTrackCellRow(track,vCells[iCell+1].Index());
+    ConnectCells( fSector->GetTrackCellIRow(track,vCells[iCell].Index()),c1,
+                 fSector->GetTrackCellIRow(track,vCells[iCell+1].Index()),c2, color );
     Double_t x1, y1, z1, x2, y2, z2;
     {
       Double_t xyz[3] = {row1.X(), c1.Y(), c1.Z()};
@@ -430,11 +441,12 @@ void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, Int_t color )
     Sec2View(x2, y2, &vx2, &vy2 );
     
     fLine.SetLineColor(color);
-    fLine.SetLineWidth(1);
+    fLine.SetLineWidth(width);    
     
-    fZY->cd();
+    fZX->cd();
     fLine.DrawLine(z1,vy1, z2, vy2 ); 
   }
   fLine.SetLineWidth(1);     
+  delete[] vCells;
 }
 
index 554fd9ce4d66c531c021b4f7d5b87ea7541b0e8a..eb23307dcf900625c915203c830f6e8527e7ed9d 100644 (file)
@@ -1,9 +1,14 @@
 //-*- Mode: C++ -*-
 // @(#) $Id$
 
-//* This file is property of and copyright by the ALICE HLT Project        * 
-//* ALICE Experiment at CERN, All rights reserved.                         *
-//* See cxx source for full Copyright notice                               *
+//* This file is property of and copyright by the ALICE HLT Project         * 
+//* ALICE Experiment at CERN, All rights reserved.                          *
+//* See cxx source for full Copyright notice                                *
+
+//*                                                                         *
+//*  AliHLTTPCCADisplay class is a debug utility.                           *
+//*  It is not used in the normal data processing.                          *
+//*                                                                         *
 
 #ifndef ALIHLTTPCCADISPLAY_H
 #define ALIHLTTPCCADISPLAY_H
@@ -12,7 +17,7 @@ class AliHLTTPCCATracker;
 class AliHLTTPCCACell;
 class AliHLTTPCCATrack;
 
-#include "TCanvas.h"
+class TCanvas;
 #include "TArc.h"
 #include "TLine.h"
 #include "TPolyLine.h"
@@ -62,7 +67,7 @@ class AliHLTTPCCADisplay
 
  protected:
 
-  TCanvas *fXY, *fZY;               // two views
+  TCanvas *fYX, *fZX;               // two views
   Bool_t fAsk;                      // flag to ask for the pressing key
   Bool_t fSectorView;               // switch between sector/TPC zoomv
   AliHLTTPCCATracker *fSector;      // current CA tracker, includes sector geometry
@@ -77,6 +82,22 @@ class AliHLTTPCCADisplay
   TCrown fCrown;   //!
   TLatex fLatex;   //!
 
+  class AliHLTTPCCADisplayTmpCell{  
+  public:
+    Int_t &Index(){ return fIndex; }
+    Double_t &S(){ return fS; }
+
+    static Bool_t CompareCellDS( const AliHLTTPCCADisplayTmpCell &a, 
+                                const AliHLTTPCCADisplayTmpCell  &b )
+    {    
+      return (a.fS < b.fS);
+    }
+  protected:
+    Int_t fIndex; // cell index
+    Double_t fS;  // cell position on the track
+  };
+
+
   ClassDef(AliHLTTPCCADisplay,1);
 
 };
index 3324c897bcbca3133cb56b9d5779e30cc949519e..6e7c90e6bc96abb0bae324ba7ebcb1e8958b9124 100644 (file)
 #include "AliHLTTPCCAHit.h"
 
 
-ClassImp(AliHLTTPCCAHit);
+ClassImp(AliHLTTPCCAHit)
 
-void AliHLTTPCCAHit::Set( Int_t ID, Double_t Y, Double_t Z, 
-                         Double_t ErrY, Double_t ErrZ  )
+void AliHLTTPCCAHit::Dummy()
 {
-  // set parameters
-  fID = ID;
-  fY = Y;
-  fZ = Z;
-  fErrY = ErrY;
-  fErrZ = ErrZ;
+  // do nothing
 }
index 0101bb4e6a60ce686aeb8fd18e92ce3811c67ad9..2617b9bb8092a5b1169baa8be287a62811605a6b 100644 (file)
@@ -8,16 +8,20 @@
 #ifndef ALIHLTTPCCAHIT_H
 #define ALIHLTTPCCAHIT_H
 
-
 #include "Rtypes.h"
 
 /**
  * @class AliHLTTPCCAHit
+ *
+ * The AliHLTTPCCAHit class is the internal representation
+ * of the TPC clusters for the AliHLTTPCCATracker algorithm.
+ *
  */
 class AliHLTTPCCAHit
 {
  public:
   AliHLTTPCCAHit(): fY(0),fZ(0),fErrY(0),fErrZ(0),fID(0){;}
+  virtual ~AliHLTTPCCAHit(){}
 
   Float_t &Y(){ return fY; }
   Float_t &Z(){ return fZ; }
@@ -29,16 +33,31 @@ class AliHLTTPCCAHit
   void Set( Int_t ID, Double_t Y, Double_t Z, 
            Double_t ErrY, Double_t ErrZ  );
 
-
  protected:
+
   Float_t fY, fZ;       // Y and Z position of the TPC cluster
   Float_t fErrY, fErrZ; // position errors
-  Int_t fID;            // external ID of this hit, 
+  Int_t fID;            // external unique ID of this hit, 
                         // used as cluster index in track->hit reference array
-  
+ private:
+
+  void Dummy(); // to make rulechecker happy by having something in .cxx file
 
   ClassDef(AliHLTTPCCAHit,1);
 };
 
 
+
+inline void AliHLTTPCCAHit::Set( Int_t ID, Double_t Y, Double_t Z, 
+                                Double_t ErrY, Double_t ErrZ  )
+{
+  //* set parameters
+  fID = ID;
+  fY = Y;
+  fZ = Z;
+  fErrY = ErrY;
+  fErrZ = ErrZ;
+}
+
+
 #endif
index 067aa45c1f9d51c3a54d08dc05063b8c7754c4c5..2c2168c2c7b5e566e8aaa1bf21bc43cd39b36000 100644 (file)
@@ -19,4 +19,8 @@
 #include "AliHLTTPCCAOutTrack.h"
 
 
-ClassImp(AliHLTTPCCAOutTrack);
+ClassImp(AliHLTTPCCAOutTrack)
+
+void AliHLTTPCCAOutTrack::Dummy()
+{
+}
index af92a93b0fae87a6e0015165604f61454f733f63..924c90af3a86167178fa63f5e53aa2a197b6bb45 100644 (file)
 
 /**
  * @class AliHLTTPCCAOutTrack
+ * AliHLTTPCCAOutTrack class is used to store the final
+ * reconstructed tracks which will be then readed
+ * by the AliHLTTPCCATrackerComponent
+ *
+ * The class contains no temporary variables, etc.
+ *
  */
 class AliHLTTPCCAOutTrack
 {
  public:
 
   AliHLTTPCCAOutTrack():fFirstHitRef(0),fNHits(0),fParam(){}
-  
+  virtual ~AliHLTTPCCAOutTrack(){}
+
   Int_t &NHits()               { return fNHits; }
   Int_t &FirstHitRef()         { return fFirstHitRef; }
   AliHLTTPCCATrackPar &Param() { return fParam; }
@@ -30,6 +37,10 @@ class AliHLTTPCCAOutTrack
   Int_t fNHits;              // number of track hits
   AliHLTTPCCATrackPar fParam;// fitted track parameters
 
+ private:
+
+  void Dummy(); // to make rulechecker happy by having something in .cxx file
+
   ClassDef(AliHLTTPCCAOutTrack,1);
 };
 
index b54c3c555833d7fa92acbc74b5b1550bdd7f52ab..03a085f7dee38499c4fbcd7b2be06cd42d57378c 100644 (file)
 #include "TMath.h"
 
 
-ClassImp(AliHLTTPCCAParam);
+ClassImp(AliHLTTPCCAParam)
 
 AliHLTTPCCAParam::AliHLTTPCCAParam()
-  : fISec(0),fNRows(63),fRowXFirst(85.225), fRowXStep(0.75),fAlpha(0.174533), fDAlpha(0.349066),
+  : fISec(0),fNRows(63),fAlpha(0.174533), fDAlpha(0.349066),
     fCosAlpha(0), fSinAlpha(0), fAngleMin(0), fAngleMax(0), fRMin(83.65), fRMax(133.3),
     fZMin(0.0529937), fZMax(249.778), fErrZ(0.228808), fErrX(0), fErrY(0),fPadPitch(0.4),fBz(-5.), 
-    fCellConnectionFactor(5), fTrackChiCut(6), fTrackChi2Cut(0), fMaxTrackMatchDRow(3),
+    fCellConnectionFactor(3), fTrackConnectionFactor(5), fTrackChiCut(6), fTrackChi2Cut(0), fMaxTrackMatchDRow(4),
     fYErrorCorrection(0.33), fZErrorCorrection(0.45)
 {
   Update();
 }
 
 void AliHLTTPCCAParam::Initialize( Int_t iSec, 
-                                  Int_t NRows, 
-                                  Double_t RowXFirst, Double_t RowXStep,
+                                  Int_t NRows, Double_t RowX[],
                                   Double_t Alpha, Double_t DAlpha,
                                   Double_t RMin, Double_t RMax,
                                   Double_t ZMin, Double_t ZMax,
@@ -55,8 +54,10 @@ void AliHLTTPCCAParam::Initialize( Int_t iSec,
   fErrZ = ZSigma;
   fBz = Bz;
   fNRows = NRows;
-  fRowXFirst = RowXFirst;
-  fRowXStep = RowXStep;
+  for( Int_t irow=0; irow<NRows; irow++ ){
+    fRowX[irow] = RowX[irow];
+  }
+
   Update();
 }
 
@@ -72,7 +73,7 @@ void AliHLTTPCCAParam::Update()
 }
 
 void AliHLTTPCCAParam::Sec2Global(   Double_t x, Double_t y,  Double_t z, 
-                                        Double_t *X, Double_t *Y,  Double_t *Z ) const
+                                    Double_t *X, Double_t *Y,  Double_t *Z ) const
 {  
   // conversion of coorinates sector->global
   *X = x*fCosAlpha - y*fSinAlpha;
index bdb6a10ae9a4ff24207808515f245c4d0172885d..0cbbc2f2585946b031518e8daad259a7b2aca977 100644 (file)
@@ -14,6 +14,9 @@
  * @class ALIHLTTPCCAParam
  * parameters of the CATracker, including geometry information
  * and some reconstructon constants.
+ *
+ * The class is under construction.
+ *
  */
 class AliHLTTPCCAParam
 {
@@ -22,7 +25,7 @@ class AliHLTTPCCAParam
   AliHLTTPCCAParam();
   virtual ~AliHLTTPCCAParam(){;}
 
-  void Initialize( Int_t iSec, Int_t NRows, Double_t RowXFirst, Double_t RowXStep,
+  void Initialize( Int_t iSec, Int_t NRows, Double_t RowX[],
                   Double_t Alpha, Double_t DAlpha,
                   Double_t RMin, Double_t RMax, Double_t ZMin, Double_t ZMax,
                   Double_t PadPitch, Double_t ZSigma, Double_t Bz );
@@ -34,8 +37,8 @@ class AliHLTTPCCAParam
                   Double_t *X, Double_t *Y,  Double_t *Z ) const;
   Int_t &ISec(){ return fISec;}
   Int_t &NRows(){ return fNRows;}
-  Double_t &RowXFirst(){ return fRowXFirst; }
-  Double_t &RowXStep(){ return fRowXStep; }
+
+  Double_t &RowX( Int_t iRow ){ return fRowX[iRow]; }
   
   Double_t &Alpha(){ return fAlpha;}
   Double_t &DAlpha(){ return fDAlpha;}
@@ -53,8 +56,9 @@ class AliHLTTPCCAParam
   Double_t &Bz(){ return fBz;}
 
   Double_t &CellConnectionFactor(){ return fCellConnectionFactor; }
+  Double_t &TrackConnectionFactor(){ return fTrackConnectionFactor; }
   Double_t &TrackChiCut() { return fTrackChiCut; }
-  Double_t  TrackChi2Cut(){ return fTrackChi2Cut; }
+  Double_t &TrackChi2Cut(){ return fTrackChi2Cut; }
   Int_t    &MaxTrackMatchDRow(){ return fMaxTrackMatchDRow; }
   Double_t &YErrorCorrection(){ return fYErrorCorrection; }
   Double_t &ZErrorCorrection(){ return fZErrorCorrection; }
@@ -63,7 +67,6 @@ class AliHLTTPCCAParam
 
   Int_t fISec; // sector number
   Int_t fNRows; // number of rows
-  Double_t fRowXFirst, fRowXStep; // X coordinate of the first row and step between rows
   Double_t fAlpha, fDAlpha; // sector angle and angular size
   Double_t fCosAlpha, fSinAlpha;// sign and cosine of the sector angle
   Double_t fAngleMin, fAngleMax; // minimal and maximal angle
@@ -74,12 +77,15 @@ class AliHLTTPCCAParam
   Double_t fBz;       // magnetic field value (only constant field can be used)
 
   Double_t fCellConnectionFactor; // allowed distance in Chi^2/3.5 for neighbouring cells
+  Double_t fTrackConnectionFactor; // allowed distance in Chi^2/3.5 for neighbouring tracks
   Double_t fTrackChiCut; // cut for track Sqrt(Chi2/NDF);
   Double_t fTrackChi2Cut;// cut for track Chi^2/NDF
   Int_t    fMaxTrackMatchDRow;// maximal jump in TPC row for connecting track segments
   Double_t fYErrorCorrection;// correction factor for Y error of input clusters
   Double_t fZErrorCorrection;// correction factor for Z error of input clusters
 
+  Double_t fRowX[200];// X-coordinate of rows
+
   ClassDef(AliHLTTPCCAParam,1);
 };
 
index a82370b54bac2cc2a81230edd3abd09127a9e38e..e53de231e15bb514e02ef3105eb934226ecf8107 100644 (file)
@@ -19,7 +19,7 @@
 #include "AliHLTTPCCARow.h"
 
 
-ClassImp(AliHLTTPCCARow);
+ClassImp(AliHLTTPCCARow)
 
 AliHLTTPCCARow::AliHLTTPCCARow() :fHits(0),fCells(0),fCellHitPointers(0),fNHits(0),fNCells(0),fX(0)
 {
@@ -48,7 +48,6 @@ void AliHLTTPCCARow::Clear()
   // clear memory
   delete[] fHits;
   delete[] fCells;
-  delete[] fCellHitPointers;
   fHits = 0;
   fCells = 0;
   fCellHitPointers = 0;    
index 60d1ff7ba38998af1b2274b322ea7f1ca8909272..15069f11679b4c94af6a067057aa120853df4b91 100644 (file)
 
 /**
  * @class ALIHLTTPCCARow
- * hit and cells container for one TPC row
+ *
+ * The ALIHLTTPCCARow class is a hit and cells container for one TPC row.
+ * It is the internal class of the AliHLTTPCCATracker algorithm.
+ *
  */
 class AliHLTTPCCARow
 {
index 89a8de7f0786ce22e0407bb5f1f7983f361cd09a..988c83c6705b31ed95e54d73b5c77a1ede13aefe 100644 (file)
@@ -19,4 +19,8 @@
 #include "AliHLTTPCCATrack.h"
 
 
-ClassImp(AliHLTTPCCATrack);
+ClassImp(AliHLTTPCCATrack)
+
+void AliHLTTPCCATrack::Dummy()
+{
+}
index c660262e249b9d84c019a0cecdc8665309456abb..86a2b05d86ad468d3794e36f042b9dd300d38622 100644 (file)
@@ -8,17 +8,20 @@
 #ifndef ALIHLTTPCCATRACK_H
 #define ALIHLTTPCCATRACK_H
 
-
-#include "Rtypes.h"
 #include "AliHLTTPCCATrackPar.h"
 
 /**
  * @class ALIHLTTPCCAtrack
+ *
+ * The class describes the [partially] reconstructed TPC track [candidate].
+ * The class is dedicated for internal use by the AliHLTTPCCATracker algorithm.
+ *
  */
 class AliHLTTPCCATrack
 {
  public:
   AliHLTTPCCATrack():fUsed(0),fNCells(0),fIFirstCell(0),fParam(){}
+  virtual ~AliHLTTPCCATrack(){}
 
   static bool CompareSize(const AliHLTTPCCATrack &t1, const AliHLTTPCCATrack &t2 ){
     return t2.fNCells<t1.fNCells;
@@ -37,6 +40,8 @@ class AliHLTTPCCATrack
   
   AliHLTTPCCATrackPar fParam; // fitted track parameters
 
+  void Dummy(); // to make rulechecker happy by having something in .cxx file
+
   ClassDef(AliHLTTPCCATrack,1);
 };
 
index 216d42d1b7cd374c1ebbb6fdd347e1b1bb9ac33a..c6a9c3657b3c6a64342b2aa75c628030071a3897 100644 (file)
@@ -19,7 +19,7 @@
 #include "AliHLTTPCCATrackPar.h"
 #include "TMath.h"
 
-ClassImp(AliHLTTPCCATrackPar);
+ClassImp(AliHLTTPCCATrackPar)
 
 void AliHLTTPCCATrackPar::Init()
 {
@@ -27,8 +27,8 @@ void AliHLTTPCCATrackPar::Init()
 
   for( Int_t i=0; i<7; i++ ) fP[i] = 0;
   for( Int_t i=0; i<28; i++ ) fC[i] = 0;
-  fC[0] = fC[2] = fC[5] = 10000;
-  fC[9] = fC[14] = fC[20] = 10000.;
+  fC[0] = fC[2] = fC[5] = 100.;
+  fC[9] = fC[14] = fC[20] = 100.;
   fC[27] = 10.;
   fChi2 = 0;
   fNDF = -5;
@@ -37,7 +37,9 @@ void AliHLTTPCCATrackPar::Init()
 
 void AliHLTTPCCATrackPar::Normalize( Double_t Direction[3] )
 {
-  //* Normalize the track
+  //* Normalize the track directions
+  //* (Px,Py,Pz,qp)-> (Px,Py,Pz,qp)/sqrt(Px²+Py²+Pz²)
+  //* 
 
   Double_t p2 = fP[3]*fP[3] + fP[4]*fP[4] + fP[5]*fP[5];
   if( p2<1.e-4 ) return;
@@ -86,7 +88,9 @@ void AliHLTTPCCATrackPar::Normalize( Double_t Direction[3] )
 
 Double_t AliHLTTPCCATrackPar::GetDsToPointBz( Double_t Bz, const Double_t xyz[3], const Double_t *T0 ) const
 {
-  //* Get dS to a certain space point for Bz field
+  //* Get dS distance to the given space point for Bz field
+  //*
+
   const Double_t kCLight = 0.000299792458;
   Double_t bq = Bz*T0[6]*kCLight;
   Double_t pt2 = T0[3]*T0[3] + T0[4]*T0[4];
@@ -142,36 +146,75 @@ void AliHLTTPCCATrackPar::TransportBz( Double_t Bz, Double_t S, Double_t *T0 )
   T0[5] = T0[5];
   T0[6] = T0[6];
 
-  Double_t mJ[7][7] = { {1,0,0,   sB, cB,  0,   dsB*px + dcB*py },
-                        {0,1,0,  -cB, sB,  0, - dcB*px + dsB*py },
-                        {0,0,1,    0,  0,  S,   0               },
-                        {0,0,0,    c,  s,  0,   (-s*px + c*py)*bs },
-                        {0,0,0,   -s,  c,  0,   (-c*px - s*py)*bs },
-                        {0,0,0,    0,  0,  1,   0                 },
-                        {0,0,0,    0,  0,  0,   1                 }  };
-
-  for( Int_t i=0; i<7; i++){
-    fP[i] = T0[i];
-    for( Int_t j=0; j<7; j++) fP[i] += mJ[i][j]*d[j];
-  }
-
-  Double_t mA[7][7];
-  for( Int_t k=0,i=0; i<7; i++)
-    for( Int_t j=0; j<=i; j++, k++ ) mA[i][j] = mA[j][i] = fC[k]; 
-
-  Double_t mJC[7][7];
-  for( Int_t i=0; i<7; i++ )
-    for( Int_t j=0; j<7; j++ ){
-      mJC[i][j]=0;
-      for( Int_t k=0; k<7; k++ ) mJC[i][j]+=mJ[i][k]*mA[k][j];
-    }
+  //* The Jacobian matrix is:
+  //* J[7][7] = { {1,0,0,   sB, cB,  0,   dsB*px + dcB*py },
+  //*             {0,1,0,  -cB, sB,  0, - dcB*px + dsB*py },
+  //*             {0,0,1,    0,  0,  S,   0               },
+  //*             {0,0,0,    c,  s,  0,   (-s*px + c*py)*bs },
+  //*             {0,0,0,   -s,  c,  0,   (-c*px - s*py)*bs },
+  //*             {0,0,0,    0,  0,  1,   0                 },
+  //*             {0,0,0,    0,  0,  0,   1                 }  };
+  //*
+  //* below the fP=T0+J*(fP-T0) and fC=J*fC*Jt operations are performed
+  //*
+
+  Double_t h0 = dsB*px + dcB*py;
+  Double_t h1 = - dcB*px + dsB*py ;
+  Double_t h3 = (-s*px + c*py)*bs ;
+  Double_t h4 = (-c*px - s*py)*bs ;
+
+
+  fP[0] = T0[0] + d[0] + sB*d[3] + cB*d[4] + h0*d[6];
+  fP[1] = T0[1] + d[1] - cB*d[3] + sB*d[4] + h1*d[6];
+  fP[2] = T0[2] + d[2] + S*d[5];
+  fP[3] = T0[3] + c*d[3] + s*d[4] + h3*d[6];
+  fP[4] = T0[4] - s*d[3] + c*d[4] + h4*d[6];
+  fP[5] = T0[5] + d[5];
+  fP[6] = T0[6] + d[6];
   
-  for( Int_t k=0,i=0; i<7; i++)
-    for( Int_t j=0; j<=i; j++, k++ ){
-      fC[k] = 0;
-      for( Int_t l=0; l<7; l++ ) fC[k]+=mJC[i][l]*mJ[j][l];
-    }
+
+  Double_t 
+    c00 = fC[ 0],
+    c01 = fC[ 1], c02 = fC[ 2],
+    c03 = fC[ 3], c04 = fC[ 4], c05 = fC[ 5],
+    c06 = fC[ 6], c07 = fC[ 7], c08 = fC[ 8], c09 = fC[ 9], 
+    c10 = fC[10], c11 = fC[11], c12 = fC[12], c13 = fC[13], c14 = fC[14], 
+    c15 = fC[15], c16 = fC[16], c17 = fC[17], c18 = fC[18], c19 = fC[19], c20 = fC[20], 
+    c21 = fC[21], c22 = fC[22], c23 = fC[23], c24 = fC[24], c25 = fC[25], c26 = fC[26], c27 = fC[27];
+
+  fC[ 0] = c00 + 2*c10*cB + c14*cB*cB + 2*c21*h0 + 2*c25*cB*h0 + c27*h0*h0 + 2*c06*sB + 2*c13*cB*sB + 2*c24*h0*sB + c09*sB*sB;
+  fC[ 1] = c01 - c06*cB + c21*h1 + c10*sB + sB*(c07 - c09*cB + c24*h1 + c13*sB) 
+    + cB*(c11 - c13*cB + c25*h1 + c14*sB) + h0*(c22 - c24*cB + c27*h1 + c25*sB);
+  fC[ 2] = c02 - 2*c07*cB + c09*cB*cB + 2*c22*h1 - 2*c24*cB*h1 + c27*h1*h1 
+    + 2*c11*sB - 2*c13*cB*sB + 2*c25*h1*sB + c14*sB*sB;
+  fC[ 3] = c03 + c12*cB + c23*h0 + c15*S + c19*cB*S + c26*h0*S + c08*sB + c18*S*sB;
+  fC[ 4] = c04 + c16*S  - cB*(c08 + c18*S) + h1*(c23 + c26*S) + (c12 + c19*S)*sB;
+  fC[ 5] = c05 + S*(2*c17 + c20*S);
+  fC[ 6] = c21*h3 + c25*cB*h3 + c27*h0*h3 + c10*s + c14*cB*s + c25*h0*s + c24*h3*sB + c13*s*sB + c*(c06 + c13*cB + c24*h0 + c09*sB);
+  fC[ 7] =  c*c07 + c22*h3 + c11*s - cB*(c*c09 + c24*h3 + c13*s) + 
+    h1*(c*c24 + c27*h3 + c25*s) + (c*c13 + c25*h3 + c14*s)*sB;
+  fC[ 8] = c23*h3 + c12*s + c26*h3*S + c19*s*S + c*(c08 + c18*S);
+  fC[ 9] = c*c*c09 + c27*h3*h3 + 2*c*(c24*h3 + c13*s) + s*(2*c25*h3 + c14*s);
+  fC[10] = c21*h4 + c25*cB*h4 + c27*h0*h4 - c06*s - c13*cB*s - c24*h0*s 
+    + c24*h4*sB - c09*s*sB + c*(c10 + c14*cB + c25*h0 + c13*sB);
+  fC[11] =  c22*h4 - c24*cB*h4 + c27*h1*h4 - c07*s + c09*cB*s - c24*h1*s + 
+    c25*h4*sB - c13*s*sB + c*(c11 - c13*cB + c25*h1 + c14*sB);
+  fC[12] =  c23*h4 - c08*s + c26*h4*S - c18*s*S + c*(c12 + c19*S);
+  fC[13] =  c*c*c13 + c27*h3*h4 - s*(c24*h3 - c25*h4 + c13*s) + c*(c25*h3 + c24*h4 - c09*s + c14*s);
+  fC[14] = c*c*c14 + 2*c*c25*h4 + c27*h4*h4 - 2*c*c13*s - 2*c24*h4*s + c09*s*s;
+  fC[15] = c15 + c19*cB + c26*h0 + c18*sB;
+  fC[16] = c16 - c18*cB + c26*h1 + c19*sB;
+  fC[17] = c17 + c20*S;
+  fC[18] = c*c18 + c26*h3 + c19*s;
+  fC[19] = c*c19 + c26*h4 - c18*s;
+  fC[20] = c20;
+  fC[21] = c21 + c25*cB + c27*h0 + c24*sB;
+  fC[22] = c22 - c24*cB + c27*h1 + c25*sB;
+  fC[23] = c23 + c26*S;
+  fC[24] = c*c24 + c27*h3 + c25*s;
+  fC[25] = c*c25 + c27*h4 - c24*s;
+  fC[26] = c26;
+  fC[27] = c27;
 }
 
 void AliHLTTPCCATrackPar::TransportBz( Double_t Bz, Double_t dS ) 
@@ -208,9 +251,14 @@ void AliHLTTPCCATrackPar::GetConnectionMatrix( Double_t B, const Double_t p[3],
 }
 
 
-void AliHLTTPCCATrackPar::Filter( const Double_t m[3], const Double_t V[6], const Double_t V1[6] )
+void AliHLTTPCCATrackPar::Filter( const Double_t m[], const Double_t V[], const Double_t G[6] )
 {
-  //* !
+  //* Add the measurement m to the track using the Kalman Filter mathematics
+  //* m[3] is the measurement
+  //* V[6] is the low-triangular covariance matrix
+  //* G[6] is the track->measurement "connection matrix", additional to V[]
+  //*
+
   Double_t 
     c00 = fC[ 0],
     c10 = fC[ 1], c11 = fC[ 2],
@@ -220,13 +268,13 @@ void AliHLTTPCCATrackPar::Filter( const Double_t m[3], const Double_t V[6], cons
     c50 = fC[15], c51 = fC[16], c52 = fC[17],
     c60 = fC[21], c61 = fC[22], c62 = fC[23];
   
-  double
+  Double_t
     z0 = m[0]-fP[0],
     z1 = m[1]-fP[1],
     z2 = m[2]-fP[2];
   
-  Double_t mS[6] = { c00+V[0]+V1[0], c10+V[1]+V1[1], c11+V[2]+V1[2],
-                    c20+V[3]+V1[3], c21+V[4]+V1[4], c22+V[5]+V1[5] };
+  Double_t mS[6] = { c00+V[0]+G[0], c10+V[1]+G[1], c11+V[2]+G[2],
+                    c20+V[3]+G[3], c21+V[4]+G[4], c22+V[5]+G[5] };
   Double_t mSi[6];
   mSi[0] = mS[4]*mS[4] - mS[2]*mS[5];
   mSi[1] = mS[1]*mS[5] - mS[3]*mS[4];
@@ -322,7 +370,8 @@ void AliHLTTPCCATrackPar::Filter( const Double_t m[3], const Double_t V[6], cons
 
 void AliHLTTPCCATrackPar::Rotate( Double_t alpha )
 {
-  //* !
+  //* Rotate the track parameters on the alpha angle 
+
   Double_t cA = TMath::Cos( alpha );
   Double_t sA = TMath::Sin( alpha );
   Double_t x= fP[0], y= fP[1], px= fP[3], py= fP[4];
@@ -362,8 +411,14 @@ void AliHLTTPCCATrackPar::Rotate( Double_t alpha )
 
 
 void AliHLTTPCCATrackPar::ConvertTo5( Double_t alpha, Double_t T[], Double_t C[] )
-const {
-  //* !
+const 
+{
+  //* Convert the track parameterisation to {y,z,ty,tz,q/p,x}
+  //* The result is stored in T[], corresponding covariance matrix in C[]
+  //*
+  //* The method is used for debuging
+  //*
+
   AliHLTTPCCATrackPar t = *this;
   t.Rotate(alpha);
   Double_t 
index b2a2b31d4228024291dcd0ce7a9d050491f208ad..6968e578c3a9933bd0b18a87a5a17602047b7b47 100644 (file)
@@ -1,9 +1,22 @@
 //-*- Mode: C++ -*-
 // @(#) $Id$
+//*************************************************************************
+// This file is property of and copyright by the ALICE HLT Project        * 
+// ALICE Experiment at CERN, All rights reserved.                         *
+//                                                                        *
+// Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//                  Ivan Kisel <kisel@kip.uni-heidelberg.de>              *
+//                  for The ALICE HLT Project.                            *
+//                                                                        *
+// Permission to use, copy, modify and distribute this software and its   *
+// documentation strictly for non-commercial purposes is hereby granted   *
+// without fee, provided that the above copyright notice appears in all   *
+// copies and that both the copyright notice and this permission notice   *
+// appear in the supporting documentation. The authors make no claims     *
+// about the suitability of this software for any purpose. It is          *
+// provided "as is" without express or implied warranty.                  *
+//*************************************************************************
 
-/* This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- * See cxx source for full Copyright notice                               */
 
 #ifndef ALIHLTTPCCATRACKPAR_H
 #define ALIHLTTPCCATRACKPAR_H
 
 /**
  * @class AliHLTTPCCATrackPar
+ *
+ * AliHLTTPCCATrackPar class describes the track parametrisation
+ * which is used by the AliHLTTPCCATracker slice tracker.
+ * The class is under development.
+ *
  */
-class AliHLTTPCCATrackPar {
+class AliHLTTPCCATrackPar 
+{
  public:
 
-  AliHLTTPCCATrackPar(): fChi2(0), fNDF(0){;}
+  AliHLTTPCCATrackPar(): fChi2(0), fNDF(0){}
+  virtual ~AliHLTTPCCATrackPar(){}
 
   Double_t *Par(){ return fP; }
   Double_t *Cov(){ return fC; }
@@ -32,22 +52,26 @@ class AliHLTTPCCATrackPar {
   Double_t GetDsToPointBz( Double_t Bz, const Double_t xyz[3] ) const;
   Double_t GetDsToPointBz( Double_t Bz, const Double_t xyz[3], const Double_t *T0 ) const;
 
-  void TransportBz( Double_t Bz, const Double_t xyz[3] ){ 
+  void TransportBz( Double_t Bz, const Double_t xyz[3] )
+  { 
     TransportBz( Bz,GetDsToPointBz(Bz, xyz)) ; 
   }
 
-  void TransportBz( Double_t Bz, const Double_t xyz[3], Double_t *T0 ){ 
+  void TransportBz( Double_t Bz, const Double_t xyz[3], Double_t *T0 )
+  { 
     TransportBz( Bz,GetDsToPointBz(Bz, xyz, T0), T0) ; 
   }
 
-  void TransportBz( Double_t Bz, Double_t x, Double_t y, Double_t z ){ 
+  void TransportBz( Double_t Bz, Double_t x, Double_t y, Double_t z )
+  { 
     Double_t xyz[3] = {x,y,z};
     TransportBz(Bz, xyz);
   }
 
   void GetConnectionMatrix( Double_t Bz, const Double_t p[3], Double_t G[6], const Double_t *T0  ) const ;
 
-  void GetConnectionMatrix( Double_t Bz, const Double_t p[3], Double_t G[6] ) const {
+  void GetConnectionMatrix( Double_t Bz, const Double_t p[3], Double_t G[6] ) const 
+  {
     GetConnectionMatrix( Bz, p, G, fP );
   }
 
@@ -57,10 +81,10 @@ class AliHLTTPCCATrackPar {
 
  private:
 
-  Double_t fP[7];  // parameters:  X, Y, Z, ex, ey, ez, q/P
-  Double_t fC[28]; // Covariance matrix
-  Double_t fChi2;  // Chi^2
-  Int_t fNDF;      // NDF
+  Double_t fP[7];  // track parameters:  X, Y, Z, ex, ey, ez, q/P
+  Double_t fC[28]; // the covariance matrix in the low-triangular form
+  Double_t fChi2;  // the chi^2 value
+  Int_t fNDF;      // the Number of Degrees of Freedom
 
   ClassDef(AliHLTTPCCATrackPar, 0);
 
index 105ccf23fbd70ed159ed8fc86819c94f247507bd..2371319fcfbedd472bc22fe064aa817a09e6e0a7 100644 (file)
 #include "TMath.h"
 //#include "Riostream.h"
 #include <vector>
-#ifndef __SUNPRO_CC
 #include <algo.h>
-#endif
-
+#include "TStopwatch.h"
 //#define DRAW
 
 #ifdef DRAW
 #include "AliHLTTPCCADisplay.h"
 #include "TApplication.h"
-#include "TROOT.h"
-#include "TSystem.h"
 #endif //DRAW
 
-ClassImp(AliHLTTPCCATracker);
+ClassImp(AliHLTTPCCATracker)
 
 
 AliHLTTPCCATracker::AliHLTTPCCATracker()
-  :fParam(),fRows(0),fOutTrackHits(0),fNOutTrackHits(0),fOutTracks(0),fNOutTracks(0),fTrackCells(0),fNHitsTotal(0),fTracks(0),fNTracks(0)
+  :fParam(),fRows(0),fOutTrackHits(0),fNOutTrackHits(0),fOutTracks(0),fNOutTracks(0),fTrackCells(0),fNHitsTotal(0),fTracks(0),fNTracks(0),fCellHitPointers(0)
 {
   // constructor
   fRows = new AliHLTTPCCARow[fParam.NRows()];
@@ -50,7 +46,7 @@ AliHLTTPCCATracker::AliHLTTPCCATracker()
 }
 
 AliHLTTPCCATracker::AliHLTTPCCATracker( const AliHLTTPCCATracker& )
-  :fParam(),fRows(0),fOutTrackHits(0),fNOutTrackHits(0),fOutTracks(0),fNOutTracks(0),fTrackCells(0),fNHitsTotal(0),fTracks(0),fNTracks(0)
+  :fParam(),fRows(0),fOutTrackHits(0),fNOutTrackHits(0),fOutTracks(0),fNOutTracks(0),fTrackCells(0),fNHitsTotal(0),fTracks(0),fNTracks(0),fCellHitPointers(0)
 {
   // dummy
 }
@@ -58,6 +54,11 @@ AliHLTTPCCATracker::AliHLTTPCCATracker( const AliHLTTPCCATracker& )
 AliHLTTPCCATracker &AliHLTTPCCATracker::operator=( const AliHLTTPCCATracker& )
 {
   // dummy
+  fRows=0;
+  fOutTrackHits=0;
+  fOutTracks=0;
+  fNOutTracks=0;
+  fTrackCells=0;
   return *this;
 }
 
@@ -79,7 +80,7 @@ void AliHLTTPCCATracker::Initialize( AliHLTTPCCAParam &param )
   fParam.Update();
   fRows = new AliHLTTPCCARow[fParam.NRows()];
   for( Int_t irow=0; irow<fParam.NRows(); irow++ ){
-    fRows[irow].X() = fParam.RowXFirst() + irow*fParam.RowXStep();
+    fRows[irow].X() = fParam.RowX(irow);
   }
   StartEvent();
 }
@@ -91,6 +92,7 @@ void AliHLTTPCCATracker::StartEvent()
   delete[] fTrackCells;
   delete[] fOutTrackHits;
   delete[] fOutTracks;
+  delete[] fCellHitPointers;
   fTracks = 0;
   fTrackCells = 0;
   fOutTrackHits = 0;
@@ -122,29 +124,42 @@ void AliHLTTPCCATracker::ReadHitRow( Int_t iRow, AliHLTTPCCAHit *Row, Int_t NHit
 void AliHLTTPCCATracker::Reconstruct()
 {
   // reconstruction of event
+  fTimers[0] = 0;
+  fTimers[1] = 0;
+  fTimers[2] = 0;
+  fTimers[3] = 0;
+  //cout<<"Find Cells..."<<endl;
   FindCells();
-  FindTracks();
-}
+  //cout<<"Find Tracks..."<<endl;
+   FindTracks();
+   //cout<<"Find Tracks OK"<<endl;
+ }
 
 
 void AliHLTTPCCATracker::FindCells()
 {
   // cell finder - neighbouring hits are grouped to cells
 
+  TStopwatch timer;
+  Bool_t *vUsed = new Bool_t [fNHitsTotal];
+  fCellHitPointers = new Int_t [fNHitsTotal];
+  AliHLTTPCCACell *vCells = new AliHLTTPCCACell[fNHitsTotal]; 
+
+  Int_t lastCellHitPointer = 0;
   for( Int_t irow=0; irow<fParam.NRows(); irow++ ){
     AliHLTTPCCARow &row=fRows[irow];
     Int_t nHits = row.NHits();
     if( nHits<1 ) continue;
-    row.CellHitPointers() = new Int_t[ nHits ];
+    row.CellHitPointers() = fCellHitPointers + lastCellHitPointer;
     Int_t nPointers = 0;
-    std::vector<AliHLTTPCCACell> vCells; 
-    Bool_t vUsed[10000];
+    Int_t nCells = 0;
+
     for (Int_t ih = 0; ih<nHits; ih++) vUsed[ih] = 0;
-  
+    
     for (Int_t ih = 0; ih<nHits; ih++){    
       if( vUsed[ih] ) continue;
       // cell start
-      AliHLTTPCCACell cell;
+      AliHLTTPCCACell &cell = vCells[nCells++];
       cell.FirstHitRef() = nPointers;
       cell.NHits() = 1;
       cell.IDown() = -1;
@@ -161,9 +176,9 @@ void AliHLTTPCCATracker::FindCells()
          if( vUsed[j] ) continue;
          AliHLTTPCCAHit &h1  = row.Hits()[j];
          Double_t dy = TMath::Abs(h.Y() - h1.Y() );
-         if( dy>(h.ErrY()+h1.ErrY())*4. ) break;
+         if( dy>(h.ErrY()+h1.ErrY())*3.5*2 ) break;
          Double_t dz = TMath::Abs(h.Z() - h1.Z() );
-         if( dz>(h.ErrZ()+h1.ErrZ())*4. ) continue;
+         if( dz>(h.ErrZ()+h1.ErrZ())*3.5*2 ) continue;
          Double_t d2 = dz*dz+dy*dy;
          if( d2<d2min ){
            d2min = d2;
@@ -184,13 +199,17 @@ void AliHLTTPCCATracker::FindCells()
       cell.Z() = .5*(h.Z() + h1.Z());
       cell.ErrY() = .5*(TMath::Abs(h.Y() - h1.Y())/3 + h.ErrY() + h1.ErrY());
       cell.ErrZ() = .5*(TMath::Abs(h.Z() - h1.Z())/3 + h.ErrZ() + h1.ErrZ());
-      vCells.push_back(cell);
     }
     
-    row.Cells() = new AliHLTTPCCACell[vCells.size()];
-    row.NCells() = vCells.size();
-    for( Int_t i=0; i<vCells.size(); i++ ) row.Cells()[i]=vCells[i];  
+    row.Cells() = new AliHLTTPCCACell[nCells];
+    row.NCells() = nCells;
+    lastCellHitPointer += nPointers;
+    for( Int_t i=0; i<nCells; i++ ) row.Cells()[i]=vCells[i];  
   }
+  delete[] vUsed;
+  delete[] vCells;
+  timer.Stop();
+  fTimers[0] = timer.CpuTime();
 }
 
 
@@ -203,19 +222,22 @@ void AliHLTTPCCATracker::FindTracks()
 #ifdef DRAW
   if( !gApplication ){
     TApplication *myapp = new TApplication("myapp",0,0);
-  }
+  }    
+  //AliHLTTPCCADisplay::Instance().Init();
   AliHLTTPCCADisplay::Instance().SetCurrentSector( this );
   AliHLTTPCCADisplay::Instance().DrawSector( this );
-  //for (Int_t i = 0; i<fHits.size(); i++) AliHLTTPCCADisplay::Instance().DrawHit( i );
-  //cout<<"hits"<<endl;
-  //AliHLTTPCCADisplay::Instance().Ask();
-  //AliHLTTPCCADisplay::Instance().Clear();
-  //AliHLTTPCCADisplay::Instance().DrawSector( this );
+  for( Int_t iRow=0; iRow<fParam.NRows(); iRow++ )
+    for (Int_t i = 0; i<fRows[iRow].NHits(); i++) 
+      AliHLTTPCCADisplay::Instance().DrawHit( iRow, i );
+  cout<<"hits"<<endl;
+  AliHLTTPCCADisplay::Instance().Ask();
+  AliHLTTPCCADisplay::Instance().Clear();
+  AliHLTTPCCADisplay::Instance().DrawSector( this );
   for( Int_t iRow=0; iRow<fParam.NRows(); iRow++ )
     for (Int_t i = 0; i<fRows[iRow].NCells(); i++) 
       AliHLTTPCCADisplay::Instance().DrawCell( iRow, i );
-  //cout<<"cells"<<endl;
-  AliHLTTPCCADisplay::Instance().Ask();
+  cout<<"cells"<<endl;
+  AliHLTTPCCADisplay::Instance().Ask();  
   Int_t nConnectedCells = 0;
 #endif 
 
@@ -223,6 +245,9 @@ void AliHLTTPCCATracker::FindTracks()
   std::vector<Int_t> vTrackCells; 
   fTrackCells = new Int_t[2*fNHitsTotal];
 
+  TStopwatch timer1;
+  Double_t factor2 = 3.5*fParam.CellConnectionFactor()*3.5*fParam.CellConnectionFactor();
+
   for( Int_t iRow1=0; iRow1<fParam.NRows()-1; iRow1++ ){
     AliHLTTPCCARow &row1 = fRows[iRow1];
     Int_t lastRow2 = iRow1+3;
@@ -237,11 +262,14 @@ void AliHLTTPCCATracker::FindTracks()
        for (Int_t i2 = 0; i2<row2.NCells(); i2++){
          AliHLTTPCCACell *c2  = &(row2.Cells()[i2]);
          Double_t sy2 = c2->ErrY()*c2->ErrY();
+         Double_t dy = c1->Y()-c2->Y();
+         if( dy*dy>factor2*(sy1+sy2) ){
+           if( dy>0 ) continue;
+           else break;
+         }
          Double_t sz2 = c2->ErrZ()*c2->ErrZ();
-         Double_t dist1 = sqrt( (c1->Y()-c2->Y())*(c1->Y()-c2->Y())/(sy1+sy2) );
-         Double_t dist2 = sqrt( (c1->Z()-c2->Z())*(c1->Z()-c2->Z())/(sz1+sz2) );
-         if( dist1>3.5*fParam.CellConnectionFactor() ) continue;
-         if( dist2>3.5*fParam.CellConnectionFactor() ) continue;
+         Double_t dz = c1->Z()-c2->Z();
+         if( dz*dz>factor2*(sz1+sz2) ) continue;
          if( c1->IUp() ==-1 ) c1->IUp() = (i2<<8)+iRow2;
          else c1->IUp() = -2;
          if( c2->IDown() ==-1 ) c2->IDown() = (i1<<8)+iRow1;
@@ -251,13 +279,18 @@ void AliHLTTPCCATracker::FindTracks()
     }
   }
 
+  timer1.Stop();
+  fTimers[1] = timer1.CpuTime();
+
+  TStopwatch timer2;
+
   Int_t nOutTrackHits = 0;
   Int_t nTrackCells = 0;
   for( Int_t iRow1=0; iRow1<fParam.NRows(); iRow1++ ){
-    AliHLTTPCCARow &row1 = fRows[iRow1];
+    AliHLTTPCCARow &row1 = fRows[iRow1];    
     for (Int_t i1 = 0; i1<row1.NCells(); i1++){ 
       AliHLTTPCCACell *c1  = &(row1.Cells()[i1]);
-      if( c1->IDown()==-2 || c1->IUp()==-2 ) continue;
+      //if( c1->IDown()==-2 || c1->IUp()==-2 ) continue;
       if( c1->IUsed()>0 ) continue;
       c1->IUsed() = 1;
       AliHLTTPCCATrack track;
@@ -273,7 +306,7 @@ void AliHLTTPCCATracker::FindTracks()
        AliHLTTPCCACell *next = &(row2.Cells()[last->IUp()>>8]);
        if( next->IDown()==-2 || next->IUp()==-2 ) break;
 #ifdef DRAW
-       AliHLTTPCCADisplay::Instance().ConnectCells( lastRow,*last,iRow2,*next );
+       AliHLTTPCCADisplay::Instance().ConnectCells( lastRow,*last,iRow2,*next );
        nConnectedCells++;
 #endif 
        next->IUsed() = 1;      
@@ -285,32 +318,54 @@ void AliHLTTPCCATracker::FindTracks()
       vTracks.push_back(track);
     }
   }
+
+  timer2.Stop();
+  fTimers[2] = timer2.CpuTime();
   
   Int_t nTracks = vTracks.size();
   std::sort( vTracks.begin(), vTracks.end(), AliHLTTPCCATrack::CompareSize);
+
+#ifdef DRAW
+  if( nConnectedCells>0 ) AliHLTTPCCADisplay::Instance().Ask();  
+#endif 
+
   
   fTracks = new AliHLTTPCCATrack[nTracks];
   fNTracks = 0;
   vTrackCells.clear();
  
-  Int_t * vMatchedTracks = new Int_t[nTracks];
+  Int_t *vMatchedTracks = new Int_t[nTracks];
+
+  //cout<<"nTracks = "<<nTracks<<endl;
+  TStopwatch timer3;
+  
   for( Int_t itr=0; itr<nTracks; itr++ ){
     AliHLTTPCCATrack &iTrack = vTracks[itr];
-    if( iTrack.Used() ) continue;    
+    if( iTrack.NCells()<3 ) break;
+
+#ifdef DRAW
     FitTrack( iTrack );
-    if( iTrack.Param().Chi2() > fParam.TrackChi2Cut()*iTrack.Param().NDF() ) continue;    
+    //AliHLTTPCCADisplay::Instance().Ask();
+    AliHLTTPCCADisplay::Instance().DrawTrack( iTrack );
+    //AliHLTTPCCADisplay::Instance().Ask();
+#endif 
+    if( iTrack.Used() ) continue;    
+    
+   
+    FitTrack( iTrack, 1 );
+    if( iTrack.Param().Chi2() > fParam.TrackChi2Cut()*iTrack.Param().NDF() ) continue;
 
     Int_t iFirstRow =  GetTrackCellIRow( iTrack, 0);
     Int_t iLastRow  =  GetTrackCellIRow( iTrack, iTrack.NCells()-1);
     AliHLTTPCCACell *iFirstCell = &GetTrackCell( iTrack, 0);
-    AliHLTTPCCACell *iLastCell = &GetTrackCell( iTrack, iTrack.NCells()-1);
-    
+    AliHLTTPCCACell *iLastCell = &GetTrackCell( iTrack, iTrack.NCells()-1);   
     Bool_t updated = 1;
     Int_t nMatched = 0;
-    std::vector<Int_t> vMatchedCells;
+    std::vector<Int_t> vMatchedCellsFront;
+    std::vector<Int_t> vMatchedCellsBack;
     while( updated ){
       updated = 0;
-      for( Int_t jtr=1; jtr<nTracks; jtr++ ){
+      for( Int_t jtr=itr+1; jtr<nTracks; jtr++ ){
        AliHLTTPCCATrack &jTrack = vTracks[jtr];
        if( jTrack.Used() ) continue;
        Int_t jFirstRow =  GetTrackCellIRow( jTrack, 0);
@@ -352,10 +407,10 @@ void AliHLTTPCCATracker::FindTracks()
          Double_t sz1 = iC->ErrZ()*iC->ErrZ();
          Double_t sy2 = jC->ErrY()*jC->ErrY();
          Double_t sz2 = jC->ErrZ()*jC->ErrZ();
-         Double_t dist1 = sqrt( (dy)/(sy1+sy2) );
-         Double_t dist2 = sqrt( (dz)/(sz1+sz2) );
-         if( dist1>3.5*5*fParam.CellConnectionFactor() ) continue;
-         if( dist2>3.5*5*fParam.CellConnectionFactor() ) continue;
+         Double_t dist1 = sqrt( (dy*dy)/(sy1+sy2) );
+         Double_t dist2 = sqrt( (dz*dz)/(sz1+sz2) );
+         if( dist1>3.5*fParam.TrackConnectionFactor() ) continue;
+         if( dist2>3.5*fParam.TrackConnectionFactor() ) continue;
        }
        AliHLTTPCCATrackPar t = iTrack.Param();
        //t.Chi2() = 0;
@@ -377,21 +432,30 @@ void AliHLTTPCCATracker::FindTracks()
        if( iCase==0 ){
          iFirstRow = jFirstRow;
          iFirstCell = jFirstCell;
+         for( Int_t i=jTrack.NCells()-1; i>=0; i-- ){
+           vMatchedCellsBack.push_back(fTrackCells[jTrack.IFirstCell()+i]);
+         }
        }else if( iCase ==1 ){
          iFirstRow = jLastRow;
          iFirstCell = jLastCell;
+         for( Int_t i=0; i<jTrack.NCells(); i++){
+           vMatchedCellsBack.push_back(fTrackCells[jTrack.IFirstCell()+i]);
+         }
        }else if( iCase == 2 ){
          iLastRow = jFirstRow;
          iLastCell = jFirstCell;
+         for( Int_t i=jTrack.NCells()-1; i>=0; i-- ){
+           vMatchedCellsFront.push_back(fTrackCells[jTrack.IFirstCell()+i]);
+         }
        }else{
          iLastRow = jLastRow;
          iLastCell = jLastCell;
+         for( Int_t i=0; i<jTrack.NCells(); i++){
+           vMatchedCellsFront.push_back(fTrackCells[jTrack.IFirstCell()+i]);
+         }
        }
        t.Normalize();
 
-       for( Int_t i=0; i<jTrack.NCells(); i++){
-         vMatchedCells.push_back(fTrackCells[jTrack.IFirstCell()+i]);
-       }
        //t.NDF()+= iTrack.Param().NDF();
        //t.Chi2()+= iTrack.Param().Chi2();
        iTrack.Param() = t;
@@ -400,7 +464,7 @@ void AliHLTTPCCATracker::FindTracks()
        updated = 1;
        break;
       }
-    }
+    }// while updated
 
     if(0){
       Double_t t0[7];
@@ -430,39 +494,58 @@ void AliHLTTPCCATracker::FindTracks()
       AliHLTTPCCACell &c = row.Cells()[ind>>8];
       nHits+=c.NHits();
     }
-    for( UInt_t i=0; i<vMatchedCells.size(); i++){
-      Int_t ind = vMatchedCells[i];
+    for( UInt_t i=0; i<vMatchedCellsBack.size(); i++){
+      Int_t ind = vMatchedCellsBack[i];
       AliHLTTPCCARow &row = fRows[ind%256];
       AliHLTTPCCACell &c = row.Cells()[ind>>8];
       nHits+=c.NHits();
     }
-
-    if( nHits<5 ){
+    for( UInt_t i=0; i<vMatchedCellsFront.size(); i++){
+      Int_t ind = vMatchedCellsFront[i];
+      AliHLTTPCCARow &row = fRows[ind%256];
+      AliHLTTPCCACell &c = row.Cells()[ind>>8];
+      nHits+=c.NHits();
+    }
+    Int_t nCells = iTrack.NCells()+vMatchedCellsBack.size()+vMatchedCellsFront.size();
+    if( nHits<5 || nCells<3){
       for( Int_t i=0; i<nMatched; i++ ) vTracks[vMatchedTracks[i]].Used()=0;
       continue;
     }
     iTrack.Used() = 1;
-    Int_t oldNCells = vTrackCells.size();
+
+    AliHLTTPCCATrack &mTrack = fTracks[fNTracks++];
+    mTrack = iTrack;
+    mTrack.IFirstCell() = vTrackCells.size();
+    mTrack.NCells() = 0;
+
+    for( Int_t i=vMatchedCellsBack.size()-1; i>=0; i-- ){
+      vTrackCells.push_back(vMatchedCellsBack[i]);
+      mTrack.NCells()++;
+    }
     for( Int_t i=0; i<iTrack.NCells() ; i++){
       vTrackCells.push_back(fTrackCells[iTrack.IFirstCell()+i]);
-    }      
-    iTrack.IFirstCell() = oldNCells;
-    for( UInt_t i=0; i<vMatchedCells.size(); i++){
-      vTrackCells.push_back(vMatchedCells[i]);
-      iTrack.NCells()++;
-    }      
-    fTracks[fNTracks++] = iTrack;  
+      mTrack.NCells()++;
+    }
+    for( UInt_t i=0; i<vMatchedCellsFront.size(); i++){
+      vTrackCells.push_back(vMatchedCellsFront[i]);
+      mTrack.NCells()++;
+    }     
     nOutTrackHits+= nHits;  
   }
-  delete [] vMatchedTracks;
+
+  timer3.Stop();
+  fTimers[3] = timer3.CpuTime();
+
+  delete[] vMatchedTracks;
 
   //fTrackCells = new Int_t[vTrackCells.size()];
   for( UInt_t i=0; i<vTrackCells.size(); i++ ) fTrackCells[i] = vTrackCells[i];
   
 #ifdef DRAW
-  if( nConnectedCells>0 ) AliHLTTPCCADisplay::Instance().Ask();
+  if( nTracks>0 ) AliHLTTPCCADisplay::Instance().Ask();
 #endif 
 
+  //cout<<"n out Tracks = "<<fNTracks<<endl;
 
   fOutTrackHits = new Int_t[nOutTrackHits];
   fNOutTrackHits = 0;
@@ -471,7 +554,8 @@ void AliHLTTPCCATracker::FindTracks()
   for( Int_t itr=0; itr<fNOutTracks; itr++ ){
     AliHLTTPCCATrack &t = fTracks[itr];
 #ifdef DRAW
-  AliHLTTPCCADisplay::Instance().DrawTrack( t );
+    AliHLTTPCCADisplay::Instance().DrawTrack( t );
+    //AliHLTTPCCADisplay::Instance().Ask();
 #endif 
     AliHLTTPCCAOutTrack &tmp = fOutTracks[itr];
     tmp.FirstHitRef() = fNOutTrackHits;
@@ -527,6 +611,8 @@ void AliHLTTPCCATracker::FitTrack( AliHLTTPCCATrack &track, Int_t nIter )
   }
   t0[6] = 0;
 
+  Int_t step = track.NCells()/3;
+
   for( Int_t iter=0; iter<nIter; iter++ ){
     t.Init();
     for( Int_t i=0; i<7; i++) t.Par()[i] = t0[i];
@@ -536,8 +622,10 @@ void AliHLTTPCCATracker::FitTrack( AliHLTTPCCATrack &track, Int_t nIter )
     }
     t.Init();
     for( Int_t i=0; i<7; i++ ) t.Par()[i] = t0[i];
-    
-    for( Int_t i=0; i<track.NCells() ; i++){
+
+    //AliHLTTPCCATrackPar tt = t;
+  
+    for( Int_t i=0; i<track.NCells() ; i+=step){
       AliHLTTPCCACell &c = GetTrackCell(track,i);
       AliHLTTPCCARow &row = GetTrackCellRow(track,i);
       for( Int_t j=0; j<c.NHits(); j++){
@@ -548,6 +636,9 @@ void AliHLTTPCCATracker::FitTrack( AliHLTTPCCATrack &track, Int_t nIter )
        t.TransportBz(fParam.Bz(),m, t0);
        t.GetConnectionMatrix(fParam.Bz(),m, mV1, t0);
        t.Filter(m, mV, mV1);
+       //tt.TransportBz(fParam.Bz(),m, t0);
+       //tt.GetConnectionMatrix(fParam.Bz(),m, mV1, t0);
+       //tt.Filter(m, mV, mV1);
       }
     }
     t.Normalize();
index fcfd531fe03db233988ce461101e5fd7bb3dcaf9..6ebc214f82d85e2088317deeb52da0432ddc76b8 100644 (file)
@@ -21,6 +21,15 @@ class AliHLTTPCCAOutTrack;
 
 /**
  * @class AliHLTTPCCATracker
+ * 
+ * Slice tracker for ALICE HLT. 
+ * The class reconstructs tracks in one slice of TPC.
+ * The reconstruction algorithm is based on the Cellular Automaton method
+ *
+ * The CA tracker is designed stand-alone. 
+ * It is integrated to the HLT framework via AliHLTTPCCATrackerComponent interface.
+ * The class is under construction.
+ *
  */
 class AliHLTTPCCATracker
 {
@@ -29,13 +38,12 @@ class AliHLTTPCCATracker
   AliHLTTPCCATracker();
   AliHLTTPCCATracker( const AliHLTTPCCATracker& );
   AliHLTTPCCATracker &operator=( const AliHLTTPCCATracker& );
+
   virtual ~AliHLTTPCCATracker();
 
   void Initialize( AliHLTTPCCAParam &param );
 
   void StartEvent();
-  void ReadHit( Int_t iRow, Int_t index, Double_t x, Double_t y, Double_t z, 
-                Double_t ErrY, Double_t ErrZ  ) const {;}
 
   void ReadHitRow( Int_t iRow, AliHLTTPCCAHit *Row, Int_t NHits );
 
@@ -58,6 +66,8 @@ class AliHLTTPCCATracker
 
   Int_t *TrackCells(){ return  fTrackCells; }
 
+  Double_t *Timers(){ return fTimers; }
+
   AliHLTTPCCACell &GetTrackCell( AliHLTTPCCATrack &t, Int_t i ) const {
     Int_t ind = fTrackCells[t.IFirstCell()+i];
     AliHLTTPCCARow &row = fRows[ind%256];
@@ -86,6 +96,9 @@ class AliHLTTPCCATracker
   Int_t fNHitsTotal;// total number of hits in event
   AliHLTTPCCATrack *fTracks;   // reconstructed tracks
   Int_t fNTracks;// number of reconstructed tracks
+  Int_t *fCellHitPointers;// global array of cell->hit pointers
+
+  Double_t fTimers[10]; // running CPU time for different parts of the algorithm
 
   ClassDef(AliHLTTPCCATracker,1);
 };
index c8c81c5f00c2dc774ba7d7ecebf2c40adfefd534..6d7c1c1558caa80c970dd61218b6229bb9f1d2b9 100644 (file)
@@ -39,13 +39,8 @@ using namespace std;
 #include "AliHLTTPCTrackArray.h"
 #include "AliHLTTPCTrackletDataFormat.h"
 #include "AliHLTTPCDefinitions.h"
+#include "TStopwatch.h"
 #include "TMath.h"
-#include "AliTPC.h"
-#include "AliTPCParam.h"
-#include "AliRun.h"
-#include <stdlib.h>
-#include <iostream>
-#include <errno.h>
 
 
 // this is a global object used for automatic component registration, do not use this
@@ -185,6 +180,12 @@ int AliHLTTPCCATrackerComponent::DoEvent
  AliHLTUInt32_t& size, 
  vector<AliHLTComponentBlockData>& outputBlocks )
 {
+
+  AliHLTUInt32_t MaxBufferSize = size;
+  size = 0; // output size
+
+  TStopwatch timer;
+
   // Event reconstruction in one TPC slice with CA Tracker
 
   Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "DoEvent", "DoEvent()" );
@@ -212,6 +213,7 @@ int AliHLTTPCCATrackerComponent::DoEvent
       if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;
 
       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
+
       Bool_t found = 0;
       slCntIter = sliceCnts.begin();
       for( slIter = slices.begin(); slIter!=slices.end(); slIter++, slCntIter++ ){
@@ -278,47 +280,37 @@ int AliHLTTPCCATrackerComponent::DoEvent
     Double_t dalpha = 0.349066;
     Double_t alpha = 0.174533 + dalpha*iSec;
     
-    Bool_t zPlus = (iSec<18|| (iSec>=36&&iSec<54) );
-    Bool_t rInner = (iSec<36);
+    Bool_t zPlus = (iSec<18 );
     Double_t zMin =  zPlus ?plusZmin :minusZmin;
     Double_t zMax =  zPlus ?plusZmax :minusZmax;
-    Double_t rMin =  rInner ?inRmin :outRmin;
-    Double_t rMax =  rInner ?inRmax :outRmax;
-    Int_t inNRows = 63;
-    Int_t outNRows = 96;
-    Double_t inRowXFirst = 85.225;
-    Double_t outRowXFirst =135.1;
-    Double_t inRowXStep = 0.75;
-    Double_t outRowXStep = 1.;
-    Int_t nRows = rInner ?inNRows :outNRows;
-    Double_t rowXFirst = rInner ?inRowXFirst :outRowXFirst;
-    Double_t rowXStep = rInner ?inRowXStep :outRowXStep;
-    
-    Int_t nSectors = 72/2;
-    
+    //TPCZmin = -249.645, ZMax = 249.778    
+    Double_t rMin =  inRmin;
+    Double_t rMax =  outRmax;
+    Int_t NRows = AliHLTTPCTransform::GetNRows();
+        
     Double_t padPitch = 0.4;
     Double_t sigmaZ = 0.228808;
     
-    //TPCZmin = -249.645, ZMax = 249.778    
+     Double_t rowX[NRows];
+    for( Int_t irow=0; irow<NRows; irow++){
+      rowX[irow] = AliHLTTPCTransform::Row2X( irow );
+    }     
      
     AliHLTTPCCAParam param;
-    param.Initialize( iSec, inNRows+outNRows, inRowXFirst, inRowXStep,alpha, dalpha,
+    param.Initialize( iSec, NRows, rowX, alpha, dalpha,
                      inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, Bz );
-      
-    fTracker->Initialize( param );
+    param.YErrorCorrection() = 1;
+    param.ZErrorCorrection() = 2;
 
-    // recalculate outer rows -> necessary for a moment
+    fTracker->Initialize( param ); 
 
-    for( Int_t irow=0; irow<outNRows; irow++){
-      fTracker->Rows()[inNRows+irow].X() = outRowXFirst + irow*outRowXStep;
-    }     
   }
 
     
   // min and max patch numbers and row numbers
 
   Int_t row[2] = {0,0};
-  Int_t minPatch=INT_MAX, maxPatch = 0;
+  Int_t minPatch=INT_MAX, maxPatch = -1;
 
   // total n Hits
 
@@ -355,15 +347,18 @@ int AliHLTTPCCATrackerComponent::DoEvent
   
   fTracker->StartEvent();
 
-  AliHLTTPCCAHit * vHits = new AliHLTTPCCAHit[nHitsTotal]; // CA hit array
-  Double_t * vHitStoreX = new Double_t[nHitsTotal];       // hit X coordinates
-  Int_t * vHitStoreID = new Int_t[nHitsTotal];            // hit ID's
+  AliHLTTPCCAHit vHits[nHitsTotal]; // CA hit array
+  Double_t vHitStoreX[nHitsTotal];       // hit X coordinates
+  Int_t vHitStoreID[nHitsTotal];            // hit ID's
+  Int_t vHitRowID[nHitsTotal];            // hit ID's
 
   Int_t nHits = 0;
  
   Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
           "Total %d hits to read for slice %d", nHitsTotal, slice );
 
+  Int_t nClusters=0;
+
   for( std::vector<unsigned long>::iterator pIter = patchIndices.begin(); pIter!=patchIndices.end(); pIter++ ){
     ndx = *pIter;
     iter = blocks+ndx;
@@ -382,8 +377,6 @@ int AliHLTTPCCATrackerComponent::DoEvent
     for (UInt_t i=0; i<inPtrSP->fSpacePointCnt; i++ ){ 
       AliHLTTPCSpacePointData* pSP = &(inPtrSP->fSpacePoints[i]);
 
-      //Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits", "hit pad %d, xyz=%f,%f,%f, sy=%f, sz=%f,", pSP->fPadRow, pSP->fX, pSP->fY, pSP->fZ, TMath::Sqrt(pSP->fSigmaY2), TMath::Sqrt(pSP->fSigmaZ2) );
-
       if( pSP->fPadRow != oldRow ){
        if( oldRow>=0 ) fTracker->ReadHitRow( oldRow, vHits+firstRowHit, nRowHits );
        oldRow = pSP->fPadRow;
@@ -391,24 +384,35 @@ int AliHLTTPCCATrackerComponent::DoEvent
        nRowHits = 0;
       }
       AliHLTTPCCAHit &h = vHits[nHits];
+      if( TMath::Abs(pSP->fX- fTracker->Rows()[pSP->fPadRow].X() )>1.e-4 ) cout<<"row "<<(Int_t)pSP->fPadRow<<" "<<fTracker->Rows()[pSP->fPadRow].X()-pSP->fX <<endl;
+
       h.Y() = pSP->fY;
       h.Z() = pSP->fZ;
-      h.ErrY() = TMath::Sqrt(pSP->fSigmaY2);
-      h.ErrZ() = TMath::Sqrt(pSP->fSigmaZ2);  
+      h.ErrY() = TMath::Sqrt(TMath::Abs(pSP->fSigmaY2));
+      h.ErrZ() = TMath::Sqrt(TMath::Abs(pSP->fSigmaZ2));  
+      if( h.ErrY()<.1 ) h.ErrY() = .1;
+      if( h.ErrZ()<.1 ) h.ErrZ() = .1;
+      if( h.ErrY()>1. ) h.ErrY() = 1.;
+      if( h.ErrZ()>1. ) h.ErrZ() = 1.;
       h.ID() = nHits;
       vHitStoreX[nHits] = pSP->fX;
       vHitStoreID[nHits] = pSP->fID;
+      vHitRowID[nHits] = pSP->fPadRow;
       nHits++; 
       nRowHits++;
+      nClusters++;
     }  
     if( oldRow>=0 ) fTracker->ReadHitRow( oldRow, vHits+firstRowHit, nRowHits );
   }
 
-  
   // reconstruct the event  
 
+  TStopwatch timerReco;
+
   fTracker->Reconstruct();
 
+  timerReco.Stop();
+
   Int_t ret = 0;
 
   Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reconstruct",
@@ -436,8 +440,8 @@ int AliHLTTPCCATrackerComponent::DoEvent
 
     UInt_t dSize = sizeof(AliHLTTPCTrackSegmentData) + t.NHits()*sizeof(UInt_t);
     
-    if( mySize + dSize >size ){
-      Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "Wrtite output","Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", size, mySize, ntracks-itr+1);
+    if( mySize + dSize > MaxBufferSize ){
+      Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "Wrtite output","Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", MaxBufferSize, mySize, ntracks-itr+1);
       ret = -ENOSPC;
       break;
     }
@@ -473,18 +477,25 @@ int AliHLTTPCCATrackerComponent::DoEvent
     currOutTracklet->fPterr = ( h3*h3*t.Param().Cov()[9] + h4*h4*t.Param().Cov()[14] + h6*h6*t.Param().Cov()[27] 
                                + 2.*(h3*h4*t.Param().Cov()[13]+h3*h6*t.Param().Cov()[24]+h4*h6*t.Param().Cov()[25] )
                                );    
-   currOutTracklet->fPsi = TMath::ATan2(ey, ex);
+    currOutTracklet->fPsi = TMath::ATan2(ey, ex);
     
     h3 =  ex/(et*et);
     h4 = -ey/(et*et);
     currOutTracklet->fPsierr = h3*h3*t.Param().Cov()[9] + h4*h4*t.Param().Cov()[14] + 2.*h3*h4*t.Param().Cov()[13];
     
-    currOutTracklet->fTgl = TMath::Abs(ex)>1.e-5  ? ez/ex :1.e5;
+    currOutTracklet->fTgl = TMath::Abs(et)>1.e-5  ? ez/et :1.e5;
       
-    h3 = (TMath::Abs(ex) >1.e-5) ? -ez/ex/ex :0;
-    h5 = (TMath::Abs(ex) >1.e-5) ? 1./ex :0;
-    currOutTracklet->fTglerr =  h3*h3*t.Param().Cov()[9] + h5*h5*t.Param().Cov()[20] + 2.*h3*h5*t.Param().Cov()[18]; 
-    
+    if( TMath::Abs(et) >1.e-2 ){
+      h3 = -ez*ex/et/et;
+      h4 = -ez*ey/et/et;
+      h5 = 1.;
+      currOutTracklet->fTglerr =  ( h3*h3*t.Param().Cov()[9] + h4*h4*t.Param().Cov()[14] + h5*h5*t.Param().Cov()[20] 
+                                   + 2.*(h3*h4*t.Param().Cov()[13]+h3*h5*t.Param().Cov()[18]+h4*h5*t.Param().Cov()[19] )
+                                   )/et/et;
+    }else{
+      currOutTracklet->fTglerr =  1.e-2;
+    }
+
     currOutTracklet->fCharge = -currOutTracklet->fCharge;
     
     t.Param().TransportBz(Bz, vHitStoreX[iLastHit], lastHit.Y(), lastHit.Z() );
@@ -493,6 +504,17 @@ int AliHLTTPCCATrackerComponent::DoEvent
     currOutTracklet->fLastY = t.Param().Par()[1];
     currOutTracklet->fLastZ = t.Param().Par()[2];
 
+#ifdef INCLUDE_TPC_HOUGH
+#ifdef ROWHOUGHPARAMS
+    currOutTracklet->fTrackID = 0;
+    currOutTracklet->fRowRange1 = vHitRowID[iFirstHit];
+    currOutTracklet->fRowRange2 = vHitRowID[iLastHit];
+    currOutTracklet->fSector = slice;
+    currOutTracklet->fPID = 211;
+#endif
+#endif // INCLUDE_TPC_HOUGH
+
+
     currOutTracklet->fNPoints = t.NHits();
 
     for( Int_t i=0; i<t.NHits(); i++ ){
@@ -503,10 +525,7 @@ int AliHLTTPCCATrackerComponent::DoEvent
     mySize+=dSize;
     outPtr->fTrackletCnt++; 
   }
-    
-  Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Tracks",
-          "Input: Number of tracks: %d Slice/MinPatch/MaxPatch/RowMin/RowMax: %d/%d/%d/%d/%d.", 
-          ntracks, slice, minPatch, maxPatch, row[0], row[1] );
+  
   
   AliHLTComponentBlockData bd;
   FillBlockData( bd );
@@ -516,11 +535,15 @@ int AliHLTTPCCATrackerComponent::DoEvent
   outputBlocks.push_back( bd );
   
   size = mySize;
-
-  delete [] vHits;
-  delete [] vHitStoreX;
-  delete [] vHitStoreID;
   
+  timerReco.Stop();
+
+  // Set log level to "Warning" for on-line system monitoring
+
+  Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "Tracks",
+          "CATracker slice %d: output %d tracks;  input %d clusters, patches %d..%d, rows %d..%d; reco time %d/%d us", 
+          slice, ntracks, nClusters, minPatch, maxPatch, row[0], row[1], (Int_t) (timer.RealTime()*1.e6), (Int_t) (timerReco.RealTime()*1.e6) );
+
   return ret;
 
 }