In class Track: renamed ImportDaughters() to ImportKine(), added ImportKineWithArgs...
[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
b8879e69 123/**************************************************************************/
5a5a1232 124
125void Track::MakeTrack()
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);
240}
241
242/**************************************************************************/
243
48dc973d 244void Track::ImportHits()
245{
246 Reve::LoadMacro("hits_from_label.C");
247 gROOT->ProcessLine(Form("hits_from_label(%d);", fLabel));
248}
249
250void Track::ImportClusters()
251{
252 Reve::LoadMacro("clusters_from_label.C");
253 gROOT->ProcessLine(Form("clusters_from_label(%d);", fLabel));
254}
255
fa446a68 256void Track::ImportClustersFromIndex()
257{
7cbaaebd 258 static const Exc_t eH("Track::ImportClustersFromIndex ");
259
260 if (fIndex < 0)
261 throw(eH + "index not set.");
262
fa446a68 263 Reve::LoadMacro("clusters_from_index.C");
264 gROOT->ProcessLine(Form("clusters_from_index(%d);", fIndex));
265}
266
b8879e69 267/**************************************************************************/
268
269void Track::ImportKine()
270{
271 static const Exc_t eH("Track::ImportKine ");
272
273 if (fLabel < 0)
274 throw(eH + "label not set.");
275
276 Reve::LoadMacro("kine_tracks.C");
277 gROOT->ProcessLine(Form("kine_track(%d, kTRUE, kFALSE);", fLabel));
278}
279
280void Track::ImportKineWithArgs(Bool_t importMother, Bool_t importDaugters)
a525aa60 281{
b8879e69 282 static const Exc_t eH("Track::ImportKineWithArgs ");
a525aa60 283
284 if (fLabel < 0)
285 throw(eH + "label not set.");
286
b8879e69 287 Reve::LoadMacro("kine_tracks.C");
288 gROOT->ProcessLine(Form("kine_track(%d, %d, %d);",
289 fLabel, importMother, importDaugters));
a525aa60 290}
291
292/**************************************************************************/
293
b1f08706 294void Track::PrintKineStack()
295{
296 Reve::LoadMacro("print_kine_from_label.C");
297 gROOT->ProcessLine(Form("print_kine_from_label(%d);", fLabel));
298}
299
a525aa60 300
301void Track::PrintPathMarks()
302{
303 static const Exc_t eH("Track::PrintPathMarks ");
304
305 if (fLabel < 0)
306 throw(eH + "label not set.");
307
308 printf("Number of path marks %d label %d\n",
309 fPathMarks.size(), fLabel);
310
311 PathMark* pm;
312 for(vpPathMark_i i=fPathMarks.begin(); i!=fPathMarks.end(); i++)
313 {
314 pm = *i;
315 printf("Reve::PathMark: %-9s p: %8f %8f %8f Vertex: %8e %8e %8e %g \n",
316 pm->type_name(),
317 pm->P.x, pm->P.y, pm->P.z,
318 pm->V.x, pm->V.y, pm->V.z,
319 pm->time);
320 }
321}
322
9c39ede9 323/**************************************************************************/
324
325void Track::CtrlClicked(Reve::Track* track)
326{
327 Emit("CtrlClicked(Reve::Track*)", (Long_t)track);
328}
329
48dc973d 330
331/**************************************************************************/
332/**************************************************************************/
333
5a5a1232 334//______________________________________________________________________
335// TrackRnrStyle
336//
337
338ClassImp(Reve::TrackRnrStyle)
339
48dc973d 340Float_t TrackRnrStyle::fgDefMagField = 5;
341const Float_t TrackRnrStyle::fgkB2C = 0.299792458e-3;
5a5a1232 342TrackRnrStyle TrackRnrStyle::fgDefStyle;
343
265ecb21 344TrackRnrStyle::TrackRnrStyle() :
345 TObject(),
5a5a1232 346
265ecb21 347 fColor(1),
2074deef 348 fWidth(1),
265ecb21 349 fMagField(fgDefMagField),
5a5a1232 350
265ecb21 351 fMaxR (350),
352 fMaxZ (450),
5a5a1232 353
265ecb21 354 fMaxOrbs (0.5),
355 fMinAng (45),
356 fDelta (0.1),
5a5a1232 357
22df2a83 358 fMinPt (0.1),
359 fMaxPt (10),
360
7cbaaebd 361 fFitDaughters (kTRUE),
362 fFitReferences (kTRUE),
363 fFitDecay (kTRUE),
5a5a1232 364
7cbaaebd 365 fRnrDaughters (kTRUE),
366 fRnrReferences (kTRUE),
367 fRnrDecay (kTRUE)
368{}
5a5a1232 369/**************************************************************************/
370/**************************************************************************/
371
372//______________________________________________________________________
373// TrackList
374//
375
376ClassImp(Reve::TrackList)
377
378void TrackList::Init()
379{
7cbaaebd 380 fMarkerStyle = 5;
5a5a1232 381 fMarkerColor = 5;
382 // fMarker->SetMarkerSize(0.05);
383
a8600b56 384 if (fRnrStyle== 0) fRnrStyle = new TrackRnrStyle;
385 SetMainColorPtr(&fRnrStyle->fColor);
5a5a1232 386}
387
a8600b56 388TrackList::TrackList(Int_t n_tracks, TrackRnrStyle* rs) :
7d42b6c2 389 RenderElementListBase(),
265ecb21 390 TPolyMarker3D(n_tracks),
391
392 fTitle(),
393
7cbaaebd 394 fRnrStyle (rs),
395 fRnrTracks (kTRUE),
396 fEditPathMarks (kFALSE)
5a5a1232 397{
398 Init();
399}
400
a8600b56 401TrackList::TrackList(const Text_t* name, Int_t n_tracks, TrackRnrStyle* rs) :
7d42b6c2 402 RenderElementListBase(),
265ecb21 403 TPolyMarker3D(n_tracks),
a8600b56 404
265ecb21 405 fTitle(),
406
a8600b56 407 fRnrStyle (rs),
265ecb21 408 fRnrTracks (kTRUE)
5a5a1232 409{
410 Init();
411 SetName(name);
412}
413
414void TrackList::Reset(Int_t n_tracks)
415{
416 delete [] fP; fP = 0;
417 fN = n_tracks;
418 if(fN) fP = new Float_t [3*fN];
419 memset(fP, 0, 3*fN*sizeof(Float_t));
420 fLastPoint = -1;
421}
422
423/**************************************************************************/
424
425void TrackList::Paint(Option_t* option)
426{
427 if(fRnrElement) {
428 if(fRnrMarkers) {
429 TPolyMarker3D::Paint(option);
430 }
431 if(fRnrTracks) {
9c39ede9 432 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
5a5a1232 433 if((*i)->GetRnrElement())
434 (*i)->GetObject()->Paint(option);
435 }
436 }
437 }
438}
439
440/**************************************************************************/
441
442void TrackList::AddElement(RenderElement* el)
443{
444 static const Exc_t eH("TrackList::AddElement ");
445 if (dynamic_cast<Track*>(el) == 0)
446 throw(eH + "new element not a Track.");
447 RenderElementListBase::AddElement(el);
448}
449
450/**************************************************************************/
451
5a5a1232 452void TrackList::MakeTracks()
453{
9c39ede9 454 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
5a5a1232 455 ((Track*)(*i))->MakeTrack();
456 }
457 gReve->Redraw3D();
458}
459
460
461void TrackList::MakeMarkers()
462{
7d42b6c2 463 Reset(fChildren.size());
9c39ede9 464 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
5a5a1232 465 Track& t = *((Track*)(*i));
466 if(t.GetN() > 0)
467 SetNextPoint(t.fV.x, t.fV.y, t.fV.z);
468 }
469 gReve->Redraw3D();
470}
471
472/**************************************************************************/
473/*************************************************************************/
474
2074deef 475void TrackList::SetWidth(Width_t w)
476{
477 Width_t oldw = fRnrStyle->fWidth;
478 fRnrStyle->fWidth = w;
9c39ede9 479 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
2074deef 480 Track& t = *((Track*)(*i));
481 if (t.GetLineWidth() == oldw)
482 t.SetLineWidth(w);
483 }
484}
485
5a5a1232 486void TrackList::SetMaxR(Float_t x)
487{
a8600b56 488 fRnrStyle->fMaxR = x;
5a5a1232 489 MakeTracks();
490 MakeMarkers();
491}
492
493void TrackList::SetMaxZ(Float_t x)
494{
a8600b56 495 fRnrStyle->fMaxZ = x;
5a5a1232 496 MakeTracks();
497 MakeMarkers();
498}
499
500void TrackList::SetMaxOrbs(Float_t x)
501{
a8600b56 502 fRnrStyle->fMaxOrbs = x;
5a5a1232 503 MakeTracks();
504}
505
506void TrackList::SetMinAng(Float_t x)
507{
a8600b56 508 fRnrStyle->fMinAng = x;
5a5a1232 509 MakeTracks();
510}
511
512void TrackList::SetDelta(Float_t x)
513{
a8600b56 514 fRnrStyle->fDelta = x;
5a5a1232 515 MakeTracks();
516}
517
518void TrackList::SetFitDaughters(Bool_t x)
519{
a8600b56 520 fRnrStyle->fFitDaughters = x;
5a5a1232 521 MakeTracks();
522}
523
7cbaaebd 524void TrackList::SetFitReferences(Bool_t x)
525{
526 fRnrStyle->fFitReferences = x;
527 MakeTracks();
528}
529
5a5a1232 530void TrackList::SetFitDecay(Bool_t x)
531{
a8600b56 532 fRnrStyle->fFitDecay = x;
5a5a1232 533 MakeTracks();
534}
535
7cbaaebd 536void TrackList::SetRnrDecay(Bool_t rnr)
537{
538 fRnrStyle->fRnrDecay = rnr;
539 MakeTracks();
540}
541
542void TrackList::SetRnrDaughters(Bool_t rnr)
543{
544 fRnrStyle->fRnrDaughters = rnr;
545 MakeTracks();
546}
547
548void TrackList::SetRnrReferences(Bool_t rnr)
549{
550 fRnrStyle->fRnrReferences = rnr;
551 MakeTracks();
552}
553
554void TrackList::SetRnrMarkers(Bool_t rnr)
555{
556 fRnrMarkers = rnr;
557 gReve->Redraw3D();
558}
559
560void TrackList::SetRnrTracks(Bool_t rnr)
561{
562
563 fRnrTracks = rnr;
564 gReve->Redraw3D();
565}
566
5a5a1232 567/**************************************************************************/
568/**************************************************************************/
569
570void TrackList::SelectByPt(Float_t min_pt, Float_t max_pt)
571{
22df2a83 572 fRnrStyle->fMinPt = min_pt;
573 fRnrStyle->fMaxPt = max_pt;
574
5a5a1232 575 Float_t minptsq = min_pt*min_pt;
576 Float_t maxptsq = max_pt*max_pt;
577 Float_t ptsq;
578
9c39ede9 579 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
5a5a1232 580 ptsq = ((Track*)(*i))->fP.Perp2();
581 (*i)->SetRnrElement(ptsq >= minptsq && ptsq <= maxptsq);
582 }
583}
584
585/**************************************************************************/
586
b99aed53 587void TrackList::ImportHits()
5a5a1232 588{
9c39ede9 589 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
b99aed53 590 ((Track*)(*i))->ImportHits();
591 }
5a5a1232 592}
593
b99aed53 594void TrackList::ImportClusters()
5a5a1232 595{
9c39ede9 596 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
b99aed53 597 ((Track*)(*i))->ImportClusters();
598 }
5a5a1232 599}
9c39ede9 600
601/**************************************************************************/
602/**************************************************************************/
603/**************************************************************************/
604
605#include "RGEditor.h"
606
607//______________________________________________________________________
608// TrackCounter
609//
610
611ClassImp(TrackCounter)
612
b1f08706 613TrackCounter* TrackCounter::fgInstance = 0;
614
9c39ede9 615TrackCounter::TrackCounter(const Text_t* name, const Text_t* title) :
616 RenderElement(),
617 TNamed(name, title),
618
619 fBadLineStyle (6),
620 fClickAction (CA_ToggleTrack),
621 fAllTracks (0),
622 fGoodTracks (0),
623 fTrackLists ()
624{
b1f08706 625 if (fgInstance == 0) fgInstance = this;
9c39ede9 626 TQObject::Connect("Reve::Track", "CtrlClicked(Reve::Track*)",
627 "Reve::TrackCounter", this, "DoTrackAction(Reve::Track*)");
628}
629
630TrackCounter::~TrackCounter()
631{
632 TQObject::Disconnect("Reve::Track", "DoTrackAction(Reve::Track*)");
b1f08706 633 if (fgInstance == this) fgInstance = 0;
9c39ede9 634}
635
636/**************************************************************************/
637
638void TrackCounter::Reset()
639{
640 printf("TrackCounter::Reset()\n");
641 fAllTracks = 0;
642 fGoodTracks = 0;
643 TIter next(&fTrackLists);
644 TrackList* tlist;
645 while ((tlist = dynamic_cast<TrackList*>(next())))
646 tlist->RemoveParent(this);
647 fTrackLists.Clear();
648}
649
650void TrackCounter::RegisterTracks(TrackList* tlist, Bool_t goodTracks)
651{
652 // printf("TrackCounter::RegisterTracks '%s', %s\n",
653 // tlist->GetObject()->GetName(), goodTracks ? "good" : "bad");
654
655 tlist->AddParent(this);
656 fTrackLists.Add(tlist);
657
658 List_i i = tlist->BeginChildren();
659 while (i != tlist->EndChildren())
660 {
661 Track* t = dynamic_cast<Track*>(*i);
662 if (t != 0)
663 {
664 if (goodTracks)
665 {
666 ++fGoodTracks;
667 } else {
668 t->SetLineStyle(fBadLineStyle);
669 }
670 ++fAllTracks;
671 }
672 ++i;
673 }
674}
675
676void TrackCounter::DoTrackAction(Track* track)
677{
678 // !!!! No check done if ok.
679 // !!!! Should also override RemoveElementLocal
7af62191 680 // !!!! But then ... should also sotre local information if track is ok.
9c39ede9 681
682 switch (fClickAction)
683 {
684
685 case CA_PrintTrackInfo:
686 {
687 printf("Track '%s'\n", track->GetObject()->GetName());
688 Vector &v = track->fV, &p = track->fP;
689 printf(" Vx=%f, Vy=%f, Vz=%f; Pt=%f, Pz=%f, phi=%f)\n",
690 v.x, v.y, v.z, p.Perp(), p.z, TMath::RadToDeg()*p.Phi());
691 printf(" <other information should be printed ... full AliESDtrack>\n");
692 break;
693 }
694
695 case CA_ToggleTrack:
696 {
697 if (track->GetLineStyle() == 1)
698 {
699 track->SetLineStyle(fBadLineStyle);
700 --fGoodTracks;
701 } else {
702 track->SetLineStyle(1);
703 ++fGoodTracks;
704 }
705 gReve->Redraw3D();
706
707 printf("TrackCounter::CountTrack All=%d, Good=%d, Bad=%d\n",
708 fAllTracks, fGoodTracks, fAllTracks-fGoodTracks);
709
710 if (gReve->GetEditor()->GetModel() == GetObject())
711 gReve->EditRenderElement(this);
712
713 break;
714 }
715
716 } // end switch fClickAction
717}
7af62191 718
719/**************************************************************************/
720
721void TrackCounter::OutputEventTracks(FILE* out)
722{
723 if (out == 0)
724 {
725 out = stdout;
726 fprintf(out, "TrackCounter::FinalizeEvent()\n");
727 }
728
729 fprintf(out, "Event = %d Ntracks = %d\n", fEventId, fGoodTracks);
730
731 TIter tlists(&fTrackLists);
732 TrackList* tlist;
733 Int_t cnt = 0;
734 while ((tlist = (TrackList*) tlists()) != 0)
735 {
736 List_i i = tlist->BeginChildren();
737 while (i != tlist->EndChildren())
738 {
739 Track* t = dynamic_cast<Track*>(*i);
740 if (t != 0 && t->GetLineStyle() == 1)
741 {
742 ++cnt;
743 fprintf(out, " %2d: chg=%+2d pt=%8.5f eta=%+8.5f\n",
744 cnt, t->fCharge, t->fP.Perp(), t->fP.Eta());
745 }
746 ++i;
747 }
7af62191 748 }
749}