Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:30

0001 // @(#)root/eve7:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT7_REveTrack
0013 #define ROOT7_REveTrack
0014 
0015 #include <vector>
0016 
0017 #include <ROOT/REveVector.hxx>
0018 #include <ROOT/REvePathMark.hxx>
0019 #include <ROOT/REveElement.hxx>
0020 #include <ROOT/REveLine.hxx>
0021 #include <ROOT/REveVSDStructs.hxx>
0022 
0023 #include "TPolyMarker3D.h"
0024 #include "TMarker.h"
0025 
0026 class TParticle;
0027 
0028 namespace ROOT {
0029 namespace Experimental {
0030 
0031 class REveTrackPropagator;
0032 class REveTrackList;
0033 
0034 ////////////////////////////////////////////////////////////////////////////////
0035 /// REveTrack
0036 /// Track with given vertex, momentum and optional referece-points (path-marks) along its path.
0037 ////////////////////////////////////////////////////////////////////////////////
0038 
0039 class REveTrack : public REveLine
0040 {
0041    friend class REveTrackPropagator;
0042    friend class REveTrackList;
0043 
0044 private:
0045    REveTrack &operator=(const REveTrack &) = delete;
0046 
0047 public:
0048    typedef std::vector<REvePathMarkD> vPathMark_t;
0049 
0050    // Deprecated -- to be removed.
0051    enum EBreakProjectedTracks_e { kBPTDefault, kBPTAlways, kBPTNever };
0052 
0053 protected:
0054    REveVectorD fV;         // Starting vertex
0055    REveVectorD fP;         // Starting momentum
0056    REveVectorD fPEnd;      // Momentum at the last point of extrapolation
0057    Double_t fBeta;         // Relativistic beta factor
0058    Double_t fDpDs;         // Momentum loss over distance
0059    Int_t fPdg;             // PDG code
0060    Int_t fCharge;          // Charge in units of e0
0061    Int_t fLabel;           // Simulation label
0062    Int_t fIndex;           // Reconstruction index
0063    Int_t fStatus;          // Status-word, user-defined.
0064    Bool_t fLockPoints;     // Lock points that are currently in - do nothing in MakeTrack().
0065    vPathMark_t fPathMarks; // REveVector of known points along the track
0066    Int_t fLastPMIdx;       //! Last path-mark index tried in track-propagation.
0067 
0068    REveTrackPropagator *fPropagator{nullptr}; // Pointer to shared render-style
0069 
0070 public:
0071    REveTrack();
0072    REveTrack(TParticle *t, Int_t label, REveTrackPropagator *prop = nullptr);
0073    // VSD inputs
0074    REveTrack(REveMCTrack*  t, REveTrackPropagator *prop = nullptr);
0075    REveTrack(REveRecTrack* t, REveTrackPropagator *prop = nullptr);
0076    REveTrack(REveRecTrackD* t, REveTrackPropagator *prop = nullptr);
0077    REveTrack(const REveTrack &t);
0078    ~REveTrack() override;
0079 
0080    void ComputeBBox() override;
0081 
0082    virtual void SetStdTitle();
0083 
0084    virtual void SetTrackParams(const REveTrack &t);
0085    virtual void SetPathMarks(const REveTrack &t);
0086 
0087    virtual void MakeTrack(Bool_t recurse = kTRUE);
0088 
0089    REveTrackPropagator *GetPropagator() const { return fPropagator; }
0090    Int_t GetLastPMIdx() const { return fLastPMIdx; }
0091    void SetPropagator(REveTrackPropagator *prop);
0092    void SetAttLineAttMarker(REveTrackList *tl);
0093 
0094    const REveVectorD &GetVertex() const { return fV; }
0095    const REveVectorD &GetMomentum() const { return fP; }
0096    const REveVectorD &GetEndMomentum() const { return fPEnd; }
0097 
0098    Double_t GetDpDs() const { return fDpDs; }
0099    void SetDpDs(Double_t dpds) { fDpDs = dpds; }
0100 
0101    Int_t GetPdg() const { return fPdg; }
0102    void SetPdg(Int_t pdg) { fPdg = pdg; }
0103    Int_t GetCharge() const { return fCharge; }
0104    void SetCharge(Int_t chg) { fCharge = chg; }
0105    Int_t GetLabel() const { return fLabel; }
0106    void SetLabel(Int_t lbl) { fLabel = lbl; }
0107    Int_t GetIndex() const { return fIndex; }
0108    void SetIndex(Int_t idx) { fIndex = idx; }
0109    Int_t GetStatus() const { return fStatus; }
0110    void SetStatus(Int_t idx) { fStatus = idx; }
0111 
0112    void AddPathMark(const REvePathMarkD &pm) { fPathMarks.push_back(pm); }
0113    void AddPathMark(const REvePathMark &pm) { fPathMarks.push_back(pm); }
0114 
0115    void SortPathMarksByTime();
0116    vPathMark_t &RefPathMarks() { return fPathMarks; }
0117    const vPathMark_t &RefPathMarks() const { return fPathMarks; }
0118 
0119    void PrintPathMarks(); // *MENU*
0120 
0121    void SetLockPoints(Bool_t l) { fLockPoints = l; }
0122    Bool_t GetLockPoints() const { return fLockPoints; }
0123 
0124    //-------------------------------------------------------------------
0125 
0126    virtual void SecSelected(REveTrack *); // *SIGNAL*
0127 
0128    void CopyVizParams(const REveElement *el) override;
0129    void WriteVizParams(std::ostream &out, const TString &var) override;
0130 
0131    TClass *ProjectedClass(const REveProjection *p) const override;
0132 
0133    Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
0134    void BuildRenderData() override;
0135 };
0136 
0137 ////////////////////////////////////////////////////////////////////////////////
0138 /// REveTrackList
0139 /// A list of tracks supporting change of common attributes and selection based on track parameters.
0140 ////////////////////////////////////////////////////////////////////////////////
0141 
0142 class REveTrackList : public REveElement,
0143                       public REveProjectable,
0144                       public TAttMarker,
0145                       public TAttLine
0146 {
0147 private:
0148    REveTrackList(const REveTrackList &) = delete;
0149    REveTrackList &operator=(const REveTrackList &) = delete;
0150 
0151 protected:
0152    REveTrackPropagator *fPropagator{nullptr}; // Basic track rendering parameters, not enforced to elements.
0153 
0154    Bool_t fRecurse; // Recurse when propagating marker/line/etc attributes to tracks.
0155 
0156    Bool_t fRnrLine;   // Render track as line.
0157    Bool_t fRnrPoints; // Render track as points.
0158 
0159    Double_t fMinPt; // Minimum track pTfor display selection.
0160    Double_t fMaxPt; // Maximum track pTfor display selection.
0161    Double_t fLimPt; // Highest track pT in the container.
0162    Double_t fMinP;  // Minimum track pfor display selection.
0163    Double_t fMaxP;  // Maximum track pfor display selection.
0164    Double_t fLimP;  // Highest track p in the container.
0165 
0166    void FindMomentumLimits(REveElement *el, Bool_t recurse = kTRUE);
0167    Double_t RoundMomentumLimit(Double_t x);
0168    void SanitizeMinMaxCuts();
0169 
0170 public:
0171    REveTrackList(REveTrackPropagator *prop = nullptr);
0172    REveTrackList(const std::string &name, REveTrackPropagator *prop = nullptr);
0173    ~REveTrackList() override;
0174 
0175    void MakeTracks(Bool_t recurse = kTRUE);
0176    void FindMomentumLimits(Bool_t recurse = kTRUE);
0177 
0178    void SetPropagator(REveTrackPropagator *prop);
0179    REveTrackPropagator *GetPropagator() { return fPropagator; }
0180 
0181    Bool_t GetRecurse() const { return fRecurse; }
0182    void SetRecurse(Bool_t x) { fRecurse = x; }
0183 
0184    //--------------------------------
0185 
0186    void SetMainColor(Color_t c) override;
0187    void SetLineColor(Color_t c) override { SetMainColor(c); }
0188    virtual void SetLineColor(Color_t c, REveElement *el);
0189    void SetLineWidth(Width_t w) override;
0190    virtual void SetLineWidth(Width_t w, REveElement *el);
0191    void SetLineStyle(Style_t s) override;
0192    virtual void SetLineStyle(Style_t s, REveElement *el);
0193 
0194    void SetMarkerColor(Color_t c) override;
0195    virtual void SetMarkerColor(Color_t c, REveElement *el);
0196    void SetMarkerSize(Size_t s) override;
0197    virtual void SetMarkerSize(Size_t s, REveElement *el);
0198    void SetMarkerStyle(Style_t s) override;
0199    virtual void SetMarkerStyle(Style_t s, REveElement *el);
0200 
0201    void SetRnrLine(Bool_t rnr);
0202    void SetRnrLine(Bool_t rnr, REveElement *el);
0203    Bool_t GetRnrLine() const { return fRnrLine; }
0204 
0205    void SetRnrPoints(Bool_t r);
0206    void SetRnrPoints(Bool_t r, REveElement *el);
0207    Bool_t GetRnrPoints() const { return fRnrPoints; }
0208 
0209    void SelectByPt(Double_t min_pt, Double_t max_pt);
0210    void SelectByPt(Double_t min_pt, Double_t max_pt, REveElement *el);
0211    void SelectByP(Double_t min_p, Double_t max_p);
0212    void SelectByP(Double_t min_p, Double_t max_p, REveElement *el);
0213 
0214    Double_t GetMinPt() const { return fMinPt; }
0215    Double_t GetMaxPt() const { return fMaxPt; }
0216    Double_t GetLimPt() const { return fLimPt; }
0217    Double_t GetMinP() const { return fMinP; }
0218    Double_t GetMaxP() const { return fMaxP; }
0219    Double_t GetLimP() const { return fLimP; }
0220 
0221    //-------------------------------------------------------------------
0222 
0223    REveTrack *FindTrackByLabel(Int_t label); // *MENU*
0224    REveTrack *FindTrackByIndex(Int_t index); // *MENU*
0225 
0226    void CopyVizParams(const REveElement *el) override;
0227    void WriteVizParams(std::ostream &out, const TString &var) override;
0228 
0229    TClass *ProjectedClass(const REveProjection *p) const override;
0230 };
0231 
0232 } // namespace Experimental
0233 } // namespace ROOT
0234 
0235 #endif