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