00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #ifndef ROOT_TSpectrum2Painter
00013 #define ROOT_TSpectrum2Painter
00014 
00015 
00016 #ifndef ROOT_TNamed
00017 #include "TNamed.h"
00018 #endif
00019 
00020 class TH2;
00021 class TLine;
00022 class TColor;
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 class TSpectrum2Painter: public TNamed {
00033 
00034 public:
00035    TSpectrum2Painter(TH2* h2, Int_t bs);
00036    virtual ~TSpectrum2Painter();
00037 
00038    void GetAngles(Int_t &alpha,Int_t &beta,Int_t &view);
00039    void GetBezier(Int_t &bezier);
00040    void GetChanGrid(Int_t &enable,Int_t &color);
00041    void GetChanMarks(Int_t &enable,Int_t &color,Int_t &width,Int_t &height,Int_t &style);
00042    void GetColorAlgorithm(Int_t &colorAlgorithm);
00043    void GetColorIncrements(Double_t &r,Double_t &g,Double_t &b);
00044    void GetContourWidth(Int_t &width);
00045    void GetDisplayMode(Int_t &modeGroup,Int_t &displayMode);
00046    void GetLightHeightWeight(Double_t &weight);
00047    void GetLightPosition(Int_t &x,Int_t &y,Int_t &z);
00048    void GetNodes(Int_t &nodesx,Int_t &nodesy);
00049    void GetPenAttr(Int_t &color, Int_t &style, Int_t &width);
00050    void GetShading(Int_t &shading,Int_t &shadow);
00051    void GetZScale(Int_t &scale);
00052    void Paint(Option_t *option);
00053    void SetAngles(Int_t alpha,Int_t beta,Int_t view);
00054    void SetBezier(Int_t bezier);
00055    void SetChanGrid(Int_t enable,Int_t color);
00056    void SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style);
00057    void SetColorAlgorithm(Int_t colorAlgorithm);
00058    void SetColorIncrements(Double_t r,Double_t g,Double_t b);
00059    void SetContourWidth(Int_t width);
00060    void SetDisplayMode(Int_t modeGroup,Int_t displayMode);
00061    void SetLightHeightWeight(Double_t weight);
00062    void SetLightPosition(Int_t x,Int_t y,Int_t z);
00063    void SetNodes(Int_t nodesx,Int_t nodesy);
00064    void SetPenAttr(Int_t color,Int_t style,Int_t width);
00065    void SetShading(Int_t shading,Int_t shadow);
00066    void SetZScale(Int_t scale);
00067 
00068    static void PaintSpectrum(TH2* h2, Option_t *option="",Int_t bs=1600);
00069 
00070    enum {
00071       kModeGroupSimple=0,
00072       kModeGroupHeight=1,
00073       kModeGroupLight=2,
00074       kModeGroupLightHeight=3,
00075       kDisplayModePoints=1,
00076       kDisplayModeGrid=2,
00077       kDisplayModeContours=3,
00078       kDisplayModeBars=4,
00079       kDisplayModeLinesX=5,
00080       kDisplayModeLinesY=6,
00081       kDisplayModeBarsX=7,
00082       kDisplayModeBarsY=8,
00083       kDisplayModeNeedles=9,
00084       kDisplayModeSurface=10,
00085       kDisplayModeTriangles=11,
00086       kZScaleLinear=0,
00087       kZScaleLog=1,
00088       kZScaleSqrt=2,
00089       kColorAlgRgbSmooth=0,
00090       kColorAlgRgbModulo=1,
00091       kColorAlgCmySmooth=2,
00092       kColorAlgCmyModulo=3,
00093       kColorAlgCieSmooth=4,
00094       kColorAlgCieModulo=5,
00095       kColorAlgYiqSmooth=6,
00096       kColorAlgYiqModulo=7,
00097       kColorAlgHvsSmooth=8,
00098       kColorAlgHvsModulo=9,
00099       kShadowsNotPainted=0,
00100       kShadowsPainted=1,
00101       kNotShaded=0,
00102       kShaded=1,
00103       kNoBezierInterpol=0,
00104       kBezierInterpol=1,
00105       kPenStyleSolid=1,
00106       kPenStyleDash=2,
00107       kPenStyleDot=3,
00108       kPenStyleDashDot=4,
00109       kChannelMarksNotDrawn=0,
00110       kChannelMarksDrawn=1,
00111       kChannelMarksStyleDot=1,
00112       kChannelMarksStyleCross=2,
00113       kChannelMarksStyleStar=3,
00114       kChannelMarksStyleRectangle=4,
00115       kChannelMarksStyleX=5,
00116       kChannelMarksStyleDiamond=6,
00117       kChannelMarksStyleTriangle=7,
00118       kChannelGridNotDrawn=0,
00119       kChannelGridDrawn=1
00120   };
00121 
00122 protected:
00123    TH2      *fH2;            
00124    Int_t     fXmin;          
00125    Int_t     fXmax;          
00126    Int_t     fYmin;          
00127    Int_t     fYmax;          
00128    Double_t  fZmin;          
00129    Double_t  fZmax;          
00130    Int_t     fBx1;           
00131    Int_t     fBx2;           
00132    Int_t     fBy1;           
00133    Int_t     fBy2;           
00134    Int_t     fPenColor;      
00135    Int_t     fPenDash;       
00136    Int_t     fPenWidth;      
00137    Int_t     fModeGroup;     
00138    Int_t     fDisplayMode;   
00139    Int_t     fZscale;        
00140    Int_t     fNodesx;        
00141    Int_t     fNodesy;        
00142    Int_t     fContWidth;     
00143    Int_t     fAlpha;         
00144    Int_t     fBeta;          
00145    Int_t     fViewAngle;     
00146    Int_t     fLevels;        
00147    Double_t  fRainbow1Step;  
00148    Double_t  fRainbow2Step;  
00149    Double_t  fRainbow3Step;  
00150    Int_t     fColorAlg;      
00151    Double_t  fLHweight;      
00152    Int_t     fXlight;        
00153    Int_t     fYlight;        
00154    Int_t     fZlight;        
00155    Int_t     fShadow;        
00156    Int_t     fShading;       
00157    Int_t     fBezier;        
00158    Int_t     fChanmarkEnDis; 
00159    Int_t     fChanmarkStyle; 
00160    Int_t     fChanmarkWidth; 
00161    Int_t     fChanmarkHeight;
00162    Int_t     fChanmarkColor; 
00163    Int_t     fChanlineEnDis; 
00164    Int_t     fChanlineColor; 
00165 
00166    
00167    Double_t  fKx;
00168    Double_t  fKy;
00169    Double_t  fMxx;
00170    Double_t  fMxy;
00171    Double_t  fMyx;
00172    Double_t  fMyy;
00173    Double_t  fTxx;
00174    Double_t  fTxy;
00175    Double_t  fTyx;
00176    Double_t  fTyy;
00177    Double_t  fTyz;
00178    Double_t  fVx;
00179    Double_t  fVy;
00180    Double_t  fNuSli;
00181 
00182    
00183    Double_t  fZ,fZeq,fGbezx,fGbezy,fDxspline,fDyspline,fZPresetValue;
00184    Int_t     fXt,fYt,fXs,fYs,fXe,fYe,fLine;
00185    Short_t  *fEnvelope;                 
00186    Short_t  *fEnvelopeContour;          
00187    TColor   *fNewColor;                 
00188    Int_t     fMaximumXScreenResolution; 
00189    Int_t     fNewColorIndex;
00190    Int_t     fBzX[4];
00191    Int_t     fBzY[4];
00192 
00193    Int_t    BezC(Int_t i);
00194    Double_t BezierBlend(Int_t i,Double_t bezf);
00195    void     BezierSmoothing(Double_t bezf);
00196    Double_t ColorCalculation(Double_t dx1,Double_t dy1,Double_t z1,Double_t dx2,Double_t dy2,Double_t z2,Double_t dx3,Double_t dy3,Double_t z3);
00197    void     ColorModel(unsigned ui,unsigned ui1,unsigned ui2,unsigned ui3);
00198    void     CopyEnvelope(Double_t xr,Double_t xs,Double_t yr,Double_t ys);
00199    void     DrawMarker(Int_t x,Int_t y,Int_t w,Int_t h,Int_t type);
00200    void     Envelope(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
00201    void     EnvelopeBars(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
00202    Double_t ShadowColorCalculation(Double_t xtaz,Double_t ytaz,Double_t ztaz,Double_t shad_noise);
00203    void     Slice(Double_t xr,Double_t yr,Double_t xs,Double_t ys,TLine *line);
00204    void     Transform(Int_t it,Int_t jt,Int_t zmt);
00205 
00206 public:
00207    ClassDef(TSpectrum2Painter,0)   
00208 };
00209 
00210 #endif