Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveTrack.cxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include <ROOT/REveTrack.hxx>
14#include <ROOT/REvePointSet.hxx>
15#include <ROOT/REveManager.hxx>
17
18#include "TParticle.h"
19#include "TParticlePDG.h"
20#include "TClass.h"
21
22#include <iostream>
23#include <vector>
24#include <algorithm>
25#include <functional>
26
27
28using namespace ROOT::Experimental;
29
30/** \class REveTrack
31\ingroup REve
32Visual representation of a track.
33
34If member fDpDs is set, the momentum is reduced on all path-marks that do
35not fix the momentum according to the distance travelled from the previous
36pathmark.
37*/
38
39////////////////////////////////////////////////////////////////////////////////
40/// Default constructor.
41
42REveTrack::REveTrack() :
43 REveLine(),
44
45 fV(),
46 fP(),
47 fPEnd(),
48 fBeta(0),
49 fDpDs(0),
50 fPdg(0),
51 fCharge(0),
52 fLabel(kMinInt),
53 fIndex(kMinInt),
54 fStatus(0),
55 fLockPoints(kFALSE),
56 fPathMarks(),
57 fLastPMIdx(0),
58 fPropagator(nullptr)
59{
60}
61
62////////////////////////////////////////////////////////////////////////////////
63/// Constructor from TParticle.
64
66 REveLine(),
67
68 fV(t->Vx(), t->Vy(), t->Vz()),
69 fP(t->Px(), t->Py(), t->Pz()),
70 fPEnd(),
71 fBeta(t->P()/t->Energy()),
72 fDpDs(0),
73 fPdg(0),
74 fCharge(0),
75 fLabel(label),
76 fIndex(kMinInt),
77 fStatus(t->GetStatusCode()),
78 fLockPoints(kFALSE),
79 fPathMarks(),
80 fLastPMIdx(0),
81 fPropagator(nullptr)
82{
85
86 TParticlePDG *pdgp = t->GetPDG();
87 if (pdgp) {
88 fPdg = pdgp->PdgCode();
89 fCharge = (Int_t) TMath::Nint(pdgp->Charge()/3);
90 }
91
92 SetName(t->GetName());
93}
94
95////////////////////////////////////////////////////////////////////////////////
96
98 REveLine(),
99
100 fV(t->Vx(), t->Vy(), t->Vz()),
101 fP(t->Px(), t->Py(), t->Pz()),
102 fPEnd(),
103 fBeta(t->P()/t->Energy()),
104 fDpDs(0),
105 fPdg(0),
106 fCharge(0),
107 fLabel(t->fLabel),
108 fIndex(t->fIndex),
109 fStatus(t->GetStatusCode()),
110 fLockPoints(kFALSE),
111 fPathMarks(),
112 fLastPMIdx(0),
113 fPropagator(nullptr)
114{
115 // Constructor from REveUtil Monte Carlo track.
116
119
120 TParticlePDG* pdgp = t->GetPDG();
121 if (pdgp) {
122 fCharge = (Int_t) TMath::Nint(pdgp->Charge()/3);
123 }
124
125 SetName(t->GetName());
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Constructor from REveRecTrack<double> reconstructed track.
130
132 REveLine(),
133
134 fV(t->fV),
135 fP(t->fP),
136 fPEnd(),
137 fBeta(t->fBeta),
138 fDpDs(0),
139 fPdg(0),
140 fCharge(t->fSign),
141 fLabel(t->fLabel),
142 fIndex(t->fIndex),
143 fStatus(t->fStatus),
144 fLockPoints(kFALSE),
145 fPathMarks(),
146 fLastPMIdx(0),
147 fPropagator(nullptr)
148{
151}
152
153////////////////////////////////////////////////////////////////////////////////
154/// Constructor from REveRecTrack<float> reconstructed track.
155/// It is recommended to use constructor with REveRecTrack<double> since
156/// REveTrackPropagator operates with double type.
157
159 REveLine(),
160
161 fV(t->fV),
162 fP(t->fP),
163 fPEnd(),
164 fBeta(t->fBeta),
165 fDpDs(0),
166 fPdg(0),
167 fCharge(t->fSign),
168 fLabel(t->fLabel),
169 fIndex(t->fIndex),
170 fStatus(t->fStatus),
171 fLockPoints(kFALSE),
172 fPathMarks(),
173 fLastPMIdx(0),
174 fPropagator(nullptr)
175{
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Copy constructor. Track parameters are copied but the
182/// extrapolation is not performed so you should still call
183/// MakeTrack() to do that.
184/// If points of 't' are locked, they are cloned.
185
187 REveLine(t),
188 fV(t.fV),
189 fP(t.fP),
190 fPEnd(),
191 fBeta(t.fBeta),
192 fDpDs(t.fDpDs),
193 fPdg(t.fPdg),
194 fCharge(t.fCharge),
195 fLabel(t.fLabel),
196 fIndex(t.fIndex),
197 fStatus(t.fStatus),
198 fLockPoints(t.fLockPoints),
199 fPathMarks(),
200 fLastPMIdx(t.fLastPMIdx),
201 fPropagator(nullptr)
202{
203 if (fLockPoints)
204 ClonePoints(t);
205
206 SetPathMarks(t);
208
209 CopyVizParams(&t);
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Destructor.
214
216{
217 SetPropagator(nullptr);
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Compute the bounding box of the track.
222
224{
225 BBoxInit();
226 for (Int_t i = 0; i < fSize; ++i)
228 for (const auto &pm : fPathMarks)
229 BBoxCheckPoint(pm.fV.fX, pm.fV.fY, pm.fV.fZ);
230}
231
232////////////////////////////////////////////////////////////////////////////////
233/// Set standard track title based on most data-member values.
234
236{
237 TString idx(fIndex == kMinInt ? "<undef>" : Form("%d", fIndex));
238 TString lbl(fLabel == kMinInt ? "<undef>" : Form("%d", fLabel));
239 SetTitle(Form("Index=%s, Label=%s\nChg=%d, Pdg=%d\n"
240 "pT=%.3f, pZ=%.3f\nV=(%.3f, %.3f, %.3f)",
241 idx.Data(), lbl.Data(), fCharge, fPdg,
242 fP.Perp(), fP.fZ, fV.fX, fV.fY, fV.fZ));
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Copy track parameters from t. Track-propagator is set, too.
247/// PathMarks are cleared - you can copy them via SetPathMarks(t).
248/// If track 't' is locked, you should probably clone its points
249/// over - use REvePointSet::ClonePoints(t);
250
252{
253 fV = t.fV;
254 fP = t.fP;
255 fBeta = t.fBeta;
256 fPdg = t.fPdg;
257 fCharge = t.fCharge;
258 fLabel = t.fLabel;
259 fIndex = t.fIndex;
260
261 fPathMarks.clear();
263}
264
265////////////////////////////////////////////////////////////////////////////////
266/// Copy path-marks from t.
267
269{
270 std::copy(t.RefPathMarks().begin(), t.RefPathMarks().end(),
271 std::back_insert_iterator<vPathMark_t>(fPathMarks));
272}
273
274////////////////////////////////////////////////////////////////////////////////
275/// Set track's propagator.
276/// Reference counts of old and new propagator are updated.
277
285
286////////////////////////////////////////////////////////////////////////////////
287/// Set line and marker attributes from REveTrackList.
288
301
302////////////////////////////////////////////////////////////////////////////////
303/// Calculate track representation based on track data and current
304/// settings of the propagator.
305/// If recurse is true, descend into children.
306
308{
309 if (!fLockPoints)
310 {
311 Reset(0);
312 fLastPMIdx = 0;
313
315
316 const Double_t maxRsq = rTP.GetMaxR() * rTP.GetMaxR();
317 const Double_t maxZ = rTP.GetMaxZ();
318
319 if ( ! REveTrackPropagator::IsOutsideBounds(fV, maxRsq, maxZ))
320 {
321 REveVectorD currP = fP;
322 Bool_t decay = kFALSE;
323 rTP.InitTrack(fV, fCharge);
324 for (auto pm = fPathMarks.begin(); pm != fPathMarks.end(); ++pm, ++fLastPMIdx)
325 {
326 Int_t start_point = rTP.GetCurrentPoint();
327
328 if (rTP.GetFitReferences() && pm->fType == REvePathMarkD::kReference)
329 {
330 if (REveTrackPropagator::IsOutsideBounds(pm->fV, maxRsq, maxZ))
331 break;
332 if (rTP.GoToVertex(pm->fV, currP))
333 {
334 currP.fX = pm->fP.fX; currP.fY = pm->fP.fY; currP.fZ = pm->fP.fZ;
335 }
336 else
337 {
338 break;
339 }
340 }
341 else if (rTP.GetFitDaughters() && pm->fType == REvePathMarkD::kDaughter)
342 {
343 if (REveTrackPropagator::IsOutsideBounds(pm->fV, maxRsq, maxZ))
344 break;
345 if (rTP.GoToVertex(pm->fV, currP))
346 {
347 currP.fX -= pm->fP.fX; currP.fY -= pm->fP.fY; currP.fZ -= pm->fP.fZ;
348 if (fDpDs != 0)
349 {
350 Double_t dp = fDpDs * rTP.GetTrackLength(start_point);
351 Double_t p = currP.Mag();
352 if (p > dp) currP *= 1.0 - dp / p;
353 }
354 }
355 else
356 {
357 break;
358 }
359 }
360 else if (rTP.GetFitDecay() && pm->fType == REvePathMarkD::kDecay)
361 {
362 if (REveTrackPropagator::IsOutsideBounds(pm->fV, maxRsq, maxZ))
363 break;
364 rTP.GoToVertex(pm->fV, currP);
365 decay = kTRUE;
366 ++fLastPMIdx;
367 break;
368 }
369 else if (rTP.GetFitCluster2Ds() && pm->fType == REvePathMarkD::kCluster2D)
370 {
371 REveVectorD itsect;
372 if (rTP.IntersectPlane(currP, pm->fV, pm->fP, itsect))
373 {
374 REveVectorD delta = itsect - pm->fV;
375 REveVectorD vtopass = pm->fV + pm->fE*(pm->fE.Dot(delta));
376 if (REveTrackPropagator::IsOutsideBounds(vtopass, maxRsq, maxZ))
377 break;
378 if ( ! rTP.GoToVertex(vtopass, currP))
379 break;
380
381 if (fDpDs != 0)
382 {
383 Double_t dp = fDpDs * rTP.GetTrackLength(start_point);
384 Double_t p = currP.Mag();
385 if (p > dp) currP *= 1.0 - dp / p;
386 }
387 }
388 else
389 {
390 Warning("REveTrack::MakeTrack", "Failed to intersect plane for Cluster2D. Ignoring path-mark.");
391 }
392 }
393 else if (rTP.GetFitLineSegments() && pm->fType == REvePathMarkD::kLineSegment)
394 {
395 if (REveTrackPropagator::IsOutsideBounds(pm->fV, maxRsq, maxZ))
396 break;
397
398 if (rTP.GoToLineSegment(pm->fV, pm->fE, currP))
399 {
400 if (fDpDs != 0)
401 {
402 Double_t dp = fDpDs * rTP.GetTrackLength(start_point);
403 Double_t p = currP.Mag();
404 if (p > dp) currP *= 1.0 - dp / p;
405 }
406 }
407 else
408 {
409 break;
410 }
411 }
412 else
413 {
414 if (REveTrackPropagator::IsOutsideBounds(pm->fV, maxRsq, maxZ))
415 break;
416 }
417 } // loop path-marks
418
419 if (!decay)
420 {
421 // printf("%s loop to bounds \n",fName.Data() );
422 rTP.GoToBounds(currP);
423 }
424 fPEnd = currP;
425 // make_polyline:
426 rTP.FillPointSet(this);
427 rTP.ResetTrack();
428 }
429 }
430
431 if (recurse)
432 {
433 for (auto &c: fChildren) {
434 REveTrack* t = dynamic_cast<REveTrack *>(c);
435 if (t) t->MakeTrack(recurse);
436 }
437 }
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// Copy visualization parameters from element el.
442
444{
445 // No local parameters.
446
447 // const REveTrack* t = dynamic_cast<const REveTrack*>(el);
448 // if (t)
449 // {}
450
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Write visualization parameters.
456
457void REveTrack::WriteVizParams(std::ostream& out, const TString& var)
458{
459 REveLine::WriteVizParams(out, var);
460
461 // TString t = " " + var + "->";
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Virtual from REveProjectable, return REveTrackProjected class.
466
468{
469 return TClass::GetClass<REveTrackProjected>();
470}
471
472namespace
473{
474 struct Cmp_pathmark_t
475 {
476 bool operator()(REvePathMarkD const & a, REvePathMarkD const & b)
477 { return a.fTime < b.fTime; }
478 };
479}
480
481////////////////////////////////////////////////////////////////////////////////
482/// Sort registered pat-marks by time.
483
485{
486 std::sort(fPathMarks.begin(), fPathMarks.end(), Cmp_pathmark_t());
487}
488
489////////////////////////////////////////////////////////////////////////////////
490/// Print registered path-marks.
491
493{
494 static const REveException eh("REveTrack::PrintPathMarks ");
495
496 printf("REveTrack '%s', number of path marks %d, label %d\n",
497 GetCName(), (Int_t)fPathMarks.size(), fLabel);
498
499 for (auto &pm: fPathMarks)
500 {
501 printf(" %-9s p: %8f %8f %8f Vertex: %8e %8e %8e %g Extra:%8f %8f %8f\n",
502 pm.TypeName(),
503 pm.fP.fX, pm.fP.fY, pm.fP.fZ,
504 pm.fV.fX, pm.fV.fY, pm.fV.fZ,
505 pm.fE.fX, pm.fE.fY, pm.fE.fZ,
506 pm.fTime);
507 }
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Fill core part of JSON representation.
512
513Int_t REveTrack::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
514{
515 // TODO: missing streaming of fitting points
516 return REveLine::WriteCoreJson(j, rnr_offset);
517}
518
519////////////////////////////////////////////////////////////////////////////////
520/// Crates 3D point array for rendering.
521
523{
524 // TODO: missing streaming o fitting points
526}
527
528////////////////////////////////////////////////////////////////////////////////
529/// Emits "SecSelected(REveTrack*)" signal.
530
532{
533 // Emit("SecSelected(REveTrack*)", (Long_t)track);
534}
535
536
537//==============================================================================
538//==============================================================================
539
540/** \class REveTrackList
541\ingroup REve
542A list of tracks supporting change of common attributes and
543selection based on track parameters.
544*/
545
546////////////////////////////////////////////////////////////////////////////////
547/// Constructor. If track-propagator argument is 0, a new default
548/// one is created.
549
551 REveElement(),
552 TAttMarker(1, 20, 1),
553 TAttLine(1,1,1),
554
555 fPropagator(nullptr),
556 fRecurse(kTRUE),
557 fRnrLine(kTRUE),
558 fRnrPoints(kFALSE),
559
560 fMinPt (0), fMaxPt (0), fLimPt (0),
561 fMinP (0), fMaxP (0), fLimP (0)
562{
563
564 fChildClass = TClass::GetClass<REveTrack>(); // override member from base REveElementList
565
567
568 if (!prop) prop = new REveTrackPropagator;
570}
571
572////////////////////////////////////////////////////////////////////////////////
573/// Constructor. If track-propagator argument is 0, a new default
574/// one is created.
575
578 TAttMarker(1, 20, 1),
579 TAttLine(1,1,1),
580
581 fPropagator(nullptr),
582 fRecurse(kTRUE),
583 fRnrLine(kTRUE),
584 fRnrPoints(kFALSE),
585
586 fMinPt (0), fMaxPt (0), fLimPt (0),
587 fMinP (0), fMaxP (0), fLimP (0)
588{
589 fChildClass = TClass::GetClass<REveTrack>(); // override member from base REveElementList
590
592
593 if (!prop) prop = new REveTrackPropagator;
595}
596
597////////////////////////////////////////////////////////////////////////////////
598/// Destructor.
599
604
605////////////////////////////////////////////////////////////////////////////////
606/// Set default propagator for tracks.
607/// This is not enforced onto the tracks themselves but this is the
608/// propagator that is shown in the GUI.
609
617
618////////////////////////////////////////////////////////////////////////////////
619/// Regenerate the visual representations of tracks.
620/// The momentum limits are rescanned during the same traversal.
621
623{
624 fLimPt = fLimP = 0;
625
626 for (auto &c: fChildren) {
627 REveTrack* track = dynamic_cast<REveTrack*>(c);
628 if (track) {
629 track->MakeTrack(recurse);
630
631 fLimPt = TMath::Max(fLimPt, track->fP.Perp());
632 fLimP = TMath::Max(fLimP, track->fP.Mag());
633 }
634 if (recurse)
635 FindMomentumLimits(c, recurse);
636 }
637
640
642}
643
644////////////////////////////////////////////////////////////////////////////////
645/// Loop over children and find highest pT and p of contained EveTracks.
646/// These are stored in members fLimPt and fLimP.
647
649{
650 fLimPt = fLimP = 0;
651
652 if (HasChildren())
653 {
654 for (auto &c: RefChildren())
655 {
656 REveTrack* track = dynamic_cast<REveTrack *>(c);
657 if (track)
658 {
659 fLimPt = TMath::Max(fLimPt, track->fP.Perp());
660 fLimP = TMath::Max(fLimP, track->fP.Mag());
661 }
662 if (recurse)
663 FindMomentumLimits(c, recurse);
664 }
665
668 }
669
671}
672
673////////////////////////////////////////////////////////////////////////////////
674/// Loop over track elements of argument el and find highest pT and p.
675/// These are stored in members fLimPt and fLimP.
676
678{
679 for (auto &c: el->RefChildren()) {
680 auto track = dynamic_cast<REveTrack *>(c);
681 if (track) {
682 fLimPt = TMath::Max(fLimPt, track->fP.Perp());
683 fLimP = TMath::Max(fLimP, track->fP.Mag());
684 }
685 if (recurse)
686 FindMomentumLimits(c, recurse);
687 }
688}
689
690////////////////////////////////////////////////////////////////////////////////
691/// Round the momentum limit up to a nice value.
692
694{
695 using namespace TMath;
696
697 if (x < 1e-3) return 1e-3;
698
699 Double_t fac = Power(10, 1 - Floor(Log10(x)));
700 return Ceil(fac*x) / fac;
701}
702
703////////////////////////////////////////////////////////////////////////////////
704/// Set Min/Max cuts so that they are within detected limits.
705
713
714////////////////////////////////////////////////////////////////////////////////
715/// Set rendering of track as line for the list and the elements.
716
718{
719 for (auto &c: RefChildren()) {
720 auto track = (REveTrack *)(c);
721 if (track->GetRnrLine() == fRnrLine)
722 track->SetRnrLine(rnr);
723 if (fRecurse)
724 SetRnrLine(rnr, c);
725 }
726 fRnrLine = rnr;
727}
728
729////////////////////////////////////////////////////////////////////////////////
730/// Set rendering of track as line for children of el.
731
733{
734 for (auto &c: el->RefChildren()) {
735 auto track = dynamic_cast<REveTrack *>(c);
736 if (track && (track->GetRnrLine() == fRnrLine))
737 track->SetRnrLine(rnr);
738 if (fRecurse)
739 SetRnrLine(rnr, c);
740 }
741}
742
743////////////////////////////////////////////////////////////////////////////////
744/// Set rendering of track as points for the list and the elements.
745
747{
748 for (auto &c: RefChildren()) {
749 auto track = (REveTrack *)(c);
750 if (track->GetRnrPoints() == fRnrPoints)
751 track->SetRnrPoints(rnr);
752 if (fRecurse)
753 SetRnrPoints(rnr, c);
754 }
755 fRnrPoints = rnr;
756}
757
758////////////////////////////////////////////////////////////////////////////////
759/// Set rendering of track as points for children of el.
760
762{
763 for (auto &c: el->RefChildren()) {
764 auto track = dynamic_cast<REveTrack *>(c);
765 if (track)
766 if (track->GetRnrPoints() == fRnrPoints)
767 track->SetRnrPoints(rnr);
768 if (fRecurse)
769 SetRnrPoints(rnr, c);
770 }
771}
772
773////////////////////////////////////////////////////////////////////////////////
774/// Set main (line) color for the list and the elements.
775
777{
778 for (auto &c: RefChildren()) {
779 auto track = (REveTrack *)(c);
780 if (track->GetLineColor() == fLineColor)
781 track->SetLineColor(col);
782 if (fRecurse)
783 SetLineColor(col, c);
784 }
786}
787
788////////////////////////////////////////////////////////////////////////////////
789/// Set line color for children of el.
790
792{
793 for (auto &c: el->RefChildren()) {
794 auto track = dynamic_cast<REveTrack *>(c);
795 if (track && track->GetLineColor() == fLineColor)
796 track->SetLineColor(col);
797 if (fRecurse)
798 SetLineColor(col, c);
799 }
800}
801
802////////////////////////////////////////////////////////////////////////////////
803/// Set line width for the list and the elements.
804
806{
807 for (auto &c: RefChildren()) {
808 auto track = (REveTrack *)(c);
809 if (track->GetLineWidth() == fLineWidth)
810 track->SetLineWidth(width);
811 if (fRecurse)
813 }
815}
816
817////////////////////////////////////////////////////////////////////////////////
818/// Set line width for children of el.
819
821{
822 for (auto &c: el->RefChildren()) {
823 auto track = dynamic_cast<REveTrack *>(c);
824 if (track && track->GetLineWidth() == fLineWidth)
825 track->SetLineWidth(width);
826 if (fRecurse)
828 }
829}
830
831////////////////////////////////////////////////////////////////////////////////
832/// Set line style for the list and the elements.
833
835{
836 for (auto &c: RefChildren()) {
837 auto track = (REveTrack *)(c);
838 if (track->GetLineStyle() == fLineStyle)
839 track->SetLineStyle(style);
840 if (fRecurse)
842 }
844}
845
846////////////////////////////////////////////////////////////////////////////////
847/// Set line style for children of el.
848
850{
851 for (auto &c: el->RefChildren()) {
852 auto track = dynamic_cast<REveTrack *>(c);
853 if (track && track->GetLineStyle() == fLineStyle)
854 track->SetLineStyle(style);
855 if (fRecurse)
857 }
858}
859
860////////////////////////////////////////////////////////////////////////////////
861/// Set marker style for the list and the elements.
862
864{
865 for (auto &c: RefChildren()) {
866 auto track = (REveTrack *)(c);
867 if (track->GetMarkerStyle() == fMarkerStyle)
868 track->SetMarkerStyle(style);
869 if (fRecurse)
871 }
873}
874
875////////////////////////////////////////////////////////////////////////////////
876/// Set marker style for children of el.
877
879{
880 for (auto &c: el->RefChildren()) {
881 auto track = dynamic_cast<REveTrack *>(c);
882 if (track && track->GetMarkerStyle() == fMarkerStyle)
883 track->SetMarkerStyle(style);
884 if (fRecurse)
886 }
887}
888
889////////////////////////////////////////////////////////////////////////////////
890/// Set marker color for the list and the elements.
891
893{
894 for (auto &c: RefChildren()) {
895 auto track = (REveTrack *)(c);
896 if (track->GetMarkerColor() == fMarkerColor)
897 track->SetMarkerColor(col);
898 if (fRecurse)
899 SetMarkerColor(col, c);
900 }
901 fMarkerColor = col;
902}
903
904////////////////////////////////////////////////////////////////////////////////
905/// Set marker color for children of el.
906
908{
909 for (auto &c: el->RefChildren()) {
910 auto track = dynamic_cast<REveTrack *>(c);
911 if (track && track->GetMarkerColor() == fMarkerColor)
912 track->SetMarkerColor(col);
913 if (fRecurse)
914 SetMarkerColor(col, c);
915 }
916}
917
918////////////////////////////////////////////////////////////////////////////////
919/// Set marker size for the list and the elements.
920
922{
923 for (auto &c: RefChildren()) {
924 auto track = (REveTrack *)(c);
925 if (track->GetMarkerSize() == fMarkerSize)
926 track->SetMarkerSize(size);
927 if (fRecurse)
929 }
931}
932
933////////////////////////////////////////////////////////////////////////////////
934/// Set marker size for children of el.
935
937{
938 for (auto &c: el->RefChildren()) {
939 auto track = dynamic_cast<REveTrack*>(c);
940 if (track && track->GetMarkerSize() == fMarkerSize)
941 track->SetMarkerSize(size);
942 if (fRecurse)
944 }
945}
946
947////////////////////////////////////////////////////////////////////////////////
948/// Select visibility of tracks by transverse momentum.
949/// If data-member fRecurse is set, the selection is applied
950/// recursively to all children.
951
953{
954 fMinPt = min_pt;
955 fMaxPt = max_pt;
956
957 const Double_t minptsq = min_pt*min_pt;
958 const Double_t maxptsq = max_pt*max_pt;
959
960 for (auto &c: RefChildren()) {
961 const Double_t ptsq = ((REveTrack*)c)->fP.Perp2();
962 Bool_t on = ptsq >= minptsq && ptsq <= maxptsq;
963 c->SetRnrState(on);
964 if (on && fRecurse)
965 SelectByPt(min_pt, max_pt, c);
966 }
967}
968
969////////////////////////////////////////////////////////////////////////////////
970/// Select visibility of el's children tracks by transverse momentum.
971
973{
974 const Double_t minptsq = min_pt*min_pt;
975 const Double_t maxptsq = max_pt*max_pt;
976
977 for (auto &c: el->RefChildren()) {
978 auto track = (REveTrack *)(c);
979 if (track) {
980 const Double_t ptsq = track->fP.Perp2();
981 Bool_t on = ptsq >= minptsq && ptsq <= maxptsq;
982 track->SetRnrState(on);
983 if (on && fRecurse)
984 SelectByPt(min_pt, max_pt, c);
985 }
986 }
987}
988
989////////////////////////////////////////////////////////////////////////////////
990/// Select visibility of tracks by momentum.
991/// If data-member fRecurse is set, the selection is applied
992/// recursively to all children.
993
995{
996 fMinP = min_p;
997 fMaxP = max_p;
998
999 const Double_t minpsq = min_p*min_p;
1000 const Double_t maxpsq = max_p*max_p;
1001
1002 for (auto &c: RefChildren()) {
1003 const Double_t psq = ((REveTrack*)c)->fP.Mag2();
1004 Bool_t on = psq >= minpsq && psq <= maxpsq;
1005 c->SetRnrState(psq >= minpsq && psq <= maxpsq);
1006 if (on && fRecurse)
1007 SelectByP(min_p, max_p, c);
1008 }
1009}
1010
1011////////////////////////////////////////////////////////////////////////////////
1012/// Select visibility of el's children tracks by momentum.
1013
1015{
1016 const Double_t minpsq = min_p*min_p;
1017 const Double_t maxpsq = max_p*max_p;
1018
1019 for (auto &c: el->RefChildren()) {
1020 auto track = (REveTrack *)(c);
1021 if (track) {
1022 const Double_t psq = ((REveTrack*)c)->fP.Mag2();
1023 Bool_t on = psq >= minpsq && psq <= maxpsq;
1024 track->SetRnrState(on);
1025 if (on && fRecurse)
1026 SelectByP(min_p, max_p, c);
1027 }
1028 }
1029}
1030
1031////////////////////////////////////////////////////////////////////////////////
1032/// Find track by label, select it and display it in the editor.
1033
1035{
1036 for (auto &c: fChildren) {
1037 if (((REveTrack*)c)->GetLabel() == label)
1038 {
1039 // TGListTree *lt = REX::gEve->GetLTEFrame()->GetListTree();
1040 // TGListTreeItem *mlti = lt->GetSelected();
1041 // if (mlti->GetUserData() != this)
1042 // mlti = FindListTreeItem(lt);
1043 // TGListTreeItem *tlti = (*i)->FindListTreeItem(lt, mlti);
1044 // lt->HighlightItem(tlti);
1045 // lt->SetSelected(tlti);
1046 // REX::gEve->EditElement(*i);
1047 return (REveTrack*) c;
1048 }
1049 }
1050 return nullptr;
1051}
1052
1053////////////////////////////////////////////////////////////////////////////////
1054/// Find track by index, select it and display it in the editor.
1055
1057{
1058 for (auto &c: fChildren) {
1059 if (((REveTrack *)c)->GetIndex() == index) {
1060 // TGListTree *lt = REX::gEve->GetLTEFrame()->GetListTree();
1061 // TGListTreeItem *mlti = lt->GetSelected();
1062 // if (mlti->GetUserData() != this)
1063 // mlti = FindListTreeItem(lt);
1064 // TGListTreeItem *tlti = (*i)->FindListTreeItem(lt, mlti);
1065 // lt->HighlightItem(tlti);
1066 // lt->SetSelected(tlti);
1067 // REX::gEve->EditElement(*i);
1068 return (REveTrack *) c;
1069 }
1070 }
1071 return nullptr;
1072}
1073
1074////////////////////////////////////////////////////////////////////////////////
1075/// Copy visualization parameters from element el.
1076
1078{
1079 const REveTrackList* m = dynamic_cast<const REveTrackList*>(el);
1080 if (m)
1081 {
1082 TAttMarker::operator=(*m);
1083 TAttLine::operator=(*m);
1084 fRecurse = m->fRecurse;
1085 fRnrLine = m->fRnrLine;
1086 fRnrPoints = m->fRnrPoints;
1087 fMinPt = m->fMinPt;
1088 fMaxPt = m->fMaxPt;
1089 fLimPt = m->fLimPt;
1090 fMinP = m->fMinP;
1091 fMaxP = m->fMaxP;
1092 fLimP = m->fLimP;
1093 }
1094
1096}
1097
1098////////////////////////////////////////////////////////////////////////////////
1099/// Write visualization parameters.
1100
1101void REveTrackList::WriteVizParams(std::ostream& out, const TString& var)
1102{
1104
1105 TString t = " " + var + "->";
1107 TAttLine ::SaveLineAttributes (out, var);
1108 out << t << "SetRecurse(" << ToString(fRecurse) << ");\n";
1109 out << t << "SetRnrLine(" << ToString(fRnrLine) << ");\n";
1110 out << t << "SetRnrPoints(" << ToString(fRnrPoints) << ");\n";
1111 // These setters are not available -- need proper AND/OR mode.
1112 // out << t << "SetMinPt(" << fMinPt << ");\n";
1113 // out << t << "SetMaxPt(" << fMaxPt << ");\n";
1114 // out << t << "SetLimPt(" << fLimPt << ");\n";
1115 // out << t << "SetMinP(" << fMinP << ");\n";
1116 // out << t << "SetMaxP(" << fMaxP << ");\n";
1117 // out << t << "SetLimP(" << fLimP << ");\n";
1118}
1119
1120////////////////////////////////////////////////////////////////////////////////
1121/// Virtual from REveProjectable, returns REveTrackListProjected class.
1122
1124{
1125 return TClass::GetClass<REveTrackListProjected>();
1126}
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Style_t
Style number (short)
Definition RtypesCore.h:97
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Size_t
Attribute size (float)
Definition RtypesCore.h:104
constexpr Int_t kMinInt
Definition RtypesCore.h:121
short Width_t
Line width (short)
Definition RtypesCore.h:99
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t SetLineWidth
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t SetLineColor
Option_t Option_t SetMarkerStyle
Option_t Option_t width
Option_t Option_t style
char name[80]
Definition TGX11.cxx:142
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2571
void SetMainColorPtr(Color_t *colptr)
void BBoxCheckPoint(const REveVector &v)
const char * GetCName() const
virtual void WriteVizParams(std::ostream &out, const TString &var)
Write-out visual parameters for this object.
void SetTitle(const std::string &title)
Set title of an element.
static const std::string & ToString(Bool_t b)
Convert Bool_t to string - kTRUE or kFALSE.
virtual void CopyVizParams(const REveElement *el)
Copy visualization parameters from element el.
void BBoxInit()
Start filling the bounding box with BBoxCheckPoint(): min at +infinity, max at -infinity,...
virtual void SetMainColor(Color_t color)
Set main color of the element.
void SetName(const std::string &name)
Set name of an element.
REveException Exception-type thrown by Eve classes.
Definition REveTypes.hxx:42
REveLine An arbitrary polyline with fixed line and marker attributes.
Definition REveLine.hxx:30
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
Definition REveLine.cxx:246
void SetMarkerColor(Color_t col) override
Set marker color. Propagate to projected lines.
Definition REveLine.cxx:59
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
Definition REveLine.cxx:263
void SetLineWidth(Width_t lwidth) override
Set line-style of the line.
Definition REveLine.cxx:95
void SetLineColor(Color_t col) override
Set the line color.
Definition REveLine.hxx:48
void SetLineStyle(Style_t lstyle) override
Set line-style of the line.
Definition REveLine.cxx:77
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
Definition REveLine.cxx:284
void SetRnrLine(Bool_t r)
Set rendering of line. Propagate to projected lines.
Definition REveLine.cxx:113
void SetRnrPoints(Bool_t r)
Set rendering of points. Propagate to projected lines.
Definition REveLine.cxx:131
void BuildRenderData() override
Virtual from REveElement. Prepares render data for binary streaming to client.
Definition REveLine.cxx:298
virtual void ClonePoints(const REvePointSet &e)
Clone points and all point-related information from point-set 'e'.
void SetMarkerSize(Size_t msize=1) override
Set marker size, propagate to projecteds.
std::vector< REveVector > fPoints
void Reset(Int_t n_points=0)
Drop all data and set-up the data structures to recive new data.
void SetMarkerStyle(Style_t mstyle=1) override
Set marker style, propagate to projecteds.
REveProjection Base for specific classes that implement non-linear projections.
REveRecTrack Template for reconstructed track (also used in VSD).
virtual void IncRefCount(REveElement *re)
Increase reference count and add re to the list of back-references.
Definition REveUtil.cxx:466
virtual void DecRefCount(REveElement *re)
Decrease reference count and remove re from the list of back-references.
Definition REveUtil.cxx:475
REveTrackList A list of tracks supporting change of common attributes and selection based on track pa...
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
void SetRnrLine(Bool_t rnr)
Set rendering of track as line for the list and the elements.
void SetRnrPoints(Bool_t r)
Set rendering of track as points for the list and the elements.
void MakeTracks(Bool_t recurse=kTRUE)
Regenerate the visual representations of tracks.
REveTrackPropagator * fPropagator
void SetMarkerSize(Size_t s) override
Set marker size for the list and the elements.
REveTrackList(const REveTrackList &)=delete
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REveTrackListProjected class.
REveTrack * FindTrackByLabel(Int_t label)
Find track by label, select it and display it in the editor.
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
Double_t RoundMomentumLimit(Double_t x)
Round the momentum limit up to a nice value.
void SelectByP(Double_t min_p, Double_t max_p)
Select visibility of tracks by momentum.
void SelectByPt(Double_t min_pt, Double_t max_pt)
Select visibility of tracks by transverse momentum.
void SetLineWidth(Width_t w) override
Set line width for the list and the elements.
void SanitizeMinMaxCuts()
Set Min/Max cuts so that they are within detected limits.
REveTrack * FindTrackByIndex(Int_t index)
Find track by index, select it and display it in the editor.
void SetMainColor(Color_t c) override
Set main (line) color for the list and the elements.
~REveTrackList() override
Destructor.
void SetPropagator(REveTrackPropagator *prop)
Set default propagator for tracks.
void SetLineStyle(Style_t s) override
Set line style for the list and the elements.
void SetMarkerColor(Color_t c) override
Set marker color for the list and the elements.
void SetLineColor(Color_t c) override
Set the line color.
void FindMomentumLimits(REveElement *el, Bool_t recurse=kTRUE)
Loop over track elements of argument el and find highest pT and p.
void SetMarkerStyle(Style_t s) override
Set marker style for the list and the elements.
REveTrackPropagator Calculates path of a particle taking into account special path-marks and imposed ...
virtual Bool_t GoToVertex(REveVectorD &v, REveVectorD &p)
Propagate particle with momentum p to vertex v.
static Bool_t IsOutsideBounds(const REveVectorD &point, Double_t maxRsqr, Double_t maxZ)
void ResetTrack()
Reset cache holding particle trajectory.
Double_t GetTrackLength(Int_t start_point=0, Int_t end_point=-1) const
Calculate track length from start_point to end_point.
void InitTrack(const REveVectorD &v, Int_t charge)
Initialize internal data-members for given particle parameters.
Bool_t IntersectPlane(const REveVectorD &p, const REveVectorD &point, const REveVectorD &normal, REveVectorD &itsect)
Find intersection of currently propagated track with a plane.
Int_t GetCurrentPoint() const
Get index of current point on track.
void FillPointSet(REvePointSet *ps) const
Reset ps and populate it with points in propagation cache.
virtual Bool_t GoToLineSegment(const REveVectorD &s, const REveVectorD &r, REveVectorD &p)
Propagate particle with momentum p to line with start point s and vector r to the second point.
virtual void GoToBounds(REveVectorD &p)
Propagate particle to bounds.
REveTrack Track with given vertex, momentum and optional referece-points (path-marks) along its path.
Definition REveTrack.hxx:40
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Fill core part of JSON representation.
virtual void SecSelected(REveTrack *)
Emits "SecSelected(REveTrack*)" signal.
REveTrackPropagator * fPropagator
Definition REveTrack.hxx:68
Int_t fLastPMIdx
! Last path-mark index tried in track-propagation.
Definition REveTrack.hxx:66
void SetAttLineAttMarker(REveTrackList *tl)
Set line and marker attributes from REveTrackList.
virtual void SetTrackParams(const REveTrack &t)
Copy track parameters from t.
virtual void MakeTrack(Bool_t recurse=kTRUE)
Calculate track representation based on track data and current settings of the propagator.
REveTrack()
Default constructor.
Definition REveTrack.cxx:42
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, return REveTrackProjected class.
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
virtual void SetPathMarks(const REveTrack &t)
Copy path-marks from t.
void SetPropagator(REveTrackPropagator *prop)
Set track's propagator.
void PrintPathMarks()
Print registered path-marks.
void BuildRenderData() override
Crates 3D point array for rendering.
void ComputeBBox() override
Compute the bounding box of the track.
virtual void SetStdTitle()
Set standard track title based on most data-member values.
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
void SortPathMarksByTime()
Sort registered pat-marks by time.
~REveTrack() override
Destructor.
Line Attributes class.
Definition TAttLine.h:21
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:36
virtual Width_t GetLineWidth() const
Return the line width.
Definition TAttLine.h:38
Width_t fLineWidth
Line width.
Definition TAttLine.h:26
virtual Style_t GetLineStyle() const
Return the line style.
Definition TAttLine.h:37
Style_t fLineStyle
Line style.
Definition TAttLine.h:25
Color_t fLineColor
Line color.
Definition TAttLine.h:24
Marker Attributes class.
Definition TAttMarker.h:22
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition TAttMarker.h:35
virtual Color_t GetMarkerColor() const
Return the marker color.
Definition TAttMarker.h:34
Color_t fMarkerColor
Marker color.
Definition TAttMarker.h:25
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition TAttMarker.h:36
Size_t fMarkerSize
Marker size.
Definition TAttMarker.h:27
Style_t fMarkerStyle
Marker style.
Definition TAttMarker.h:26
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
Description of the static properties of a particle.
Int_t PdgCode() const
Double_t Charge() const
Description of the dynamic properties of a particle.
Definition TParticle.h:26
TParticlePDG * GetPDG(Int_t mode=0) const
Returns a pointer to the TParticlePDG object using the pdgcode.
const char * GetName() const override
Return particle name.
Basic string class.
Definition TString.h:137
const char * Data() const
Definition TString.h:385
Double_t x[n]
Definition legend1.C:17
Namespace for ROOT features in testing.
Definition TROOT.h:100
TMath.
Definition TMathBase.h:35
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition TMath.h:706
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:197
TMarker m
Definition textangle.C:8