]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCADisplay.cxx
Commit from Sergey:
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCADisplay.cxx
1 // $Id$
2 //***************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project          * 
4 // ALICE Experiment at CERN, All rights reserved.                           *
5 //                                                                          *
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.                              *
9 //                                                                          *
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.                    *
17 //***************************************************************************
18
19 #include "AliHLTTPCCADisplay.h"
20
21 #include "AliHLTTPCCATracker.h"
22 #include "AliHLTTPCCAEndPoint.h"
23 #include "AliHLTTPCCARow.h"
24 #include "AliHLTTPCCATrack.h"
25
26 //#include "TString.h"
27 #include "Riostream.h"
28 #include "TMath.h"
29 #include "TStyle.h"
30 #include "TCanvas.h"
31
32 ClassImp(AliHLTTPCCADisplay)
33
34 AliHLTTPCCADisplay &AliHLTTPCCADisplay::Instance()
35 {
36   // reference to static object
37   static AliHLTTPCCADisplay gAliHLTTPCCADisplay;
38   return gAliHLTTPCCADisplay; 
39 }
40
41 AliHLTTPCCADisplay::AliHLTTPCCADisplay() : TObject(), fYX(0), fZX(0), fAsk(1), fSliceView(1), fSlice(0), 
42                                            fCos(1), fSin(0), fZMin(-250), fZMax(250),fSliceCos(1), fSliceSin(0),
43                                            fRInnerMin(83.65), fRInnerMax(133.3), fROuterMin(133.5), fROuterMax(247.7),
44                                            fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex()
45 {
46   // constructor
47
48
49
50 AliHLTTPCCADisplay::AliHLTTPCCADisplay( const AliHLTTPCCADisplay& ) 
51   : TObject(), fYX(0), fZX(0), fAsk(1), fSliceView(1), fSlice(0), 
52     fCos(1), fSin(0), fZMin(-250), fZMax(250),fSliceCos(1), fSliceSin(0),
53     fRInnerMin(83.65), fRInnerMax(133.3), fROuterMin(133.5), fROuterMax(247.7),
54     fTPCZMin(-250.), fTPCZMax(250), fArc(), fLine(), fPLine(), fMarker(), fBox(), fCrown(), fLatex()
55 {
56   // dummy
57 }
58
59 AliHLTTPCCADisplay& AliHLTTPCCADisplay::operator=( const AliHLTTPCCADisplay& )
60 {
61   // dummy
62   return *this;
63 }
64  
65 AliHLTTPCCADisplay::~AliHLTTPCCADisplay()
66 {
67   // destructor
68   delete fYX; 
69   delete fZX;
70 }
71
72 void AliHLTTPCCADisplay::Init()
73 {
74   // initialization
75   gStyle->SetCanvasBorderMode(0);
76   gStyle->SetCanvasBorderSize(1);
77   gStyle->SetCanvasColor(0);
78   fYX = new TCanvas ("YX", "YX window", -1, 0, 600, 600);
79   fZX = new TCanvas ("ZX", "ZX window", -610, 0, 590, 600);  
80   fMarker = TMarker(0.0, 0.0, 20);//6);
81 }
82
83 void AliHLTTPCCADisplay::Update()
84 {
85   // update windows
86   if( !fAsk ) return;
87   fYX->Update();
88   fZX->Update();
89 }
90
91 void AliHLTTPCCADisplay::ClearView()
92 {
93   // clear windows
94   fYX->Clear();
95   fZX->Clear();
96 }
97
98 void AliHLTTPCCADisplay::Ask()
99 {
100   // whait for the pressed key, when "r" pressed, don't ask anymore
101   char symbol;
102   if (fAsk){
103     Update();
104     std::cout<<"ask> "<<std::endl;
105     do{
106       std::cin.get(symbol);
107       if (symbol == 'r')
108         fAsk = false;
109     } while (symbol != '\n');
110   }
111 }
112
113
114 void AliHLTTPCCADisplay::SetSliceView()
115 {
116   // switch to slice view
117   fSliceView = 1;
118 }
119
120 void AliHLTTPCCADisplay::SetTPCView()
121 {
122   // switch to full TPC view
123   fSliceView = 0;
124   fCos = 1;
125   fSin = 0;
126   fZMin = fTPCZMin;
127   fZMax = fTPCZMax;
128 }
129
130 void AliHLTTPCCADisplay::SetCurrentSlice( AliHLTTPCCATracker *slice )
131 {
132   // set reference to the current CA tracker, and read the current slice geometry
133   fSlice = slice;
134   SetSliceTransform( slice );
135   if( fSliceView ){
136     fCos = slice->Param().SinAlpha();
137     fSin = slice->Param().CosAlpha();
138     fZMin = slice->Param().ZMin();
139     fZMax = slice->Param().ZMax();
140     ClearView();
141     Double_t r0 = .5*(slice->Param().RMax()+slice->Param().RMin());
142     Double_t dr = .5*(slice->Param().RMax()-slice->Param().RMin());
143     Double_t cx = 0;
144     Double_t cy = r0;    
145     Double_t cz = .5*(slice->Param().ZMax()+slice->Param().ZMin());
146     Double_t dz = .5*(slice->Param().ZMax()-slice->Param().ZMin())*1.2;
147     fYX->Range(cx-dr, cy-dr*1.05, cx+dr, cy+dr);
148     fZX->Range(cz-dz, cy-dr*1.05, cz+dz, cy+dr);
149
150     //fYX->Range(cx-dr/6, cy-dr, cx+dr/8, cy-dr + dr/8);
151     //fZX->Range(cz+dz/2+dz/6, cy-dr , cz+dz-dz/8, cy-dr + dr/8);
152
153     //fYX->Range(cx-dr/3, cy-dr/3, cx+dr, cy+dr);
154     //fZX->Range(cz-dz/3, cy-dr/3, cz+dz, cy+dr);//+dr);
155     //fYX->Range(cx-dr/3, cy-dr/2*1.3, cx+dr/3, cy-dr/2*1.1);//+dr);
156     //fZX->Range(cz-dz*0.65, cy-dr/2*1.3, cz+dz*0-dz*0.55, cy-dr/2*1.1);//+dr);
157    }
158 }
159
160 void AliHLTTPCCADisplay::Set2Slices( AliHLTTPCCATracker *slice )
161 {
162   //* Set view for two neighbouring slices
163
164   fSlice = slice;
165   fSliceView = 0;
166   fCos = TMath::Cos(TMath::Pi()/2 - (slice->Param().Alpha()+10./180.*TMath::Pi()));
167   fSin = TMath::Sin(TMath::Pi()/2 - (slice->Param().Alpha()+10./180.*TMath::Pi()));
168   fZMin = slice->Param().ZMin();
169   fZMax = slice->Param().ZMax();
170   ClearView();
171   Double_t r0 = .5*(slice->Param().RMax()+slice->Param().RMin());
172   Double_t dr = .5*(slice->Param().RMax()-slice->Param().RMin());
173   Double_t cx = 0;
174   Double_t cy = r0;    
175   fYX->Range(cx-1.3*dr, cy-1.1*dr, cx+1.3*dr, cy+1.1*dr);
176   fYX->cd();
177   Int_t islice = slice->Param().ISlice();
178   Int_t jslice = slice->Param().ISlice()+1;
179   if( islice==17 ) jslice = 0;
180   else if( islice==35 ) jslice = 18;
181   fLatex.DrawLatex(cx-1.3*dr+1.3*dr*.05,cy-dr+dr*.05, Form("YX, Slices %2i/%2i",islice,jslice));
182   Double_t cz = .5*(slice->Param().ZMax()+slice->Param().ZMin());
183   Double_t dz = .5*(slice->Param().ZMax()-slice->Param().ZMin())*1.2;
184   fZX->Range(cz-dz, cy-1.1*dr, cz+dz, cy+1.1*dr);//+dr);
185   fZX->cd();  
186   fLatex.DrawLatex(cz-dz+dz*.05,cy-dr+dr*.05, Form("ZX, Slices %2i/%2i",islice,jslice));
187 }
188
189
190 Int_t AliHLTTPCCADisplay::GetColor( Double_t z ) const 
191 {
192   // Get color with respect to Z coordinate
193   const Color_t kMyColor[11] = { kGreen, kBlue, kYellow, kMagenta, kCyan, 
194                                  kOrange, kSpring, kTeal, kAzure, kViolet, kPink };
195
196   Double_t zz = (z-fZMin)/(fZMax-fZMin);    
197   Int_t iz = (int) (zz*11);
198   if( iz<0 ) iz = 0;
199   if( iz>10 ) iz = 10;
200   return kMyColor[iz];
201 }
202
203 void AliHLTTPCCADisplay::Global2View( Double_t x, Double_t y, Double_t *xv, Double_t *yv ) const
204 {
205   // convert coordinates global->view
206   *xv = x*fCos + y*fSin;
207   *yv = y*fCos - x*fSin;
208 }
209
210 void AliHLTTPCCADisplay::SetSliceTransform( Double_t alpha )
211 {
212   fSliceCos = TMath::Cos( alpha );
213   fSliceSin = TMath::Sin( alpha );
214
215
216 void AliHLTTPCCADisplay::SetSliceTransform( AliHLTTPCCATracker *slice )
217 {
218   SetSliceTransform(slice->Param().Alpha());
219 }
220
221 void AliHLTTPCCADisplay::Slice2View( Double_t x, Double_t y, Double_t *xv, Double_t *yv ) const
222 {
223   // convert coordinates slice->view
224   Double_t xg = x*fSliceCos - y*fSliceSin;
225   Double_t yg = y*fSliceCos + x*fSliceSin;
226   *xv = xg*fCos - yg*fSin;
227   *yv = yg*fCos + xg*fSin;
228 }
229
230
231 void AliHLTTPCCADisplay::DrawTPC()
232 {
233   // schematically draw TPC detector
234   fYX->Range(-fROuterMax, -fROuterMax, fROuterMax, fROuterMax);
235   fYX->Clear();
236   {
237     fArc.SetLineColor(kBlack);
238     fArc.SetFillStyle(0);
239     fYX->cd();    
240     for( Int_t iSlice=0; iSlice<18; iSlice++){
241       fCrown.SetLineColor(kBlack);
242       fCrown.SetFillStyle(0);
243       fCrown.DrawCrown(0,0,fRInnerMin, fRInnerMax, 360./18.*iSlice, 360./18.*(iSlice+1) );
244       fCrown.DrawCrown(0,0,fROuterMin, fROuterMax, 360./18.*iSlice, 360./18.*(iSlice+1) );
245     }
246   }
247   fZX->cd();
248   fZX->Range( fTPCZMin, -fROuterMax, fTPCZMax, fROuterMax );
249   fZX->Clear();
250 }
251
252 void AliHLTTPCCADisplay::DrawSlice( AliHLTTPCCATracker *slice )
253 {     
254   // draw current the TPC slice
255   fYX->cd();
256   Double_t r0 = .5*(slice->Param().RMax()+slice->Param().RMin());
257   Double_t dr = .5*(slice->Param().RMax()-slice->Param().RMin());
258   Double_t cx = r0*slice->Param().CosAlpha();
259   Double_t cy = r0*slice->Param().SinAlpha();
260   Double_t raddeg = 180./3.1415;
261   Double_t a0 = raddeg*.5*(slice->Param().AngleMax() + slice->Param().AngleMin());
262   Double_t da = raddeg*.5*(slice->Param().AngleMax() - slice->Param().AngleMin());
263   if( fSliceView ){
264     cx = 0; cy = r0;
265     a0 = 90.;
266     fLatex.DrawLatex(cx-dr+dr*.05,cy-dr+dr*.05, Form("YX, Slice %2i",slice->Param().ISlice()));
267   } else {
268     a0+= raddeg*TMath::ATan2(fSin, fCos );
269   }
270   fArc.SetLineColor(kBlack);
271   fArc.SetFillStyle(0);     
272   fCrown.SetLineColor(kBlack);
273   fCrown.SetFillStyle(0);
274     
275   fCrown.DrawCrown(0,0, slice->Param().RMin(),slice->Param().RMax(), a0-da, a0+da );
276
277   fLine.SetLineColor(kBlack);
278  
279   fZX->cd();
280
281   Double_t cz = .5*(slice->Param().ZMax()+slice->Param().ZMin());
282   Double_t dz = .5*(slice->Param().ZMax()-slice->Param().ZMin())*1.2;
283   //fLine.DrawLine(cz+dz, cy-dr, cz+dz, cy+dr ); 
284   if( fSliceView ) fLatex.DrawLatex(cz-dz+dz*.05,cy-dr+dr*.05, Form("ZX, Slice %2i",slice->Param().ISlice()));
285 }
286
287
288 void AliHLTTPCCADisplay::DrawHit( Int_t iRow, Int_t iHit, Int_t color )
289 {
290   // draw hit
291   if( !fSlice ) return;
292   AliHLTTPCCARow &row = fSlice->Rows()[iRow];
293   AliHLTTPCCAHit *h = &(row.Hits()[iHit]);
294   if( color<0 ) color = GetColor( h->Z() );
295
296   //Double_t dgy = 3.5*TMath::Abs(h->ErrY()*fSlice->Param().CosAlpha() - fSlice->Param().ErrX()*fSlice->Param().SinAlpha() );
297   Double_t dx = 0.1;//fSlice->Param().ErrX()*TMath::Sqrt(12.)/2.;
298   Double_t dy = h->ErrY()*3.5;
299   //Double_t dz = h->ErrZ()*3.5;
300   fMarker.SetMarkerSize(.3);
301   fMarker.SetMarkerColor(color);
302   fArc.SetLineColor(color);
303   fArc.SetFillStyle(0);
304   Double_t vx, vy, dvx, dvy;
305   Slice2View( row.X(), h->Y(), &vx, &vy );
306   Slice2View( dx, dy, &dvx, &dvy );
307   
308   fYX->cd();
309   //if( fSliceView ) fArc.DrawEllipse( vx, vy, dvx, dvy, 0,360, 0);
310   //else  fArc.DrawEllipse( vx, vy, dx, dy, 0,360, fSlice->Param().Alpha()*180./3.1415);
311   fMarker.DrawMarker(vx, vy);
312   fZX->cd();
313   //if( fSliceView ) fArc.DrawEllipse( h->Z(), vy, dz, dvy, 0,360, 0 );
314   //else fArc.DrawEllipse( h->Z(), vy, dz, dgy, 0,360, fSlice->Param().Alpha()*180./3.1415);
315   fMarker.DrawMarker(h->Z(), vy); 
316 }
317
318 void AliHLTTPCCADisplay::DrawCell( Int_t iRow, AliHLTTPCCACell &cell, Int_t width, Int_t color )
319 {
320   // draw cell
321   AliHLTTPCCARow &row = fSlice->Rows()[iRow];
322   Double_t vx, vy, vdx, vdy, vz = cell.Z(), vdz = cell.ErrZ()*3.5;
323   Slice2View(row.X(), cell.Y(), &vx, &vy);
324   Slice2View(0.2, cell.ErrY()*3.5, &vdx, &vdy);
325   if( color<0 ) color = GetColor(cell.Z());
326   fLine.SetLineColor(color);
327   fLine.SetLineWidth(width);
328   fArc.SetLineColor(color);
329   fArc.SetFillStyle(0);
330   fYX->cd();
331   //fLine.DrawLine(vx-vdx,vy-vdy, vx+vdx, vy+vdy );
332   fArc.DrawEllipse(vx, vy, vdx, vdy, 0,360, 0);
333   fZX->cd();
334   //fLine.DrawLine(cell.Z()-3*cell.ErrZ(),vy-vdy, cell.Z()+3*cell.ErrZ(), vy+vdy ); 
335   fArc.DrawEllipse(vz, vy, vdz, vdy, 0,360, 0);
336   fLine.SetLineWidth(1);
337 }
338
339 void  AliHLTTPCCADisplay::DrawCell( Int_t iRow, Int_t iCell, Int_t width, Int_t color )
340 {
341   // draw cell
342   AliHLTTPCCARow &row = fSlice->Rows()[iRow];
343   DrawCell( iRow, row.Cells()[iCell], width, color );
344 }
345  
346
347 void AliHLTTPCCADisplay::DrawEndPoint( Int_t ID, Float_t R, Int_t width, Int_t color)
348 {
349   // draw endpoint
350   if( !fSlice ) return;
351   AliHLTTPCCARow &row = fSlice->ID2Row(ID);
352   AliHLTTPCCAEndPoint &p = fSlice->ID2Point(ID);
353   AliHLTTPCCACell &c = fSlice->ID2Cell(p.CellID());
354   if( color<0 ) color = GetColor( c.Z() );
355
356   fArc.SetLineColor(color);
357   fArc.SetFillStyle(0);
358   fArc.SetLineWidth(width);
359
360   Double_t vx, vy;
361   Slice2View( row.X(), c.Y(), &vx, &vy );  
362   fYX->cd();
363   fArc.DrawEllipse( vx, vy, R, R, 0,360, 90);  
364   fZX->cd();
365   fArc.DrawEllipse( c.Z(), vy, R, R, 0,360, 90);  
366   fArc.SetLineWidth(1);
367
368 }
369  
370 void AliHLTTPCCADisplay::ConnectEndPoints( Int_t iID, Int_t jID, Float_t R, Int_t width, Int_t color )
371 {
372    // connect endpoints
373   if( !fSlice ) return;
374   AliHLTTPCCARow &irow = fSlice->ID2Row(iID);
375   AliHLTTPCCAEndPoint &ip = fSlice->ID2Point(iID);
376   AliHLTTPCCACell &ic = fSlice->ID2Cell(ip.CellID());
377   AliHLTTPCCARow &jrow = fSlice->ID2Row(jID);
378   AliHLTTPCCAEndPoint &jp = fSlice->ID2Point(jID);
379   AliHLTTPCCACell &jc = fSlice->ID2Cell(jp.CellID());
380   if( color<0 ) color = GetColor( ic.Z() );
381   
382   fArc.SetLineColor(color);
383   fArc.SetFillStyle(0);
384   fArc.SetLineWidth(width);
385   fLine.SetLineWidth(width);
386   fLine.SetLineColor(color);
387   Double_t ivx, ivy;
388   Slice2View( irow.X(), ic.Y(), &ivx, &ivy );  
389   Double_t jvx, jvy;
390   Slice2View( jrow.X(), jc.Y(), &jvx, &jvy );  
391
392   fYX->cd();
393   fArc.DrawEllipse( ivx, ivy, R, R, 0,360, 90);  
394   fArc.DrawEllipse( jvx, jvy, R, R, 0,360, 90);  
395   fLine.DrawLine(ivx, ivy,jvx, jvy);
396   fZX->cd();
397   fArc.DrawEllipse( ic.Z(), ivy, R, R, 0,360, 90);  
398   fArc.DrawEllipse( jc.Z(), jvy, R, R, 0,360, 90);  
399   fLine.DrawLine(ic.Z(), ivy, jc.Z(), jvy);
400   fArc.SetLineWidth(1);
401   fLine.SetLineWidth(1);
402 }
403
404 void AliHLTTPCCADisplay::ConnectCells( Int_t iRow1, AliHLTTPCCACell &cell1, 
405                                        Int_t iRow2, AliHLTTPCCACell &cell2, Int_t color )
406 {
407   // connect two cells on display, kind of row is drawing
408   AliHLTTPCCARow &row1 = fSlice->Rows()[iRow1];
409   AliHLTTPCCARow &row2 = fSlice->Rows()[iRow2];
410
411   AliHLTTPCCAHit &h11 = row1.GetCellHit(cell1,0);
412   AliHLTTPCCAHit &h12 = row1.GetCellHit(cell1,cell1.NHits()-1);
413   AliHLTTPCCAHit &h21 = row2.GetCellHit(cell2,0);
414   AliHLTTPCCAHit &h22=  row2.GetCellHit(cell2,cell2.NHits()-1);
415
416   Double_t x11 = row1.X();
417   Double_t x12 = row1.X();
418   Double_t y11 = h11.Y() - h11.ErrY()*3;
419   Double_t y12 = h12.Y() + h12.ErrY()*3;
420   Double_t z11 = h11.Z() - h11.ErrZ()*3;
421   Double_t z12 = h12.Z() + h12.ErrZ()*3;
422   Double_t x21 = row2.X();
423   Double_t x22 = row2.X();
424   Double_t y21 = h21.Y() - h21.ErrY()*3;
425   Double_t y22 = h22.Y() + h22.ErrY()*3;
426   Double_t z21 = h21.Z() - h21.ErrZ()*3;
427   Double_t z22 = h22.Z() + h22.ErrZ()*3;
428
429   Double_t vx11, vx12, vy11, vy12, vx21, vx22, vy21, vy22;
430
431   Slice2View(x11,y11, &vx11, &vy11 );
432   Slice2View(x12,y12, &vx12, &vy12 );
433   Slice2View(x21,y21, &vx21, &vy21 );
434   Slice2View(x22,y22, &vx22, &vy22 );
435
436   Double_t lx[] = { vx11, vx12, vx22, vx21, vx11 };
437   Double_t ly[] = { vy11, vy12, vy22, vy21, vy11 };
438   Double_t lz[] = { z11, z12, z22, z21, z11 };
439
440   if( color<0 ) color = GetColor( (z11+z12+z22+z21)/4. );
441   fPLine.SetLineColor(color);    
442   fPLine.SetLineWidth(1);        
443   //fPLine.SetFillColor(color);
444   fPLine.SetFillStyle(-1);
445  
446   fYX->cd();
447   fPLine.DrawPolyLine(5, lx, ly );
448   fZX->cd();
449   fPLine.DrawPolyLine(5, lz, ly );   
450   DrawCell( iRow1, cell1, 1, color );
451   DrawCell( iRow2, cell2, 1, color );
452 }
453
454
455
456
457 void AliHLTTPCCADisplay::DrawTrack( AliHLTTPCCATrack &track, Int_t color, Bool_t DrawCells )
458 {
459   // draw track
460
461   if( track.NCells()<2 ) return;
462   int width = 1;
463
464   AliHLTTPCCADisplayTmpCell *vCells = new AliHLTTPCCADisplayTmpCell[track.NCells()];
465   AliHLTTPCCATrackParam &t = fSlice->ID2Point(track.PointID()[0]).Param();
466
467   Int_t iID = track.FirstCellID();
468   {
469     Int_t iCell=0;
470     while( iID>=0 ){
471       AliHLTTPCCACell *c = &(fSlice->ID2Cell( iID )); 
472       AliHLTTPCCARow &row = fSlice->ID2Row(iID);
473       vCells[iCell].ID() = iID;    
474       vCells[iCell].S() = t.GetS( row.X(), c->Y() );
475       vCells[iCell].Z() = c->Z();
476       iCell++;
477       iID = c->Link(); 
478     }
479   }
480   sort(vCells, vCells + track.NCells(), AliHLTTPCCADisplayTmpCell::CompareCellZ );
481   
482   {
483     AliHLTTPCCACell &c1 = fSlice->ID2Cell(vCells[0].ID());
484     AliHLTTPCCACell &c2 = fSlice->ID2Cell(vCells[track.NCells()-1].ID());
485     if( color<0 ) color = GetColor( (c1.Z()+c2.Z())/2. );
486   }
487   
488   fMarker.SetMarkerColor(color);//kBlue);
489   fMarker.SetMarkerSize(1.);
490   /*
491   for( Int_t i=0; i<3; i++){    
492     AliHLTTPCCACell &c1 = fSlice->ID2Cell(track.CellID()[i]);    
493     AliHLTTPCCARow &row1 = fSlice->ID2Row(track.CellID()[i]);
494     Double_t vx1, vy1;
495     Slice2View(row1.X(), c1.Y(), &vx1, &vy1 ); 
496     fYX->cd();
497     fMarker.DrawMarker(vx1,vy1);
498     fZX->cd();
499     fMarker.DrawMarker(c1.Z(),vy1);
500   }
501   */
502   DrawTrackletPoint( fSlice->ID2Point(track.PointID()[0]).Param(), kBlack);//color );
503   DrawTrackletPoint( fSlice->ID2Point(track.PointID()[1]).Param(), kBlack);//color );
504
505   for( Int_t iCell=0; iCell<track.NCells()-1; iCell++ )
506   {
507     AliHLTTPCCACell &c1 = fSlice->ID2Cell(vCells[iCell].ID());
508     AliHLTTPCCACell &c2 = fSlice->ID2Cell(vCells[iCell+1].ID());
509     AliHLTTPCCARow &row1 = fSlice->ID2Row(vCells[iCell].ID());
510     AliHLTTPCCARow &row2 = fSlice->ID2Row(vCells[iCell+1].ID());
511     Float_t x1, y1, z1, x2, y2, z2;    
512     t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1 );
513     t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2 );
514
515     //if( color<0 ) color = GetColor( (z1+z2)/2. );
516     Double_t vx1, vy1, vx2, vy2;
517     Slice2View(x1, y1, &vx1, &vy1 );
518     Slice2View(x2, y2, &vx2, &vy2 );
519     
520     fLine.SetLineColor( color );
521     fLine.SetLineWidth( width );
522     
523     Double_t x0 = t.GetX();
524     Double_t y0 = t.GetY();
525     Double_t sinPhi = t.GetSinPhi();
526     Double_t k = t.GetKappa();
527     Double_t ex = t.GetCosPhi();
528     Double_t ey = sinPhi;
529  
530     if( TMath::Abs(k)>1.e-4 ){
531
532       fArc.SetFillStyle(0);
533       fArc.SetLineColor(color);    
534       fArc.SetLineWidth(width);        
535       
536       fYX->cd();
537
538       Double_t r = 1/TMath::Abs(k);
539       Double_t xc = x0 -ey*(1/k);
540       Double_t yc = y0 +ex*(1/k);
541      
542       Double_t vx, vy;
543       Slice2View( xc, yc, &vx, &vy );
544       
545       Double_t a1 = TMath::ATan2(vy1-vy, vx1-vx)/TMath::Pi()*180.;
546       Double_t a2 = TMath::ATan2(vy2-vy, vx2-vx)/TMath::Pi()*180.;
547       if( a1<0 ) a1+=360;
548       if( a2<0 ) a2+=360;
549       if( a2<a1 ) a2+=360;
550       Double_t da = TMath::Abs(a2-a1);
551       if( da>360 ) da-= 360;
552       if( da>180 ){
553         da = a1;
554         a1 = a2;
555         a2 = da;
556         if( a2<a1 ) a2+=360;    
557       }
558       fArc.DrawArc(vx,vy,r, a1,a2,"only");
559       //fArc.DrawArc(vx,vy,r, 0,360,"only");
560    } else {
561       fYX->cd();
562       fLine.DrawLine(vx1,vy1, vx2, vy2 );
563     }
564   }
565
566   for( Int_t iCell=0; iCell<track.NCells()-1; iCell++ ){
567     AliHLTTPCCACell &c1 = fSlice->ID2Cell(vCells[iCell].ID());
568     AliHLTTPCCACell &c2 = fSlice->ID2Cell(vCells[iCell+1].ID());
569     AliHLTTPCCARow &row1 = fSlice->ID2Row(vCells[iCell].ID());
570     AliHLTTPCCARow &row2 = fSlice->ID2Row(vCells[iCell+1].ID());
571
572     if( DrawCells ) ConnectCells( fSlice->ID2IRow(vCells[iCell].ID()),c1,
573                                   fSlice->ID2IRow(vCells[iCell+1].ID()),c2, color );
574     Float_t x1, y1, z1, x2, y2, z2;
575     t.GetDCAPoint( row1.X(), c1.Y(), c1.Z(), x1, y1, z1 );
576     t.GetDCAPoint( row2.X(), c2.Y(), c2.Z(), x2, y2, z2 );
577
578     Double_t vx1, vy1, vx2, vy2;
579     Slice2View(x1, y1, &vx1, &vy1 );
580     Slice2View(x2, y2, &vx2, &vy2 );
581     
582     fLine.SetLineColor(color);
583     fLine.SetLineWidth(width);    
584     
585     fZX->cd();
586     fLine.DrawLine(z1,vy1, z2, vy2 ); 
587   }
588   fLine.SetLineWidth(1);     
589   delete[] vCells;
590 }
591
592
593 void AliHLTTPCCADisplay::DrawTrackletPoint( AliHLTTPCCATrackParam &t, Int_t color )
594 {
595   // draw tracklet point
596
597   Double_t x = t.GetX();
598   Double_t y = t.GetY();
599   Double_t sinPhi = t.GetSinPhi();
600   Double_t z = t.GetZ();
601   Double_t dzds = t.GetDzDs();
602   Double_t ex = t.GetCosPhi();
603   Double_t ey = sinPhi;
604
605   int width = 3;
606
607   if( color<0 ) color = GetColor( t.GetZ() );
608     
609   fMarker.SetMarkerColor(color);
610   fMarker.SetMarkerSize(.5);
611   fLine.SetLineWidth(width);  
612   fLine.SetLineColor(color);
613
614   Double_t vx, vy, vex, vey, vdx, vdy;
615   Double_t dz = TMath::Sqrt(t.GetErr2Z());
616   Slice2View( x, y, &vx, &vy ); 
617   Slice2View( ex, ey, &vex, &vey ); 
618   Slice2View( 0, TMath::Sqrt(t.GetErr2Y())*3.5, &vdx, &vdy);
619   Double_t d = TMath::Sqrt(vex*vex+vey*vey);
620   vex/=d;
621   vey/=d;
622   fYX->cd();
623   fMarker.DrawMarker(vx,vy);
624   fLine.DrawLine(vx,vy,vx+vex*4, vy+vey*4);
625   fLine.DrawLine(vx-vdx,vy-vdy, vx+vdx, vy+vdy );
626   fZX->cd();
627   fMarker.DrawMarker(z,vy);
628   fLine.DrawLine(z,vy,z+dzds*4, vy+vey*4);
629   fLine.DrawLine(z-3.5*dz,vy-vdy, z+3.5*dz, vy+vdy ); 
630   fLine.SetLineWidth(1);
631 }