Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TScatter2D.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/hist:$Id$
0002 // Author: Olivier Couet   23/09/2025
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, 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_TScatter2D
0013 #define ROOT_TScatter2D
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TScatter2D                                                           //
0019 //                                                                      //
0020 // A scatter plot able to draw five variables on a single plot          //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TNamed.h"
0025 #include "TAttLine.h"
0026 #include "TAttFill.h"
0027 #include "TAttMarker.h"
0028 #include "TGraph2D.h"
0029 
0030 class TH3F;
0031 
0032 class TScatter2D : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
0033 
0034 protected:
0035    Int_t      fNpoints{-1};        ///< Number of points of arrays fX, fY and fZ
0036    TGraph2D  *fGraph{nullptr};     ///< Pointer to graph holding X, Y and Z positions
0037    Double_t  *fColor{nullptr};     ///< [fNpoints] array of colors
0038    Double_t  *fSize{nullptr};      ///< [fNpoints] array of marker sizes
0039    Double_t   fMaxMarkerSize{5.};  ///< Largest marker size used to paint the markers
0040    Double_t   fMinMarkerSize{1.};  ///< Smallest marker size used to paint the markers
0041    Double_t   fMargin{.1};         ///< Margin around the plot in %
0042 
0043 public:
0044    TScatter2D();
0045    TScatter2D(Int_t n);
0046    TScatter2D(Int_t n, Double_t *x, Double_t *y, Double_t *z, const Double_t *col = nullptr, const Double_t *size = nullptr);
0047    ~TScatter2D() override;
0048 
0049    Int_t     DistancetoPrimitive(Int_t px, Int_t py) override;
0050    void      ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0051    Double_t *GetColor()  const {return fColor;}                ///< Get the array of colors
0052    Double_t *GetSize()   const {return fSize;}                 ///< Get the array of marker sizes
0053    Double_t  GetMargin() const {return fMargin;}               ///< Set the margin around the plot in %
0054    Double_t  GetMaxMarkerSize() const {return fMaxMarkerSize;} ///< Get the largest marker size used to paint the markers
0055    Double_t  GetMinMarkerSize() const {return fMinMarkerSize;} ///< Get the smallest marker size used to paint the markers
0056    TGraph2D *GetGraph()  const {return fGraph;}                ///< Get the graph holding X, Y and Z positions
0057    TH2D     *GetHistogram() const;                             ///< Get the graph histogram used for drawing axis
0058    TAxis    *GetXaxis() const ;
0059    TAxis    *GetYaxis() const ;
0060    TAxis    *GetZaxis() const ;
0061 
0062    void      SetMaxMarkerSize(Double_t max) {fMaxMarkerSize = max;} ///< Set the largest marker size used to paint the markers
0063    void      SetMinMarkerSize(Double_t min) {fMinMarkerSize = min;} ///< Set the smallest marker size used to paint the markers
0064    void      SetMargin(Double_t);
0065    void      Print(Option_t *chopt="") const override;
0066    void      SavePrimitive(std::ostream &out, Option_t *option = "") override;
0067    void      Paint(Option_t *chopt="") override;
0068 
0069 
0070    ClassDefOverride(TScatter2D,1)  //A 2D scatter plot
0071 };
0072 #endif
0073