Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/gl:$Id$
0002 // Author:  Timur Pocheptsov  07/08/2009
0003 
0004 #ifndef ROOT_TGLTH3Composition
0005 #define ROOT_TGLTH3Composition
0006 
0007 #include <utility>
0008 #include <memory>
0009 #include <vector>
0010 
0011 #include "TGLHistPainter.h"
0012 #include "TGLPlotPainter.h"
0013 #include "TGLQuadric.h"
0014 #include "TH3.h"
0015 
0016 //
0017 //Composition of TH3 objects. All TH3 must have the same axis range
0018 //and the same number of bins. If this condition is violated,
0019 //AddTH3 will throw.
0020 //IMPORTANT: TGLTH3Composition does not own TH3 objects
0021 //it contains.
0022 //This class inherits TH3 - to re-use TH3 editor.
0023 //I use TH3C to reduce memory usage.
0024 //Slising is not implemeted yet.
0025 //
0026 
0027 class TGLTH3Composition : public TH3C {
0028    friend class TGLTH3CompositionPainter;
0029 public:
0030    TGLTH3Composition();//I need it only because of explicit private copy ctor.
0031 
0032    enum ETH3BinShape {
0033       kBox,
0034       kSphere
0035    };
0036 
0037    void AddTH3(const TH3 *hist, ETH3BinShape shape = kBox);
0038 
0039    //These are functions for TPad and
0040    //TPad's standard machinery (picking, painting).
0041    Int_t    DistancetoPrimitive(Int_t px, Int_t py) override;
0042    void     ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0043    char    *GetObjectInfo(Int_t px, Int_t py) const override;
0044    void     Paint(Option_t *option) override;
0045 
0046 private:
0047    void CheckRanges(const TH3 *hist);
0048 
0049    typedef std::pair<const TH3 *, ETH3BinShape> TH3Pair_t;
0050 
0051    std::vector<TH3Pair_t>        fHists;
0052    std::unique_ptr<TGLHistPainter> fPainter;
0053 
0054    TGLTH3Composition(const TGLTH3Composition &) = delete;
0055    TGLTH3Composition &operator = (const TGLTH3Composition &) = delete;
0056 
0057    ClassDefOverride(TGLTH3Composition, 0)//Composition of TH3 objects.
0058 };
0059 
0060 //
0061 //TGLTH3CompositionPainter class.
0062 //
0063 class TGLTH3CompositionPainter: public TGLPlotPainter {
0064 public:
0065    TGLTH3CompositionPainter(TGLTH3Composition *data, TGLPlotCamera *camera,
0066                             TGLPlotCoordinates *coord);
0067 
0068    //TGLPlotPainter final-overriders.
0069    char      *GetPlotInfo(Int_t px, Int_t py) override;
0070    Bool_t     InitGeometry() override;
0071    void       StartPan(Int_t px, Int_t py) override;
0072    void       Pan(Int_t px, Int_t py) override;
0073    void       AddOption(const TString &option) override;
0074    void       ProcessEvent(Int_t event, Int_t px, Int_t py) override;
0075 
0076 private:
0077    //TGLPlotPainter final-overriders.
0078    void       InitGL()const override;
0079    void       DeInitGL()const override;
0080 
0081    void       DrawPlot()const override;
0082 
0083    //Empty overriders.
0084    void       DrawSectionXOZ()const override {}
0085    void       DrawSectionYOZ()const override {}
0086    void       DrawSectionXOY()const override {}
0087 
0088    void       SetColor(Int_t color)const;
0089 
0090    TGLTH3Composition            *fData;
0091    std::pair<Double_t, Double_t> fMinMaxVal;
0092 
0093    mutable TGLQuadric            fQuadric;
0094 
0095    TGLTH3CompositionPainter(const TGLTH3CompositionPainter &) = delete;
0096    TGLTH3CompositionPainter &operator = (const TGLTH3CompositionPainter &)  = delete;
0097 
0098    ClassDefOverride(TGLTH3CompositionPainter, 0)//Painter to draw several TH3.
0099 };
0100 
0101 
0102 #endif