Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 &); // Not implemented
46 
47 public:
48  typedef std::vector<REvePathMarkD> vPathMark_t;
49 
50  // Deprecated -- to be removed.
51  enum EBreakProjectedTracks_e { kBPTDefault, kBPTAlways, kBPTNever };
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
74  REveTrack(REveMCTrack* t, REveTrackPropagator* prop=0);
75  REveTrack(REveRecTrack* t, REveTrackPropagator* prop=0);
76  REveTrack(REveRecTrackD* t, REveTrackPropagator* prop=0);
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 
89  REveTrackPropagator *GetPropagator() const { return fPropagator; }
90  Int_t GetLastPMIdx() const { return fLastPMIdx; }
91  void SetPropagator(REveTrackPropagator *prop);
92  void SetAttLineAttMarker(REveTrackList *tl);
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();
116  vPathMark_t &RefPathMarks() { return fPathMarks; }
117  const vPathMark_t &RefPathMarks() const { return fPathMarks; }
118 
119  void PrintPathMarks(); // *MENU*
120 
121  void SetLockPoints(Bool_t l) { fLockPoints = l; }
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 &); // Not implemented
149  REveTrackList &operator=(const REveTrackList &); // Not implemented
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);
167  Double_t RoundMomentumLimit(Double_t x);
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 
178  void SetPropagator(REveTrackPropagator *prop);
179  REveTrackPropagator *GetPropagator() { return fPropagator; }
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