00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4Picture.h"
00015
00016
00017 #include "TClass.h"
00018 #include "TObjArray.h"
00019 #include "TObjString.h"
00020 #include "TVirtualPad.h"
00021 #include "TFrame.h"
00022 #include "TList.h"
00023 #include "TPad.h"
00024 #include "TCanvas.h"
00025 #include "TH1.h"
00026 #include "TGraph.h"
00027 #include "THStack.h"
00028 #include "TStyle.h"
00029 #include "TText.h"
00030 #include "TDatime.h"
00031 #include "TArrayL.h"
00032 #include "TAttLine.h"
00033 #include "TAttFill.h"
00034 #include "TAttMarker.h"
00035 #include "TPaveStats.h"
00036 #if ROOT_VERSION_CODE > ROOT_VERSION(5,9,0)
00037 #include "TBufferXML.h"
00038 #endif
00039 enum OptionsIdentifiers {
00040 op_RangeXMin = 1,
00041 op_RangeXMax = 2,
00042 op_RangeYMin = 3,
00043 op_RangeYMax = 4,
00044
00045 op_LineColor = 5,
00046 op_LineStyle = 6,
00047 op_LineWidth = 7,
00048
00049 op_FillColor = 8,
00050 op_FillStyle = 9,
00051
00052 op_MarkerColor = 10,
00053 op_MarkerSize = 11,
00054 op_MarkerStyle = 12,
00055
00056 op_LogScaleX = 13,
00057 op_LogScaleY = 14,
00058 op_LogScaleZ = 15,
00059
00060 op_TitleTime = 16,
00061 op_TitleDate = 17,
00062 op_TitleItem = 18,
00063
00064 op_HisStatsX1 = 19,
00065 op_HisStatsY1 = 20,
00066 op_HisStatsX2 = 21,
00067 op_HisStatsY2 = 22,
00068
00069
00070
00071 op_HisStats = 24,
00072 op_HisTitle = 25,
00073 op_LegendDraw = 26,
00074 op_Crosshair = 27,
00075 op_AutoScale = 28,
00076 op_Superimpose = 29,
00077 op_ContentModified = 30,
00078 op_PadModified = 31,
00079
00080 op_RangeZMin = 32,
00081 op_RangeZMax = 33,
00082
00083 op_FullDim = 34,
00084 op_FullXMin = 35,
00085 op_FullXMax = 36,
00086 op_FullYMin = 37,
00087 op_FullYMax = 38,
00088 op_FullZMin = 39,
00089 op_FullZMax = 40,
00090 op_AxisX = 41,
00091 op_AxisY = 53,
00092 op_AxisZ = 65,
00093 op_Pad = 77,
00094 op_HisStatsOpt = 85,
00095 op_HisStatsFit = 86,
00096 op_RebinX = 87,
00097 op_RebinY = 88,
00098
00099 op_TitleX1 = 89,
00100 op_TitleY1 = 90,
00101 op_TitleX2 = 91,
00102 op_TitleY2 = 92,
00103 op_TitleTextSz = 93,
00104
00105 op_TimeAxisX = 200,
00106
00107
00108
00109 op_ObjsBound = 0x4000,
00110
00111 op_Style = op_ObjsBound,
00112 op_Draw = op_ObjsBound+1,
00113 op_HisStatsOptF = op_ObjsBound+2,
00114 op_HisStatsFitF = op_ObjsBound+3,
00115 op_TimeAxisXFmt= op_ObjsBound+4
00116
00117 };
00118
00119 TGo4Picture::TGo4Picture() :
00120 TNamed(),
00121 fiNDivX(1),
00122 fiNDivY(1),
00123 fiPosX(0),
00124 fiPosY(0),
00125 fxNames(0),
00126 fxObjects(0),
00127 fxSubPictures(0),
00128 fiOptSize(0),
00129 fxOptIndex(),
00130 fxOptValue(),
00131 fxOptObjects(0),
00132 fxSpecialObjects(0),
00133 fiLastIndex(0)
00134 {
00135 }
00136
00137 TGo4Picture::TGo4Picture(const char* name, const char* title, Int_t ndivy, Int_t ndivx) :
00138 TNamed(name, title),
00139 fiNDivX(1),
00140 fiNDivY(1),
00141 fiPosX(0),
00142 fiPosY(0),
00143 fxNames(0),
00144 fxObjects(0),
00145 fxSubPictures(0),
00146 fiOptSize(0),
00147 fxOptIndex(),
00148 fxOptValue(),
00149 fxOptObjects(0),
00150 fxSpecialObjects(0),
00151 fiLastIndex(0)
00152 {
00153 SetDivision(ndivy, ndivx);
00154 }
00155
00156 TGo4Picture::TGo4Picture(TGo4Picture& picture) :
00157 TNamed(),
00158 fiNDivX(1),
00159 fiNDivY(1),
00160 fiPosX(0),
00161 fiPosY(0),
00162 fxNames(0),
00163 fxObjects(0),
00164 fxSubPictures(0),
00165 fiOptSize(0),
00166 fxOptIndex(),
00167 fxOptValue(),
00168 fxOptObjects(0),
00169 fxSpecialObjects(0),
00170 fiLastIndex(0)
00171 {
00172 UpdateFrom(&picture);
00173 }
00174
00175 TGo4Picture::~TGo4Picture()
00176 {
00177 if (fxNames!=0) delete fxNames;
00178 if (fxObjects) delete fxObjects;
00179 if (fxSubPictures!=0) delete fxSubPictures;
00180 if (fxOptObjects!=0) delete fxOptObjects;
00181 if (fxSpecialObjects) delete fxSpecialObjects;
00182 }
00183
00184 void TGo4Picture::SetDrawHeader(Bool_t draw)
00185 {
00186 SetTitleTime(draw);
00187 SetTitleDate(draw);
00188 }
00189
00190 Bool_t TGo4Picture::IsDrawHeader()
00191 {
00192 return IsTitleTime() && IsTitleDate();
00193 }
00194
00195 void TGo4Picture::SetDivision(Int_t ndivy, Int_t ndivx)
00196 {
00197 if (ndivx<1) fiNDivX = 1; else fiNDivX = ndivx;
00198 if (ndivy<1) fiNDivY = 1; else fiNDivY = ndivy;
00199 }
00200
00201 TGo4Picture* TGo4Picture::FindPic(Int_t posy, Int_t posx)
00202 {
00203 if (fxSubPictures==0) return 0; if (posx<0) posx=0; else if(posx>=GetDivX()) posx = GetDivX()-1;
00204 if (posy<0) posy=0; else if(posy>=GetDivY()) posy = GetDivY()-1;
00205 for (Int_t n=0;n<=fxSubPictures->GetLast();n++) {
00206 TGo4Picture* sub = dynamic_cast<TGo4Picture*> (fxSubPictures->At(n));
00207 if (sub!=0)
00208 if (sub->CheckPosition(posy,posx)) return sub;
00209 }
00210 return 0;
00211 }
00212
00213 TGo4Picture* TGo4Picture::Pic(Int_t posy, Int_t posx)
00214 {
00215 if (!IsDivided()) return this;
00216 if (posx<0) posx=0; else if(posx>=GetDivX()) posx = GetDivX()-1;
00217 if (posy<0) posy=0; else if(posy>=GetDivY()) posy = GetDivY()-1;
00218 TGo4Picture* sub = FindPic(posy, posx);
00219 if (sub!=0) return sub;
00220 sub = new TGo4Picture("Sub", "Sub picture");
00221 sub->SetPosition(posy, posx);
00222 if (fxSubPictures==0) {
00223 fxSubPictures = new TObjArray();
00224 fxSubPictures->SetOwner(kTRUE);
00225 }
00226 fxSubPictures->Add(sub);
00227 return sub;
00228 }
00229
00230 void TGo4Picture::SetLinesDivision(Int_t numlines, const Int_t* numbers)
00231 {
00232 SetDivision(numlines,1);
00233 for (Int_t n=0;n<numlines;n++)
00234 if (numbers[n]>1) Pic(n,0)->SetDivision(1,numbers[n]);
00235 }
00236
00237 void TGo4Picture::SetLinesDivision(Int_t numlines,
00238 Int_t n0, Int_t n1, Int_t n2, Int_t n3, Int_t n4,
00239 Int_t n5, Int_t n6, Int_t n7, Int_t n8, Int_t n9)
00240 {
00241 const Int_t numbers[10] = { n0, n1, n2, n3, n4, n5, n6, n7, n8, n9};
00242 SetLinesDivision(numlines, numbers);
00243 }
00244
00245 TGo4Picture* TGo4Picture::LPic(Int_t nline, Int_t ncol)
00246 {
00247 if (!IsDivided()) return this;
00248 TGo4Picture* sub = Pic(nline, 0);
00249 if (sub==0) return 0;
00250 if (sub->IsDivided()) return sub->Pic(0,ncol);
00251 else return sub;
00252 }
00253
00254 void TGo4Picture::SetPosition(Int_t posy, Int_t posx)
00255 {
00256 fiPosX = posx; fiPosY = posy;
00257 }
00258
00259 Bool_t TGo4Picture::CheckPosition(Int_t posy, Int_t posx)
00260 {
00261 return (fiPosX == posx) && (fiPosY == posy);
00262 }
00263
00264 void TGo4Picture::AddH1(TH1* histo, Option_t* DrawOption)
00265 {
00266 AddObject(histo, DrawOption);
00267 }
00268
00269 void TGo4Picture::AddH1(Int_t posy, Int_t posx, TH1* histo, Option_t* DrawOption)
00270 {
00271 AddObject(posy, posx, histo, DrawOption);
00272 }
00273
00274 void TGo4Picture::AddHStack(THStack* st, Option_t* DrawOption)
00275 {
00276 AddObject(st, DrawOption);
00277 }
00278
00279 void TGo4Picture::AddHStack(Int_t posy, Int_t posx, THStack* st, Option_t* DrawOption)
00280 {
00281 AddObject(posy, posx, st, DrawOption);
00282 }
00283
00284 void TGo4Picture::AddGraph(TGraph* gr, Option_t* DrawOption)
00285 {
00286 AddObject(gr, DrawOption);
00287 }
00288
00289 void TGo4Picture::AddGraph(Int_t posy, Int_t posx, TGraph* gr, Option_t* DrawOption)
00290 {
00291 AddObject(posy, posx, gr, DrawOption);
00292 }
00293
00294 void TGo4Picture::AddCondition(TNamed* cond)
00295 {
00296 AddObject(cond);
00297 }
00298
00299 void TGo4Picture::AddCondition(Int_t posy, Int_t posx, TNamed* cond)
00300 {
00301 AddObject(posy, posx, cond);
00302 }
00303
00304 void TGo4Picture::AddObjName(const char* name, Option_t* DrawOption)
00305 {
00306 if (name==0) return;
00307 if (fxNames==0) {
00308 fxNames = new TObjArray();
00309 fxNames->SetOwner(kTRUE);
00310 }
00311 fxNames->Add(new TObjString(name));
00312 SetDrawOption(DrawOption, fxNames->GetLast());
00313
00314
00315
00316 fiLastIndex = fxNames->GetLast();
00317 }
00318
00319 void TGo4Picture::AddObjName(Int_t posy, Int_t posx, const char* name, Option_t* DrawOption)
00320 {
00321 if (name!=0)
00322 Pic(posy,posx)->AddObjName(name, DrawOption);
00323 }
00324
00325 void TGo4Picture::ClearObjNames(Bool_t recursive)
00326 {
00327 if (fxNames!=0) {
00328 delete fxNames;
00329 fxNames = 0;
00330 }
00331 fiLastIndex = 0;
00332 if (recursive && fxSubPictures)
00333 for (Int_t n=0;n<=fxSubPictures->GetLast();n++) {
00334 TGo4Picture* sub = dynamic_cast<TGo4Picture*> (fxSubPictures->At(n));
00335 if (sub) sub->ClearObjNames(recursive);
00336 }
00337 }
00338
00339 Int_t TGo4Picture::GetNumObjNames()
00340 {
00341 return (fxNames==0) ? 0 : fxNames->GetLast()+1;
00342 }
00343
00344 Bool_t TGo4Picture::IsObjNames()
00345 {
00346 if (GetNumObjNames()>0) return kTRUE;
00347
00348 if (fxSubPictures)
00349 for (Int_t n=0;n<=fxSubPictures->GetLast();n++) {
00350 TGo4Picture* sub = dynamic_cast<TGo4Picture*> (fxSubPictures->At(n));
00351 if (sub && sub->IsObjNames()) return kTRUE;
00352 }
00353 return kFALSE;
00354 }
00355
00356 const char* TGo4Picture::GetObjName(Int_t n)
00357 {
00358 if ((fxNames==0) || (n<0) || (n>fxNames->GetLast())) return 0;
00359 TObjString* str = dynamic_cast<TObjString*> (fxNames->At(n));
00360 if (str!=0) return str->String().Data();
00361 else return 0;
00362 }
00363
00364 void TGo4Picture::AddObject(TObject* obj, Option_t* DrawOption)
00365 {
00366 if (obj!=0)
00367 AddObjName(obj->GetName(), DrawOption);
00368 }
00369
00370 void TGo4Picture::AddObject(Int_t posy, Int_t posx, TObject* obj, Option_t* DrawOption)
00371 {
00372 if (obj!=0)
00373 AddObjName(posy, posx, obj->GetName(), DrawOption);
00374 }
00375
00376 void TGo4Picture::SetRangeX(Double_t min, Double_t max)
00377 {
00378 SetOptionD(PictureIndex, op_RangeXMin, min);
00379 SetOptionD(PictureIndex, op_RangeXMax, max);
00380 }
00381
00382 Bool_t TGo4Picture::GetRangeX(Double_t& min, Double_t& max)
00383 {
00384 min = 0.; max = 0;
00385 return GetOptionD(PictureIndex, op_RangeXMin, min) &&
00386 GetOptionD(PictureIndex, op_RangeXMax, max);
00387 }
00388
00389 void TGo4Picture::ClearRangeX()
00390 {
00391 ClearOption(PictureIndex, op_RangeXMin);
00392 ClearOption(PictureIndex, op_RangeXMax);
00393 }
00394
00395 void TGo4Picture::SetRangeY(Double_t min, Double_t max)
00396 {
00397 SetOptionD(PictureIndex, op_RangeYMin, min);
00398 SetOptionD(PictureIndex, op_RangeYMax, max);
00399 }
00400
00401 Bool_t TGo4Picture::GetRangeY(Double_t& min, Double_t& max)
00402 {
00403 min = 0.; max = 0;
00404 return GetOptionD(PictureIndex, op_RangeYMin, min) &&
00405 GetOptionD(PictureIndex, op_RangeYMax, max);
00406 }
00407
00408 void TGo4Picture::ClearRangeY()
00409 {
00410 ClearOption(PictureIndex, op_RangeYMin);
00411 ClearOption(PictureIndex, op_RangeYMax);
00412 }
00413
00414 void TGo4Picture::SetRangeZ(Double_t min, Double_t max)
00415 {
00416 SetOptionD(PictureIndex, op_RangeZMin, min);
00417 SetOptionD(PictureIndex, op_RangeZMax, max);
00418 }
00419
00420 Bool_t TGo4Picture::GetRangeZ(Double_t& min, Double_t& max)
00421 {
00422 min = 0.; max = 0;
00423 return GetOptionD(PictureIndex, op_RangeZMin, min) &&
00424 GetOptionD(PictureIndex, op_RangeZMax, max);
00425 }
00426
00427 void TGo4Picture::ClearRangeZ()
00428 {
00429 ClearOption(PictureIndex, op_RangeZMin);
00430 ClearOption(PictureIndex, op_RangeZMax);
00431 }
00432
00433 void TGo4Picture::SetRange(Int_t naxis, Double_t min, Double_t max)
00434 {
00435 switch (naxis) {
00436 case 0: SetRangeX(min, max); break;
00437 case 1: SetRangeY(min, max); break;
00438 case 2: SetRangeZ(min, max); break;
00439 }
00440 }
00441
00442 Bool_t TGo4Picture::GetRange(Int_t naxis, Double_t& min, Double_t& max)
00443 {
00444 switch (naxis) {
00445 case 0: return GetRangeX(min, max); break;
00446 case 1: return GetRangeY(min, max); break;
00447 case 2: return GetRangeZ(min, max); break;
00448 }
00449 return kFALSE;
00450 }
00451
00452 void TGo4Picture::ClearRange(Int_t naxis)
00453 {
00454 switch (naxis) {
00455 case 0: ClearRangeX(); break;
00456 case 1: ClearRangeY(); break;
00457 case 2: ClearRangeZ(); break;
00458 default:
00459 ClearRangeX();
00460 ClearRangeY();
00461 ClearRangeZ();
00462 break;
00463 }
00464 }
00465
00466 void TGo4Picture::SetLogScale(Int_t nscale, Int_t zn)
00467 {
00468 Int_t typ;
00469 switch (nscale) {
00470 case 1: typ = op_LogScaleY; break;
00471 case 2: typ = op_LogScaleZ; break;
00472 default: typ = op_LogScaleX;
00473 }
00474 SetOption(PictureIndex, typ, zn);
00475 }
00476
00477 Int_t TGo4Picture::GetLogScale(Int_t nscale)
00478 {
00479 Int_t typ;
00480 switch (nscale) {
00481 case 1: typ = op_LogScaleY; break;
00482 case 2: typ = op_LogScaleZ; break;
00483 default: typ = op_LogScaleX;
00484 }
00485 Long_t zn;
00486 if (GetOption(PictureIndex, typ, zn)) return zn;
00487 else return 0;
00488 }
00489
00490 void TGo4Picture::GetLogScales(TVirtualPad* pad)
00491 {
00492 if (pad == 0) return;
00493 Long_t zn;
00494 if (GetOption(PictureIndex, op_LogScaleX, zn)) pad->SetLogx(zn);
00495 if (GetOption(PictureIndex, op_LogScaleY, zn)) pad->SetLogy(zn);
00496 if (GetOption(PictureIndex, op_LogScaleZ, zn)) pad->SetLogz(zn);
00497 }
00498
00499 void TGo4Picture::ClearLogScales()
00500 {
00501 ClearOption(PictureIndex, op_LogScaleX);
00502 ClearOption(PictureIndex, op_LogScaleY);
00503 ClearOption(PictureIndex, op_LogScaleZ);
00504 }
00505
00506 void TGo4Picture::SetLineAtt(Color_t color, Style_t style, Width_t width, Int_t index)
00507 {
00508 CheckIndex(index);
00509 SetOption(index, op_LineColor, color);
00510 SetOption(index, op_LineStyle, style);
00511 SetOption(index, op_LineWidth, width);
00512 }
00513
00514 void TGo4Picture::SetLineAtt(TAttLine* line, Int_t index)
00515 {
00516 if (line==0) return;
00517 CheckIndex(index);
00518 SetOption(index, op_LineColor, line->GetLineColor());
00519 SetOption(index, op_LineStyle, line->GetLineStyle());
00520 SetOption(index, op_LineWidth, line->GetLineWidth());
00521 }
00522
00523 Bool_t TGo4Picture::GetLineAtt(TAttLine* line, Int_t index)
00524 {
00525 if (line==0) return kFALSE;
00526 CheckIndex(index);
00527 Long_t color = -111, style=-111, width=-111;
00528 if (GetOption(index, op_LineColor, color)) line->SetLineColor(color);
00529 if (GetOption(index, op_LineStyle, style)) line->SetLineStyle(style);
00530 if (GetOption(index, op_LineWidth, width)) line->SetLineWidth(width);
00531 return (color!=-111) && (style!=-111) && (width!=-111);
00532 }
00533
00534 void TGo4Picture::ClearLineAtt(Int_t index)
00535 {
00536 CheckIndex(index);
00537 ClearOption(index, op_LineColor);
00538 ClearOption(index, op_LineStyle);
00539 ClearOption(index, op_LineWidth);
00540 }
00541
00542 void TGo4Picture::SetFillAtt(Color_t color, Style_t style, Int_t index)
00543 {
00544 CheckIndex(index);
00545 SetOption(index, op_FillColor, color);
00546 SetOption(index, op_FillStyle, style);
00547 }
00548
00549 void TGo4Picture::SetFillAtt(TAttFill* fill, Int_t index)
00550 {
00551 if (fill==0) return;
00552 CheckIndex(index);
00553 SetOption(index, op_FillColor, fill->GetFillColor());
00554 SetOption(index, op_FillStyle, fill->GetFillStyle());
00555 }
00556
00557 Bool_t TGo4Picture::GetFillAtt(TAttFill* fill, Int_t index)
00558 {
00559 if (fill==0) return kFALSE;
00560 CheckIndex(index);
00561 Long_t color = -111, style = -111;
00562 if (GetOption(index, op_FillColor, color)) fill->SetFillColor(color);
00563 if (GetOption(index, op_FillStyle, style)) fill->SetFillStyle(style);
00564 return (color!=-111) && (style!=-111);
00565 }
00566
00567 void TGo4Picture::ClearFillAtt(Int_t index)
00568 {
00569 CheckIndex(index);
00570 ClearOption(index, op_FillColor);
00571 ClearOption(index, op_FillStyle);
00572 }
00573
00574 void TGo4Picture::SetMarkerAtt(Color_t color, Size_t size, Style_t style, Int_t index)
00575 {
00576 CheckIndex(index);
00577 SetOption(index, op_MarkerColor, color);
00578 SetOption(index, op_MarkerSize, int(size));
00579 SetOption(index, op_MarkerStyle, style);
00580 }
00581
00582 void TGo4Picture::SetMarkerAtt(TAttMarker* marker, Int_t index)
00583 {
00584 if (marker==0) return;
00585 CheckIndex(index);
00586 SetOption(index, op_MarkerColor, marker->GetMarkerColor());
00587 SetOption(index, op_MarkerSize, int(marker->GetMarkerSize()));
00588 SetOption(index, op_MarkerStyle, marker->GetMarkerStyle());
00589 }
00590
00591 Bool_t TGo4Picture::GetMarkerAtt(TAttMarker* marker, Int_t index)
00592 {
00593 if (marker==0) return kFALSE;
00594 CheckIndex(index);
00595 Long_t color=-111, size=-111, style=-111;
00596 if (GetOption(index, op_MarkerColor, color)) marker->SetMarkerColor(color);
00597 if (GetOption(index, op_MarkerSize, size)) marker->SetMarkerSize(size);
00598 if (GetOption(index, op_MarkerStyle, style)) marker->SetMarkerStyle(style);
00599 return (color!=-111) && (size!=-111) && (style!=-111);
00600 }
00601
00602 void TGo4Picture::ClearMarkerAtt(Int_t index)
00603 {
00604 CheckIndex(index);
00605 ClearOption(index, op_MarkerColor);
00606 ClearOption(index, op_MarkerSize);
00607 ClearOption(index, op_MarkerStyle);
00608 }
00609
00610 void TGo4Picture::SetRebinX(Int_t ngroupx, Int_t index)
00611 {
00612 CheckIndex(index);
00613 if (ngroupx>0) SetOption(index, op_RebinX, ngroupx);
00614 else ClearOption(index, op_RebinX);
00615 }
00616
00617 void TGo4Picture::SetRebinY(Int_t ngroupy, Int_t index)
00618 {
00619 CheckIndex(index);
00620 if (ngroupy>0) SetOption(index, op_RebinY, ngroupy);
00621 else ClearOption(index, op_RebinY);
00622 }
00623
00624 Int_t TGo4Picture::GetRebinX(Int_t index)
00625 {
00626 CheckIndex(index);
00627 Long_t ngroupx = 0;
00628 if (!GetOption(index, op_RebinX, ngroupx)) ngroupx = 0;
00629 return ngroupx;
00630 }
00631
00632 Int_t TGo4Picture::GetRebinY(Int_t index)
00633 {
00634 CheckIndex(index);
00635 Long_t ngroupy = 0;
00636 if (!GetOption(index, op_RebinY, ngroupy)) ngroupy = 0;
00637 return ngroupy;
00638 }
00639
00640 void TGo4Picture::ClearRebin(Int_t index)
00641 {
00642 CheckIndex(index);
00643 ClearOption(index, op_RebinX);
00644 ClearOption(index, op_RebinY);
00645 }
00646
00647 void TGo4Picture::GetDrawAttributes(TObject* obj, Int_t index)
00648 {
00649 if (obj==0) return;
00650 CheckIndex(index);
00651 GetLineAtt((TAttLine*) Cast(obj, TAttLine::Class()), index);
00652 GetFillAtt((TAttFill*) Cast(obj, TAttFill::Class()), index);
00653 GetMarkerAtt((TAttMarker*) Cast(obj, TAttMarker::Class()), index);
00654 GetH1Att((TH1*) Cast(obj, TH1::Class()), index);
00655 GetPadAtt((TPad*) Cast(obj, TPad::Class()), index);
00656 }
00657
00658 void TGo4Picture::SetDrawAttributes(TObject* obj, Int_t index)
00659 {
00660 if (obj==0) return;
00661 CheckIndex(index);
00662 SetLineAtt((TAttLine*) Cast(obj, TAttLine::Class()), index);
00663 SetFillAtt((TAttFill*) Cast(obj, TAttFill::Class()), index);
00664 SetMarkerAtt((TAttMarker*) Cast(obj, TAttMarker::Class()), index);
00665 SetH1Att((TH1*) Cast(obj, TH1::Class()), index);
00666 SetPadAtt((TPad*) Cast(obj, TPad::Class()), index);
00667 }
00668
00669 void TGo4Picture::SetH1Att(TH1* h1, Int_t index)
00670 {
00671 if (h1==0) return;
00672 CheckIndex(index);
00673 SetAxisAtt(0, h1->GetXaxis(), index);
00674 SetAxisAtt(1, h1->GetYaxis(), index);
00675 SetAxisAtt(2, h1->GetZaxis(), index);
00676 }
00677
00678 void TGo4Picture::GetH1Att(TH1* h1, Int_t index)
00679 {
00680 if (h1==0) return;
00681 CheckIndex(index);
00682 GetAxisAtt(0, h1->GetXaxis(), index);
00683 GetAxisAtt(1, h1->GetYaxis(), index);
00684 GetAxisAtt(2, h1->GetZaxis(), index);
00685 }
00686
00687 void TGo4Picture::SetAxisLabelFontSize(Int_t naxis, Float_t LabelSize, Int_t index)
00688 {
00689 if ((naxis<0) || (naxis>2)) return;
00690 CheckIndex(index);
00691 Int_t op = op_AxisX;
00692 if (naxis==1) op = op_AxisY; else
00693 if (naxis==2) op = op_AxisZ;
00694
00695 SetOptionF(index, op+4, LabelSize);
00696
00697 }
00698
00699 void TGo4Picture::SetAxisTitleFontSize(Int_t naxis, Float_t TitleSize, Int_t index)
00700 {
00701 if ((naxis<0) || (naxis>2)) return;
00702 CheckIndex(index);
00703 Int_t op = op_AxisX;
00704 if (naxis==1) op = op_AxisY; else
00705 if (naxis==2) op = op_AxisZ;
00706
00707 SetOptionF(index, op+10, TitleSize);
00708 }
00709
00710 void TGo4Picture::SetXAxisAttTime(Bool_t timedisplay, const char* format, Int_t index)
00711 {
00712
00713 CheckIndex(index);
00714 SetOption (index, op_TimeAxisX, timedisplay);
00715 SetStrOption(index, op_TimeAxisXFmt, format);
00716
00717 }
00718
00719 void TGo4Picture::SetXAxisTimeDisplay(Bool_t on)
00720 {
00721
00722 SetOption (PictureIndex, op_TimeAxisX, on);
00723 }
00724
00725 void TGo4Picture::SetXAxisTimeFormat(const char* format)
00726 {
00727
00728 SetStrOption(PictureIndex, op_TimeAxisXFmt, format);
00729 }
00730
00731 Bool_t TGo4Picture::IsXAxisTimeDisplay()
00732 {
00733 Long_t value=0;
00734 GetOption(PictureIndex, op_TimeAxisX,value);
00735
00736 return value;
00737
00738 }
00739
00740 const char* TGo4Picture::GetXAxisTimeFormat()
00741 {
00742
00743 return GetStrOption(PictureIndex, op_TimeAxisXFmt , "%H:%M:%S");
00744 }
00745
00746 void TGo4Picture::SetAxisAtt(Int_t naxis,
00747 Color_t AxisColor,
00748 Color_t LabelColor,
00749 Style_t LabelFont,
00750 Float_t LabelOffset,
00751 Float_t LabelSize,
00752 Int_t Ndivisions,
00753 Float_t TickLength,
00754 Color_t TitleColor,
00755 Style_t TitleFont,
00756 Float_t TitleOffset,
00757 Float_t TitleSize,
00758 Bool_t decimals,
00759 const char* ticks,
00760 Int_t bits,
00761 Int_t index)
00762 {
00763 if ((naxis<0) || (naxis>2)) return;
00764 CheckIndex(index);
00765 Int_t op = op_AxisX;
00766 if (naxis==1) op = op_AxisY; else
00767 if (naxis==2) op = op_AxisZ;
00768
00769 SetOption (index, op+0, AxisColor);
00770 SetOption (index, op+1, LabelColor);
00771 SetOption (index, op+2, LabelFont);
00772 SetOptionF(index, op+3, LabelOffset);
00773 SetOptionF(index, op+4, LabelSize);
00774 SetOption (index, op+5, Ndivisions);
00775 SetOptionF(index, op+6, TickLength);
00776 SetOption (index, op+7, TitleColor);
00777 SetOption (index, op+8, TitleFont);
00778 SetOptionF(index, op+9, TitleOffset);
00779 SetOptionF(index, op+10, TitleSize);
00780
00781 if (decimals) bits = bits | 1;
00782 if (ticks!=0) {
00783 if (strchr(ticks,'+')!=0) bits = bits | 2;
00784 if (strchr(ticks,'-')!=0) bits = bits | 4;
00785 }
00786 SetOption (index, op+11, bits);
00787 }
00788
00789 void TGo4Picture::SetAxisAtt(Int_t naxis, TAxis* axis, Int_t index)
00790 {
00791 if (axis!=0)
00792 SetAxisAtt(naxis,
00793 axis->GetAxisColor(),
00794 axis->GetLabelColor(),
00795 axis->GetLabelFont(),
00796 axis->GetLabelOffset(),
00797 axis->GetLabelSize(),
00798 axis->GetNdivisions(),
00799 axis->GetTickLength(),
00800 axis->GetTitleColor(),
00801 axis->GetTitleFont(),
00802 axis->GetTitleOffset(),
00803 axis->GetTitleSize(),
00804 axis->GetDecimals(),
00805 axis->GetTicks(),
00806 axis->TestBits(0x0ff0),
00807 index);
00808 if(naxis==0)
00809 {
00810
00811 SetXAxisAttTime(axis->GetTimeDisplay(), axis->GetTimeFormat(), index);
00812 }
00813 }
00814
00815 void TGo4Picture::GetAxisAtt(Int_t naxis, TAxis* axis, Int_t index)
00816 {
00817 if ((axis==0) || (naxis<0) || (naxis>2)) return;
00818 CheckIndex(index);
00819 Int_t op = op_AxisX;
00820 if (naxis==1) op = op_AxisY; else
00821 if (naxis==2) op = op_AxisZ;
00822
00823 Long_t lv;
00824 Float_t fv;
00825 if (GetOption (index, op+0, lv)) axis->SetAxisColor(lv);
00826 if (GetOption (index, op+1, lv)) axis->SetLabelColor(lv);
00827 if (GetOption (index, op+2, lv)) axis->SetLabelFont(lv);
00828 if (GetOptionF(index, op+3, fv)) axis->SetLabelOffset(fv);
00829 if (GetOptionF(index, op+4, fv)) axis->SetLabelSize(fv);
00830 if (GetOption (index, op+5, lv)) axis->SetNdivisions(lv);
00831 if (GetOptionF(index, op+6, fv)) axis->SetTickLength(fv);
00832 if (GetOption (index, op+7, lv)) axis->SetTitleColor(lv);
00833 if (GetOption (index, op+8, lv)) axis->SetTitleFont(lv);
00834 if (GetOptionF(index, op+9, fv)) axis->SetTitleOffset(fv);
00835 if (GetOptionF(index, op+10, fv)) axis->SetTitleSize(fv);
00836 if (GetOption (index, op+11, lv)) {
00837 axis->SetDecimals((lv & 1) != 0);
00838 TString ticks;
00839 if ((lv & 2) != 0) ticks+="+";
00840 if ((lv & 4) != 0) ticks+="-";
00841 axis->SetTicks(ticks.Data());
00842 for(int n=9;n<24;n++) {
00843 if (n==13) continue;
00844 Int_t mask = BIT(n);
00845 axis->SetBit(mask, (lv & mask) != 0);
00846 }
00847 }
00848
00849 if(naxis==0)
00850 {
00851
00852 if (GetOption (index, op_TimeAxisX, lv)) axis->SetTimeDisplay(lv);
00853 axis->SetTimeFormat(GetStrOption(index, op_TimeAxisXFmt , "%H:%M:%S"));
00854 }
00855
00856 }
00857
00858 void TGo4Picture::SetPadAtt(Int_t BorderMode,
00859 Int_t BorderSize,
00860 Int_t Gridx,
00861 Int_t Gridy,
00862 Double_t Phi,
00863 Double_t Theta,
00864 Int_t Tickx,
00865 Int_t Ticky,
00866 Int_t index)
00867 {
00868 CheckIndex(index);
00869 SetOption (index, op_Pad+ 0, BorderMode);
00870 SetOption (index, op_Pad+ 1, BorderSize);
00871 SetOption (index, op_Pad+ 2, Gridx);
00872 SetOption (index, op_Pad+ 3, Gridy);
00873 SetOptionD(index, op_Pad+ 4, Phi);
00874 SetOptionD(index, op_Pad+ 5, Theta);
00875 SetOption (index, op_Pad+ 6, Tickx);
00876 SetOption (index, op_Pad+ 7, Ticky);
00877 }
00878
00879 void TGo4Picture::SetPadAtt(TPad* pad, Int_t index)
00880 {
00881 if (pad==0) return;
00882 CheckIndex(index);
00883 SetPadAtt(pad->GetBorderMode(),
00884 pad->GetBorderSize(),
00885 pad->GetGridx(),
00886 pad->GetGridy(),
00887 pad->GetPhi(),
00888 pad->GetTheta(),
00889 pad->GetTickx(),
00890 pad->GetTicky(),
00891 index);
00892 SetDrawAttributes(pad->GetFrame(), index);
00893 }
00894
00895 void TGo4Picture::GetPadAtt(TPad* pad, Int_t index)
00896 {
00897 if (pad==0) return;
00898 CheckIndex(index);
00899
00900 Long_t lv;
00901 Double_t dv;
00902 if (GetOption (index, op_Pad+ 0, lv)) pad->SetBorderMode(lv);
00903 if (GetOption (index, op_Pad+ 1, lv)) pad->SetBorderSize(lv);
00904 if (GetOption (index, op_Pad+ 2, lv)) pad->SetGridx(lv);
00905 if (GetOption (index, op_Pad+ 3, lv)) pad->SetGridy(lv);
00906 if (GetOptionD(index, op_Pad+ 4, dv)) pad->SetPhi(dv);
00907 if (GetOptionD(index, op_Pad+ 5, dv)) pad->SetTheta(dv);
00908 if (GetOption (index, op_Pad+ 6, lv)) pad->SetTickx(lv);
00909 if (GetOption (index, op_Pad+ 7, lv)) pad->SetTicky(lv);
00910 GetDrawAttributes(pad->GetFrame(), index);
00911 }
00912
00913 void* TGo4Picture::Cast(TObject* obj, TClass* cl)
00914 {
00915 if ((obj==0) || (cl==0)) return 0;
00916 Int_t shift = obj->IsA()->GetBaseClassOffset(cl);
00917 if (shift<0) return 0;
00918 return (char*) obj + shift;
00919 }
00920
00921 void TGo4Picture::SetHisStats(Bool_t on)
00922 {
00923 SetOption(PictureIndex, op_HisStats, on ? 1 : 0);
00924 }
00925
00926 Bool_t TGo4Picture::IsHisStats() const
00927 {
00928 Long_t zn = kTRUE;
00929 GetOption(PictureIndex, op_HisStats, zn);
00930 return zn!=0;
00931 }
00932
00933 void TGo4Picture::SetStatsAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2,
00934 Int_t optstat, const char* statformat,
00935 Int_t optfit, const char* fitformat)
00936 {
00937 SetOptionD(PictureIndex, op_HisStatsX1, x1);
00938 SetOptionD(PictureIndex, op_HisStatsY1, y1);
00939 SetOptionD(PictureIndex, op_HisStatsX2, x2);
00940 SetOptionD(PictureIndex, op_HisStatsY2, y2);
00941
00942 SetOption(PictureIndex, op_HisStatsOpt, optstat);
00943 SetStrOption(PictureIndex, op_HisStatsOptF, statformat);
00944 SetOption(PictureIndex, op_HisStatsFit, optfit);
00945 SetStrOption(PictureIndex, op_HisStatsFitF, fitformat);
00946 }
00947
00948 void TGo4Picture::SetStatsAttr(TPaveStats* stats)
00949 {
00950 if (stats!=0)
00951 SetStatsAttr(stats->GetX1NDC(), stats->GetY1NDC(),
00952 stats->GetX2NDC(), stats->GetY2NDC(),
00953 stats->GetOptStat(), stats->GetStatFormat(),
00954 stats->GetOptFit(), stats->GetFitFormat());
00955 }
00956
00957 Bool_t TGo4Picture::GetStatsAttr(TPaveStats* stats)
00958 {
00959 if (stats==0) return kFALSE;
00960
00961 Double_t x1, y1, x2, y2;
00962 if (GetOptionD(PictureIndex, op_HisStatsX1, x1) &&
00963 GetOptionD(PictureIndex, op_HisStatsY1, y1) &&
00964 GetOptionD(PictureIndex, op_HisStatsX2, x2) &&
00965 GetOptionD(PictureIndex, op_HisStatsY2, y2)) {
00966 stats->SetX1NDC(x1);
00967 stats->SetY1NDC(y1);
00968 stats->SetX2NDC(x2);
00969 stats->SetY2NDC(y2);
00970 stats->ConvertNDCtoPad();
00971 }
00972
00973 Long_t optstat, optfit;
00974 if (GetOption(PictureIndex, op_HisStatsOpt, optstat))
00975 stats->SetOptStat(optstat);
00976
00977 if (GetOption(PictureIndex, op_HisStatsFit, optfit))
00978 stats->SetOptFit(optfit);
00979
00980 const char* fmtstat = GetStrOption(PictureIndex, op_HisStatsOptF);
00981 if (fmtstat!=0) stats->SetStatFormat(fmtstat);
00982
00983 const char* fmtfit = GetStrOption(PictureIndex, op_HisStatsFitF);
00984 if (fmtfit!=0) stats->SetFitFormat(fmtfit);
00985
00986 return kTRUE;
00987 }
00988
00989 void TGo4Picture::SetHisTitle(bool on)
00990 {
00991 SetOption(PictureIndex, op_HisTitle, on ? 1 : 0);
00992 }
00993
00994 Bool_t TGo4Picture::IsHisTitle() const
00995 {
00996 Long_t zn = kTRUE;
00997 GetOption(PictureIndex, op_HisTitle, zn);
00998 return zn!=0;
00999 }
01000
01001 void TGo4Picture::SetTitleAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t textsize)
01002 {
01003 SetOptionD(PictureIndex, op_TitleX1, x1);
01004 SetOptionD(PictureIndex, op_TitleY1, y1);
01005 SetOptionD(PictureIndex, op_TitleX2, x2);
01006 SetOptionD(PictureIndex, op_TitleY2, y2);
01007
01008 if (textsize!=0.)
01009 SetOptionD(PictureIndex, op_TitleTextSz, textsize);
01010 }
01011
01012 void TGo4Picture::SetTitleAttr(TPaveText* titl)
01013 {
01014 if (titl!=0) {
01015 SetTitleAttr(titl->GetX1NDC(), titl->GetY1NDC(),
01016 titl->GetX2NDC(), titl->GetY2NDC(),
01017 titl->GetTextSize());
01018 }
01019 }
01020
01021 Bool_t TGo4Picture::HasTitleAttr()
01022 {
01023 return (FindOptPos(PictureIndex, op_TitleX1)>=0) &&
01024 (FindOptPos(PictureIndex, op_TitleX2)>=0) &&
01025 (FindOptPos(PictureIndex, op_TitleY1)>=0) &&
01026 (FindOptPos(PictureIndex, op_TitleY2)>=0);
01027 }
01028
01029
01030 Bool_t TGo4Picture::GetTitleAttr(TPaveText* titl)
01031 {
01032 if (titl==0) return kFALSE;
01033
01034 Double_t x1, y1, x2, y2, sz(0.);
01035 if (GetOptionD(PictureIndex, op_TitleX1, x1) &&
01036 GetOptionD(PictureIndex, op_TitleY1, y1) &&
01037 GetOptionD(PictureIndex, op_TitleX2, x2) &&
01038 GetOptionD(PictureIndex, op_TitleY2, y2)) {
01039 titl->SetX1NDC(x1);
01040 titl->SetY1NDC(y1);
01041 titl->SetX2NDC(x2);
01042 titl->SetY2NDC(y2);
01043 titl->ConvertNDCtoPad();
01044 }
01045
01046 if (GetOptionD(PictureIndex, op_TitleTextSz, sz))
01047 titl->SetTextSize(sz);
01048 else
01049 titl->SetTextSize(0);
01050
01051 return kTRUE;
01052 }
01053
01054
01055 void TGo4Picture::SetTitleTime(Bool_t on)
01056 {
01057 SetOption(PictureIndex, op_TitleTime, on ? 1 : 0);
01058 }
01059
01060 Bool_t TGo4Picture::IsTitleTime() const
01061 {
01062 Long_t zn = kTRUE;
01063 GetOption(PictureIndex, op_TitleTime, zn);
01064 return zn!=0;
01065 }
01066
01067 void TGo4Picture::SetTitleDate(Bool_t on)
01068 {
01069 SetOption(PictureIndex, op_TitleDate, on ? 1 : 0);
01070 }
01071
01072 Bool_t TGo4Picture::IsTitleDate() const
01073 {
01074 Long_t zn = kFALSE;
01075 GetOption(PictureIndex, op_TitleDate, zn);
01076 return zn!=0;
01077 }
01078
01079 void TGo4Picture::SetTitleItem(Bool_t on)
01080 {
01081 SetOption(PictureIndex, op_TitleItem, on ? 1 : 0);
01082 }
01083
01084 Bool_t TGo4Picture::IsTitleItem() const
01085 {
01086 Long_t zn = kFALSE;
01087 GetOption(PictureIndex, op_TitleItem, zn);
01088 return zn!=0;
01089 }
01090
01091 void TGo4Picture::SetLegendDraw(bool on)
01092 {
01093 SetOption(PictureIndex, op_LegendDraw, on ? 1 : 0);
01094 }
01095
01096 bool TGo4Picture::IsLegendDraw() const
01097 {
01098 Long_t zn = kTRUE;
01099 GetOption(PictureIndex, op_LegendDraw, zn);
01100 return zn!=0;
01101 }
01102
01103 void TGo4Picture::SetCrosshair(bool on)
01104 {
01105 SetOption(PictureIndex, op_Crosshair, on ? 1 : 0);
01106 }
01107
01108 bool TGo4Picture::IsCrosshair() const
01109 {
01110 Long_t zn = kFALSE;
01111 GetOption(PictureIndex, op_Crosshair, zn);
01112 return zn!=0;
01113 }
01114
01115 void TGo4Picture::SetAutoScale(bool on)
01116 {
01117 SetOption(PictureIndex, op_AutoScale, on ? 1 : 0);
01118 }
01119
01120 bool TGo4Picture::IsAutoScale() const
01121 {
01122 Long_t zn = kTRUE;
01123 GetOption(PictureIndex, op_AutoScale, zn);
01124 return zn!=0;
01125 }
01126
01127 void TGo4Picture::SetSuperimpose(bool on)
01128 {
01129 SetOption(PictureIndex, op_Superimpose, on ? 1 : 0);
01130 }
01131
01132 bool TGo4Picture::IsSuperimpose() const
01133 {
01134 Long_t zn = kFALSE;
01135 GetOption(PictureIndex, op_Superimpose, zn);
01136 return zn!=0;
01137 }
01138
01139 void TGo4Picture::SetContentModified(bool on)
01140 {
01141 SetOption(PictureIndex, op_ContentModified, on ? 1 : 0);
01142 }
01143
01144 bool TGo4Picture::IsContentModified() const
01145 {
01146 Long_t zn = kFALSE;
01147 GetOption(PictureIndex, op_ContentModified, zn);
01148 return zn!=0;
01149 }
01150
01151 void TGo4Picture::SetPadModified(bool on)
01152 {
01153 SetOption(PictureIndex, op_PadModified, on ? 1 : 0);
01154 }
01155
01156 bool TGo4Picture::IsPadModified() const
01157 {
01158 Long_t zn = kFALSE;
01159 GetOption(PictureIndex, op_PadModified, zn);
01160 return zn!=0;
01161 }
01162
01163 void TGo4Picture::ChangeDrawOption(Int_t kind, Int_t value)
01164 {
01165 switch(kind) {
01166 case 0: break;
01167 case 1: break;
01168 case 2: break;
01169 case 3: SetLogScale(0, value); break;
01170 case 4: SetLogScale(1, value); break;
01171 case 5: SetLogScale(2, value); break;
01172 case 6: SetHisStats(value!=0); break;
01173 case 7: SetHisTitle(value!=0); break;
01174 case 8: SetLegendDraw(value!=0); break;
01175 case 9: SetCrosshair(value!=0); break;
01176 case 10: {
01177 Int_t numdim = GetFullRangeDim();
01178 SetAutoScale(value!=0);
01179 Double_t min, max;
01180 if (!IsAutoScale()) {
01181 if ((numdim==1) && !GetRange(1, min, max)) {
01182 GetFullRange(1, min, max);
01183 SetRange(1, min, max);
01184 } else
01185 if ((numdim==2) && !GetRange(1, min, max)) {
01186 GetFullRange(2, min, max);
01187 SetRange(2, min, max);
01188 }
01189 }
01190 break;
01191 }
01192 case 11: SetSuperimpose(value!=0); break;
01193 case 12: SetTitleTime(value!=0); break;
01194 case 13: SetTitleDate(value!=0); break;
01195 case 14: SetTitleItem(value!=0); break;
01196 case 15: SetXAxisTimeDisplay(value!=0); break;
01197 }
01198 SetPadModified();
01199 }
01200
01201
01202 void TGo4Picture::SetFullRangeDim(Int_t ndim)
01203 {
01204 SetOption(PictureIndex, op_FullDim, ndim);
01205 }
01206
01207 Int_t TGo4Picture::GetFullRangeDim() const
01208 {
01209 Long_t zn = 0;
01210 GetOption(PictureIndex, op_FullDim, zn);
01211 return zn;
01212 }
01213
01214 void TGo4Picture::SetFullRange(Int_t naxis, Double_t min, Double_t max)
01215 {
01216 Int_t op;
01217 switch (naxis) {
01218 case 1: op = op_FullYMin; break;
01219 case 2: op = op_FullZMin; break;
01220 default: op = op_FullXMin; break;
01221 }
01222 SetOptionD(PictureIndex, op, min);
01223 SetOptionD(PictureIndex, op+1, max);
01224 }
01225
01226 Bool_t TGo4Picture::GetFullRange(Int_t naxis, Double_t& min, Double_t& max)
01227 {
01228 Int_t op;
01229 switch (naxis) {
01230 case 1: op = op_FullYMin; break;
01231 case 2: op = op_FullZMin; break;
01232 default: op = op_FullXMin; break;
01233 }
01234 return GetOptionD(PictureIndex, op, min) && GetOptionD(PictureIndex, op+1, max);
01235 }
01236
01237 void TGo4Picture::ClearFullRange(Int_t naxis)
01238 {
01239 if (naxis<0) {
01240 for(int n=0;n<3;n++)
01241 ClearFullRange(n);
01242 ClearOption(PictureIndex, op_FullDim);
01243 }
01244 Int_t op;
01245 switch (naxis) {
01246 case 1: op = op_FullYMin; break;
01247 case 2: op = op_FullZMin; break;
01248 default: op = op_FullXMin; break;
01249 }
01250 ClearOption(PictureIndex, op);
01251 ClearOption(PictureIndex, op+1);
01252 }
01253
01254 void TGo4Picture::UpdateFrom(TGo4Picture* source, TClass* selectedobjclass)
01255 {
01256 if (source==0) return;
01257 Clear();
01258
01259 SetName(source->GetName());
01260 SetTitle(source->GetTitle());
01261
01262 fiNDivX = source->fiNDivX;
01263 fiNDivY = source->fiNDivY;
01264 fiPosX = source->fiPosX;
01265 fiPosY = source->fiPosY;
01266
01267 for (Int_t n=0; n<source->GetNumObjNames();n++)
01268 AddObjName(source->GetObjName(n));
01269
01270 if (source->GetSpecialObjects()!=0)
01271 fxSpecialObjects = (TList*) source->GetSpecialObjects()->Clone();
01272
01273 CopyOptionsFrom(source);
01274
01275 if (source->fxSubPictures!=0) {
01276 fxSubPictures = new TObjArray();
01277 fxSubPictures->SetOwner(kTRUE);
01278 for (Int_t n=0;n<=source->fxSubPictures->GetLast();n++) {
01279 TGo4Picture* sub = dynamic_cast<TGo4Picture*> (source->fxSubPictures->At(n));
01280 if (sub!=0) {
01281 TGo4Picture* newsub = new TGo4Picture;
01282 newsub->UpdateFrom(sub, selectedobjclass);
01283 fxSubPictures->Add(newsub);
01284 }
01285 }
01286 }
01287 }
01288
01289 void TGo4Picture::CopyOptionsFrom(TGo4Picture* source)
01290 {
01291 fiOptSize = source->fiOptSize;
01292 source->fxOptIndex.Copy(fxOptIndex);
01293 source->fxOptValue.Copy(fxOptValue);
01294 if (fxOptObjects!=0) delete fxOptObjects;
01295 fxOptObjects = 0;
01296 if (source->fxOptObjects)
01297 fxOptObjects = (TObjArray*) source->fxOptObjects->Clone();
01298 }
01299
01300
01301 void TGo4Picture::Clear(Option_t* option)
01302 {
01303 fiNDivX = 1;
01304 fiNDivY = 1;
01305 fiPosX = 0;
01306 fiPosY = 0;
01307 if (fxNames!=0) { delete fxNames; fxNames = 0; }
01308 if (fxSubPictures!=0) { delete fxSubPictures; fxSubPictures = 0; }
01309 fiLastIndex = 0;
01310 fiOptSize = 0;
01311 fxOptIndex.Set(0);
01312 fxOptValue.Set(0);
01313 if (fxOptObjects!=0) { delete fxOptObjects; fxOptObjects = 0; }
01314 }
01315
01316 Int_t TGo4Picture::FindOptPos(Short_t index, Short_t typ) const
01317 {
01318 Long_t zn = index + 1 + (typ << 16);
01319 for (Int_t i=0;i<fiOptSize;i++)
01320 if (fxOptIndex[i]==zn) return i;
01321 return -1;
01322 }
01323
01324 Int_t TGo4Picture::ExtendOptPos(Short_t index, Short_t typ)
01325 {
01326 Long_t zn = index + 1 + (typ << 16);
01327 if (fxOptIndex.GetSize()==fiOptSize) {
01328 fxOptIndex.Set(fiOptSize+8);
01329 fxOptValue.Set(fiOptSize+8);
01330 }
01331 fxOptIndex[fiOptSize] = zn;
01332 fiOptSize++;
01333 return fiOptSize-1;
01334 }
01335
01336 void TGo4Picture::SetOption(Short_t index, Short_t typ, Long_t value)
01337 {
01338 if (typ>=op_ObjsBound) return;
01339 Int_t pos = FindOptPos(index,typ);
01340 if (pos<0) pos = ExtendOptPos(index, typ);
01341 fxOptValue[pos] = value;
01342 }
01343
01344 Bool_t TGo4Picture::GetOption(Short_t index, Short_t typ, Long_t& value) const
01345 {
01346 if (typ>=op_ObjsBound) return kFALSE;
01347 Int_t pos = FindOptPos(index, typ);
01348 if (pos<0) return kFALSE;
01349 value = fxOptValue[pos];
01350 return kTRUE;
01351 }
01352
01353 Long_t TGo4Picture::GetI(Short_t index, Short_t typ, Long_t def) const
01354 {
01355 Long_t value = 0;
01356 if (!GetOption(index, typ, value)) return def;
01357 return value;
01358 }
01359
01360 void TGo4Picture::SetOptionF(Short_t index, Short_t typ, Float_t value)
01361 {
01362 Long_t buf;
01363 if (sizeof(Long_t)==sizeof(Float_t))
01364 memcpy(&buf, &value, sizeof(Long_t));
01365 else {
01366 Double_t v(value);
01367 memcpy(&buf, &v, sizeof(Long_t));
01368 }
01369 SetOption(index, typ, buf);
01370 }
01371
01372 Bool_t TGo4Picture::GetOptionF(Short_t index, Short_t typ, Float_t& value)
01373 {
01374 Long_t buf;
01375 Bool_t res = GetOption(index, typ, buf);
01376
01377 if (res){
01378 if (sizeof(Long_t)==sizeof(Float_t))
01379 memcpy(&value, &buf, sizeof(Long_t));
01380 else {
01381 Double_t v;
01382 memcpy(&v, &buf, sizeof(Long_t));
01383 value = v;
01384 }
01385 }
01386 return res;
01387 }
01388
01389 void TGo4Picture::SetOptionD(Short_t index, Short_t typ, Double_t value)
01390 {
01391 Long_t buf;
01392 if (sizeof(Long_t)==sizeof(Float_t)) {
01393 Float_t v(value);
01394 memcpy(&buf, &v, sizeof(Long_t));
01395 } else
01396 memcpy(&buf, &value, sizeof(Long_t));
01397 SetOption(index, typ, buf);
01398 }
01399
01400 Bool_t TGo4Picture::GetOptionD(Short_t index, Short_t typ, Double_t& value)
01401 {
01402 Long_t buf;
01403 Bool_t res = GetOption(index, typ, buf);
01404
01405 if (res){
01406 if (sizeof(Long_t)==sizeof(Float_t)) {
01407 Float_t v;
01408 memcpy(&v, &buf, sizeof(Long_t));
01409 value = v;
01410 } else
01411 memcpy(&value, &buf, sizeof(Long_t));
01412 }
01413 return res;
01414 }
01415
01416 Double_t TGo4Picture::GetD(Short_t index, Short_t typ, Double_t def)
01417 {
01418 Double_t value;
01419 if (!GetOptionD(index, typ, value)) return def;
01420 return value;
01421 }
01422
01423
01424 void TGo4Picture::SetObjOption(Short_t index, Short_t typ, TObject* obj)
01425 {
01426 if (obj==0) return;
01427 if (typ<op_ObjsBound) { delete obj; return; }
01428 Int_t pos = FindOptPos(index, typ);
01429 if (pos>=0) {
01430 TObject* old = fxOptObjects->RemoveAt(fxOptValue[pos]);
01431 delete old;
01432 fxOptObjects->AddAt(obj, fxOptValue[pos]);
01433 } else {
01434 pos = ExtendOptPos(index, typ);
01435 if (fxOptObjects==0) {
01436 fxOptObjects = new TObjArray();
01437 fxOptObjects->SetOwner(kTRUE);
01438 }
01439 fxOptObjects->Add(obj);
01440 fxOptValue[pos] = fxOptObjects->GetLast();
01441 }
01442 }
01443
01444 TObject* TGo4Picture::GetObjOption(Short_t index, Short_t typ)
01445 {
01446 if (typ<op_ObjsBound) return 0;
01447 Int_t pos = FindOptPos(index, typ);
01448 if (pos<0) return 0;
01449 return fxOptObjects->At(fxOptValue[pos]);
01450 }
01451
01452 void TGo4Picture::SetStrOption(Short_t index, Short_t typ, const char* value)
01453 {
01454 if (value==0) return;
01455 SetObjOption(index, typ, new TObjString(value));
01456 }
01457
01458 const char* TGo4Picture::GetStrOption(Short_t index, Short_t typ, const char* defvalue)
01459 {
01460 TObjString* ostr = dynamic_cast<TObjString*> (GetObjOption(index, typ));
01461 if (ostr==0) return defvalue;
01462 return ostr->String().Data();
01463 }
01464
01465 void TGo4Picture::SetDrawOption(Option_t* option, Int_t index)
01466 {
01467 CheckIndex(index);
01468 if (option==0) ClearOption(index, op_Draw);
01469 else SetStrOption(index, op_Draw, option);
01470 }
01471
01472 Option_t* TGo4Picture::GetDrawOption(Int_t index)
01473 {
01474 CheckIndex(index);
01475 return (Option_t*) GetStrOption(index, op_Draw);
01476 }
01477
01478 void TGo4Picture::SetStyle(TStyle* style, Int_t index)
01479 {
01480 if (style==0) return;
01481 CheckIndex(index);
01482 SetObjOption(index, op_Style, new TStyle(*style));
01483 }
01484
01485 TStyle* TGo4Picture::FindStyle(Int_t index)
01486 {
01487 CheckIndex(index);
01488 Int_t pos = FindOptPos(index, op_Style);
01489 if (pos<0) return 0;
01490 return dynamic_cast<TStyle*> (GetObjOption(index, op_Style));
01491 }
01492
01493 TStyle* TGo4Picture::GetStyle(Int_t index)
01494 {
01495 CheckIndex(index);
01496 TStyle* style = FindStyle(index);
01497 if (style==0) {
01498 style = new TStyle(*gStyle);
01499 SetObjOption(index, op_Style, style);
01500 }
01501 return style;
01502 }
01503
01504 void TGo4Picture::ClearOption(Short_t index, Short_t typ)
01505 {
01506 ClearOption(FindOptPos(index,typ));
01507 }
01508
01509 void TGo4Picture::ClearOption(Int_t pos)
01510 {
01511 if (pos<0) return;
01512 Int_t bnd = op_ObjsBound << 16;
01513
01514 if (fxOptIndex[pos]>=bnd) {
01515 for (Int_t i=0;i<fiOptSize;i++)
01516 if (fxOptIndex[i]>=bnd)
01517 if (fxOptValue[i]>fxOptValue[pos]) fxOptValue[i]-=1;
01518 TObject* obj = fxOptObjects->RemoveAt(fxOptValue[pos]);
01519 delete obj;
01520 fxOptObjects->Compress();
01521 if (fxOptObjects->GetLast()<0) {
01522 delete fxOptObjects;
01523 fxOptObjects = 0;
01524 }
01525 }
01526
01527 for (Int_t i=pos;i<fiOptSize-1;i++) {
01528 fxOptIndex[i] = fxOptIndex[i+1];
01529 fxOptValue[i] = fxOptValue[i+1];
01530 }
01531 fiOptSize--;
01532 }
01533
01534 void TGo4Picture::CheckIndex(Int_t& index)
01535 {
01536 if(index==UndefIndex){
01537 if (fiLastIndex>=PictureIndex) index = fiLastIndex;
01538 else index = PictureIndex;
01539 }
01540 }
01541
01542 void TGo4Picture::ClearAllOptions(Short_t index)
01543 {
01544 if (index<0) {
01545 fxOptIndex.Set(0);
01546 fxOptValue.Set(0);
01547 if (fxOptObjects) {
01548 delete fxOptObjects;
01549 fxOptObjects = 0;
01550 }
01551 } else {
01552 Int_t pos = 0;
01553 while (pos<fiOptSize)
01554 if ((fxOptIndex[pos] & 0x7fff)==index+1) ClearOption(pos);
01555 else pos++;
01556 }
01557 }
01558
01559 Int_t TGo4Picture::GetObjAttIndex(TObject* obj)
01560 {
01561 if (obj==0) return UndefIndex;
01562 for (Int_t n=0;n<GetNumObjNames();n++)
01563 if (strcmp(GetObjName(n),obj->GetName())==0) return n;
01564 return UndefIndex;
01565 }
01566
01567 void TGo4Picture::DrawPic(TVirtualPad* pad)
01568 {
01569 if (pad==0) return;
01570 double txt_y = 0.9;
01571 if (IsDivided()) {
01572 pad->Divide(GetDivX(), GetDivY());
01573 for(Int_t posx=0; posx<GetDivX(); posx++)
01574 for(Int_t posy=0; posy<GetDivY(); posy++) {
01575 TGo4Picture* sub = FindPic(posy,posx);
01576 if (sub) sub->DrawPic(pad->GetPad(posy*GetDivX() + posx + 1));
01577 }
01578 } else
01579 for (Int_t indx=0;indx<GetNumObjNames();indx++) {
01580 TString str = "Obj: ";
01581 str += GetObjName(indx);
01582 const char* opt = GetDrawOption(indx);
01583 if ((opt==0) && (indx==0))
01584 opt = GetDrawOption(PictureIndex);
01585 if (opt!=0) {
01586 str += " Opt: ";
01587 str += opt;
01588 }
01589 TText* txt = new TText(0.1, txt_y, str.Data());
01590 pad->cd();
01591 txt->Draw();
01592 if (GetNumObjNames()<8) txt_y -= 0.1;
01593 else txt_y -= 0.8/GetNumObjNames();
01594 }
01595 }
01596
01597 void TGo4Picture::Draw(Option_t* option)
01598 {
01599 TCanvas* c = 0;
01600 if (gPad==0) {
01601 c = new TCanvas();
01602 c->cd();
01603 } else {
01604 c = gPad->GetCanvas();
01605 c->Clear();
01606 c->cd();
01607 }
01608 if (c==0) return;
01609
01610 if (IsDrawHeader()) {
01611 TString txt = c->GetName();
01612 txt += " Pic: ";
01613 txt += GetName();
01614 if (strcmp(GetName(), GetTitle())!=0) {
01615 txt += " Title: ";
01616 txt += GetTitle();
01617 }
01618 c->SetTitle(txt.Data());
01619 }
01620
01621 DrawPic(c);
01622 }
01623
01624 void TGo4Picture::PrintPic(int shift, Bool_t showopt)
01625 {
01626 for (int n=0;n<shift;n++) std::cout << ' ';
01627 if (IsDivided()) {
01628 std::cout << "Divided numx:" << GetDivX() << " numy:" << GetDivY() << std::endl;
01629 for(Int_t posx=0; posx<GetDivX(); posx++)
01630 for(Int_t posy=0; posy<GetDivY(); posy++) {
01631 for (int n=0;n<shift+2;n++) std::cout << ' ';
01632 std::cout << "subpic x:" << posx << " y:" << posy << std::endl;
01633 TGo4Picture* sub = FindPic(posy,posx);
01634 if (sub) sub->PrintPic(shift+4, showopt);
01635 }
01636 } else {
01637 std::cout << "Objects:" << std::endl;
01638 for (Int_t num=0; num<GetNumObjNames(); num++) {
01639 const char* objname = GetObjName(num);
01640 for (int n=0;n<shift+2;n++) std::cout << ' ';
01641 std::cout << objname;
01642
01643 Option_t* drawopt = GetDrawOption(num);
01644 if (drawopt) std::cout << " opt: " << drawopt;
01645 std::cout << std::endl;
01646 }
01647 if (!showopt) return;
01648 for (int n=0;n<shift;n++) std::cout << ' ';
01649 std::cout << "Options:" << std::endl;
01650 for (Int_t nop=0;nop<fiOptSize;nop++) {
01651 Int_t indx = (fxOptIndex[nop] & 0x00ff);
01652 Int_t op = fxOptIndex[nop] >> 16;
01653 for (int n=0;n<shift+2;n++) std::cout << ' ';
01654 std::cout << indx << " " << op << " " << fxOptValue[nop] << std::endl;
01655 }
01656 }
01657 }
01658
01659 void TGo4Picture::Print(Option_t* option) const
01660 {
01661 std::cout << "Picture " << GetName() << std::endl;
01662 ((TGo4Picture*)this)->PrintPic(2, (strstr(option,"attr")!=0));
01663 }
01664
01665 void TGo4Picture::AddSubPicture(TGo4Picture* pic)
01666 {
01667 if (pic == 0) return;
01668 if (fxSubPictures==0) {
01669 fxSubPictures = new TObjArray();
01670 fxSubPictures->SetOwner(kTRUE);
01671 }
01672 fxSubPictures->Add(pic);
01673 }
01674
01675 void TGo4Picture::AddSpecialObject(TObject* obj, Option_t* drawopt)
01676 {
01677 if (fxSpecialObjects==0) {
01678 fxSpecialObjects = new TList;
01679 fxSpecialObjects->SetOwner(kTRUE);
01680 }
01681
01682 fxSpecialObjects->Add(obj, drawopt);
01683 }
01684
01685 void TGo4Picture::AddSpecialObjectXml(const char* xmlcode, Option_t* drawopt)
01686 {
01687 #if ROOT_VERSION_CODE > ROOT_VERSION(5,9,0)
01688 TObject* obj = TBufferXML::ConvertFromXML(xmlcode);
01689 if (obj!=0) AddSpecialObject(obj, drawopt);
01690 #endif
01691 }
01692
01693 Long_t TGo4Picture::GetTotalSize()
01694 {
01695 Long_t sz = IsA()->Size();
01696
01697 if (fxNames) {
01698 sz += TObjArray::Class()->Size() + fxNames->GetSize() * sizeof(void*);
01699 for (int n=0;n<=fxNames->GetLast();n++) {
01700 TObjString* str = (TObjString*) fxNames->At(n);
01701 if (str) sz += str->IsA()->Size() + str->GetString().Length();
01702 }
01703 }
01704
01705 if (fxSubPictures)
01706 sz += TObjArray::Class()->Size() + fxSubPictures->GetSize() * sizeof(void*);
01707
01708 if (fxOptObjects) {
01709 sz += TObjArray::Class()->Size() + fxOptObjects->GetSize() * sizeof(void*);
01710 for (int n=0;n<=fxOptObjects->GetLast();n++) {
01711 TObject* obj = fxOptObjects->At(n);
01712 if (obj) sz += obj->IsA()->Size();
01713 }
01714 }
01715
01716 if (fxSpecialObjects) {
01717 sz += TList::Class()->Size();
01718 TListIter iter(fxSpecialObjects);
01719 TObject* obj = 0;
01720
01721 while ((obj = iter()) != 0)
01722 sz += sizeof(TObjLink) + obj->IsA()->Size();
01723 }
01724
01725 sz += fxOptIndex.GetSize() * sizeof(Long_t);
01726 sz += fxOptValue.GetSize() * sizeof(Long_t);
01727
01728 if (IsDivided())
01729 for(int ny=0;ny<GetDivY();ny++)
01730 for(int nx=0;nx<GetDivX();nx++)
01731 sz += Pic(ny,nx)->GetTotalSize();
01732
01733 return sz;
01734 }
01735
01736
01737 #if ROOT_VERSION_CODE > ROOT_VERSION(5,11,6)
01738 void TGo4Picture::SavePrimitive(std::ostream& fs, Option_t*)
01739 #else
01740 void TGo4Picture::SavePrimitive(std::ofstream& fs, Option_t*)
01741 #endif
01742 {
01743 fs << "TGo4Picture *" << GetName() << " = new TGo4Picture(\"" << GetName()
01744 << "\", \"" << GetTitle() << "\");" << std::endl;
01745 TString name = GetName();
01746 name+="->";
01747
01748 fs << name << "SetCrosshair(" << (IsCrosshair() ? "true" : "false") << ");" << std::endl;
01749
01750 MakeScript(fs, name.Data());
01751 }
01752
01753 void TGo4Picture::MakeAxisScript(std::ostream& fs, const char* name, Int_t index, Int_t naxis)
01754 {
01755 if ((naxis<0) || (naxis>2)) return;
01756 const char* axisname = "X";
01757 Int_t op = op_AxisX;
01758 if (naxis==1) { op = op_AxisY; axisname = "Y"; } else
01759 if (naxis==2) { op = op_AxisZ; axisname = "Z"; }
01760
01761 Long_t lv;
01762 Float_t fv;
01763 if (!GetOption (index, op+0, lv)) return;
01764
01765 fs << name << "SetAxisAtt(" << naxis << ", ";
01766 fs << lv << ", ";
01767 if (!GetOption (index, op+1, lv)) lv = gStyle->GetLabelColor(axisname);
01768 fs << lv << ", ";
01769 if (!GetOption (index, op+2, lv)) lv = gStyle->GetLabelFont(axisname);
01770 fs << lv << ", ";
01771 if (!GetOptionF(index, op+3, fv)) fv = gStyle->GetLabelOffset(axisname);
01772 fs << fv << ", ";
01773 if (!GetOptionF(index, op+4, fv)) fv = gStyle->GetLabelSize(axisname);
01774 fs << fv << ", ";
01775 if (!GetOption (index, op+5, lv)) lv = gStyle->GetNdivisions(axisname);
01776 fs << lv << ", ";
01777 if (!GetOptionF(index, op+6, fv)) fv = gStyle->GetTickLength(axisname);
01778 fs << fv << ", ";
01779 if (!GetOption (index, op+7, lv)) lv = gStyle->GetTitleColor(axisname);
01780 fs << lv << ", ";
01781 if (!GetOption (index, op+8, lv)) lv = gStyle->GetTitleFont(axisname);
01782 fs << lv << ", ";
01783 if (!GetOptionF(index, op+9, fv)) fv = gStyle->GetTitleOffset(axisname);
01784 fs << fv << ", ";
01785 if (!GetOptionF(index, op+10, fv)) fv = gStyle->GetTitleSize(axisname);
01786 fs << fv << ", ";
01787
01788 if (GetOption (index, op+11, lv)) {
01789 if ((lv & 1) != 0) fs << "kTRUE, ";
01790 else fs << "kFALSE, ";
01791 TString ticks;
01792 if ((lv & 2) != 0) ticks+="+";
01793 if ((lv & 4) != 0) ticks+="-";
01794 fs << "\"" << ticks <<"\", ";
01795 fs << (lv & 0x0ff0) << ", ";
01796 } else
01797 fs << "kTRUE, \"+\", 0, ";
01798
01799 fs << index << ");" << std::endl;
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817 }
01818
01819 void TGo4Picture::MakeScript(std::ostream& fs, const char* name)
01820 {
01821 for(Int_t naxis=0;naxis<3;naxis++)
01822 if (GetLogScale(naxis)>0)
01823 fs << name << "SetLogScale(" << naxis << ", 1);" << std::endl;
01824
01825 Double_t min, max;
01826 if (GetRangeX(min, max))
01827 fs << name << "SetRangeX(" << min << ", " << max << ");" << std::endl;
01828 if (GetRangeY(min, max))
01829 fs << name << "SetRangeY(" << min << ", " << max << ");" << std::endl;
01830 if (GetRangeZ(min, max))
01831 fs << name << "SetRangeZ(" << min << ", " << max << ");" << std::endl;
01832
01833 TAttLine latt;
01834 TAttFill fatt;
01835 TAttMarker matt;
01836
01837 if (GetLineAtt(&latt,PictureIndex))
01838 fs << name << "SetLineAtt("
01839 << latt.GetLineColor() << ", "
01840 << latt.GetLineStyle() << ", "
01841 << latt.GetLineWidth() << ", " << PictureIndex << ");" << std::endl;
01842 if (GetFillAtt(&fatt, PictureIndex))
01843 fs << name << "SetFillAtt("
01844 << fatt.GetFillColor() << ", "
01845 << fatt.GetFillStyle() << ", " << PictureIndex << ");" << std::endl;
01846 if (GetMarkerAtt(&matt, PictureIndex))
01847 fs << name << "SetMarkerAtt("
01848 << matt.GetMarkerColor() << ", "
01849 << matt.GetMarkerSize() << ", "
01850 << matt.GetMarkerStyle()<< ", " << PictureIndex << ");" << std::endl;
01851
01852 fs << name << "SetHisStats(" << (IsHisStats() ? "true" : "false") << ");" << std::endl;
01853
01854 if (IsHisStats() && (FindOptPos(PictureIndex, op_HisStatsX1) >= 0)) {
01855 fs << name << "SetStatsAttr("
01856 << GetD(PictureIndex, op_HisStatsX1, gStyle->GetStatX()-gStyle->GetStatW()) << ", "
01857 << GetD(PictureIndex, op_HisStatsY1, gStyle->GetStatY()-gStyle->GetStatH()) << ", "
01858 << GetD(PictureIndex, op_HisStatsX2, gStyle->GetStatX()) << ", "
01859 << GetD(PictureIndex, op_HisStatsY2, gStyle->GetStatY()) << ", "
01860 << GetI(PictureIndex, op_HisStatsOpt, 1111) << ", \""
01861 << GetStrOption(PictureIndex, op_HisStatsOptF, "6.4g") << "\", "
01862 << GetI(PictureIndex, op_HisStatsFit, 111) << ", \""
01863 << GetStrOption(PictureIndex, op_HisStatsFitF, "5.4g") << "\");" << std::endl;
01864 }
01865
01866 fs << name << "SetHisTitle(" << (IsHisTitle() ? "true" : "false") << ");" << std::endl;
01867 if (HasTitleAttr()) {
01868 fs << name << "SetTitleAttr("
01869 << GetD(PictureIndex, op_TitleX1, gStyle->GetTitleX()-gStyle->GetTitleW()) << ", "
01870 << GetD(PictureIndex, op_TitleY1, gStyle->GetTitleY()-gStyle->GetTitleH()) << ", "
01871 << GetD(PictureIndex, op_TitleX2, gStyle->GetTitleX()) << ", "
01872 << GetD(PictureIndex, op_TitleY2, gStyle->GetTitleY());
01873
01874 Double_t sz(0.);
01875 if (GetOptionD(PictureIndex, op_TitleTextSz, sz))
01876 fs << ", " << sz;
01877
01878 fs << ");" << std::endl;
01879
01880 fs << name << "SetTitleTime(" << (IsTitleTime() ? "true" : "false") << ");" << std::endl;
01881 fs << name << "SetTitleDate(" << (IsTitleDate() ? "true" : "false") << ");" << std::endl;
01882 fs << name << "SetTitleItem(" << (IsTitleItem() ? "true" : "false") << ");" << std::endl;
01883 }
01884
01885 fs << name << "SetAutoScale(" << (IsAutoScale() ? "true" : "false") << ");" << std::endl;
01886
01887 if (IsSuperimpose()) {
01888 fs << name << "SetSuperimpose(true);" << std::endl;
01889 fs << name << "SetLegendDraw(" << (IsLegendDraw() ? "true" : "false") << ");" << std::endl;
01890 }
01891
01892 Long_t lv;
01893 Double_t dv;
01894 fs << name << "SetPadAtt(";
01895 if (!GetOption (PictureIndex, op_Pad+ 0, lv)) lv = gStyle->GetPadBorderMode();
01896 fs << lv << ", ";
01897 if (!GetOption (PictureIndex, op_Pad+ 1, lv)) lv = gStyle->GetPadBorderSize();
01898 fs << lv << ", ";
01899 if (!GetOption (PictureIndex, op_Pad+ 2, lv)) lv = gStyle->GetPadGridX();
01900 fs << lv << ", ";
01901 if (!GetOption (PictureIndex, op_Pad+ 3, lv)) lv = gStyle->GetPadGridY();
01902 fs << lv << ", ";
01903 if (!GetOptionD(PictureIndex, op_Pad+ 4, dv)) dv = 0.;
01904 fs << dv << ", ";
01905 if (!GetOptionD(PictureIndex, op_Pad+ 5, dv)) dv = 0.;
01906 fs << dv << ", ";
01907 if (!GetOption (PictureIndex, op_Pad+ 6, lv)) lv = gStyle->GetPadTickX();
01908 fs << lv << ", ";
01909 if (!GetOption (PictureIndex, op_Pad+ 7, lv)) lv = gStyle->GetPadTickY();
01910 fs << lv << ");" << std::endl;
01911
01912 const char* drawopt = GetDrawOption(PictureIndex);
01913 if (drawopt!=0)
01914 fs << name << "SetDrawOption(\"" << drawopt << "\", " << PictureIndex << ");" << std::endl;
01915
01916
01917 Bool_t tdisp=kFALSE;
01918 if (GetOption (PictureIndex, op_TimeAxisX, lv) && lv) tdisp=kTRUE;
01919 TString format=GetStrOption(PictureIndex, op_TimeAxisXFmt , "%H:%M:%S");
01920 fs << name << "SetXAxisAttTime(";
01921 fs << tdisp << ", ";
01922 fs << "\"" << format.Data()<< "\"" <<", ";
01923 fs << PictureIndex << ");" << std::endl;
01924
01925
01926 for(Int_t indx=0;indx<GetNumObjNames();indx++) {
01927 const char* objname = GetObjName(indx);
01928 const char* objopt = GetDrawOption(indx);
01929
01930 fs << name << "AddObjName(\"" << objname << "\"";
01931 if (objopt!=0) fs << ", \"" << objopt << "\"";
01932 fs << ");" << std::endl;
01933 if (GetLineAtt(&latt,indx))
01934 fs << name << "SetLineAtt("
01935 << latt.GetLineColor() << ", "
01936 << latt.GetLineStyle() << ", "
01937 << latt.GetLineWidth() << ", " << indx << ");" << std::endl;
01938 if (GetFillAtt(&fatt, indx))
01939 fs << name << "SetFillAtt("
01940 << fatt.GetFillColor() << ", "
01941 << fatt.GetFillStyle() << ", " << indx << ");" << std::endl;
01942 if (GetMarkerAtt(&matt, indx))
01943 fs << name << "SetMarkerAtt("
01944 << matt.GetMarkerColor() << ", "
01945 << matt.GetMarkerSize() << ", "
01946 << matt.GetMarkerStyle() << ", " << indx << ");" << std::endl;
01947
01948 MakeAxisScript(fs, name, indx, 0);
01949 MakeAxisScript(fs, name, indx, 1);
01950 MakeAxisScript(fs, name, indx, 2);
01951
01952 if (GetRebinX(indx)>0)
01953 fs << name << "SetRebinX(" << GetRebinX(indx) << ", " << indx << ");" << std::endl;
01954
01955 if (GetRebinY(indx)>0)
01956 fs << name << "SetRebinY(" << GetRebinY(indx) << ", " << indx << ");" << std::endl;
01957 }
01958
01959 #if ROOT_VERSION_CODE > ROOT_VERSION(5,9,0)
01960 TListIter iter(fxSpecialObjects);
01961 TObject* obj = 0;
01962 while ((obj=iter())!=0) {
01963
01964 TString xmlbuf = TBufferXML::ConvertToXML(obj);
01965
01966 TString buf = xmlbuf;
01967 Int_t len = 0;
01968 do {
01969 len = buf.Length();
01970 buf.ReplaceAll("\n ","\n");
01971 } while (len!=buf.Length());
01972
01973 buf.ReplaceAll("\n"," ");
01974 buf.ReplaceAll("\"","\\\"");
01975
01976 buf.Prepend("\"");
01977 buf.Append("\"");
01978
01979 if (buf.Length()>950) {
01980 fs << "TString sbuf = \"\";" << std::endl;
01981 const char* pos = xmlbuf.Data();
01982 while (*pos!=0) {
01983 const char* lastpos = pos;
01984 while ((*pos !=0) && (*pos!='\n')) pos++;
01985 TString subbuf(lastpos, pos-lastpos);
01986 subbuf.ReplaceAll("\"","\\\"");
01987 fs << "TGo4Picture::Add(sbuf,\"" << subbuf << "\");" << std::endl;
01988 if (*pos==0) break;
01989 pos++;
01990 }
01991 buf = "sbuf";
01992 }
01993
01994 fs << name << "AddSpecialObjectXml(" << buf;
01995
01996 Option_t* opt = iter.GetOption();
01997
01998 if ((opt!=0) && (*opt!=0))
01999 fs << ", \"" << opt << "\"";
02000 fs << ");" << std::endl;
02001 }
02002 #endif
02003
02004 if (IsDivided()) {
02005 fs << name << "SetDivision(" << GetDivY() << ", " << GetDivX() << ");" << std::endl;
02006 for(int ny=0;ny<GetDivY();ny++)
02007 for(int nx=0;nx<GetDivX();nx++) {
02008 TString subname = name;
02009 subname+="Pic(";
02010 subname+=ny;
02011 subname+=",";
02012 subname+=nx;
02013 subname+=")->";
02014 Pic(ny,nx)->MakeScript(fs, subname.Data());
02015 }
02016 }
02017 }
02018
02019