Missing initialization; fiddle with the track marker-style a bit more.
[u/mrichter/AliRoot.git] / EVE / Reve / Track.cxx
CommitLineData
5a5a1232 1// $Header$
2
3#include "Track.h"
4#include "MCHelixLine.hi"
7cbaaebd 5#include "PointSet.h"
5a5a1232 6
7#include <TPolyLine3D.h>
8#include <TPolyMarker3D.h>
9#include <TColor.h>
10
11// Updates
12#include <Reve/RGTopFrame.h>
13#include <TCanvas.h>
14
15#include <vector>
16
17using namespace Reve;
18
19//______________________________________________________________________
20// Track
21//
22
23ClassImp(Reve::Track)
24
265ecb21 25Track::Track() :
eadaa89b 26 Line(),
5a5a1232 27
265ecb21 28 fV(),
29 fP(),
30 fBeta(0),
31 fCharge(0),
7cbaaebd 32 fLabel(-1),
33 fIndex(-1),
265ecb21 34 fPathMarks(),
35
eadaa89b 36 fRnrStyle(0)
265ecb21 37{}
38
3d75306d 39Track::Track(TParticle* t, Int_t label, TrackRnrStyle* rs):
eadaa89b 40 Line(),
3d75306d 41
42 fV(t->Vx(), t->Vy(), t->Vz()),
43 fP(t->Px(), t->Py(), t->Pz()),
44 fBeta(t->P()/t->Energy()),
45 fCharge(0),
46 fLabel(label),
7cbaaebd 47 fIndex(-1),
3d75306d 48 fPathMarks(),
49
eadaa89b 50 fRnrStyle(rs)
3d75306d 51{
52 fLineColor = fRnrStyle->GetColor();
53 fMainColorPtr = &fLineColor;
54
55 TParticlePDG* pdgp = t->GetPDG();
56 if (pdgp)
57 fCharge = (Int_t) TMath::Nint(pdgp->Charge()/3);
eadaa89b 58
59 SetName(t->GetName());
3d75306d 60}
61
265ecb21 62Track::Track(Reve::MCTrack* t, TrackRnrStyle* rs):
eadaa89b 63 Line(),
5a5a1232 64
265ecb21 65 fV(t->Vx(), t->Vy(), t->Vz()),
66 fP(t->Px(), t->Py(), t->Pz()),
67 fBeta(t->P()/t->Energy()),
68 fCharge(0),
69 fLabel(t->label),
fa446a68 70 fIndex(t->index),
265ecb21 71 fPathMarks(),
72
eadaa89b 73 fRnrStyle(rs)
265ecb21 74{
5a5a1232 75 fLineColor = fRnrStyle->GetColor();
76 fMainColorPtr = &fLineColor;
77
5a5a1232 78 TParticlePDG* pdgp = t->GetPDG();
79 if(pdgp == 0) {
80 t->ResetPdgCode(); pdgp = t->GetPDG();
81 }
48dc973d 82 fCharge = (Int_t) TMath::Nint(pdgp->Charge()/3);
eadaa89b 83
84 SetName(t->GetName());
5a5a1232 85}
86
265ecb21 87Track::Track(Reve::RecTrack* t, TrackRnrStyle* rs) :
eadaa89b 88 Line(),
265ecb21 89
90 fV(t->V),
91 fP(t->P),
92 fBeta(t->beta),
93 fCharge(t->sign),
94 fLabel(t->label),
fa446a68 95 fIndex(t->index),
265ecb21 96 fPathMarks(),
97
eadaa89b 98 fRnrStyle(rs)
5a5a1232 99{
5a5a1232 100 fLineColor = fRnrStyle->GetColor();
101 fMainColorPtr = &fLineColor;
eadaa89b 102
103 SetName(t->GetName());
5a5a1232 104}
105
106Track::~Track()
265ecb21 107{
108 for (vpPathMark_i i=fPathMarks.begin(); i!=fPathMarks.end(); ++i)
109 delete *i;
110}
5a5a1232 111
eadaa89b 112/*
5a5a1232 113void Track::Reset(Int_t n_points)
114{
115 delete [] TPolyLine3D::fP; TPolyLine3D::fP = 0;
116 fN = n_points;
117 if(fN) TPolyLine3D::fP = new Float_t [3*fN];
118 memset(TPolyLine3D::fP, 0, 3*fN*sizeof(Float_t));
119 fLastPoint = -1;
120}
eadaa89b 121*/
5a5a1232 122
2fbbf445 123 /**************************************************************************/
5a5a1232 124
2fbbf445 125void Track::MakeTrack( Bool_t recurse)
5a5a1232 126{
5a5a1232 127 TrackRnrStyle& RS((fRnrStyle != 0) ? *fRnrStyle : TrackRnrStyle::fgDefStyle);
128
129 Float_t px = fP.x, py = fP.y, pz = fP.z;
130
131 MCVertex mc_v0;
132 mc_v0.x = fV.x;
133 mc_v0.y = fV.y;
134 mc_v0.z = fV.z;
135 mc_v0.t = 0;
136
137 std::vector<MCVertex> track_points;
48dc973d 138 Bool_t decay = kFALSE;
5a5a1232 139
140 if ((TMath::Abs(fV.z) > RS.fMaxZ) || (fV.x*fV.x + fV.y*fV.y > RS.fMaxR*RS.fMaxR))
141 goto make_polyline;
142
01024c63 143 if (fCharge != 0 && TMath::Abs(RS.fMagField) > 1e-5) {
144
145 // Charged particle in magnetic field
5a5a1232 146
48dc973d 147 Float_t a = RS.fgkB2C * RS.fMagField * fCharge;
5a5a1232 148
149 MCHelix helix(fRnrStyle, &mc_v0, TMath::C()*fBeta, &track_points, a); //m->cm
150 helix.Init(TMath::Sqrt(px*px+py*py), pz);
151
7cbaaebd 152 if(!fPathMarks.empty())
153 {
154 for(std::vector<Reve::PathMark*>::iterator i=fPathMarks.begin(); i!=fPathMarks.end(); ++i)
155 {
5a5a1232 156 Reve::PathMark* pm = *i;
157
7cbaaebd 158 if (RS.fFitReferences && pm->type == Reve::PathMark::Reference)
159 {
5a5a1232 160 if(TMath::Abs(pm->V.z) > RS.fMaxZ
161 || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
162 goto helix_bounds;
163
7cbaaebd 164 // printf("%s fit reference \n", fName.Data());
165 helix.LoopToVertex(px, py, pz, pm->V.x, pm->V.y, pm->V.z);
166 px = pm->P.x;
167 py = pm->P.y;
168 pz = pm->P.z;
5a5a1232 169 }
7cbaaebd 170 else if(RS.fFitDaughters && pm->type == Reve::PathMark::Daughter)
171 {
5a5a1232 172 if(TMath::Abs(pm->V.z) > RS.fMaxZ
173 || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
174 goto helix_bounds;
7cbaaebd 175
176 // printf("%s fit daughter \n", fName.Data());
177 helix.LoopToVertex(px, py, pz, pm->V.x, pm->V.y, pm->V.z);
178 px -= pm->P.x;
179 py -= pm->P.y;
180 pz -= pm->P.z;
181 }
182 else if(RS.fFitDecay && pm->type == Reve::PathMark::Decay)
183 {
184 if(TMath::Abs(pm->V.z) > RS.fMaxZ
185 || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
186 goto helix_bounds;
187 helix.LoopToVertex(px, py, pz, pm->V.x, pm->V.y, pm->V.z);
5a5a1232 188 decay = true;
189 break;
190 }
191 }
192 }
193 helix_bounds:
7cbaaebd 194 // go to bounds
48dc973d 195 if(!decay || RS.fFitDecay == kFALSE){
5a5a1232 196 helix.LoopToBounds(px,py,pz);
197 // printf("%s loop to bounds \n",fName.Data() );
198 }
199
01024c63 200 } else {
201
202 // Neutral particle or no field
5a5a1232 203
204 MCLine line(fRnrStyle, &mc_v0, TMath::C()*fBeta, &track_points);
205
206 if(!fPathMarks.empty()){
207 for(std::vector<Reve::PathMark*>::iterator i=fPathMarks.begin(); i!=fPathMarks.end(); ++i) {
208 Reve::PathMark* pm = *i;
209
210 if(RS.fFitDaughters && pm->type == Reve::PathMark::Daughter){
211 if(TMath::Abs(pm->V.z) > RS.fMaxZ
212 || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
213 goto line_bounds;
214 line.GotoVertex(pm->V.x, pm->V.y, pm->V.z);
215 fP.x -= pm->P.x;
216 fP.y -= pm->P.y;
217 fP.z -= pm->P.z;
218 }
219
220 if(RS.fFitDecay && pm->type == Reve::PathMark::Decay){
221 if(TMath::Abs(pm->V.z) > RS.fMaxZ
222 || TMath::Sqrt(pm->V.x*pm->V.x + pm->V.y*pm->V.y) > RS.fMaxR )
223 goto line_bounds;
224 line.GotoVertex(pm->V.x, pm->V.y, pm->V.z);
225 decay = true;
226 break;
227 }
228 }
229 }
230
231 line_bounds:
48dc973d 232 if(!decay || RS.fFitDecay == kFALSE)
5a5a1232 233 line.GotoBounds(px,py,pz);
234
235 }
236make_polyline:
237 Reset(track_points.size());
238 for(std::vector<MCVertex>::iterator i=track_points.begin(); i!=track_points.end(); ++i)
239 SetNextPoint(i->x, i->y, i->z);
2fbbf445 240
241 if(recurse) {
242 Track* t;
243 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
244 t = dynamic_cast<Track*>(*i);
245 if(t)t->MakeTrack(recurse);
246 }
247 }
5a5a1232 248}
249
250/**************************************************************************/
251
48dc973d 252void Track::ImportHits()
253{
254 Reve::LoadMacro("hits_from_label.C");
2fbbf445 255 gROOT->ProcessLine(Form("hits_from_label(%d, (Reve::RenderElement*)%p);",
256 fLabel, this));
48dc973d 257}
258
259void Track::ImportClusters()
260{
261 Reve::LoadMacro("clusters_from_label.C");
2fbbf445 262 gROOT->ProcessLine(Form("clusters_from_label(%d, (Reve::RenderElement*)%p);",
263 fLabel, this));
48dc973d 264}
265
fa446a68 266void Track::ImportClustersFromIndex()
267{
7cbaaebd 268 static const Exc_t eH("Track::ImportClustersFromIndex ");
269
270 if (fIndex < 0)
271 throw(eH + "index not set.");
272
fa446a68 273 Reve::LoadMacro("clusters_from_index.C");
2fbbf445 274 gROOT->ProcessLine(Form("clusters_from_index(%d, (Reve::RenderElement*)%p);",
275 fIndex, this));
fa446a68 276}
277
b8879e69 278/**************************************************************************/
279
280void Track::ImportKine()
281{
282 static const Exc_t eH("Track::ImportKine ");
283
284 if (fLabel < 0)
285 throw(eH + "label not set.");
286
287 Reve::LoadMacro("kine_tracks.C");
2fbbf445 288 gROOT->ProcessLine(Form("kine_track(%d, kFALSE, kTRUE, (Reve::RenderElement*)%p);",
289 fLabel, this));
290
b8879e69 291}
292
293void Track::ImportKineWithArgs(Bool_t importMother, Bool_t importDaugters)
a525aa60 294{
b8879e69 295 static const Exc_t eH("Track::ImportKineWithArgs ");
a525aa60 296
297 if (fLabel < 0)
298 throw(eH + "label not set.");
299
b8879e69 300 Reve::LoadMacro("kine_tracks.C");
2fbbf445 301 gROOT->ProcessLine(Form("kine_track(%d, %d, %d, (Reve::RenderElement*)%p);",
302 fLabel, importMother, importDaugters, this));
303
a525aa60 304}
305
306/**************************************************************************/
307
b1f08706 308void Track::PrintKineStack()
309{
310 Reve::LoadMacro("print_kine_from_label.C");
311 gROOT->ProcessLine(Form("print_kine_from_label(%d);", fLabel));
312}
313
a525aa60 314
315void Track::PrintPathMarks()
316{
317 static const Exc_t eH("Track::PrintPathMarks ");
318
319 if (fLabel < 0)
320 throw(eH + "label not set.");
321
322 printf("Number of path marks %d label %d\n",
323 fPathMarks.size(), fLabel);
324
325 PathMark* pm;
326 for(vpPathMark_i i=fPathMarks.begin(); i!=fPathMarks.end(); i++)
327 {
328 pm = *i;
329 printf("Reve::PathMark: %-9s p: %8f %8f %8f Vertex: %8e %8e %8e %g \n",
330 pm->type_name(),
331 pm->P.x, pm->P.y, pm->P.z,
332 pm->V.x, pm->V.y, pm->V.z,
333 pm->time);
334 }
335}
336
9c39ede9 337/**************************************************************************/
338
339void Track::CtrlClicked(Reve::Track* track)
340{
341 Emit("CtrlClicked(Reve::Track*)", (Long_t)track);
342}
343
48dc973d 344
345/**************************************************************************/
346/**************************************************************************/
347
5a5a1232 348//______________________________________________________________________
349// TrackRnrStyle
350//
351
352ClassImp(Reve::TrackRnrStyle)
353
48dc973d 354Float_t TrackRnrStyle::fgDefMagField = 5;
355const Float_t TrackRnrStyle::fgkB2C = 0.299792458e-3;
5a5a1232 356TrackRnrStyle TrackRnrStyle::fgDefStyle;
357
265ecb21 358TrackRnrStyle::TrackRnrStyle() :
359 TObject(),
5a5a1232 360
265ecb21 361 fColor(1),
2074deef 362 fWidth(1),
265ecb21 363 fMagField(fgDefMagField),
5a5a1232 364
265ecb21 365 fMaxR (350),
366 fMaxZ (450),
5a5a1232 367
265ecb21 368 fMaxOrbs (0.5),
369 fMinAng (45),
370 fDelta (0.1),
5a5a1232 371
22df2a83 372 fMinPt (0.1),
373 fMaxPt (10),
374
7cbaaebd 375 fFitDaughters (kTRUE),
376 fFitReferences (kTRUE),
377 fFitDecay (kTRUE),
5a5a1232 378
7cbaaebd 379 fRnrDaughters (kTRUE),
380 fRnrReferences (kTRUE),
381 fRnrDecay (kTRUE)
382{}
5a5a1232 383/**************************************************************************/
384/**************************************************************************/
385
386//______________________________________________________________________
387// TrackList
388//
389
390ClassImp(Reve::TrackList)
391
392void TrackList::Init()
393{
139b93bd 394 fMarkerStyle = 2;
a4fc27a6 395 fMarkerColor = 4;
139b93bd 396 fMarkerSize = 0.6;
5a5a1232 397
a8600b56 398 if (fRnrStyle== 0) fRnrStyle = new TrackRnrStyle;
399 SetMainColorPtr(&fRnrStyle->fColor);
5a5a1232 400}
401
a8600b56 402TrackList::TrackList(Int_t n_tracks, TrackRnrStyle* rs) :
2fbbf445 403 RenderElement(),
265ecb21 404 TPolyMarker3D(n_tracks),
405
406 fTitle(),
407
7cbaaebd 408 fRnrStyle (rs),
409 fRnrTracks (kTRUE),
410 fEditPathMarks (kFALSE)
5a5a1232 411{
412 Init();
413}
414
a8600b56 415TrackList::TrackList(const Text_t* name, Int_t n_tracks, TrackRnrStyle* rs) :
2fbbf445 416 RenderElement(),
265ecb21 417 TPolyMarker3D(n_tracks),
a8600b56 418
265ecb21 419 fTitle(),
420
139b93bd 421 fRnrStyle (rs),
422 fRnrTracks (kTRUE),
423 fEditPathMarks (kFALSE)
5a5a1232 424{
425 Init();
426 SetName(name);
427}
428
429void TrackList::Reset(Int_t n_tracks)
430{
431 delete [] fP; fP = 0;
432 fN = n_tracks;
433 if(fN) fP = new Float_t [3*fN];
434 memset(fP, 0, 3*fN*sizeof(Float_t));
435 fLastPoint = -1;
436}
437
438/**************************************************************************/
439
440void TrackList::Paint(Option_t* option)
441{
2fbbf445 442 if(fRnrSelf) {
5a5a1232 443 if(fRnrMarkers) {
444 TPolyMarker3D::Paint(option);
445 }
2fbbf445 446 if(fRnrTracks && fRnrChildren) {
9c39ede9 447 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
2fbbf445 448 if((*i)->GetRnrSelf())
5a5a1232 449 (*i)->GetObject()->Paint(option);
450 }
451 }
452 }
453}
454
455/**************************************************************************/
456
457void TrackList::AddElement(RenderElement* el)
458{
459 static const Exc_t eH("TrackList::AddElement ");
460 if (dynamic_cast<Track*>(el) == 0)
461 throw(eH + "new element not a Track.");
2fbbf445 462 RenderElement::AddElement(el);
5a5a1232 463}
464
465/**************************************************************************/
466
5a5a1232 467void TrackList::MakeTracks()
468{
9c39ede9 469 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
5a5a1232 470 ((Track*)(*i))->MakeTrack();
471 }
472 gReve->Redraw3D();
473}
474
475
476void TrackList::MakeMarkers()
477{
7d42b6c2 478 Reset(fChildren.size());
9c39ede9 479 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
5a5a1232 480 Track& t = *((Track*)(*i));
481 if(t.GetN() > 0)
482 SetNextPoint(t.fV.x, t.fV.y, t.fV.z);
483 }
484 gReve->Redraw3D();
485}
486
487/**************************************************************************/
488/*************************************************************************/
489
2074deef 490void TrackList::SetWidth(Width_t w)
491{
492 Width_t oldw = fRnrStyle->fWidth;
493 fRnrStyle->fWidth = w;
9c39ede9 494 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
2074deef 495 Track& t = *((Track*)(*i));
496 if (t.GetLineWidth() == oldw)
497 t.SetLineWidth(w);
498 }
499}
500
5a5a1232 501void TrackList::SetMaxR(Float_t x)
502{
a8600b56 503 fRnrStyle->fMaxR = x;
5a5a1232 504 MakeTracks();
505 MakeMarkers();
506}
507
508void TrackList::SetMaxZ(Float_t x)
509{
a8600b56 510 fRnrStyle->fMaxZ = x;
5a5a1232 511 MakeTracks();
512 MakeMarkers();
513}
514
515void TrackList::SetMaxOrbs(Float_t x)
516{
a8600b56 517 fRnrStyle->fMaxOrbs = x;
5a5a1232 518 MakeTracks();
519}
520
521void TrackList::SetMinAng(Float_t x)
522{
a8600b56 523 fRnrStyle->fMinAng = x;
5a5a1232 524 MakeTracks();
525}
526
527void TrackList::SetDelta(Float_t x)
528{
a8600b56 529 fRnrStyle->fDelta = x;
5a5a1232 530 MakeTracks();
531}
532
533void TrackList::SetFitDaughters(Bool_t x)
534{
a8600b56 535 fRnrStyle->fFitDaughters = x;
5a5a1232 536 MakeTracks();
537}
538
7cbaaebd 539void TrackList::SetFitReferences(Bool_t x)
540{
541 fRnrStyle->fFitReferences = x;
542 MakeTracks();
543}
544
5a5a1232 545void TrackList::SetFitDecay(Bool_t x)
546{
a8600b56 547 fRnrStyle->fFitDecay = x;
5a5a1232 548 MakeTracks();
549}
550
7cbaaebd 551void TrackList::SetRnrDecay(Bool_t rnr)
552{
553 fRnrStyle->fRnrDecay = rnr;
554 MakeTracks();
555}
556
557void TrackList::SetRnrDaughters(Bool_t rnr)
558{
559 fRnrStyle->fRnrDaughters = rnr;
560 MakeTracks();
561}
562
563void TrackList::SetRnrReferences(Bool_t rnr)
564{
565 fRnrStyle->fRnrReferences = rnr;
566 MakeTracks();
567}
568
569void TrackList::SetRnrMarkers(Bool_t rnr)
570{
571 fRnrMarkers = rnr;
572 gReve->Redraw3D();
573}
574
575void TrackList::SetRnrTracks(Bool_t rnr)
576{
577
578 fRnrTracks = rnr;
579 gReve->Redraw3D();
580}
581
5a5a1232 582/**************************************************************************/
583/**************************************************************************/
584
585void TrackList::SelectByPt(Float_t min_pt, Float_t max_pt)
586{
22df2a83 587 fRnrStyle->fMinPt = min_pt;
588 fRnrStyle->fMaxPt = max_pt;
589
5a5a1232 590 Float_t minptsq = min_pt*min_pt;
591 Float_t maxptsq = max_pt*max_pt;
592 Float_t ptsq;
593
9c39ede9 594 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
5a5a1232 595 ptsq = ((Track*)(*i))->fP.Perp2();
2fbbf445 596 (*i)->SetRnrSelf(ptsq >= minptsq && ptsq <= maxptsq);
5a5a1232 597 }
598}
599
600/**************************************************************************/
601
b99aed53 602void TrackList::ImportHits()
5a5a1232 603{
9c39ede9 604 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
b99aed53 605 ((Track*)(*i))->ImportHits();
606 }
5a5a1232 607}
608
b99aed53 609void TrackList::ImportClusters()
5a5a1232 610{
9c39ede9 611 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
b99aed53 612 ((Track*)(*i))->ImportClusters();
613 }
5a5a1232 614}
9c39ede9 615
616/**************************************************************************/
617/**************************************************************************/
618/**************************************************************************/
619
620#include "RGEditor.h"
621
622//______________________________________________________________________
623// TrackCounter
624//
625
626ClassImp(TrackCounter)
627
b1f08706 628TrackCounter* TrackCounter::fgInstance = 0;
629
9c39ede9 630TrackCounter::TrackCounter(const Text_t* name, const Text_t* title) :
631 RenderElement(),
632 TNamed(name, title),
633
634 fBadLineStyle (6),
635 fClickAction (CA_ToggleTrack),
636 fAllTracks (0),
637 fGoodTracks (0),
638 fTrackLists ()
639{
b1f08706 640 if (fgInstance == 0) fgInstance = this;
9c39ede9 641 TQObject::Connect("Reve::Track", "CtrlClicked(Reve::Track*)",
642 "Reve::TrackCounter", this, "DoTrackAction(Reve::Track*)");
643}
644
645TrackCounter::~TrackCounter()
646{
647 TQObject::Disconnect("Reve::Track", "DoTrackAction(Reve::Track*)");
b1f08706 648 if (fgInstance == this) fgInstance = 0;
9c39ede9 649}
650
651/**************************************************************************/
652
653void TrackCounter::Reset()
654{
655 printf("TrackCounter::Reset()\n");
656 fAllTracks = 0;
657 fGoodTracks = 0;
658 TIter next(&fTrackLists);
659 TrackList* tlist;
660 while ((tlist = dynamic_cast<TrackList*>(next())))
661 tlist->RemoveParent(this);
662 fTrackLists.Clear();
663}
664
665void TrackCounter::RegisterTracks(TrackList* tlist, Bool_t goodTracks)
666{
667 // printf("TrackCounter::RegisterTracks '%s', %s\n",
668 // tlist->GetObject()->GetName(), goodTracks ? "good" : "bad");
669
670 tlist->AddParent(this);
671 fTrackLists.Add(tlist);
672
673 List_i i = tlist->BeginChildren();
674 while (i != tlist->EndChildren())
675 {
676 Track* t = dynamic_cast<Track*>(*i);
677 if (t != 0)
678 {
679 if (goodTracks)
680 {
681 ++fGoodTracks;
682 } else {
683 t->SetLineStyle(fBadLineStyle);
684 }
685 ++fAllTracks;
686 }
687 ++i;
688 }
689}
690
691void TrackCounter::DoTrackAction(Track* track)
692{
693 // !!!! No check done if ok.
694 // !!!! Should also override RemoveElementLocal
7af62191 695 // !!!! But then ... should also sotre local information if track is ok.
9c39ede9 696
697 switch (fClickAction)
698 {
699
700 case CA_PrintTrackInfo:
701 {
702 printf("Track '%s'\n", track->GetObject()->GetName());
703 Vector &v = track->fV, &p = track->fP;
704 printf(" Vx=%f, Vy=%f, Vz=%f; Pt=%f, Pz=%f, phi=%f)\n",
705 v.x, v.y, v.z, p.Perp(), p.z, TMath::RadToDeg()*p.Phi());
706 printf(" <other information should be printed ... full AliESDtrack>\n");
707 break;
708 }
709
710 case CA_ToggleTrack:
711 {
712 if (track->GetLineStyle() == 1)
713 {
714 track->SetLineStyle(fBadLineStyle);
715 --fGoodTracks;
716 } else {
717 track->SetLineStyle(1);
718 ++fGoodTracks;
719 }
720 gReve->Redraw3D();
721
722 printf("TrackCounter::CountTrack All=%d, Good=%d, Bad=%d\n",
723 fAllTracks, fGoodTracks, fAllTracks-fGoodTracks);
724
725 if (gReve->GetEditor()->GetModel() == GetObject())
726 gReve->EditRenderElement(this);
727
728 break;
729 }
730
731 } // end switch fClickAction
732}
7af62191 733
734/**************************************************************************/
735
736void TrackCounter::OutputEventTracks(FILE* out)
737{
738 if (out == 0)
739 {
740 out = stdout;
741 fprintf(out, "TrackCounter::FinalizeEvent()\n");
742 }
743
744 fprintf(out, "Event = %d Ntracks = %d\n", fEventId, fGoodTracks);
745
746 TIter tlists(&fTrackLists);
747 TrackList* tlist;
748 Int_t cnt = 0;
749 while ((tlist = (TrackList*) tlists()) != 0)
750 {
751 List_i i = tlist->BeginChildren();
752 while (i != tlist->EndChildren())
753 {
754 Track* t = dynamic_cast<Track*>(*i);
755 if (t != 0 && t->GetLineStyle() == 1)
756 {
757 ++cnt;
758 fprintf(out, " %2d: chg=%+2d pt=%8.5f eta=%+8.5f\n",
759 cnt, t->fCharge, t->fP.Perp(), t->fP.Eta());
760 }
761 ++i;
762 }
7af62191 763 }
764}