Logo ROOT   6.21/01
Reference Guide
REveTrack.hxx
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 #ifndef ROOT7_REveTrack
13 #define ROOT7_REveTrack
14 
15 #include <vector>
16 
17 #include <ROOT/REveVector.hxx>
18 #include <ROOT/REvePathMark.hxx>
19 #include <ROOT/REveElement.hxx>
20 #include <ROOT/REveLine.hxx>
21 #include <ROOT/REveVSDStructs.hxx>
22 
23 #include "TPolyMarker3D.h"
24 #include "TMarker.h"
25 
26 class TParticle;
27 
28 namespace ROOT {
29 namespace Experimental {
30 
31 class REveTrackPropagator;
32 class REveTrackList;
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// REveTrack
36 /// Track with given vertex, momentum and optional referece-points (path-marks) along its path.
37 ////////////////////////////////////////////////////////////////////////////////
38 
39 class REveTrack : public REveLine
40 {
41  friend class REveTrackPropagator;
42  friend class REveTrackList;
43 
44 private:
45  REveTrack &operator=(const REveTrack &) = delete;
46 
47 public:
48  typedef std::vector<REvePathMarkD> vPathMark_t;
49 
50  // Deprecated -- to be removed.
52 
53 protected:
54  REveVectorD fV; // Starting vertex
55  REveVectorD fP; // Starting momentum
56  REveVectorD fPEnd; // Momentum at the last point of extrapolation
57  Double_t fBeta; // Relativistic beta factor
58  Double_t fDpDs; // Momentum loss over distance
59  Int_t fPdg; // PDG code
60  Int_t fCharge; // Charge in units of e0
61  Int_t fLabel; // Simulation label
62  Int_t fIndex; // Reconstruction index
63  Int_t fStatus; // Status-word, user-defined.
64  Bool_t fLockPoints; // Lock points that are currently in - do nothing in MakeTrack().
65  vPathMark_t fPathMarks; // REveVector of known points along the track
66  Int_t fLastPMIdx; //! Last path-mark index tried in track-propagation.
67 
68  REveTrackPropagator *fPropagator{nullptr}; // Pointer to shared render-style
69 
70 public:
71  REveTrack();
72  REveTrack(TParticle *t, Int_t label, REveTrackPropagator *prop = nullptr);
73  // VSD inputs
77  REveTrack(const REveTrack &t);
78  virtual ~REveTrack();
79 
80  void ComputeBBox() override;
81 
82  virtual void SetStdTitle();
83 
84  virtual void SetTrackParams(const REveTrack &t);
85  virtual void SetPathMarks(const REveTrack &t);
86 
87  virtual void MakeTrack(Bool_t recurse = kTRUE);
88 
90  Int_t GetLastPMIdx() const { return fLastPMIdx; }
93 
94  const REveVectorD &GetVertex() const { return fV; }
95  const REveVectorD &GetMomentum() const { return fP; }
96  const REveVectorD &GetEndMomentum() const { return fPEnd; }
97 
98  Double_t GetDpDs() const { return fDpDs; }
99  void SetDpDs(Double_t dpds) { fDpDs = dpds; }
100 
101  Int_t GetPdg() const { return fPdg; }
102  void SetPdg(Int_t pdg) { fPdg = pdg; }
103  Int_t GetCharge() const { return fCharge; }
104  void SetCharge(Int_t chg) { fCharge = chg; }
105  Int_t GetLabel() const { return fLabel; }
106  void SetLabel(Int_t lbl) { fLabel = lbl; }
107  Int_t GetIndex() const { return fIndex; }
108  void SetIndex(Int_t idx) { fIndex = idx; }
109  Int_t GetStatus() const { return fStatus; }
110  void SetStatus(Int_t idx) { fStatus = idx; }
111 
112  void AddPathMark(const REvePathMarkD &pm) { fPathMarks.push_back(pm); }
113  void AddPathMark(const REvePathMark &pm) { fPathMarks.push_back(pm); }
114 
115  void SortPathMarksByTime();
117  const vPathMark_t &RefPathMarks() const { return fPathMarks; }
118 
119  void PrintPathMarks(); // *MENU*
120 
122  Bool_t GetLockPoints() const { return fLockPoints; }
123 
124  //-------------------------------------------------------------------
125 
126  virtual void SecSelected(REveTrack *); // *SIGNAL*
127 
128  void CopyVizParams(const REveElement *el) override;
129  void WriteVizParams(std::ostream &out, const TString &var) override;
130 
131  TClass *ProjectedClass(const REveProjection *p) const override;
132 
133  Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
134  void BuildRenderData() override;
135 };
136 
137 ////////////////////////////////////////////////////////////////////////////////
138 /// REveTrackList
139 /// A list of tracks supporting change of common attributes and selection based on track parameters.
140 ////////////////////////////////////////////////////////////////////////////////
141 
142 class REveTrackList : public REveElement,
143  public REveProjectable,
144  public TAttMarker,
145  public TAttLine
146 {
147 private:
148  REveTrackList(const REveTrackList &) = delete;
149  REveTrackList &operator=(const REveTrackList &) = delete;
150 
151 protected:
152  REveTrackPropagator *fPropagator{nullptr}; // Basic track rendering parameters, not enforced to elements.
153 
154  Bool_t fRecurse; // Recurse when propagating marker/line/etc attributes to tracks.
155 
156  Bool_t fRnrLine; // Render track as line.
157  Bool_t fRnrPoints; // Render track as points.
158 
159  Double_t fMinPt; // Minimum track pTfor display selection.
160  Double_t fMaxPt; // Maximum track pTfor display selection.
161  Double_t fLimPt; // Highest track pT in the container.
162  Double_t fMinP; // Minimum track pfor display selection.
163  Double_t fMaxP; // Maximum track pfor display selection.
164  Double_t fLimP; // Highest track p in the container.
165 
166  void FindMomentumLimits(REveElement *el, Bool_t recurse = kTRUE);
168  void SanitizeMinMaxCuts();
169 
170 public:
171  REveTrackList(REveTrackPropagator *prop = nullptr);
172  REveTrackList(const std::string &name, REveTrackPropagator *prop = nullptr);
173  virtual ~REveTrackList();
174 
175  void MakeTracks(Bool_t recurse = kTRUE);
176  void FindMomentumLimits(Bool_t recurse = kTRUE);
177 
180 
181  Bool_t GetRecurse() const { return fRecurse; }
182  void SetRecurse(Bool_t x) { fRecurse = x; }
183 
184  //--------------------------------
185 
186  void SetMainColor(Color_t c) override;
187  void SetLineColor(Color_t c) override { SetMainColor(c); }
188  virtual void SetLineColor(Color_t c, REveElement *el);
189  void SetLineWidth(Width_t w) override;
190  virtual void SetLineWidth(Width_t w, REveElement *el);
191  void SetLineStyle(Style_t s) override;
192  virtual void SetLineStyle(Style_t s, REveElement *el);
193 
194  void SetMarkerColor(Color_t c) override;
195  virtual void SetMarkerColor(Color_t c, REveElement *el);
196  void SetMarkerSize(Size_t s) override;
197  virtual void SetMarkerSize(Size_t s, REveElement *el);
198  void SetMarkerStyle(Style_t s) override;
199  virtual void SetMarkerStyle(Style_t s, REveElement *el);
200 
201  void SetRnrLine(Bool_t rnr);
202  void SetRnrLine(Bool_t rnr, REveElement *el);
203  Bool_t GetRnrLine() const { return fRnrLine; }
204 
205  void SetRnrPoints(Bool_t r);
206  void SetRnrPoints(Bool_t r, REveElement *el);
207  Bool_t GetRnrPoints() const { return fRnrPoints; }
208 
209  void SelectByPt(Double_t min_pt, Double_t max_pt);
210  void SelectByPt(Double_t min_pt, Double_t max_pt, REveElement *el);
211  void SelectByP(Double_t min_p, Double_t max_p);
212  void SelectByP(Double_t min_p, Double_t max_p, REveElement *el);
213 
214  Double_t GetMinPt() const { return fMinPt; }
215  Double_t GetMaxPt() const { return fMaxPt; }
216  Double_t GetLimPt() const { return fLimPt; }
217  Double_t GetMinP() const { return fMinP; }
218  Double_t GetMaxP() const { return fMaxP; }
219  Double_t GetLimP() const { return fLimP; }
220 
221  //-------------------------------------------------------------------
222 
223  REveTrack *FindTrackByLabel(Int_t label); // *MENU*
224  REveTrack *FindTrackByIndex(Int_t index); // *MENU*
225 
226  void CopyVizParams(const REveElement *el) override;
227  void WriteVizParams(std::ostream &out, const TString &var) override;
228 
229  TClass *ProjectedClass(const REveProjection *p) const override;
230 };
231 
232 } // namespace Experimental
233 } // namespace ROOT
234 
235 #endif
virtual ~REveTrack()
Destructor.
Definition: REveTrack.cxx:222
void SetMarkerColor(Color_t c) override
Set marker color for the list and the elements.
Definition: REveTrack.cxx:912
void SetLineWidth(Width_t w) override
Set line width for the list and the elements.
Definition: REveTrack.cxx:825
void SetDpDs(Double_t dpds)
Definition: REveTrack.hxx:99
REveTrackPropagator * GetPropagator() const
Definition: REveTrack.hxx:89
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
Definition: REveTrack.cxx:1121
REveTrackPropagator Calculates path of a particle taking into account special path-marks and imposed ...
void BuildRenderData() override
Crates 3D point array for rendering.
Definition: REveTrack.cxx:542
short Style_t
Definition: RtypesCore.h:76
Returns the available number of logical cores.
Definition: StringConv.hxx:21
float Size_t
Definition: RtypesCore.h:83
void SetPropagator(REveTrackPropagator *prop)
Set track&#39;s propagator.
Definition: REveTrack.cxx:298
void MakeTracks(Bool_t recurse=kTRUE)
Regenerate the visual representations of tracks.
Definition: REveTrack.cxx:642
const REveVectorD & GetMomentum() const
Definition: REveTrack.hxx:95
virtual void SetTrackParams(const REveTrack &t)
Copy track parameters from t.
Definition: REveTrack.cxx:271
REveTrackList(const REveTrackList &)=delete
Description of the dynamic properties of a particle.
Definition: TParticle.h:26
void SetMainColor(Color_t c) override
Set main (line) color for the list and the elements.
Definition: REveTrack.cxx:796
const REveVectorD & GetVertex() const
Definition: REveTrack.hxx:94
void SetMarkerSize(Size_t s) override
Set marker size for the list and the elements.
Definition: REveTrack.cxx:941
virtual void SecSelected(REveTrack *)
Emits "SecSelected(REveTrack*)" signal.
Definition: REveTrack.cxx:551
std::vector< REvePathMarkD > vPathMark_t
Definition: REveTrack.hxx:48
REveTrack()
Default constructor.
Definition: REveTrack.cxx:49
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~REveTrackList()
Destructor.
Definition: REveTrack.cxx:620
void SetLineColor(Color_t c) override
Set the line color.
Definition: REveTrack.hxx:187
void SanitizeMinMaxCuts()
Set Min/Max cuts so that they are within detected limits.
Definition: REveTrack.cxx:726
void SetLineStyle(Style_t s) override
Set line style for the list and the elements.
Definition: REveTrack.cxx:854
Marker Attributes class.
Definition: TAttMarker.h:19
Double_t x[n]
Definition: legend1.C:17
void SetAttLineAttMarker(REveTrackList *tl)
Set line and marker attributes from REveTrackList.
Definition: REveTrack.cxx:309
void AddPathMark(const REvePathMark &pm)
Definition: REveTrack.hxx:113
REveTrackPropagator * GetPropagator()
Definition: REveTrack.hxx:179
void ComputeBBox() override
Compute the bounding box of the track.
Definition: REveTrack.cxx:230
static constexpr double s
REveProjection Base for specific classes that implement non-linear projections.
short Color_t
Definition: RtypesCore.h:79
virtual void SetStdTitle()
Set standard track title based on most data-member values.
Definition: REveTrack.cxx:255
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
Definition: REveTrack.cxx:463
void FindMomentumLimits(REveElement *el, Bool_t recurse=kTRUE)
Loop over track elements of argument el and find highest pT and p.
Definition: REveTrack.cxx:697
void SetPropagator(REveTrackPropagator *prop)
Set default propagator for tracks.
Definition: REveTrack.cxx:630
virtual void SetPathMarks(const REveTrack &t)
Copy path-marks from t.
Definition: REveTrack.cxx:288
ROOT::R::TRInterface & r
Definition: Object.C:4
REveTrack * FindTrackByLabel(Int_t label)
Find track by label, select it and display it in the editor.
Definition: REveTrack.cxx:1054
Special-point on track:
REveTrack * FindTrackByIndex(Int_t index)
Find track by index, select it and display it in the editor.
Definition: REveTrack.cxx:1076
void SortPathMarksByTime()
Sort registered pat-marks by time.
Definition: REveTrack.cxx:504
void SetMarkerStyle(Style_t s) override
Set marker style for the list and the elements.
Definition: REveTrack.cxx:883
REveTrack & operator=(const REveTrack &)=delete
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
void AddPathMark(const REvePathMarkD &pm)
Definition: REveTrack.hxx:112
REveTrackList & operator=(const REveTrackList &)=delete
REveTrackPropagator * fPropagator
Last path-mark index tried in track-propagation.
Definition: REveTrack.hxx:68
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REveTrackListProjected class.
Definition: REveTrack.cxx:1143
short Width_t
Definition: RtypesCore.h:78
void SelectByP(Double_t min_p, Double_t max_p)
Select visibility of tracks by momentum.
Definition: REveTrack.cxx:1014
double Double_t
Definition: RtypesCore.h:55
const vPathMark_t & RefPathMarks() const
Definition: REveTrack.hxx:117
virtual void MakeTrack(Bool_t recurse=kTRUE)
Calculate track representation based on track data and current settings of the propagator.
Definition: REveTrack.cxx:327
Double_t RoundMomentumLimit(Double_t x)
Round the momentum limit up to a nice value.
Definition: REveTrack.cxx:713
void SelectByPt(Double_t min_pt, Double_t max_pt)
Select visibility of tracks by transverse momentum.
Definition: REveTrack.cxx:972
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition: REveTrack.cxx:533
Double_t GetDpDs() const
Definition: REveTrack.hxx:98
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, return REveTrackProjected class.
Definition: REveTrack.cxx:487
auto * l
Definition: textangle.C:4
void SetRnrPoints(Bool_t r)
Set rendering of track as points for the list and the elements.
Definition: REveTrack.cxx:766
REveTrack Track with given vertex, momentum and optional referece-points (path-marks) along its path...
Definition: REveTrack.hxx:39
#define c(i)
Definition: RSha256.hxx:101
void PrintPathMarks()
Print registered path-marks.
Definition: REveTrack.cxx:512
REveTrackPropagator * fPropagator
Definition: REveTrack.hxx:152
REveLine An arbitrary polyline with fixed line and marker attributes.
Definition: REveLine.hxx:28
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
Definition: REveTrack.cxx:1097
const REveVectorD & GetEndMomentum() const
Definition: REveTrack.hxx:96
REveTrackList A list of tracks supporting change of common attributes and selection based on track pa...
Definition: REveTrack.hxx:142
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
Definition: REveTrack.cxx:477
const Bool_t kTRUE
Definition: RtypesCore.h:87
void SetRnrLine(Bool_t rnr)
Set rendering of track as line for the list and the elements.
Definition: REveTrack.cxx:737
Line Attributes class.
Definition: TAttLine.h:18
char name[80]
Definition: TGX11.cxx:109
vPathMark_t & RefPathMarks()
Definition: REveTrack.hxx:116