00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4PICTURE_H
00015 #define TGO4PICTURE_H
00016
00017 #include "TNamed.h"
00018
00019 #include "TArrayL.h"
00020 #include "TArrayF.h"
00021 #include "RVersion.h"
00022
00023 #include "Gtypes.h"
00024
00025 class TVirtualPad;
00026 class TPad;
00027 class TObjArray;
00028 class TAttLine;
00029 class TAttFill;
00030 class TAttMarker;
00031 class TStyle;
00032 class TString;
00033 class TAxis;
00034 class TH1;
00035 class THStack;
00036 class TGraph;
00037 class TPaveStats;
00038 class TPaveText;
00039 class TList;
00040
00041 class TGo4Picture : public TNamed {
00042 public:
00043 enum Indexes { UndefIndex = -2, PictureIndex = -1 };
00044
00045 TGo4Picture();
00046 TGo4Picture(const char* name, const char* title, Int_t ndivy = 1, Int_t ndivx = 1);
00047 virtual ~TGo4Picture();
00048
00049
00050
00051 void SetDrawHeader(Bool_t draw = kTRUE);
00052 Bool_t IsDrawHeader();
00053
00054
00055
00056 void SetDivision(Int_t ndivy, Int_t ndivx);
00057 Int_t GetDivX() { return fiNDivX; }
00058 Int_t GetDivY() { return fiNDivY; }
00059 Bool_t IsDivided() { return (GetDivX()!=1) || (GetDivY()!=1); }
00060
00061 TGo4Picture& operator()(int posy, int posx) { return *Pic(posy,posx); }
00062 TGo4Picture* Pic(Int_t posy, Int_t posx);
00063 TGo4Picture* FindPic(Int_t posy, Int_t posx);
00064
00065
00066
00067 void SetLinesDivision(Int_t numlines, const Int_t* numbers);
00068 void SetLinesDivision(Int_t numlines, Int_t n0=1, Int_t n1=1, Int_t n2=1, Int_t n3=1, Int_t n4=1,
00069 Int_t n5=1, Int_t n6=1, Int_t n7=1, Int_t n8=1, Int_t n9=1);
00070 TGo4Picture* LPic(Int_t nline, Int_t ncol);
00071
00072
00073 void AddH1(TH1* histo, Option_t* DrawOption = 0);
00074 void AddH1(Int_t posy, Int_t posx, TH1* histo, Option_t* DrawOption = 0);
00075
00076
00077 void AddHStack(THStack* st, Option_t* DrawOption = 0);
00078 void AddHStack(Int_t posy, Int_t posx, THStack* st, Option_t* DrawOption = 0);
00079
00080
00081 void AddGraph(TGraph* gr, Option_t* DrawOption = 0);
00082 void AddGraph(Int_t posy, Int_t posx, TGraph* gr, Option_t* DrawOption = 0);
00083
00084
00085 void AddCondition(TNamed* cond = 0);
00086 void AddCondition(Int_t posy, Int_t posx, TNamed* cond = 0);
00087
00088
00089 void ClearObjNames(Bool_t recursive = kFALSE);
00090
00091
00092 void SetRangeX(Double_t min, Double_t max);
00093 Bool_t GetRangeX(Double_t& min, Double_t& max);
00094 void ClearRangeX();
00095 void SetRangeY(Double_t min, Double_t max);
00096 Bool_t GetRangeY(Double_t& min, Double_t& max);
00097 void ClearRangeY();
00098 void SetRangeZ(Double_t min, Double_t max);
00099 Bool_t GetRangeZ(Double_t& min, Double_t& max);
00100 void ClearRangeZ();
00101
00102
00103 void SetLogScale(Int_t nscale = 0, Int_t zn = 1);
00104 Int_t GetLogScale(Int_t nscale = 0);
00105 void GetLogScales(TVirtualPad* pad);
00106 void ClearLogScales();
00107
00108
00109 void SetSelectedIndex(Int_t index = PictureIndex) { fiLastIndex = index; }
00110
00111
00112 void SetLineAtt(Color_t color, Style_t style, Width_t width, Int_t index = UndefIndex);
00113 void SetLineAtt(TAttLine* line, Int_t index = UndefIndex);
00114 Bool_t GetLineAtt(TAttLine* line, Int_t index = UndefIndex);
00115 void ClearLineAtt(Int_t index = UndefIndex);
00116
00117
00118 void SetFillAtt(Color_t color, Style_t style, Int_t index = UndefIndex);
00119 void SetFillAtt(TAttFill* fill, Int_t index = UndefIndex);
00120 Bool_t GetFillAtt(TAttFill* fill, Int_t index = UndefIndex);
00121 void ClearFillAtt(Int_t index = UndefIndex);
00122
00123
00124 void SetMarkerAtt(Color_t color, Size_t size, Style_t style, Int_t index = UndefIndex);
00125 void SetMarkerAtt(TAttMarker* marker, Int_t index = UndefIndex);
00126 Bool_t GetMarkerAtt(TAttMarker* marker, Int_t index = UndefIndex);
00127 void ClearMarkerAtt(Int_t index = UndefIndex);
00128
00129
00130 void SetRebinX(Int_t ngroupx, Int_t index = UndefIndex);
00131 void SetRebinY(Int_t ngroupy, Int_t index = UndefIndex);
00132 Int_t GetRebinX(Int_t index = UndefIndex);
00133 Int_t GetRebinY(Int_t index = UndefIndex);
00134 void ClearRebin(Int_t index = UndefIndex);
00135
00136
00137 void SetDrawAttributes(TObject* obj, Int_t index = UndefIndex);
00138
00139 void GetDrawAttributes(TObject* obj, Int_t index = UndefIndex);
00140
00141
00142 virtual void SetDrawOption(Option_t* option = "")
00143 {
00144 SetDrawOption(option, UndefIndex);
00145 }
00146
00147 virtual void SetDrawOption(Option_t* option, Int_t index);
00148
00149 virtual Option_t* GetDrawOption()
00150 {
00151 return GetDrawOption(UndefIndex);
00152 }
00153
00154 virtual Option_t* GetDrawOption(Int_t index);
00155
00156
00157 void SetHisStats(Bool_t on);
00158 Bool_t IsHisStats() const;
00159
00160 void SetStatsAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2,
00161 Int_t optstat = 1111, const char* statformat = "6.4g",
00162 Int_t optfit = 1111, const char* fitformat = "5.4g");
00163 void SetStatsAttr(TPaveStats* stats);
00164 Bool_t GetStatsAttr(TPaveStats* stats);
00165
00166 void SetHisTitle(bool on);
00167 Bool_t IsHisTitle() const;
00168
00169 void SetTitleAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t textsize = 0.);
00170 void SetTitleAttr(TPaveText* titl);
00171 Bool_t HasTitleAttr();
00172 Bool_t GetTitleAttr(TPaveText* titl);
00173
00174 void SetTitleTime(Bool_t on = kTRUE);
00175 Bool_t IsTitleTime() const;
00176
00177 void SetTitleDate(Bool_t on = kTRUE);
00178 Bool_t IsTitleDate() const;
00179
00180 void SetTitleItem(Bool_t on = kTRUE);
00181 Bool_t IsTitleItem() const;
00182
00183 void SetLegendDraw(bool on);
00184 bool IsLegendDraw() const;
00185
00186 void SetCrosshair(bool on);
00187 bool IsCrosshair() const;
00188
00189 void SetAutoScale(bool on);
00190 bool IsAutoScale() const;
00191
00192 void SetSuperimpose(bool on);
00193 bool IsSuperimpose() const;
00194
00195 virtual void Draw(Option_t* option = "");
00196
00197 virtual void Clear(Option_t* option = "");
00198
00199 virtual void Print(Option_t* option = "") const;
00200
00201 #ifndef __CINT__
00202
00203 #if ROOT_VERSION_CODE > ROOT_VERSION(5,11,6)
00204 virtual void SavePrimitive(ostream& fs, Option_t* = "");
00205 #else
00206 virtual void SavePrimitive(ofstream& fs, Option_t* = "");
00207 #endif
00208
00209 #endif
00210
00211
00212
00213
00214 void AddObjName(const char* name, Option_t* DrawOption = 0);
00215 void AddObjName(Int_t posy, Int_t posx, const char* name, Option_t* DrawOption = 0);
00216
00217
00218 void AddObject(TObject* obj, Option_t* DrawOption = 0);
00219 void AddObject(Int_t posy, Int_t posx, TObject* obj, Option_t* DrawOption = 0);
00220
00221 void Reset() {}
00222
00223
00224 void UpdateFrom(TGo4Picture* source, TClass* selectedobjclass = 0);
00225 void CopyOptionsFrom(TGo4Picture* source);
00226
00227 Int_t GetNumObjNames();
00228 const char* GetObjName(Int_t n);
00229 Bool_t IsObjNames();
00230
00231
00232
00233
00234 void AddSpecialObject(TObject* obj, Option_t* drawopt = 0);
00235 void AddSpecialObjectXml(const char* xmlcode, Option_t* drawopt = 0);
00236 TList* GetSpecialObjects() const { return fxSpecialObjects; }
00237
00238
00239 void SetStyle(TStyle* style, Int_t index = UndefIndex);
00240 TStyle* FindStyle(Int_t index = UndefIndex);
00241 TStyle* GetStyle(Int_t index = UndefIndex);
00242
00243
00244 void SetAxisLabelFontSize(Int_t naxis, Float_t LabelSize, Int_t index = UndefIndex);
00245 void SetAxisTitleFontSize(Int_t naxis, Float_t TitleSize, Int_t index = UndefIndex);
00246 void SetAxisAtt(Int_t naxis,
00247 Color_t AxisColor,
00248 Color_t LabelColor,
00249 Style_t LabelFont,
00250 Float_t LabelOffset,
00251 Float_t LabelSize,
00252 Int_t Ndivisions,
00253 Float_t TickLength,
00254 Color_t TitleColor,
00255 Style_t TitleFont,
00256 Float_t TitleOffset,
00257 Float_t TitleSize,
00258 Bool_t decimals,
00259 const char* ticks,
00260 Int_t bits,
00261 Int_t index = UndefIndex);
00262
00263 void SetPadAtt(Int_t BorderMode,
00264 Int_t BorderSize,
00265 Int_t Gridx,
00266 Int_t Gridy,
00267 Double_t Phi,
00268 Double_t Theta,
00269 Int_t Tickx,
00270 Int_t Ticky,
00271 Int_t index = PictureIndex);
00272
00273
00274
00275 void SetContentModified(bool on = true);
00276 bool IsContentModified() const;
00277
00278 void SetPadModified(bool on = true);
00279 bool IsPadModified() const;
00280
00281 void SetFullRangeDim(Int_t ndim);
00282 Int_t GetFullRangeDim() const;
00283 void SetFullRange(Int_t naxis, Double_t min, Double_t max);
00284 Bool_t GetFullRange(Int_t naxis, Double_t& min, Double_t& max);
00285 void ClearFullRange(Int_t naxis = -1);
00286
00287 void SetRange(Int_t naxis, Double_t min, Double_t max);
00288 Bool_t GetRange(Int_t naxis, Double_t& min, Double_t& max);
00289 void ClearRange(Int_t naxis = -1);
00290
00291 void ChangeDrawOption(Int_t kind, Int_t value);
00292
00294 Long_t GetTotalSize();
00295
00296 static void Add(TString& s, const char* buf) { s+=buf; }
00297
00298 protected:
00299 TGo4Picture(TGo4Picture& picture);
00300 void AddSubPicture(TGo4Picture* pic);
00301
00302 Int_t GetObjAttIndex(TObject* obj);
00303
00304 void SetPosition(Int_t posy, Int_t posx);
00305 Bool_t CheckPosition(Int_t posy, Int_t posx);
00306
00307 Int_t FindOptPos(Short_t index, Short_t typ) const;
00308 Int_t ExtendOptPos(Short_t index, Short_t typ);
00309
00310 void SetOption(Short_t index, Short_t typ, Long_t value);
00311 Bool_t GetOption(Short_t index, Short_t typ, Long_t& value) const;
00312 Long_t GetI(Short_t index, Short_t typ, Long_t def = 0) const;
00313
00314 void SetOptionF(Short_t index, Short_t typ, Float_t value);
00315 Bool_t GetOptionF(Short_t index, Short_t typ, Float_t& value);
00316
00317 void SetOptionD(Short_t index, Short_t typ, Double_t value);
00318 Bool_t GetOptionD(Short_t index, Short_t typ, Double_t& value);
00319 Double_t GetD(Short_t index, Short_t typ, Double_t def = 0.);
00320
00321 void SetObjOption(Short_t index, Short_t typ, TObject* obj);
00322 TObject* GetObjOption(Short_t index, Short_t typ);
00323
00324 void SetStrOption(Short_t index, Short_t typ, const char* value);
00325 const char* GetStrOption(Short_t index, Short_t typ, const char* defvalue = 0);
00326
00327 void ClearOption(Short_t index, Short_t typ);
00328 void ClearOption(Int_t pos);
00329 void ClearAllOptions(Short_t index = UndefIndex);
00330
00331 void* Cast(TObject* obj, TClass* cl);
00332
00333 void CheckIndex(Int_t& index);
00334
00335 void DrawPic(TVirtualPad* pad);
00336
00337 void PrintPic(int shift, Bool_t showopt);
00338
00339 void SetH1Att(TH1* h1, Int_t index = UndefIndex);
00340 void GetH1Att(TH1* h1, Int_t index = UndefIndex);
00341 void SetAxisAtt(Int_t naxis, TAxis* axis, Int_t index = UndefIndex);
00342 void GetAxisAtt(Int_t naxis, TAxis* axis, Int_t index = UndefIndex);
00343 void SetPadAtt(TPad* pad, Int_t index = UndefIndex);
00344 void GetPadAtt(TPad* pad, Int_t index = UndefIndex);
00345
00346 void MakeScript(ostream& fs, const char* name);
00347
00348 void MakeAxisScript(ostream& fs, const char* name, Int_t indx, Int_t naxis);
00349
00350 private:
00351 Int_t fiNDivX;
00352 Int_t fiNDivY;
00353
00354 Int_t fiPosX;
00355 Int_t fiPosY;
00356
00357 TObjArray* fxNames;
00358
00359 TObjArray* fxObjects;
00360
00361 TObjArray* fxSubPictures;
00362
00363 Int_t fiOptSize;
00364 TArrayL fxOptIndex;
00365 TArrayL fxOptValue;
00366 TObjArray* fxOptObjects;
00367
00368 TList* fxSpecialObjects;
00369
00370 Int_t fiLastIndex;
00371
00372 ClassDef(TGo4Picture, 3)
00373 };
00374
00375 #endif //TGO4PICTURE_H
00376
00377