Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TScatter.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   18/05/2022
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_TScatter
0013 #define ROOT_TScatter
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TScatter                                                             //
0019 //                                                                      //
0020 // A scatter plot able to draw four 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 "TGraph.h"
0029 
0030 class TH2F;
0031 
0032 class TScatter : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
0033 
0034 protected:
0035    Int_t      fMaxSize{-1};        ///<!Current dimension of arrays fX and fY
0036    Int_t      fNpoints{-1};        ///< Number of points <= fMaxSize
0037    TH2F      *fHistogram{nullptr}; ///< Pointer to histogram used for drawing axis
0038    TGraph    *fGraph{nullptr};     ///< Pointer to graph holding X and Y positions
0039    Double_t  *fColor{nullptr};     ///< [fNpoints] array of colors
0040    Double_t  *fSize{nullptr};      ///< [fNpoints] array of marker sizes
0041    Double_t   fMaxMarkerSize{5.};  ///< Largest marker size used to paint the markers
0042    Double_t   fMinMarkerSize{1.};  ///< Smallest marker size used to paint the markers
0043    Double_t   fMargin{.1};         ///< Margin around the plot in %
0044 
0045 public:
0046    TScatter();
0047    TScatter(Int_t n);
0048    TScatter(Int_t n, const Double_t *x, const Double_t *y, const Double_t *col = nullptr, const Double_t *size = nullptr);
0049    ~TScatter() override;
0050 
0051    Int_t     DistancetoPrimitive(Int_t px, Int_t py) override;
0052    void      ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0053    Double_t *GetColor()  const {return fColor;}                ///< Get the array of colors
0054    Double_t *GetSize()   const {return fSize;}                 ///< Get the array of marker sizes
0055    Double_t  GetMargin() const {return fMargin;}               ///< Set the margin around the plot in %
0056    Double_t  GetMaxMarkerSize() const {return fMaxMarkerSize;} ///< Get the largest marker size used to paint the markers
0057    Double_t  GetMinMarkerSize() const {return fMinMarkerSize;} ///< Get the smallest marker size used to paint the markers
0058    TGraph   *GetGraph()  const {return fGraph;}                ///< Get the graph holding X and Y positions
0059    TH2F     *GetHistogram() const;                             ///< Get the graph histogram used for drawing axis
0060 
0061    void      SetMaxMarkerSize(Double_t max) {fMaxMarkerSize = max;} ///< Set the largest marker size used to paint the markers
0062    void      SetMinMarkerSize(Double_t min) {fMinMarkerSize = min;} ///< Set the smallest marker size used to paint the markers
0063    void      SetMargin(Double_t);
0064    void      SetHistogram(TH2F *h) {fHistogram = h;}
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(TScatter,2)  //A scatter plot
0071 };
0072 #endif
0073