00001 #ifndef BFLDCANVAS_H
00002 #define BFLDCANVAS_H
00003
00004 #include "TCanvas.h"
00005 #include "TH2F.h"
00006 #include "Validity/VldContext.h"
00007 #include "BField/BField.h"
00008 #include "BField/BfldHandler.h"
00009
00010 class BfldCanvas
00011 {
00012
00028 public:
00029
00030 BfldCanvas(VldContext& vldc, std::string tag, int iscoil);
00031 BfldCanvas();
00032 virtual ~BfldCanvas();
00033
00034 void SetTitle(std::string title);
00035 void Fill(BField& bfld);
00036 void Fill(BfldHandler& bhandler);
00037 virtual void Draw();
00038
00039 void SetVldContext(VldContext vldc) { fVldc = vldc; }
00040 void SetZ(double z) { fZ = z; }
00041 void SetScaleMax(double scale = 1.0 );
00042 void SetArrowScale(double scale = 1.0) { fArrowScale = scale; }
00043
00044 TCanvas* GetCanvas() const { return fCanvas; }
00045 TH2F* GetScatter() const { return fScatter; }
00046 VldContext GetVldContext() const { return fVldc; }
00047 double GetZ() const { return fZ; }
00048 int GetIsCoil() const { return fIsCoil; }
00049 double GetScaleMax() const { return fScaleMax; }
00050 BfldInterpMethod::InterpMethod_t
00051 GetInterpMethod() const { return fInterpMethod; }
00052
00053
00054
00055 static BfldInterpMethod::InterpMethod_t
00056 GetDefaultInterpMethod() { return fgDefaultInterpMethod; }
00057 static void SetDefaultInterpMethod(BfldInterpMethod::InterpMethod_t method)
00058 { fgDefaultInterpMethod = method; }
00059 static void SetVerbose(int v=true) { fgVerbose = v; }
00060 static void SetKGaussLimits(double kgmin, double kgmax)
00061 { fgKGMin = kgmin; fgKGMax = kgmax; }
00062 static void SetArrowGrid(int nxa = 40 ) { fgArrowGridX = nxa; }
00063
00064 protected:
00065
00066 virtual void DetermineLimits(double& xmin, double& xmax,
00067 double& ymin, double& ymax,
00068 int& xpixels, int& ypixels);
00069 virtual void DetermineColorGrid(int& nx, int& ny);
00070 virtual void DetermineArrowGrid(int& nxa, int& nya, double& scalea);
00071 virtual void AdjustLabels();
00072 virtual void AdjustMargins();
00073 void Fill(BField* bfld=0, BfldHandler* bhandler=0);
00074 virtual void DrawArrows();
00075 virtual void DrawCheveron(double x0, double y0, double dx, double dy,
00076 double scale);
00077 virtual std::string GetZoomInterpString();
00078
00079 TCanvas* fCanvas;
00080 TH2F* fScatter;
00081 TH2F* fPhase;
00082 int fIsCoil;
00083 VldContext fVldc;
00084 double fZ;
00085 double fScaleMax;
00086 double fArrowScale;
00087 BfldInterpMethod::InterpMethod_t fInterpMethod;
00088
00089
00090
00091 static int fgVerbose;
00092 static double fgKGMin;
00093 static double fgKGMax;
00094 static int fgArrowGridX;
00095 static BfldInterpMethod::InterpMethod_t fgDefaultInterpMethod;
00096
00097 };
00098
00099 #endif //BFLDCANVAS_H