TGLTH3Composition.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLTH3Composition.h 29714 2009-08-07 08:36:09Z brun $
00002 // Author:  Timur Pocheptsov  07/08/2009
00003 
00004 #ifndef ROOT_TGLTH3Composition
00005 #define ROOT_TGLTH3Composition
00006 
00007 #include <utility>
00008 #include <memory>
00009 #include <vector>
00010 
00011 #ifndef ROOT_TGLHistPainter
00012 #include "TGLHistPainter.h"
00013 #endif
00014 #ifndef ROOT_TGLPlotPainter
00015 #include "TGLPlotPainter.h"
00016 #endif
00017 #ifndef ROOT_TGLQuadric
00018 #include "TGLQuadric.h"
00019 #endif
00020 #ifndef ROOT_TH3
00021 #include "TH3.h"
00022 #endif
00023 
00024 //
00025 //Composition of TH3 objects. All TH3 must have the same axis range
00026 //and the same number of bins. If this condition is violated,
00027 //AddTH3 will throw.
00028 //IMPORTANT: TGLTH3Composition does not own TH3 objects
00029 //it contains.
00030 //This class inherits TH3 - to re-use TH3 editor.
00031 //I use TH3C to reduce memory usage.
00032 //Slising is not implemeted yet.
00033 //
00034 
00035 class TGLTH3Composition : public TH3C {
00036    friend class TGLTH3CompositionPainter;
00037 public:
00038    TGLTH3Composition();//I need it only because of explicit private copy ctor.
00039 
00040    enum ETH3BinShape {
00041       kBox,
00042       kSphere
00043    };
00044 
00045    void AddTH3(const TH3 *hist, ETH3BinShape shape = kBox);
00046 
00047    //These are functions for TPad and
00048    //TPad's standard machinery (picking, painting).
00049    Int_t    DistancetoPrimitive(Int_t px, Int_t py);
00050    void     ExecuteEvent(Int_t event, Int_t px, Int_t py);
00051    char    *GetObjectInfo(Int_t px, Int_t py) const;
00052    void     Paint(Option_t *option);
00053 
00054 private:
00055    void CheckRanges(const TH3 *hist);
00056 
00057    typedef std::pair<const TH3 *, ETH3BinShape> TH3Pair_t;
00058 
00059    std::vector<TH3Pair_t>        fHists;
00060    std::auto_ptr<TGLHistPainter> fPainter;
00061 
00062    TGLTH3Composition(const TGLTH3Composition &rhs);
00063    TGLTH3Composition &operator = (const TGLTH3Composition &);
00064 
00065    ClassDef(TGLTH3Composition, 0)//Composition of TH3 objects.
00066 };
00067 
00068 //
00069 //TGLTH3CompositionPainter class.
00070 //
00071 class TGLTH3CompositionPainter: public TGLPlotPainter {
00072 public:
00073    TGLTH3CompositionPainter(TGLTH3Composition *data, TGLPlotCamera *camera, 
00074                             TGLPlotCoordinates *coord);
00075 
00076    //TGLPlotPainter final-overriders.
00077    char      *GetPlotInfo(Int_t px, Int_t py);
00078    Bool_t     InitGeometry();
00079    void       StartPan(Int_t px, Int_t py);
00080    void       Pan(Int_t px, Int_t py);
00081    void       AddOption(const TString &option);
00082    void       ProcessEvent(Int_t event, Int_t px, Int_t py);
00083 
00084 private:
00085    //TGLPlotPainter final-overriders.
00086    void       InitGL()const;
00087    void       DeInitGL()const;
00088    
00089    void       DrawPlot()const;
00090    
00091    //Empty overriders.
00092    void       DrawSectionXOZ()const{}
00093    void       DrawSectionYOZ()const{}
00094    void       DrawSectionXOY()const{}
00095    
00096    void       SetColor(Int_t color)const;
00097 
00098    TGLTH3Composition            *fData;
00099    std::pair<Double_t, Double_t> fMinMaxVal;
00100 
00101    mutable TGLQuadric            fQuadric;
00102 
00103    TGLTH3CompositionPainter(const TGLTH3CompositionPainter &rhs);
00104    TGLTH3CompositionPainter &operator = (const TGLTH3CompositionPainter &rhs);
00105 
00106    ClassDef(TGLTH3CompositionPainter, 0)//Painter to draw several TH3.
00107 };
00108 
00109 
00110 #endif

Generated on Tue Jul 5 14:16:55 2011 for ROOT_528-00b_version by  doxygen 1.5.1