TEveCalo.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveCalo.h 35074 2010-08-30 15:18:02Z matevz $
00002 // Author: Matevz Tadel 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TEveCalo
00013 #define ROOT_TEveCalo
00014 
00015 #include "TEveElement.h"
00016 #include "TEveProjectionBases.h"
00017 #include "TEveProjectionManager.h"
00018 
00019 #include "TAtt3D.h"
00020 #include "TAttBBox.h"
00021 #include "TEveCaloData.h"
00022 
00023 class TClass;
00024 class TEveRGBAPalette;
00025 
00026 class TEveCaloViz : public TEveElement,
00027                     public TNamed,
00028                     public TAtt3D,
00029                     public TAttBBox,
00030                     public TEveProjectable
00031 {
00032    friend class TEveCaloVizEditor;
00033 
00034 private:
00035    TEveCaloViz(const TEveCaloViz&);        // Not implemented
00036    TEveCaloViz& operator=(const TEveCaloViz&); // Not implemented
00037 
00038 protected:
00039    TEveCaloData* fData;           // event data reference
00040    Bool_t        fCellIdCacheOK;  // data cell ids cache state
00041 
00042    Double_t      fEtaMin;
00043    Double_t      fEtaMax;
00044 
00045    Double_t      fPhi;
00046    Double_t      fPhiOffset;     // phi range +/- offset
00047 
00048    Bool_t        fAutoRange;     // set eta phi limits on DataChanged()
00049 
00050    Float_t       fBarrelRadius;  // barrel raidus in cm
00051    Float_t       fEndCapPos;     // end cap z coordinate in cm
00052 
00053    Float_t       fPlotEt;        // plot E or Et.
00054 
00055    Float_t           fMaxTowerH;  // bounding box z dimesion
00056    Bool_t            fScaleAbs;
00057    Float_t           fMaxValAbs;
00058 
00059    Bool_t            fValueIsColor;   // Interpret signal value as RGBA color.
00060    TEveRGBAPalette*  fPalette;        // Pointer to signal-color palette.
00061 
00062 
00063    void AssignCaloVizParameters(TEveCaloViz* cv);
00064 
00065    void SetupColorHeight(Float_t value, Int_t slice, Float_t& height) const;
00066 
00067    virtual void BuildCellIdCache() = 0;
00068 
00069 public:
00070    TEveCaloViz(TEveCaloData* data=0, const char* n="TEveCaloViz", const char* t="");
00071 
00072    virtual ~TEveCaloViz();
00073 
00074    virtual TEveElement* ForwardSelection();
00075    virtual TEveElement* ForwardEdit();
00076 
00077    virtual void Paint(Option_t* option="");
00078 
00079    virtual TClass* ProjectedClass(const TEveProjection* p) const;
00080    virtual Float_t GetValToHeight() const;
00081    virtual void    CellSelectionChanged() {}
00082    
00083    virtual void    SetScaleAbs(Bool_t x) { fScaleAbs = x; }
00084 
00085    TEveCaloData* GetData() const { return fData; }
00086    void    SetData(TEveCaloData* d);
00087    void    DataChanged();
00088    Float_t GetMaxVal() const;
00089 
00090    Bool_t  AssertCellIdCache() const;
00091    void    InvalidateCellIdCache() { fCellIdCacheOK=kFALSE; ResetBBox(); };
00092 
00093    Float_t GetDataSliceThreshold(Int_t slice) const;
00094    void    SetDataSliceThreshold(Int_t slice, Float_t val);
00095    Color_t GetDataSliceColor(Int_t slice) const;
00096    void    SetDataSliceColor(Int_t slice, Color_t col);
00097 
00098    Float_t GetBarrelRadius() const { return fBarrelRadius; }
00099    void    SetBarrelRadius(Float_t r) { fBarrelRadius = r; ResetBBox(); }
00100    Float_t GetEndCapPos   () const { return fEndCapPos; }
00101    void    SetEndCapPos   (Float_t z) { fEndCapPos = z; ResetBBox(); }
00102 
00103    Bool_t  GetPlotEt() const { return fPlotEt; }
00104    void    SetPlotEt(Bool_t x);
00105 
00106    void    SetMaxTowerH(Float_t x) { fMaxTowerH = x; }
00107    Float_t GetMaxTowerH() const    { return fMaxTowerH; }
00108    Bool_t  GetScaleAbs() const { return fScaleAbs; }
00109    void    SetMaxValAbs(Float_t x) { fMaxValAbs = x; }
00110    Float_t GetMaxValAbs() const    { return fMaxValAbs; }
00111 
00112    Float_t GetTransitionEta() const;
00113    Float_t GetTransitionTheta() const;
00114 
00115    TEveRGBAPalette* GetPalette() const { return fPalette; }
00116    void             SetPalette(TEveRGBAPalette* p);
00117 
00118    TEveRGBAPalette* AssertPalette();
00119    Bool_t  GetValueIsColor()   const { return fValueIsColor;}
00120    void    SetValueIsColor(Bool_t x) { fValueIsColor = x;}
00121 
00122    Bool_t  GetAutoRange()   const { return fAutoRange; }
00123    void    SetAutoRange(Bool_t x) { fAutoRange = x; }
00124 
00125    void    SetEta(Float_t l, Float_t u);
00126    Float_t GetEta()    const { return 0.5f*(fEtaMin+fEtaMax); }
00127    Float_t GetEtaMin() const { return fEtaMin; }
00128    Float_t GetEtaMax() const { return fEtaMax; }
00129    Float_t GetEtaRng() const { return fEtaMax-fEtaMin; }
00130 
00131    void    SetPhi(Float_t phi)    { SetPhiWithRng(phi, fPhiOffset); }
00132    void    SetPhiRng(Float_t rng) { SetPhiWithRng(fPhi, rng); }
00133    void    SetPhiWithRng(Float_t x, Float_t r);
00134    Float_t GetPhi()    const { return fPhi; }
00135    Float_t GetPhiMin() const { return fPhi-fPhiOffset; }
00136    Float_t GetPhiMax() const { return fPhi+fPhiOffset; }
00137    Float_t GetPhiRng() const { return 2.0f*fPhiOffset; }
00138 
00139    Bool_t  CellInEtaPhiRng (TEveCaloData::CellData_t&) const;
00140 
00141    ClassDef(TEveCaloViz, 0); // Base-class for visualization of calorimeter eventdata.
00142 };
00143 
00144 /**************************************************************************/
00145 /**************************************************************************/
00146 
00147 class TEveCalo3D : public TEveCaloViz
00148 {
00149    friend class TEveCalo3DGL;
00150 private:
00151    TEveCalo3D(const TEveCalo3D&);            // Not implemented
00152    TEveCalo3D& operator=(const TEveCalo3D&); // Not implemented
00153 
00154 protected:
00155    TEveCaloData::vCellId_t fCellList;
00156 
00157    Bool_t    fRnrEndCapFrame;
00158    Bool_t    fRnrBarrelFrame;
00159 
00160    Float_t   fFrameWidth;
00161    Color_t   fFrameColor;
00162    Char_t    fFrameTransparency;
00163 
00164    virtual void BuildCellIdCache();
00165 
00166 public:
00167    TEveCalo3D(TEveCaloData* d=0, const char* n="TEveCalo3D", const char* t="xx");
00168    virtual ~TEveCalo3D() {}
00169    virtual void ComputeBBox();
00170 
00171    void    SetFrameWidth(Float_t w) { fFrameWidth = w; }
00172    Float_t GetFrameWidth() const    { return fFrameWidth; }
00173 
00174    void SetRnrFrame(Bool_t e, Bool_t b)         { fRnrEndCapFrame = e; fRnrBarrelFrame = b; }
00175    void GetRnrFrame(Bool_t &e, Bool_t &b) const { e = fRnrEndCapFrame; b = fRnrBarrelFrame; }
00176    void SetRnrEndCapFrame(Bool_t r) { fRnrEndCapFrame = r; }
00177    void SetRnrBarrelFrame(Bool_t r) { fRnrBarrelFrame = r; }
00178    Bool_t GetRnrEndCapFrame() const { return fRnrEndCapFrame; }
00179    Bool_t GetRnrBarrelFrame() const { return fRnrBarrelFrame; }
00180 
00181    void   SetFrameTransparency(Char_t x) { fFrameTransparency = x; }
00182    Char_t GetFrameTransparency() const { return fFrameTransparency; }
00183 
00184    ClassDef(TEveCalo3D, 0); // Class for 3D visualization of calorimeter event data.
00185 };
00186 
00187 /**************************************************************************/
00188 /**************************************************************************/
00189 
00190 class TEveCalo2D : public TEveCaloViz,
00191                    public TEveProjected
00192 {
00193    friend class TEveCalo2DGL;
00194 
00195    typedef std::vector<TEveCaloData::vCellId_t*>           vBinCells_t;
00196    typedef std::vector<TEveCaloData::vCellId_t*>::iterator vBinCells_i;
00197 
00198 private:
00199    TEveCalo2D(const TEveCalo2D&);            // Not implemented
00200    TEveCalo2D& operator=(const TEveCalo2D&); // Not implemented
00201 
00202    TEveProjection::EPType_e  fOldProjectionType;
00203    void CellSelectionChangedInternal(TEveCaloData::vCellId_t& cells, std::vector<TEveCaloData::vCellId_t*>& cellLists);
00204 
00205 protected:
00206    std::vector<TEveCaloData::vCellId_t*>   fCellLists;
00207 
00208    std::vector<TEveCaloData::vCellId_t*>   fCellListsSelected;
00209    std::vector<TEveCaloData::vCellId_t*>   fCellListsHighlighted;
00210 
00211    Float_t                                 fMaxESumBin;
00212    Float_t                                 fMaxEtSumBin;
00213 
00214    virtual void BuildCellIdCache();
00215 
00216    virtual void SetDepthLocal(Float_t x) { fDepth = x; }
00217 
00218 public:
00219    TEveCalo2D(const char* n="TEveCalo2D", const char* t="");
00220    virtual ~TEveCalo2D();
00221 
00222    virtual void SetProjection(TEveProjectionManager* proj, TEveProjectable* model);
00223    virtual void UpdateProjection();
00224    virtual void ComputeBBox();
00225 
00226    virtual void CellSelectionChanged();
00227       
00228    virtual void    SetScaleAbs(Bool_t);
00229 
00230    virtual Float_t GetValToHeight() const;
00231 
00232    ClassDef(TEveCalo2D, 0); // Class for visualization of projected calorimeter event data.
00233 };
00234 /**************************************************************************/
00235 /**************************************************************************/
00236 
00237 class TEveCaloLego : public TEveCaloViz
00238 {
00239    friend class TEveCaloLegoGL;
00240    friend class TEveCaloLegoOverlay;
00241 
00242 public:
00243    enum EProjection_e { kAuto, k3D, k2D };
00244    enum E2DMode_e     { kValColor, kValSize, kValSizeOutline };
00245    enum EBoxMode_e    { kNone, kFrontBack, kBack};
00246 
00247 private:
00248    TEveCaloLego(const TEveCaloLego&);            // Not implemented
00249    TEveCaloLego& operator=(const TEveCaloLego&); // Not implemented
00250 
00251 protected:
00252    TEveCaloData::vCellId_t fCellList;
00253 
00254    Color_t                 fFontColor;
00255    Color_t                 fGridColor;
00256    Color_t                 fPlaneColor;
00257    Char_t                  fPlaneTransparency;
00258 
00259    Int_t                   fNZSteps; // Z axis label step in GeV
00260    Float_t                 fZAxisStep;
00261 
00262    Bool_t                  fAutoRebin;
00263    Int_t                   fPixelsPerBin;
00264    Bool_t                  fNormalizeRebin;
00265 
00266    EProjection_e           fProjection;
00267    E2DMode_e               f2DMode;
00268    EBoxMode_e              fBoxMode;  // additional scale info
00269 
00270    Bool_t                  fDrawHPlane;
00271    Float_t                 fHPlaneVal;
00272 
00273    Bool_t                  fHasFixedHeightIn2DMode;
00274    Float_t                 fFixedHeightValIn2DMode; // 1% of whole height
00275 
00276    Int_t                   fDrawNumberCellPixels;
00277    Int_t                   fCellPixelFontSize;
00278 
00279    virtual void BuildCellIdCache();
00280 
00281 public:
00282    TEveCaloLego(TEveCaloData* data=0, const char* n="TEveCaloLego", const char* t="");
00283    virtual ~TEveCaloLego(){}
00284 
00285    virtual void ComputeBBox();
00286    virtual void  SetData(TEveCaloData* d);
00287 
00288    Color_t  GetFontColor() const { return fFontColor; }
00289    void     SetFontColor(Color_t ci) { fFontColor=ci; }
00290 
00291    Color_t  GetGridColor() const { return fGridColor; }
00292    void     SetGridColor(Color_t ci) { fGridColor=ci; }
00293 
00294    Color_t  GetPlaneColor() const { return fPlaneColor; }
00295    void     SetPlaneColor(Color_t ci) { fPlaneColor=ci; }
00296 
00297    Char_t   GetPlaneTransparency() const { return fPlaneTransparency; }
00298    void     SetPlaneTransparency(Char_t t) { fPlaneTransparency=t; }
00299 
00300    Int_t    GetNZSteps() const { return fNZSteps; }
00301    void     SetNZSteps(Int_t s) { fNZSteps = s;}
00302 
00303    Int_t    GetPixelsPerBin() const { return fPixelsPerBin; }
00304    void     SetPixelsPerBin(Int_t bw) { fPixelsPerBin = bw; }
00305 
00306    Bool_t   GetAutoRebin() const { return fAutoRebin; }
00307    void     SetAutoRebin(Bool_t s) { fAutoRebin = s;}
00308 
00309    Bool_t   GetNormalizeRebin() const { return fNormalizeRebin; }
00310    void     SetNormalizeRebin(Bool_t s) { fNormalizeRebin = s; fCellIdCacheOK=kFALSE;}
00311 
00312    EProjection_e  GetProjection() const { return fProjection; }
00313    void           SetProjection(EProjection_e p) { fProjection = p; }
00314 
00315    void       Set2DMode(E2DMode_e p) { f2DMode = p; }
00316    E2DMode_e  Get2DMode() { return f2DMode; }
00317 
00318    bool       GetHasFixedHeightIn2DMode() const { return fHasFixedHeightIn2DMode; }
00319    void       SetHasFixedHeightIn2DMode(bool x) { fHasFixedHeightIn2DMode = x; }
00320 
00321    float      GetFixedHeightValIn2DMode() const  { return fFixedHeightValIn2DMode; }
00322    void       SetFixedHeightValIn2DMode(float x) { fFixedHeightValIn2DMode = x; }
00323 
00324    void        SetBoxMode(EBoxMode_e p) { fBoxMode = p; }
00325    EBoxMode_e  GetBoxMode() { return fBoxMode; }
00326 
00327    Bool_t   GetDrawHPlane() const { return fDrawHPlane; }
00328    void     SetDrawHPlane(Bool_t s) { fDrawHPlane = s;}
00329 
00330    Float_t  GetHPlaneVal() const { return fHPlaneVal; }
00331    void     SetHPlaneVal(Float_t s) { fHPlaneVal = s;}
00332 
00333    Int_t    GetDrawNumberCellPixels() { return fDrawNumberCellPixels; }
00334    void     SetDrawNumberCellPixels(Int_t x) { fDrawNumberCellPixels = x; }
00335    Int_t    GetCellPixelFontSize() { return fCellPixelFontSize; }
00336    void     SetCellPixelFontSize(Int_t x) { fCellPixelFontSize = x; }
00337 
00338    ClassDef(TEveCaloLego, 0);  // Class for visualization of calorimeter histogram data.
00339 };
00340 
00341 #endif

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