Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:43

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