]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/tracking-ca/AliHLTTPCCADisplay.cxx
Fit mathematics improved, obsollete GBTracker cleaned up
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCADisplay.cxx
index 029a454de7fe3dd13deab63226a741853bc09b25..d89a15ad5895e0d1912f9b32004666ad812c02bc 100644 (file)
 #include "TApplication.h"
 
 
+class AliHLTTPCCADisplay::AliHLTTPCCADisplayTmpHit
+{
+
+public:
+
+  Int_t ID() const { return fHitID; }
+  Double_t S() const { return fS; }
+  Double_t Z() const { return fZ; }
+  
+  void SetID( Int_t v ){ fHitID = v; }    
+  void SetS( Double_t v){ fS = v; }
+  void SetZ( Double_t v){ fZ = v; }
+  
+  static Bool_t CompareHitDS( const AliHLTTPCCADisplayTmpHit &a, 
+                             const AliHLTTPCCADisplayTmpHit  &b )
+  {    
+    return (a.fS < b.fS);
+  }
+
+  static Bool_t CompareHitZ( const AliHLTTPCCADisplayTmpHit &a, 
+                            const AliHLTTPCCADisplayTmpHit  &b )
+  {    
+    return (a.fZ < b.fZ);
+  }
+
+private:
+
+  Int_t fHitID; // hit ID
+  Double_t fS;  // hit position on the XY track curve 
+  Double_t fZ;  // hit Z position
+
+};
+
 
 
 AliHLTTPCCADisplay &AliHLTTPCCADisplay::Instance()
@@ -373,7 +406,7 @@ Int_t AliHLTTPCCADisplay::GetColorK( Double_t k ) const
   return kMyColor[iy];
 }
 
-void AliHLTTPCCADisplay::Global2View( Double_t x, Double_t y, Double_t *xv, Double_t * yv ) const
+void AliHLTTPCCADisplay::Global2View( Double_t x, Double_t y, Double_t *xv, Double_t *yv ) const
 {
   // convert coordinates global->view
   *xv = x*fCos + y*fSin;
@@ -458,57 +491,55 @@ void AliHLTTPCCADisplay::DrawSliceHit( Int_t iRow, Int_t iHit, Int_t color, Size
 {
   // draw hit
   if( !fSlice ) return;
-  AliHLTTPCCAGBTracker &tracker = *fGB;
-  const AliHLTTPCCARow &row = fSlice->Row(iRow);
-  Int_t id = tracker.FirstSliceHit()[fSlice->Param().ISlice()]+fSlice->HitInputIDs()[row.FirstHit()+iHit];
-  DrawGBHit(  tracker, id, color, width );
+  const AliHLTTPCCARow &row = fSlice->Row(iRow);        
+  float y0 = row.Grid().YMin();
+  float z0 = row.Grid().ZMin();
+  float stepY = row.HstepY();
+  float stepZ = row.HstepZ();
+  const uint4* tmpint4 = fSlice->RowData() + row.FullOffset();
+  const ushort2 *hits = reinterpret_cast<const ushort2*>(tmpint4);
+  ushort2 hh = hits[iHit];
+  Float_t x = row.X();
+  Float_t y = y0 + hh.x*stepY;
+  Float_t z = z0 + hh.y*stepZ;
+
+  SetSliceTransform(fSlice);
+  
+  if( color<0 ){
+    if( fPerf && fGB ){
+      Int_t id = fGB->FirstSliceHit()[fSlice->Param().ISlice()]+fSlice->HitInputIDs()[row.FirstHit()+iHit];
+      AliHLTTPCCAGBHit &h = fGB->Hits()[id];
+      Int_t lab = fPerf->HitLabels()[h.ID()].fLab[0];
+      color = GetColor(lab+1);
+      if( lab>=0 ){
+       AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
+       if( mc.P()>=1. ) color = kRed;  
+       else if(fDrawOnlyRef) return;
+      }
+    }else color=GetColorZ( z );
+  }
+  if( width>0 )fMarker.SetMarkerSize(width);
+  else fMarker.SetMarkerSize(.3);
+  fMarker.SetMarkerColor(color);
+  Double_t vx, vy;
+  Slice2View( x, y, &vx, &vy );    
+  fYX->cd();
+  fMarker.DrawMarker(vx, vy);
+  fZX->cd();  
+  fMarker.DrawMarker(z, vy); 
 }
 
 void AliHLTTPCCADisplay::DrawSliceHits( Int_t color, Size_t width )
 {
-  // draw hits 
-
-  if( !fPerf || !fGB) return;
-  AliHLTTPCCAGBTracker &tracker = *fGB;
-  if( width<0 ) width = .3;
 
-  for( Int_t imc=-3; imc<fPerf->NMCTracks(); imc++ ){
-    Int_t nh=0;
-    AliHLTTPCCAMCTrack *mc = (imc>=0) ?&(fPerf->MCTracks()[imc]) :0;
-    if(fDrawOnlyRef && (!mc || (mc->P()<1))) continue;
-  
-    Int_t col = color;
-    if( color<0 ){
-      col = GetColor(imc+1);
-      if( imc>=0 ){
-       if( mc&&(mc->P()>=1.) ) col = kRed;     
-      }
-    }
+  // draw hits 
 
-    for( Int_t ih=0; ih<fSlice->NHitsTotal(); ih++ ){   
-       Int_t id = fSlice->HitInputIDs()[ih];
-      AliHLTTPCCAGBHit &h = tracker.Hits()[tracker.FirstSliceHit()[fSlice->Param().ISlice()]+id];
-      if( fPerf->HitLabels()[h.ID()].fLab[0] != imc ) continue;
-      nh++;
-      //AliHLTTPCCATracker &slice = tracker.Slices()[h.ISlice()];
-      //SetSliceTransform(&slice);
-      
-      fMarker.SetMarkerSize(width);
-      fMarker.SetMarkerColor(col);
-      Double_t vx, vy;
-      Slice2View( h.X(), h.Y(), &vx, &vy );  
-      
-      fYX->cd();
-      fMarker.DrawMarker(vx, vy);
-      fZX->cd();  
-      fMarker.DrawMarker(h.Z(), vy);     
+  for( Int_t iRow=0; iRow<fSlice->Param().NRows(); iRow++ ){
+    const AliHLTTPCCARow &row = fSlice->Row(iRow);
+    for( Int_t ih=0; ih<row.NHits(); ih++ ){
+      DrawSliceHit( iRow, ih, color, width );     
     }
-    //if( nh<=0 ) continue;
-    //float p = mc ? mc->P() :0;  
-    //std::cout<<"lab,nhits,color= "<<imc<<" "<<nh<<" "<<col<<std::endl;
-    //Ask();
-  }
+  }  
 }
 
 
@@ -668,12 +699,9 @@ Bool_t AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrackParam t, Double_t Alpha, c
       if( mc.P()>=1. ) color = kRed;   
     }  
   }
-  std::cout<<"mark 1"<<std::endl;
+
   if( t.SinPhi()>.999 )  t.SetSinPhi( .999 );
   else if( t.SinPhi()<-.999 )  t.SetSinPhi( -.999 );
-  if( t.CosPhi()>=0 ) t.SetCosPhi( TMath::Sqrt(1-t.SinPhi()*t.SinPhi() ));
-  else t.SetCosPhi( -TMath::Sqrt(1-t.SinPhi()*t.SinPhi() ));
-  std::cout<<"mark 2"<<std::endl;
 
   //  Int_t iSlice = fSlice->Param().ISlice();
 
@@ -952,7 +980,7 @@ void AliHLTTPCCADisplay::DrawGBTrackFast( AliHLTTPCCAGBTracker &tracker, Int_t i
     Slice2View(h1.X(), h1.Y(), &gx1, &gy1 );
     Slice2View(h2.X(), h2.Y(), &gx2, &gy2 );
     if( colorY<0 ) colorY = GetColorY( (gy1+gy2)/2. );
-    color = colorY = GetColorK(t.GetKappa());
+    color = colorY = GetColorK(t.GetQPt());
   }
 
   fMarker.SetMarkerColor(color);//kBlue);
@@ -982,7 +1010,7 @@ void AliHLTTPCCADisplay::DrawGBTrackFast( AliHLTTPCCAGBTracker &tracker, Int_t i
       alpha = tracker.Slices()[h1.ISlice()].Param().Alpha();
       SetSliceTransform( &(tracker.Slices()[oldSlice]) );
     }
-    t.GetDCAPoint( h1.X(), h1.Y(), h1.Z(), x1, y1, z1 );  
+    t.GetDCAPoint( h1.X(), h1.Y(), h1.Z(), x1, y1, z1, fSlice->Param().Bz()  );  
     Slice2View(x1, y1, &vx1, &vy1 );
 
     if( h2.ISlice() != oldSlice ){
@@ -991,13 +1019,13 @@ void AliHLTTPCCADisplay::DrawGBTrackFast( AliHLTTPCCAGBTracker &tracker, Int_t i
       alpha = tracker.Slices()[h2.ISlice()].Param().Alpha();
       SetSliceTransform( &(tracker.Slices()[oldSlice]) );
     }
-    t.GetDCAPoint( h2.X(), h2.Y(), h2.Z(), x2, y2, z2 );
+    t.GetDCAPoint( h2.X(), h2.Y(), h2.Z(), x2, y2, z2, fSlice->Param().Bz()  );
     Slice2View(x2, y2, &vx2, &vy2 );
     
     Double_t x0 = t.GetX();
     Double_t y0 = t.GetY();
     Double_t sinPhi = t.GetSinPhi();
-    Double_t k = t.GetKappa();
+    Double_t k = t.GetKappa( fSlice->Param().Bz() );
     Double_t ex = t.GetCosPhi();
     Double_t ey = sinPhi;
  
@@ -1047,7 +1075,7 @@ void AliHLTTPCCADisplay::DrawGBTrackFast( AliHLTTPCCAGBTracker &tracker, Int_t i
       alpha = tracker.Slices()[h1.ISlice()].Param().Alpha();
       SetSliceTransform( &(tracker.Slices()[oldSlice]) );
     }
-    t.GetDCAPoint( h1.X(), h1.Y(), h1.Z(), x1, y1, z1 );  
+    t.GetDCAPoint( h1.X(), h1.Y(), h1.Z(), x1, y1, z1, fSlice->Param().Bz()  );  
     Slice2View(x1, y1, &vx1, &vy1 );
     py[iHit] = vy1;
     pz[iHit] = z1;
@@ -1193,8 +1221,8 @@ void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, Int_t color, Bool_t
     AliHLTTPCCARow &row1 = fSlice->ID2Row(vHits[iHit].ID());
     AliHLTTPCCARow &row2 = fSlice->ID2Row(vHits[iHit+1].ID());
     Float_t x1, y1, z1, x2, y2, z2;    
-    t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1 );
-    t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2 );
+    t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1,fSlice->Param().Bz()  );
+    t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2,fSlice->Param().Bz()  );
 
     //if( color<0 ) color = GetColorZ( (z1+z2)/2. );
     Double_t vx1, vy1, vx2, vy2;
@@ -1256,8 +1284,8 @@ void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, Int_t color, Bool_t
     //if( DrawHits ) ConnectHits( fSlice->ID2IRow(vHits[iHit].ID()),c1,
     //fSlice->ID2IRow(vHits[iHit+1].ID()),c2, color );
     Float_t x1, y1, z1, x2, y2, z2;
-    t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1 );
-    t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2 );
+    t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1,fSlice->Param().Bz()  );
+    t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2,fSlice->Param().Bz()  );
 
     Double_t vx1, vy1, vx2, vy2;
     Slice2View(x1, y1, &vx1, &vy1 );