2 // **************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project *
4 // ALICE Experiment at CERN, All rights reserved. *
6 // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7 // Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8 // for The ALICE HLT Project. *
10 // Permission to use, copy, modify and distribute this software and its *
11 // documentation strictly for non-commercial purposes is hereby granted *
12 // without fee, provided that the above copyright notice appears in all *
13 // copies and that both the copyright notice and this permission notice *
14 // appear in the supporting documentation. The authors make no claims *
15 // about the suitability of this software for any purpose. It is *
16 // provided "as is" without express or implied warranty. *
18 //***************************************************************************
21 #include "AliHLTTPCCADisplay.h"
24 #include "AliHLTTPCCATracker.h"
25 #include "AliHLTTPCCAGBTracker.h"
26 #include "AliHLTTPCCARow.h"
27 #include "AliHLTTPCCATrack.h"
28 #include "AliHLTTPCCAGBTrack.h"
29 #include "AliHLTTPCCAGBHit.h"
30 #include "AliHLTTPCCAPerformance.h"
31 #include "AliHLTTPCCAMCTrack.h"
32 #include "AliHLTTPCCAOutTrack.h"
35 #include "Riostream.h"
39 #include "TApplication.h"
42 class AliHLTTPCCADisplay::AliHLTTPCCADisplayTmpHit
47 int ID() const { return fHitID; }
48 double S() const { return fS; }
49 double Z() const { return fZ; }
51 void SetID( int v ) { fHitID = v; }
52 void SetS( double v ) { fS = v; }
53 void SetZ( double v ) { fZ = v; }
55 static bool CompareHitDS( const AliHLTTPCCADisplayTmpHit &a,
56 const AliHLTTPCCADisplayTmpHit &b ) {
57 return ( a.fS < b.fS );
60 static bool CompareHitZ( const AliHLTTPCCADisplayTmpHit &a,
61 const AliHLTTPCCADisplayTmpHit &b ) {
62 return ( a.fZ < b.fZ );
68 double fS; // hit position on the XY track curve
69 double fZ; // hit Z position
75 AliHLTTPCCADisplay &AliHLTTPCCADisplay::Instance()
77 // reference to static object
78 static AliHLTTPCCADisplay gAliHLTTPCCADisplay;
79 static bool firstCall = 1;
81 if ( !gApplication ) new TApplication( "myapp", 0, 0 );
82 gAliHLTTPCCADisplay.Init();
85 return gAliHLTTPCCADisplay;
88 AliHLTTPCCADisplay::AliHLTTPCCADisplay() : fYX( 0 ), fZX( 0 ), fAsk( 1 ), fSliceView( 1 ), fSlice( 0 ), fGB( 0 ), fPerf( 0 ),
89 fCos( 1 ), fSin( 0 ), fZMin( -250 ), fZMax( 250 ), fYMin( -250 ), fYMax( 250 ), fSliceCos( 1 ), fSliceSin( 0 ),
90 fRInnerMin( 83.65 ), fRInnerMax( 133.3 ), fROuterMin( 133.5 ), fROuterMax( 247.7 ),
91 fTPCZMin( -250. ), fTPCZMax( 250 ), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex(), fDrawOnlyRef( 0 )
93 fPerf = &( AliHLTTPCCAPerformance::Instance() );
98 AliHLTTPCCADisplay::AliHLTTPCCADisplay( const AliHLTTPCCADisplay& )
99 : fYX( 0 ), fZX( 0 ), fAsk( 1 ), fSliceView( 1 ), fSlice( 0 ), fGB( 0 ), fPerf( 0 ),
100 fCos( 1 ), fSin( 0 ), fZMin( -250 ), fZMax( 250 ), fYMin( -250 ), fYMax( 250 ), fSliceCos( 1 ), fSliceSin( 0 ),
101 fRInnerMin( 83.65 ), fRInnerMax( 133.3 ), fROuterMin( 133.5 ), fROuterMax( 247.7 ),
102 fTPCZMin( -250. ), fTPCZMax( 250 ), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex(), fDrawOnlyRef( 0 )
107 const AliHLTTPCCADisplay& AliHLTTPCCADisplay::operator=( const AliHLTTPCCADisplay& ) const
113 AliHLTTPCCADisplay::~AliHLTTPCCADisplay()
120 void AliHLTTPCCADisplay::Init()
123 gStyle->SetCanvasBorderMode( 0 );
124 gStyle->SetCanvasBorderSize( 1 );
125 gStyle->SetCanvasColor( 0 );
126 fYX = new TCanvas ( "YX", "YX window", -1, 0, 600, 600 );
127 fZX = new TCanvas ( "ZX", "ZX window", -610, 0, 590, 600 );
128 fMarker = TMarker( 0.0, 0.0, 20 );//6);
132 void AliHLTTPCCADisplay::Update()
138 fYX->Print( "YX.pdf" );
139 fZX->Print( "ZX.pdf" );
143 void AliHLTTPCCADisplay::ClearView()
150 void AliHLTTPCCADisplay::Ask()
152 // whait for the pressed key, when "r" pressed, don't ask anymore
156 std::cout << "ask> " << std::endl;
158 std::cin.get( symbol );
161 } while ( symbol != '\n' );
166 void AliHLTTPCCADisplay::SetSliceView()
168 // switch to slice view
172 void AliHLTTPCCADisplay::SetTPCView()
174 // switch to full TPC view
185 void AliHLTTPCCADisplay::SetGB( AliHLTTPCCAGBTracker * const GBTracker )
190 void AliHLTTPCCADisplay::SetCurrentSlice( AliHLTTPCCATracker *slice )
192 // set reference to the current CA tracker, and read the current slice geometry
194 SetSliceTransform( slice );
196 fCos = slice->Param().SinAlpha();
197 fSin = slice->Param().CosAlpha();
198 fZMin = slice->Param().ZMin();
199 fZMax = slice->Param().ZMax();
201 double r0 = .5 * ( slice->Param().RMax() + slice->Param().RMin() );
202 double dr = .5 * ( slice->Param().RMax() - slice->Param().RMin() );
207 double cz = .5 * ( slice->Param().ZMax() + slice->Param().ZMin() );
208 double dz = .5 * ( slice->Param().ZMax() - slice->Param().ZMin() ) * 1.2;
209 fYX->Range( cx - dr, cy - dr*1.05, cx + dr, cy + dr );
210 fZX->Range( cz - dz, cy - dr*1.05, cz + dz, cy + dr );
212 //fYX->Range(cx-dr*.3, cy-dr*1.05, cx+dr*.3, cy-dr*.35);
213 //fZX->Range(cz-dz, cy-dr*1.05, cz+dz, cy-dr*.3);
215 //fYX->Range(cx-dr*.3, cy-dr*.8, cx-dr*.1, cy-dr*.75);
216 //fZX->Range(cz-dz*0, cy-dr*.8, cz+dz, cy-dr*.75);
218 //fYX->Range(cx-dr*.08, cy-dr*1., cx-dr*.02, cy-dr*0.7);
219 //fZX->Range(cz-dz*.2, cy-dr*1., cz-dz*.05, cy-dr*0.7);
221 //double x0 = cx-dr*.1, x1 = cx-dr*.05;
222 //double y0 = cy-dr*1.05, y1 = cy-dr*0.7;
223 //double z0 = cz-dz*.3, z1 = cz;
224 //double xc = (x0+x1)/2, yc= (y0+y1)/2, zc=(z0+z1)/2;
225 //double d = TMath::Max((x1-x0)/2,TMath::Max((y1-y0)/2,(z1-z0)/2));
226 //fYX->Range(xc-d, yc-d, xc+d, yc+d);
227 //fZX->Range(zc-d, yc-d, zc+d, yc+d);
232 void AliHLTTPCCADisplay::SetSliceTransform( double alpha )
234 fSliceCos = TMath::Cos( alpha );
235 fSliceSin = TMath::Sin( alpha );
238 void AliHLTTPCCADisplay::SetSliceTransform( AliHLTTPCCATracker *slice )
240 SetSliceTransform( slice->Param().Alpha() );
244 void AliHLTTPCCADisplay::DrawTPC()
246 // schematically draw TPC detector
247 fYX->Range( -fROuterMax, -fROuterMax, fROuterMax, fROuterMax );
248 //fYX->Range( -fROuterMax*.7, -fROuterMax, fROuterMax*0., -fROuterMax*.5);
251 fArc.SetLineColor( kBlack );
252 fArc.SetFillStyle( 0 );
254 for ( int iSlice = 0; iSlice < 18; iSlice++ ) {
255 fCrown.SetLineColor( kBlack );
256 fCrown.SetFillStyle( 0 );
257 fCrown.DrawCrown( 0, 0, fRInnerMin, fRInnerMax, 360. / 18.*iSlice, 360. / 18.*( iSlice + 1 ) );
258 fCrown.DrawCrown( 0, 0, fROuterMin, fROuterMax, 360. / 18.*iSlice, 360. / 18.*( iSlice + 1 ) );
262 fZX->Range( fTPCZMin, -fROuterMax, fTPCZMax*1.1, fROuterMax );
263 //fZX->Range( fTPCZMax*.1, -fROuterMax, fTPCZMax*.3, -fROuterMax*0.5 );
267 void AliHLTTPCCADisplay::DrawSlice( AliHLTTPCCATracker *slice, bool DrawRows )
269 // draw current the TPC slice
271 double r0 = .5 * ( slice->Param().RMax() + slice->Param().RMin() );
272 double dr = .5 * ( slice->Param().RMax() - slice->Param().RMin() );
273 double cx = r0 * slice->Param().CosAlpha();
274 double cy = r0 * slice->Param().SinAlpha();
275 double raddeg = 180. / 3.1415;
276 double a0 = raddeg * .5 * ( slice->Param().AngleMax() + slice->Param().AngleMin() );
277 double da = raddeg * .5 * ( slice->Param().AngleMax() - slice->Param().AngleMin() );
281 fLatex.DrawLatex( cx - dr + dr*.05, cy - dr + dr*.05, Form( "YX, Slice %2i", slice->Param().ISlice() ) );
283 a0 += raddeg * TMath::ATan2( fSin, fCos );
285 fArc.SetLineColor( kBlack );
286 fArc.SetFillStyle( 0 );
287 fCrown.SetLineColor( kBlack );
288 fCrown.SetFillStyle( 0 );
289 fCrown.DrawCrown( 0, 0, fRInnerMin, fRInnerMax, a0 - da, a0 + da );
290 fCrown.DrawCrown( 0, 0, fROuterMin, fROuterMax, a0 - da, a0 + da );
291 //fCrown.DrawCrown(0,0, slice->Param().RMin(),slice->Param().RMax(), a0-da, a0+da );
293 fLine.SetLineColor( kBlack );
297 double cz = .5 * ( slice->Param().ZMax() + slice->Param().ZMin() );
298 double dz = .5 * ( slice->Param().ZMax() - slice->Param().ZMin() ) * 1.2;
299 //fLine.DrawLine(cz+dz, cy-dr, cz+dz, cy+dr );
300 if ( fSliceView ) fLatex.DrawLatex( cz - dz + dz*.05, cy - dr + dr*.05, Form( "ZX, Slice %2i", slice->Param().ISlice() ) );
303 fLine.SetLineWidth( 1 );
304 fLine.SetLineColor( kBlack );
305 SetSliceTransform( fSlice );
306 for ( int iRow = 0; iRow < fSlice->Param().NRows(); iRow++ ) {
307 double x = fSlice->Row( iRow ).X();
308 double y = fSlice->Row( iRow ).MaxY();
309 double vx0, vy0, vx1, vy1;
310 Slice2View( x, y, &vx0, &vy0 );
311 Slice2View( x, -y, &vx1, &vy1 );
313 fLine.DrawLine( vx0, vy0, vx1, vy1 );
315 fLine.DrawLine( fTPCZMin, vy0, fTPCZMax, vy1 );
322 void AliHLTTPCCADisplay::Set2Slices( AliHLTTPCCATracker * const slice )
324 //* Set view for two neighbouring slices
328 fCos = TMath::Cos( TMath::Pi() / 2 - ( slice->Param().Alpha() + 10. / 180.*TMath::Pi() ) );
329 fSin = TMath::Sin( TMath::Pi() / 2 - ( slice->Param().Alpha() + 10. / 180.*TMath::Pi() ) );
330 fZMin = slice->Param().ZMin();
331 fZMax = slice->Param().ZMax();
333 double r0 = .5 * ( slice->Param().RMax() + slice->Param().RMin() );
334 double dr = .5 * ( slice->Param().RMax() - slice->Param().RMin() );
337 fYX->Range( cx - 1.3*dr, cy - 1.1*dr, cx + 1.3*dr, cy + 1.1*dr );
339 int islice = slice->Param().ISlice();
340 int jslice = slice->Param().ISlice() + 1;
341 if ( islice == 17 ) jslice = 0;
342 else if ( islice == 35 ) jslice = 18;
343 fLatex.DrawLatex( cx - 1.3*dr + 1.3*dr*.05, cy - dr + dr*.05, Form( "YX, Slices %2i/%2i", islice, jslice ) );
344 double cz = .5 * ( slice->Param().ZMax() + slice->Param().ZMin() );
345 double dz = .5 * ( slice->Param().ZMax() - slice->Param().ZMin() ) * 1.2;
346 fZX->Range( cz - dz, cy - 1.1*dr, cz + dz, cy + 1.1*dr );//+dr);
348 fLatex.DrawLatex( cz - dz + dz*.05, cy - dr + dr*.05, Form( "ZX, Slices %2i/%2i", islice, jslice ) );
351 int AliHLTTPCCADisplay::GetColor( int i ) const
353 // Get color with respect to Z coordinate
354 const Color_t kMyColor[9] = { kGreen, kBlue, kYellow, kCyan, kOrange,
355 kSpring, kTeal, kAzure, kViolet
358 if ( i == 0 ) return kBlack;
359 return kMyColor[( i-1 )%9];
362 int AliHLTTPCCADisplay::GetColorZ( double z ) const
364 // Get color with respect to Z coordinate
365 const Color_t kMyColor[11] = { kGreen, kBlue, kYellow, kMagenta, kCyan,
366 kOrange, kSpring, kTeal, kAzure, kViolet, kPink
369 double zz = ( z - fZMin ) / ( fZMax - fZMin );
370 int iz = ( int ) ( zz * 11 );
371 if ( iz < 0 ) iz = 0;
372 if ( iz > 10 ) iz = 10;
376 int AliHLTTPCCADisplay::GetColorY( double y ) const
378 // Get color with respect to Z coordinate
379 const Color_t kMyColor[11] = { kGreen, kBlue, kYellow, kMagenta, kCyan,
380 kOrange, kSpring, kTeal, kAzure, kViolet, kPink
383 double yy = ( y - fYMin ) / ( fYMax - fYMin );
384 int iy = ( int ) ( yy * 11 );
385 if ( iy < 0 ) iy = 0;
386 if ( iy > 10 ) iy = 10;
390 int AliHLTTPCCADisplay::GetColorK( double k ) const
392 // Get color with respect to Z coordinate
393 const Color_t kMyColor[11] = { kRed, kBlue, kYellow, kMagenta, kCyan,
394 kOrange, kSpring, kTeal, kAzure, kViolet, kPink
396 const double kCLight = 0.000299792458;
397 const double kBz = 5;
399 if ( TMath::Abs( kBz ) > 1.e-4 ) k2QPt = 1. / ( kBz * kCLight );
400 double qPt = k * k2QPt;
402 if ( TMath::Abs( qPt ) > 1.e-4 ) pt = 1. / TMath::Abs( qPt );
404 double yy = ( pt - 0.1 ) / ( 1. - 0.1 );
405 int iy = ( int ) ( yy * 11 );
406 if ( iy < 0 ) iy = 0;
407 if ( iy > 10 ) iy = 10;
411 void AliHLTTPCCADisplay::Global2View( double x, double y, double *xv, double *yv ) const
413 // convert coordinates global->view
414 *xv = x * fCos + y * fSin;
415 *yv = y * fCos - x * fSin;
419 void AliHLTTPCCADisplay::Slice2View( double x, double y, double *xv, double *yv ) const
421 // convert coordinates slice->view
422 double xg = x * fSliceCos - y * fSliceSin;
423 double yg = y * fSliceCos + x * fSliceSin;
424 *xv = xg * fCos - yg * fSin;
425 *yv = yg * fCos + xg * fSin;
429 void AliHLTTPCCADisplay::DrawGBHit( AliHLTTPCCAGBTracker &tracker, int iHit, int color, Size_t width )
432 AliHLTTPCCAGBHit &h = tracker.Hits()[iHit];
433 AliHLTTPCCATracker &slice = tracker.Slices()[h.ISlice()];
434 SetSliceTransform( &slice );
438 int lab = fPerf->HitLabels()[h.ID()].fLab[0];
439 color = GetColor( lab + 1 );
441 AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
442 if ( mc.P() >= 1. ) color = kRed;
443 else if ( fDrawOnlyRef ) return;
445 } else color = GetColorZ( h.Z() );
447 if ( width > 0 )fMarker.SetMarkerSize( width );
448 else fMarker.SetMarkerSize( .3 );
449 fMarker.SetMarkerColor( color );
451 Slice2View( h.X(), h.Y(), &vx, &vy );
454 fMarker.DrawMarker( vx, vy );
456 fMarker.DrawMarker( h.Z(), vy );
459 void AliHLTTPCCADisplay::DrawGBHits( AliHLTTPCCAGBTracker &tracker, int color, Size_t width )
463 if ( !fPerf ) return;
464 if ( width < 0 ) width = .3;
466 for ( int iHit = 0; iHit < tracker.NHits(); iHit++ ) {
467 AliHLTTPCCAGBHit &h = tracker.Hits()[iHit];
468 int imc = fPerf->HitLabels()[h.ID()].fLab[0];
469 AliHLTTPCCAMCTrack *mc = ( imc >= 0 ) ? &( fPerf->MCTracks()[imc] ) : 0;
470 if ( fDrawOnlyRef && ( !mc || ( mc->P() < 1 ) ) ) continue;
473 col = GetColor( imc + 1 ) ;
474 if ( mc && ( mc->P() >= 1. ) ) col = kRed;
477 AliHLTTPCCATracker &slice = tracker.Slices()[h.ISlice()];
478 SetSliceTransform( &slice );
480 fMarker.SetMarkerSize( width );
481 fMarker.SetMarkerColor( col );
483 Slice2View( h.X(), h.Y(), &vx, &vy );
486 fMarker.DrawMarker( vx, vy );
488 fMarker.DrawMarker( h.Z(), vy );
492 void AliHLTTPCCADisplay::DrawSliceHit( int iRow, int iHit, int color, Size_t width )
495 if ( !fSlice ) return;
496 const AliHLTTPCCARow &row = fSlice->Row( iRow );
497 float y0 = row.Grid().YMin();
498 float z0 = row.Grid().ZMin();
499 float stepY = row.HstepY();
500 float stepZ = row.HstepZ();
501 const uint4* tmpint4 = fSlice->RowData() + row.FullOffset();
502 const ushort2 *hits = reinterpret_cast<const ushort2*>( tmpint4 );
503 ushort2 hh = hits[iHit];
505 float y = y0 + hh.x * stepY;
506 float z = z0 + hh.y * stepZ;
508 SetSliceTransform( fSlice );
511 if ( fPerf && fGB ) {
512 int id = fGB->FirstSliceHit()[fSlice->Param().ISlice()] + fSlice->HitInputIDs()[row.FirstHit()+iHit];
513 AliHLTTPCCAGBHit &h = fGB->Hits()[id];
514 int lab = fPerf->HitLabels()[h.ID()].fLab[0];
515 color = GetColor( lab + 1 );
517 AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
518 if ( mc.P() >= 1. ) color = kRed;
519 else if ( fDrawOnlyRef ) return;
521 } else color = GetColorZ( z );
523 if ( width > 0 )fMarker.SetMarkerSize( width );
524 else fMarker.SetMarkerSize( .3 );
525 fMarker.SetMarkerColor( color );
527 Slice2View( x, y, &vx, &vy );
529 fMarker.DrawMarker( vx, vy );
531 fMarker.DrawMarker( z, vy );
534 void AliHLTTPCCADisplay::DrawSliceHits( int color, Size_t width )
539 for ( int iRow = 0; iRow < fSlice->Param().NRows(); iRow++ ) {
540 const AliHLTTPCCARow &row = fSlice->Row( iRow );
541 for ( int ih = 0; ih < row.NHits(); ih++ ) {
542 DrawSliceHit( iRow, ih, color, width );
548 void AliHLTTPCCADisplay::DrawSliceLink( int iRow, int iHit, int colorUp, int colorDn, int width )
550 // draw link between clusters
552 if ( !fPerf || !fGB ) return;
553 AliHLTTPCCAGBTracker &tracker = *fGB;
554 if ( width < 0 ) width = 1.;
555 fLine.SetLineWidth( width );
556 int colUp = colorUp >= 0 ? colorUp : kMagenta;
557 int colDn = colorDn >= 0 ? colorDn : kBlack;
558 if ( iRow < 1 || iRow >= fSlice->Param().NRows() - 1 ) return;
560 const AliHLTTPCCARow& row = fSlice->Row( iRow );
561 const AliHLTTPCCARow& rowUp = fSlice->Row( iRow + 1 );
562 const AliHLTTPCCARow& rowDn = fSlice->Row( iRow - 1 );
564 int id = fSlice->HitInputIDs()[row.FirstHit()+iHit];
565 AliHLTTPCCAGBHit &h = tracker.Hits()[tracker.FirstSliceHit()[fSlice->Param().ISlice()] + id];
566 short iUp = ( ( short* )( fSlice->RowData() + row.FullOffset() ) )[row.FullLinkOffset()+iHit];
567 short iDn = ( ( short* )( fSlice->RowData() + row.FullOffset() ) )[row.FullLinkOffset()+row.NHits()+iHit];
570 int id1 = fSlice->HitInputIDs()[rowUp.FirstHit()+iUp];
571 AliHLTTPCCAGBHit &h1 = tracker.Hits()[tracker.FirstSliceHit()[fSlice->Param().ISlice()] + id1];
572 double vx, vy, vx1, vy1;
573 Slice2View( h.X(), h.Y(), &vx, &vy );
574 Slice2View( h1.X(), h1.Y(), &vx1, &vy1 );
575 fLine.SetLineColor( colUp );
577 fLine.DrawLine( vx - .1, vy, vx1 - .1, vy1 );
579 fLine.DrawLine( h.Z() - 1., vy, h1.Z() - 1., vy1 );
582 int id1 = fSlice->HitInputIDs()[rowDn.FirstHit()+iDn];
583 AliHLTTPCCAGBHit &h1 = tracker.Hits()[tracker.FirstSliceHit()[fSlice->Param().ISlice()] + id1];
584 double vx, vy, vx1, vy1;
585 Slice2View( h.X(), h.Y(), &vx, &vy );
586 Slice2View( h1.X(), h1.Y(), &vx1, &vy1 );
587 fLine.SetLineColor( colDn );
589 fLine.DrawLine( vx + .1, vy, vx1 + .1, vy1 );
591 fLine.DrawLine( h.Z() + 1., vy, h1.Z() + 1., vy1 );
596 void AliHLTTPCCADisplay::DrawSliceLinks( int colorUp, int colorDn, int width )
598 // draw links between clusters
600 for ( int iRow = 1; iRow < fSlice->Param().NRows() - 1; iRow++ ) {
601 const AliHLTTPCCARow& row = fSlice->Row( iRow );
602 for ( int ih = 0; ih < row.NHits(); ih++ ) {
603 DrawSliceLink( iRow, ih, colorUp, colorDn, width );
610 int AliHLTTPCCADisplay::GetTrackMC( const AliHLTTPCCADisplayTmpHit *vHits, int NHits )
612 // get MC label for the track
614 AliHLTTPCCAGBTracker &tracker = *fGB;
618 int *lb = new int[NHits*3];
620 //std::cout<<"\n\nTrack hits mc: "<<std::endl;
621 for ( int ihit = 0; ihit < NHits; ihit++ ) {
622 AliHLTTPCCAGBHit &h = tracker.Hits()[vHits[ihit].ID()];
623 AliHLTTPCCAPerformance::AliHLTTPCCAHitLabel &l = fPerf->HitLabels()[h.ID()];
624 if ( l.fLab[0] >= 0 ) lb[nla++] = l.fLab[0];
625 if ( l.fLab[1] >= 0 ) lb[nla++] = l.fLab[1];
626 if ( l.fLab[2] >= 0 ) lb[nla++] = l.fLab[2];
627 //std::cout<<ihit<<": "<<l.fLab[0]<<" "<<l.fLab[1]<<" "<<l.fLab[2]<<std::endl;
629 sort( lb, lb + nla );
630 int labmax = -1, labcur = -1, lmax = 0, lcurr = 0, nh = 0;
631 //std::cout<<"MC track IDs :"<<std::endl;
632 for ( int i = 0; i < nla; i++ ) {
633 if ( lb[i] != labcur ) {
634 if ( 0 && i > 0 && lb[i-1] >= 0 ) {
635 AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lb[i-1]];
636 std::cout << lb[i-1] << ": nhits=" << nh << ", pdg=" << mc.PDG() << ", Pt=" << mc.Pt() << ", P=" << mc.P()
637 << ", par=" << mc.Par()[0] << " " << mc.Par()[1] << " " << mc.Par()[2]
638 << " " << mc.Par()[3] << " " << mc.Par()[4] << " " << mc.Par()[5] << " " << mc.Par()[6] << std::endl;
642 if ( labcur >= 0 && lmax < lcurr ) {
652 if ( 0 && nla - 1 > 0 && lb[nla-1] >= 0 ) {
653 AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lb[nla-1]];
654 std::cout << lb[nla-1] << ": nhits=" << nh << ", pdg=" << mc.PDG() << ", Pt=" << mc.Pt() << ", P=" << mc.P()
655 << ", par=" << mc.Par()[0] << " " << mc.Par()[1] << " " << mc.Par()[2]
656 << " " << mc.Par()[3] << " " << mc.Par()[4] << " " << mc.Par()[5] << " " << mc.Par()[6] << std::endl;
659 if ( labcur >= 0 && lmax < lcurr ) {
664 for ( int ihit = 0; ihit < NHits; ihit++ ) {
665 AliHLTTPCCAGBHit &h = tracker.Hits()[vHits[ihit].ID()];
666 AliHLTTPCCAPerformance::AliHLTTPCCAHitLabel &l = fPerf->HitLabels()[h.ID()];
667 if ( l.fLab[0] == labmax || l.fLab[1] == labmax || l.fLab[2] == labmax
671 purity = ( ( NHits > 0 ) ? double( lmax ) / double( NHits ) : 0 );
672 if ( lb ) delete[] lb;
673 if ( purity < .9 ) label = -1;
677 bool AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrackParam t, double Alpha, const AliHLTTPCCADisplayTmpHit *vHits,
678 int NHits, int color, int width, bool pPoint )
682 if ( NHits < 2 ) return 0;
684 AliHLTTPCCAGBTracker &tracker = *fGB;
685 if ( width < 0 ) width = 2;
687 if ( fDrawOnlyRef ) {
688 int lab = GetTrackMC( vHits, NHits );
689 if ( lab < 0 ) return 0;
690 AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
691 if ( mc.P() < 1 ) return 0;
695 //color = GetColorZ( (vz[0]+vz[mHits-1])/2. );
696 //color = GetColorK(t.GetKappa());
697 int lab = GetTrackMC( vHits, NHits );
698 color = GetColor( lab + 1 );
700 AliHLTTPCCAMCTrack &mc = fPerf->MCTracks()[lab];
701 if ( mc.P() >= 1. ) color = kRed;
705 if ( t.SinPhi() > .999 ) t.SetSinPhi( .999 );
706 else if ( t.SinPhi() < -.999 ) t.SetSinPhi( -.999 );
708 // int iSlice = fSlice->Param().ISlice();
710 //sort(vHits, vHits + NHits, AliHLTTPCCADisplayTmpHit::CompareHitZ );
712 double vx[2000], vy[2000], vz[2000];
716 double alpha = ( TMath::Abs( Alpha + 1 ) < 1.e-4 ) ? fSlice->Param().Alpha() : Alpha;
717 AliHLTTPCCATrackParam tt = t;
719 for ( int iHit = 0; iHit < NHits; iHit++ ) {
721 AliHLTTPCCAGBHit &h = tracker.Hits()[vHits[iHit].ID()];
723 double hCos = TMath::Cos( alpha - tracker.Slices()[h.ISlice()].Param().Alpha() );
724 double hSin = TMath::Sin( alpha - tracker.Slices()[h.ISlice()].Param().Alpha() );
725 double x0 = h.X(), y0 = h.Y(), z1 = h.Z();
726 double x1 = x0 * hCos + y0 * hSin;
727 double y1 = y0 * hCos - x0 * hSin;
730 double dx = x1 - tt.X();
731 double dy = y1 - tt.Y();
732 if ( dx*dx + dy*dy > 1. ) {
733 double dalpha = TMath::ATan2( dy, dx );
734 if ( tt.Rotate( dalpha ) ) {
736 hCos = TMath::Cos( alpha - tracker.Slices()[h.ISlice()].Param().Alpha() );
737 hSin = TMath::Sin( alpha - tracker.Slices()[h.ISlice()].Param().Alpha() );
738 x1 = x0 * hCos + y0 * hSin;
739 y1 = y0 * hCos - x0 * hSin;
743 SetSliceTransform( alpha );
745 //t.GetDCAPoint( x1, y1, z1, x1, y1, z1 );
746 std::cout << "mark 3" << std::endl;
747 bool ok = tt.TransportToX( x1, .999 );
748 std::cout << "mark 4" << std::endl;
755 Slice2View( x1, y1, &x1, &y1 );
760 for ( int j = 0; j < 0; j++ ) {
761 x0 = h.X() + j; y0 = h.Y(); z1 = h.Z();
762 x1 = x0 * hCos + y0 * hSin;
763 y1 = y0 * hCos - x0 * hSin;
764 ok = tt.TransportToX( x1, .999 );
771 Slice2View( x1, y1, &x1, &y1 );
779 double x1 = t.X(), y1 = t.Y(), z1 = t.Z();
780 double a = ( TMath::Abs( Alpha + 1 ) < 1.e-4 ) ? fSlice->Param().Alpha() : Alpha;
781 SetSliceTransform( a );
783 Slice2View( x1, y1, &x1, &y1 );
784 double dx = x1 - vx[0];
785 double dy = y1 - vy[0];
786 //std::cout<<x1<<" "<<y1<<" "<<vx[0]<<" "<<vy[0]<<" "<<dx<<" "<<dy<<std::endl;
787 double d0 = dx * dx + dy * dy;
788 dx = x1 - vx[mHits-1];
789 dy = y1 - vy[mHits-1];
790 //std::cout<<x1<<" "<<y1<<" "<<vx[mHits-1]<<" "<<vy[mHits-1]<<" "<<dx<<" "<<dy<<std::endl;
791 double d1 = dx * dx + dy * dy;
792 //std::cout<<"d0, d1="<<d0<<" "<<d1<<std::endl;
799 for ( int i = mHits; i > 0; i-- ) {
812 fLine.SetLineColor( color );
813 fLine.SetLineWidth( width );
814 fArc.SetFillStyle( 0 );
815 fArc.SetLineColor( color );
816 fArc.SetLineWidth( width );
818 pl.SetLineColor( color );
819 pl.SetLineWidth( width );
821 plZ.SetLineColor( color );
822 plZ.SetLineWidth( width );
824 fMarker.SetMarkerSize( width / 2. );
825 fMarker.SetMarkerColor( color );
828 pl.DrawPolyLine( mHits, vx, vy );
830 fMarker.DrawMarker( vx[0], vy[0] );
831 fMarker.DrawMarker( vx[mHits-1], vy[mHits-1] );
834 plZ.DrawPolyLine( mHits, vz, vy );
835 fMarker.DrawMarker( vz[0], vy[0] );
836 fMarker.DrawMarker( vz[mHits-1], vy[mHits-1] );
838 fLine.SetLineWidth( 1 );
843 bool AliHLTTPCCADisplay::DrawTracklet( AliHLTTPCCATrackParam &track, const int *hitstore, int color, int width, bool pPoint )
846 AliHLTTPCCAGBTracker &tracker = *fGB;
847 AliHLTTPCCADisplayTmpHit vHits[200];
849 for ( int iRow = 0; iRow < fSlice->Param().NRows(); iRow++ ) {
850 int iHit = hitstore[iRow];
851 if ( iHit < 0 ) continue;
852 const AliHLTTPCCARow &row = fSlice->Row( iRow );
853 int id = fSlice->HitInputIDs()[row.FirstHit()+iHit];
854 int iGBHit = tracker.FirstSliceHit()[fSlice->Param().ISlice()] + id;
855 AliHLTTPCCAGBHit &h = tracker.Hits()[iGBHit];
856 vHits[nHits].SetID( iGBHit );
857 vHits[nHits].SetS( 0 );
858 vHits[nHits].SetZ( h.Z() );
861 return DrawTrack( track, -1, vHits, nHits, color, width, pPoint );
865 void AliHLTTPCCADisplay::DrawSliceOutTrack( AliHLTTPCCATrackParam &t, double alpha, int itr, int color, int width )
869 AliHLTTPCCAOutTrack &track = fSlice->OutTracks()[itr];
870 if ( track.NHits() < 2 ) return;
872 AliHLTTPCCAGBTracker &tracker = *fGB;
873 AliHLTTPCCADisplayTmpHit vHits[200];
875 for ( int ih = 0; ih < track.NHits(); ih++ ) {
876 int id = tracker.FirstSliceHit()[fSlice->Param().ISlice()] + fSlice->OutTrackHits()[track.FirstHitRef()+ih];
877 AliHLTTPCCAGBHit &h = tracker.Hits()[id];
878 vHits[ih].SetID( id );
880 vHits[ih].SetZ( h.Z() );
883 DrawTrack( t, alpha, vHits, track.NHits(), color, width, 1 );
886 void AliHLTTPCCADisplay::DrawSliceOutTrack( int itr, int color, int width )
890 AliHLTTPCCAOutTrack &track = fSlice->OutTracks()[itr];
891 if ( track.NHits() < 2 ) return;
893 AliHLTTPCCAGBTracker &tracker = *fGB;
894 AliHLTTPCCADisplayTmpHit vHits[200];
896 for ( int ih = 0; ih < track.NHits(); ih++ ) {
897 int id = tracker.FirstSliceHit()[fSlice->Param().ISlice()] + fSlice->OutTrackHits()[track.FirstHitRef()+ih];
898 AliHLTTPCCAGBHit &h = tracker.Hits()[id];
899 vHits[ih].SetID( id );
901 vHits[ih].SetZ( h.Z() );
904 DrawTrack( track.StartPoint(), -1, vHits, track.NHits(), color, width );
908 void AliHLTTPCCADisplay::DrawSliceTrack( int itr, int color )
912 AliHLTTPCCATrack &track = fSlice->Tracks()[itr];
913 if ( track.NHits() < 2 ) return;
915 AliHLTTPCCAGBTracker &tracker = *fGB;
916 AliHLTTPCCADisplayTmpHit vHits[200];
917 for ( int ith = 0; ith < track.NHits(); ith++ ) {
918 int ic = ( fSlice->TrackHits()[track.FirstHitID()+ith] );
919 const AliHLTTPCCARow &row = fSlice->ID2Row( ic );
920 int ih = fSlice->ID2IHit( ic );
921 int id = fSlice->HitInputIDs()[row.FirstHit()+ih];
922 int gbID = tracker.FirstSliceHit()[fSlice->Param().ISlice()] + id;
923 AliHLTTPCCAGBHit &h = tracker.Hits()[gbID];
924 vHits[ith].SetID( gbID );
925 vHits[ith].SetS( 0 );
926 vHits[ith].SetZ( h.Z() );
929 DrawTrack( track.Param(), -1, vHits, track.NHits(), color, -1 );
930 //track.Param().Print();
934 void AliHLTTPCCADisplay::DrawGBTrack( int itr, int color, int width )
938 AliHLTTPCCAGBTracker &tracker = *fGB;
939 AliHLTTPCCADisplayTmpHit vHits[1000];
941 AliHLTTPCCAGBTrack &track = tracker.Tracks()[itr];
942 if ( track.NHits() < 2 ) return;
944 for ( int ih = 0; ih < track.NHits(); ih++ ) {
945 int i = tracker.TrackHits()[ track.FirstHitRef() + ih];
946 AliHLTTPCCAGBHit &h = tracker.Hits()[i];
947 vHits[ih].SetID( i );
949 vHits[ih].SetZ( h.Z() );
952 DrawTrack( track.Param(), track.Alpha(), vHits, track.NHits(), color, width );
956 void AliHLTTPCCADisplay::DrawGBTrackFast( AliHLTTPCCAGBTracker &tracker, int itr, int color )
960 AliHLTTPCCAGBTrack &track = tracker.Tracks()[itr];
961 if ( track.NHits() < 2 ) return;
964 AliHLTTPCCADisplayTmpHit *vHits = new AliHLTTPCCADisplayTmpHit[track.NHits()];
965 AliHLTTPCCATrackParam t = track.Param();
967 for ( int ih = 0; ih < track.NHits(); ih++ ) {
968 int i = tracker.TrackHits()[ track.FirstHitRef() + ih];
969 AliHLTTPCCAGBHit *h = &( tracker.Hits()[i] );
970 vHits[ih].SetID( i );
972 vHits[ih].SetZ( h->Z() );
975 sort( vHits, vHits + track.NHits(), AliHLTTPCCADisplayTmpHit::CompareHitZ );
978 AliHLTTPCCAGBHit &h1 = tracker.Hits()[ vHits[0].ID()];
979 AliHLTTPCCAGBHit &h2 = tracker.Hits()[ vHits[track.NHits()-1].ID()];
980 if ( color < 0 ) color = GetColorZ( ( h1.Z() + h2.Z() ) / 2. );
981 double gx1, gy1, gx2, gy2;
982 Slice2View( h1.X(), h1.Y(), &gx1, &gy1 );
983 Slice2View( h2.X(), h2.Y(), &gx2, &gy2 );
984 if ( colorY < 0 ) colorY = GetColorY( ( gy1 + gy2 ) / 2. );
985 color = colorY = GetColorK( t.GetQPt() );
988 fMarker.SetMarkerColor( color );//kBlue);
989 fMarker.SetMarkerSize( 1. );
990 fLine.SetLineColor( color );
991 fLine.SetLineWidth( width );
992 fArc.SetFillStyle( 0 );
993 fArc.SetLineColor( color );
994 fArc.SetLineWidth( width );
996 pl.SetLineColor( colorY );
997 pl.SetLineWidth( width );
1000 double alpha = track.Alpha();
1004 AliHLTTPCCAGBHit &h1 = tracker.Hits()[vHits[0].ID()];
1005 AliHLTTPCCAGBHit &h2 = tracker.Hits()[vHits[track.NHits()-1].ID()];
1006 float x1, y1, z1, x2, y2, z2;
1007 double vx1, vy1, vx2, vy2;
1009 if ( h1.ISlice() != oldSlice ) {
1010 t.Rotate( tracker.Slices()[h1.ISlice()].Param().Alpha() - alpha );
1011 oldSlice = h1.ISlice();
1012 alpha = tracker.Slices()[h1.ISlice()].Param().Alpha();
1013 SetSliceTransform( &( tracker.Slices()[oldSlice] ) );
1015 t.GetDCAPoint( h1.X(), h1.Y(), h1.Z(), x1, y1, z1, fSlice->Param().Bz() );
1016 Slice2View( x1, y1, &vx1, &vy1 );
1018 if ( h2.ISlice() != oldSlice ) {
1019 t.Rotate( tracker.Slices()[h2.ISlice()].Param().Alpha() - alpha );
1020 oldSlice = h2.ISlice();
1021 alpha = tracker.Slices()[h2.ISlice()].Param().Alpha();
1022 SetSliceTransform( &( tracker.Slices()[oldSlice] ) );
1024 t.GetDCAPoint( h2.X(), h2.Y(), h2.Z(), x2, y2, z2, fSlice->Param().Bz() );
1025 Slice2View( x2, y2, &vx2, &vy2 );
1027 double x0 = t.GetX();
1028 double y0 = t.GetY();
1029 double sinPhi = t.GetSinPhi();
1030 double k = t.GetKappa( fSlice->Param().Bz() );
1031 double ex = t.GetCosPhi();
1034 if ( TMath::Abs( k ) > 1.e-4 ) {
1038 double r = 1 / TMath::Abs( k );
1039 double xc = x0 - ey * ( 1 / k );
1040 double yc = y0 + ex * ( 1 / k );
1043 Slice2View( xc, yc, &vx, &vy );
1045 double a1 = TMath::ATan2( vy1 - vy, vx1 - vx ) / TMath::Pi() * 180.;
1046 double a2 = TMath::ATan2( vy2 - vy, vx2 - vx ) / TMath::Pi() * 180.;
1047 if ( a1 < 0 ) a1 += 360;
1048 if ( a2 < 0 ) a2 += 360;
1049 if ( a2 < a1 ) a2 += 360;
1050 double da = TMath::Abs( a2 - a1 );
1051 if ( da > 360 ) da -= 360;
1056 if ( a2 < a1 ) a2 += 360;
1058 fArc.DrawArc( vx, vy, r, a1, a2, "only" );
1059 //fArc.DrawArc(vx,vy,r, 0,360,"only");
1062 fLine.DrawLine( vx1, vy1, vx2, vy2 );
1067 double py[track.NHits()], pz[track.NHits()];
1069 for ( int iHit = 0; iHit < track.NHits(); iHit++ ) {
1071 AliHLTTPCCAGBHit &h1 = tracker.Hits()[vHits[iHit].ID()];
1074 if ( h1.ISlice() != oldSlice ) {
1075 t.Rotate( tracker.Slices()[h1.ISlice()].Param().Alpha() - alpha );
1076 oldSlice = h1.ISlice();
1077 alpha = tracker.Slices()[h1.ISlice()].Param().Alpha();
1078 SetSliceTransform( &( tracker.Slices()[oldSlice] ) );
1080 t.GetDCAPoint( h1.X(), h1.Y(), h1.Z(), x1, y1, z1, fSlice->Param().Bz() );
1081 Slice2View( x1, y1, &vx1, &vy1 );
1088 pl.DrawPolyLine( track.NHits(), pz, py );
1090 fLine.SetLineWidth( 1 );
1103 void AliHLTTPCCADisplay::DrawMergedHit( int iRow, int iHit, int color )
1105 // connect two cells on display
1109 const AliHLTTPCCARow &row = fSlice->Row( iRow );
1110 AliHLTTPCCAHit &h = row.Hits()[iHit];
1111 AliHLTTPCCAHit &hyz = row.HitsYZ()[iHit];
1116 double x1 = x, x2 = x;
1117 double y1 = y, y2 = y;
1118 double z1 = z, z2 = z;
1119 int iRow1 = iRow, iHit1 = iHit;
1120 int iRow2 = iRow, iHit2 = iHit;
1122 if ( fSlice->HitLinksDown()[] >= 0 ) {
1124 iHit1 = h.LinkDown();
1125 AliHLTTPCCARow &row1 = fSlice->Rows()[iRow1];
1126 AliHLTTPCCAHitYZ &h1 = row1.HitsYZ()[iHit1];
1131 if ( h.LinkUp() >= 0 ) {
1134 AliHLTTPCCARow &row2 = fSlice->Rows()[iRow2];
1135 AliHLTTPCCAHitYZ &h2 = row2.HitsYZ()[iHit2];
1140 if ( color < 0 ) color = GetColorZ( ( z + z1 + z2 ) / 3. );
1143 Slice2View( x, y, &x, &y );
1144 Slice2View( x1, y1, &x1, &y1 );
1145 Slice2View( x2, y2, &x2, &y2 );
1147 double lx[] = { x1, x, x2 };
1148 double ly[] = { y1, y, y2 };
1149 double lz[] = { z1, z, z2 };
1151 fPLine.SetLineColor( color );
1152 fPLine.SetLineWidth( 1 );
1153 //fPLine.SetFillColor(color);
1154 fPLine.SetFillStyle( -1 );
1157 fPLine.DrawPolyLine( 3, lx, ly );
1159 fPLine.DrawPolyLine( 3, lz, ly );
1160 DrawHit( iRow, iHit, color );
1161 DrawHit( iRow1, iHit1, color );
1162 DrawHit( iRow2, iHit2, color );
1167 void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, int color, bool DrawHits )
1171 if ( track.NHits() < 2 ) return;
1174 AliHLTTPCCADisplayTmpHit *vHits = new AliHLTTPCCADisplayTmpHit[track.NHits()];
1175 AliHLTTPCCATrackParam &t = track.Param();
1177 int iID = track.FirstHitID();
1181 for ( int ih = 0; ih < track.NHits(); ih++ ) {
1182 int i = fSlice->TrackHits()[iID];
1183 AliHLTTPCCAHit *h = &( fSlice->ID2Hit( i ) );
1184 AliHLTTPCCARow &row = fSlice->ID2Row( i );
1185 vHits[iHit].ID() = i;
1186 vHits[iHit].S() = t.GetS( row.X(), h->Y() );
1187 vHits[iHit].Z() = h->Z();
1193 sort( vHits, vHits + track.NHits(), AliHLTTPCCADisplayTmpHit::CompareHitZ );
1194 //cout<<"Draw track, nhits = "<<nhits<<endl;
1196 AliHLTTPCCAHit &c1 = fSlice->ID2Hit( vHits[0].ID() );
1197 AliHLTTPCCAHit &c2 = fSlice->ID2Hit( vHits[track.NHits()-1].ID() );
1198 if ( color < 0 ) color = GetColorZ( ( c1.Z() + c2.Z() ) / 2. );
1201 fMarker.SetMarkerColor( color );//kBlue);
1202 fMarker.SetMarkerSize( 1. );
1204 for( int i=0; i<3; i++){
1205 AliHLTTPCCAHit &c1 = fSlice->ID2Hit(track.HitID()[i]);
1206 AliHLTTPCCARow &row1 = fSlice->ID2Row(track.HitID()[i]);
1208 Slice2View(row1.X(), c1.Y(), &vx1, &vy1 );
1210 fMarker.DrawMarker(vx1,vy1);
1212 fMarker.DrawMarker(c1.Z(),vy1);
1216 //DrawTrackletPoint( fSlice->ID2Point(track.PointID()[0]).Param(), kBlack);//color );
1217 //DrawTrackletPoint( fSlice->ID2Point(track.PointID()[1]).Param(), kBlack);//color );
1218 //cout<<"DrawTrack end points x = "<<fSlice->ID2Point(track.PointID()[0]).Param().GetX()<<" "<<fSlice->ID2Point(track.PointID()[1]).Param().GetX()<<endl;
1219 for ( int iHit = 0; iHit < track.NHits() - 1; iHit++ ) {
1220 AliHLTTPCCAHit &c1 = fSlice->ID2Hit( vHits[iHit].ID() );
1221 AliHLTTPCCAHit &c2 = fSlice->ID2Hit( vHits[iHit+1].ID() );
1222 AliHLTTPCCARow &row1 = fSlice->ID2Row( vHits[iHit].ID() );
1223 AliHLTTPCCARow &row2 = fSlice->ID2Row( vHits[iHit+1].ID() );
1224 float x1, y1, z1, x2, y2, z2;
1225 t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1, fSlice->Param().Bz() );
1226 t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2, fSlice->Param().Bz() );
1228 //if( color<0 ) color = GetColorZ( (z1+z2)/2. );
1229 double vx1, vy1, vx2, vy2;
1230 Slice2View( x1, y1, &vx1, &vy1 );
1231 Slice2View( x2, y2, &vx2, &vy2 );
1233 fLine.SetLineColor( color );
1234 fLine.SetLineWidth( width );
1236 double x0 = t.GetX();
1237 double y0 = t.GetY();
1238 double sinPhi = t.GetSinPhi();
1239 double k = t.GetKappa();
1240 double ex = t.GetCosPhi();
1243 if ( TMath::Abs( k ) > 1.e-4 ) {
1245 fArc.SetFillStyle( 0 );
1246 fArc.SetLineColor( color );
1247 fArc.SetLineWidth( width );
1251 double r = 1 / TMath::Abs( k );
1252 double xc = x0 - ey * ( 1 / k );
1253 double yc = y0 + ex * ( 1 / k );
1256 Slice2View( xc, yc, &vx, &vy );
1258 double a1 = TMath::ATan2( vy1 - vy, vx1 - vx ) / TMath::Pi() * 180.;
1259 double a2 = TMath::ATan2( vy2 - vy, vx2 - vx ) / TMath::Pi() * 180.;
1260 if ( a1 < 0 ) a1 += 360;
1261 if ( a2 < 0 ) a2 += 360;
1262 if ( a2 < a1 ) a2 += 360;
1263 double da = TMath::Abs( a2 - a1 );
1264 if ( da > 360 ) da -= 360;
1269 if ( a2 < a1 ) a2 += 360;
1271 fArc.DrawArc( vx, vy, r, a1, a2, "only" );
1272 //fArc.DrawArc(vx,vy,r, 0,360,"only");
1275 fLine.DrawLine( vx1, vy1, vx2, vy2 );
1279 for ( int iHit = 0; iHit < track.NHits() - 1; iHit++ ) {
1280 AliHLTTPCCAHit &c1 = fSlice->ID2Hit( vHits[iHit].ID() );
1281 AliHLTTPCCAHit &c2 = fSlice->ID2Hit( vHits[iHit+1].ID() );
1282 AliHLTTPCCARow &row1 = fSlice->ID2Row( vHits[iHit].ID() );
1283 AliHLTTPCCARow &row2 = fSlice->ID2Row( vHits[iHit+1].ID() );
1285 //if( DrawHits ) ConnectHits( fSlice->ID2IRow(vHits[iHit].ID()),c1,
1286 //fSlice->ID2IRow(vHits[iHit+1].ID()),c2, color );
1287 float x1, y1, z1, x2, y2, z2;
1288 t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1, fSlice->Param().Bz() );
1289 t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2, fSlice->Param().Bz() );
1291 double vx1, vy1, vx2, vy2;
1292 Slice2View( x1, y1, &vx1, &vy1 );
1293 Slice2View( x2, y2, &vx2, &vy2 );
1295 fLine.SetLineColor( color );
1296 fLine.SetLineWidth( width );
1299 fLine.DrawLine( z1, vy1, z2, vy2 );
1301 fLine.SetLineWidth( 1 );
1306 void AliHLTTPCCADisplay::DrawTrackletPoint( AliHLTTPCCATrackParam &t, int color )
1308 // draw tracklet point
1310 double x = t.GetX();
1311 double y = t.GetY();
1312 double sinPhi = t.GetSinPhi();
1313 double z = t.GetZ();
1314 double dzds = t.GetDzDs();
1315 double ex = t.GetCosPhi();
1320 if ( color < 0 ) color = GetColorZ( t.GetZ() );
1322 fMarker.SetMarkerColor( color );
1323 fMarker.SetMarkerSize( .5 );
1324 fLine.SetLineWidth( width );
1325 fLine.SetLineColor( color );
1327 double vx, vy, vex, vey, vdx, vdy;
1328 double dz = TMath::Sqrt( t.GetErr2Z() );
1329 Slice2View( x, y, &vx, &vy );
1330 Slice2View( ex, ey, &vex, &vey );
1331 Slice2View( 0, TMath::Sqrt( t.GetErr2Y() )*3.5, &vdx, &vdy );
1332 double d = TMath::Sqrt( vex * vex + vey * vey );
1336 fMarker.DrawMarker( vx, vy );
1337 fLine.DrawLine( vx, vy, vx + vex*4, vy + vey*4 );
1338 fLine.DrawLine( vx - vdx, vy - vdy, vx + vdx, vy + vdy );
1340 fMarker.DrawMarker( z, vy );
1341 fLine.DrawLine( z, vy, z + dzds*4, vy + vey*4 );
1342 fLine.DrawLine( z - 3.5*dz, vy - vdy, z + 3.5*dz, vy + vdy );
1343 fLine.SetLineWidth( 1 );