GSI Object Oriented Online Offline (Go4) GO4-6.4.5
Loading...
Searching...
No Matches
TGo4Picture.cxx
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#include "TGo4Picture.h"
15
16#include <iostream>
17
18#include "RConfigure.h"
19#include "TClass.h"
20#include "TObjArray.h"
21#include "TObjString.h"
22#include "TVirtualPad.h"
23#include "TFrame.h"
24#include "TList.h"
25#include "TMath.h"
26#include "TCanvas.h"
27#include "TH1.h"
28#include "TGraph.h"
29#include "THStack.h"
30#include "TStyle.h"
31#include "TText.h"
32#include "TDatime.h"
33#include "TArrayL.h"
34#include "TAttLine.h"
35#include "TAttFill.h"
36#include "TAttMarker.h"
37#include "TPaveStats.h"
38#include "TBufferXML.h"
39
45
49
52
56
60
64
69
70// op_PicHeader = 23,
71
80
83
91 op_AxisX = 41, // 12 parameters
92 op_AxisY = 53, // 12 parameters
93 op_AxisZ = 65, // 12 parameters
94 op_Pad = 77, // 8 parameters
99
105
107
112
115
117 //op_TimeAxisXFmt= 201, // must be larger han op_ObjsBound for SetStrOption?
118 // check reason for this later JAM
119
120 op_XYRatioOne = 300, // JAM2016: 1:1 coordinate ratio
121 op_DefaultRatio = 301, // temporary used to reset ratio to default
122
123 op_ObjsBound = 0x4000,
124
130
131};
132
133
134template<class T>
135T* Cast(TObject *obj)
136{
137 auto cl = TClass::GetClass<T>();
138 if (!obj || !cl) return nullptr;
139 auto shift = obj->IsA()->GetBaseClassOffset(cl);
140 if (shift < 0) return nullptr;
141 return (T *)((char *) obj + shift);
142}
143
144
146{
147}
148
149TGo4Picture::TGo4Picture(const char *name, const char *title, Int_t ndivy, Int_t ndivx) :
150 TNamed(name, title)
151{
152 SetDivision(ndivy, ndivx);
153}
154
156 TNamed()
157{
158 UpdateFrom(&picture);
159}
160
162{
163 if (fxNames) { delete fxNames; fxNames = nullptr; }
164 if (fxObjects) { delete fxObjects; fxObjects = nullptr; }
165 if (fxSubPictures) { delete fxSubPictures; fxSubPictures = nullptr; }
166 if (fxOptObjects) { delete fxOptObjects; fxOptObjects = nullptr; }
167 if (fxSpecialObjects) { delete fxSpecialObjects; fxSpecialObjects = nullptr; }
168}
169
171{
172 SetTitleTime(draw);
173 SetTitleDate(draw);
174}
175
177{
178 return IsTitleTime() && IsTitleDate();
179}
180
181void TGo4Picture::SetDivision(Int_t ndivy, Int_t ndivx)
182{
183 fiNDivX = (ndivx < 1) ? 1 : ndivx;
184 fiNDivY = (ndivy < 1) ? 1 : ndivy;
185}
186
187TGo4Picture *TGo4Picture::FindPic(Int_t posy, Int_t posx)
188{
189 if (!fxSubPictures) return nullptr;
190 if (posx < 0)
191 posx = 0;
192 else if (posx >= GetDivX())
193 posx = GetDivX() - 1;
194
195 if (posy < 0)
196 posy = 0;
197 else if (posy >= GetDivY())
198 posy = GetDivY() - 1;
199
200 for (Int_t n = 0; n <= fxSubPictures->GetLast(); n++) {
201 TGo4Picture *sub = dynamic_cast<TGo4Picture *>(fxSubPictures->At(n));
202 if (sub && sub->CheckPosition(posy,posx))
203 return sub;
204 }
205 return nullptr;
206}
207
208TGo4Picture *TGo4Picture::Pic(Int_t posy, Int_t posx)
209{
210 if (!IsDivided())
211 return this;
212 if (posx < 0)
213 posx = 0;
214 else if (posx >= GetDivX())
215 posx = GetDivX() - 1;
216 if (posy < 0)
217 posy = 0;
218 else if (posy >= GetDivY())
219 posy = GetDivY() - 1;
220 TGo4Picture *sub = FindPic(posy, posx);
221 if (sub)
222 return sub;
223 sub = new TGo4Picture("Sub", "Sub picture");
224 sub->SetPosition(posy, posx);
225 if (!fxSubPictures) {
226 fxSubPictures = new TObjArray();
227 fxSubPictures->SetOwner(kTRUE);
228 }
229 fxSubPictures->Add(sub);
230 return sub;
231}
232
233void TGo4Picture::SetLinesDivision(Int_t numlines, const Int_t *numbers)
234{
235 SetDivision(numlines,1);
236 for (Int_t n = 0; n < numlines; n++)
237 if (numbers[n] > 1)
238 Pic(n,0)->SetDivision(1,numbers[n]);
239}
240
242 Int_t n0, Int_t n1, Int_t n2, Int_t n3, Int_t n4,
243 Int_t n5, Int_t n6, Int_t n7, Int_t n8, Int_t n9)
244{
245 const Int_t numbers[10] = { n0, n1, n2, n3, n4, n5, n6, n7, n8, n9};
246 SetLinesDivision(numlines, numbers);
247}
248
249TGo4Picture *TGo4Picture::LPic(Int_t nline, Int_t ncol)
250{
251 if (!IsDivided()) return this;
252 TGo4Picture *sub = Pic(nline, 0);
253 if (!sub) return nullptr;
254 if (sub->IsDivided()) return sub->Pic(0,ncol);
255 else return sub;
256}
257
258void TGo4Picture::SetPosition(Int_t posy, Int_t posx)
259{
260 fiPosX = posx; fiPosY = posy;
261}
262
263Bool_t TGo4Picture::CheckPosition(Int_t posy, Int_t posx) const
264{
265 return (fiPosX == posx) && (fiPosY == posy);
266}
267
268void TGo4Picture::AddH1(TH1 *histo, Option_t *DrawOption)
269{
270 AddObject(histo, DrawOption);
271}
272
273void TGo4Picture::AddH1(Int_t posy, Int_t posx, TH1 *histo, Option_t *DrawOption)
274{
275 AddObject(posy, posx, histo, DrawOption);
276}
277
278void TGo4Picture::AddHStack(THStack *st, Option_t *DrawOption)
279{
280 AddObject(st, DrawOption);
281}
282
283void TGo4Picture::AddHStack(Int_t posy, Int_t posx, THStack *st, Option_t *DrawOption)
284{
285 AddObject(posy, posx, st, DrawOption);
286}
287
288void TGo4Picture::AddGraph(TGraph *gr, Option_t *DrawOption)
289{
290 AddObject(gr, DrawOption);
291}
292
293void TGo4Picture::AddGraph(Int_t posy, Int_t posx, TGraph *gr, Option_t *DrawOption)
294{
295 AddObject(posy, posx, gr, DrawOption);
296}
297
299{
300 AddObject(cond);
301}
302
303void TGo4Picture::AddCondition(Int_t posy, Int_t posx, TNamed *cond)
304{
305 AddObject(posy, posx, cond);
306}
307
308void TGo4Picture::AddObjName(const char *name, Option_t *DrawOption)
309{
310 if (!name) return;
311 if (!fxNames) {
312 fxNames = new TObjArray();
313 fxNames->SetOwner(kTRUE);
314 }
315 fxNames->Add(new TObjString(name));
316 SetDrawOption(DrawOption, fxNames->GetLast());
317// if (DrawOption && (*DrawOption != 0))
318// SetDrawOption(DrawOption, PictureIndex);
319
320 fiLastIndex = fxNames->GetLast();
321}
322
323void TGo4Picture::AddObjName(Int_t posy, Int_t posx, const char *name, Option_t *DrawOption)
324{
325 if (name)
326 Pic(posy,posx)->AddObjName(name, DrawOption);
327}
328
329void TGo4Picture::ClearObjNames(Bool_t recursive)
330{
331 if (fxNames) {
332 delete fxNames;
333 fxNames = nullptr;
334 }
335 fiLastIndex = 0;
336 if (recursive && fxSubPictures)
337 for (Int_t n = 0; n <= fxSubPictures->GetLast(); n++) {
338 TGo4Picture *sub = dynamic_cast<TGo4Picture *>(fxSubPictures->At(n));
339 if (sub)
340 sub->ClearObjNames(recursive);
341 }
342}
343
345{
346 return !fxNames ? 0 : fxNames->GetLast()+1;
347}
348
350{
351 if (GetNumObjNames() > 0)
352 return kTRUE;
353
354 if (fxSubPictures)
355 for (Int_t n = 0; n <= fxSubPictures->GetLast(); n++) {
356 TGo4Picture *sub = dynamic_cast<TGo4Picture *>(fxSubPictures->At(n));
357 if (sub && sub->IsObjNames())
358 return kTRUE;
359 }
360 return kFALSE;
361}
362
363const char *TGo4Picture::GetObjName(Int_t n) const
364{
365 if (!fxNames || (n < 0) || (n > fxNames->GetLast())) return nullptr;
366 TObjString* str = dynamic_cast<TObjString*> (fxNames->At(n));
367 return str ? str->String().Data() : nullptr;
368}
369
370void TGo4Picture::AddObject(TObject *obj, Option_t *DrawOption)
371{
372 if (obj)
373 AddObjName(obj->GetName(), DrawOption);
374}
375
376void TGo4Picture::AddObject(Int_t posy, Int_t posx, TObject *obj, Option_t *DrawOption)
377{
378 if (obj)
379 AddObjName(posy, posx, obj->GetName(), DrawOption);
380}
381
382void TGo4Picture::SetRangeX(Double_t min, Double_t max)
383{
386}
387
388Bool_t TGo4Picture::GetRangeX(Double_t& min, Double_t& max) const
389{
390 min = 0.; max = 0;
391 return GetOptionD(PictureIndex, op_RangeXMin, min) &&
393}
394
400
401void TGo4Picture::SetRangeY(Double_t min, Double_t max)
402{
405}
406
407Bool_t TGo4Picture::GetRangeY(Double_t& min, Double_t& max) const
408{
409 min = 0.; max = 0;
410 return GetOptionD(PictureIndex, op_RangeYMin, min) &&
412}
413
419
420void TGo4Picture::SetRangeZ(Double_t min, Double_t max)
421{
424}
425
426Bool_t TGo4Picture::GetRangeZ(Double_t& min, Double_t& max) const
427{
428 min = 0.; max = 0;
429 return GetOptionD(PictureIndex, op_RangeZMin, min) &&
431}
432
438
439void TGo4Picture::SetRange(Int_t naxis, Double_t min, Double_t max)
440{
441 switch (naxis) {
442 case 0: SetRangeX(min, max); break;
443 case 1: SetRangeY(min, max); break;
444 case 2: SetRangeZ(min, max); break;
445 }
446}
447
448Bool_t TGo4Picture::GetRange(Int_t naxis, Double_t& min, Double_t& max) const
449{
450 switch (naxis) {
451 case 0: return GetRangeX(min, max);
452 case 1: return GetRangeY(min, max);
453 case 2: return GetRangeZ(min, max);
454 }
455 return kFALSE;
456}
457
458void TGo4Picture::ClearRange(Int_t naxis)
459{
460 switch (naxis) {
461 case 0: ClearRangeX(); break;
462 case 1: ClearRangeY(); break;
463 case 2: ClearRangeZ(); break;
464 default:
465 ClearRangeX();
466 ClearRangeY();
467 ClearRangeZ();
468 break;
469 }
470}
471
472void TGo4Picture::SetLogScale(Int_t nscale, Int_t zn)
473{
474 Int_t typ;
475 switch (nscale) {
476 case 1: typ = op_LogScaleY; break;
477 case 2: typ = op_LogScaleZ; break;
478 default: typ = op_LogScaleX;
479 }
480 SetOption(PictureIndex, typ, zn);
481}
482
483Int_t TGo4Picture::GetLogScale(Int_t nscale) const
484{
485 Int_t typ;
486 switch (nscale) {
487 case 1: typ = op_LogScaleY; break;
488 case 2: typ = op_LogScaleZ; break;
489 default: typ = op_LogScaleX;
490 }
491 Long_t zn;
492 if (GetOption(PictureIndex, typ, zn))
493 return zn;
494 return 0;
495}
496
497void TGo4Picture::GetLogScales(TVirtualPad *pad)
498{
499 if (!pad) return;
500 Long_t zn;
501 if (GetOption(PictureIndex, op_LogScaleX, zn)) pad->SetLogx(zn);
502 if (GetOption(PictureIndex, op_LogScaleY, zn)) pad->SetLogy(zn);
503 if (GetOption(PictureIndex, op_LogScaleZ, zn)) pad->SetLogz(zn);
504}
505
512
513void TGo4Picture::SetLineAtt(Color_t color, Style_t style, Width_t width, Int_t index)
514{
515 CheckIndex(index);
516 SetOption(index, op_LineColor, color);
517 SetOption(index, op_LineStyle, style);
518 SetOption(index, op_LineWidth, width);
519}
520
521void TGo4Picture::SetLineAtt(TAttLine* line, Int_t index)
522{
523 if (!line) return;
524 CheckIndex(index);
525 SetOption(index, op_LineColor, line->GetLineColor());
526 SetOption(index, op_LineStyle, line->GetLineStyle());
527 SetOption(index, op_LineWidth, line->GetLineWidth());
528}
529
530Bool_t TGo4Picture::GetLineAtt(TAttLine* line, Int_t index) const
531{
532 if (!line) return kFALSE;
533 CheckIndex(index);
534 Long_t color = -111, style = -111, width = -111;
535 if (GetOption(index, op_LineColor, color)) line->SetLineColor(color);
536 if (GetOption(index, op_LineStyle, style)) line->SetLineStyle(style);
537 if (GetOption(index, op_LineWidth, width)) line->SetLineWidth(width);
538 return (color!=-111) && (style!=-111) && (width!=-111);
539}
540
542{
543 CheckIndex(index);
547}
548
549void TGo4Picture::SetFillAtt(Color_t color, Style_t style, Int_t index)
550{
551 CheckIndex(index);
552 SetOption(index, op_FillColor, color);
553 SetOption(index, op_FillStyle, style);
554}
555
556void TGo4Picture::SetFillAtt(TAttFill* fill, Int_t index)
557{
558 if (!fill) return;
559 CheckIndex(index);
560 SetOption(index, op_FillColor, fill->GetFillColor());
561 SetOption(index, op_FillStyle, fill->GetFillStyle());
562}
563
564Bool_t TGo4Picture::GetFillAtt(TAttFill* fill, Int_t index) const
565{
566 if (!fill) return kFALSE;
567 CheckIndex(index);
568 Long_t color = -111, style = -111;
569 if (GetOption(index, op_FillColor, color)) fill->SetFillColor(color);
570 if (GetOption(index, op_FillStyle, style)) fill->SetFillStyle(style);
571 return (color != -111) && (style != -111);
572}
573
575{
576 CheckIndex(index);
579}
580
581void TGo4Picture::SetMarkerAtt(Color_t color, Size_t size, Style_t style, Int_t index)
582{
583 CheckIndex(index);
584 SetOption(index, op_MarkerColor, color);
585 SetOption(index, op_MarkerSize, int(size));
586 SetOption(index, op_MarkerStyle, style);
587}
588
589void TGo4Picture::SetMarkerAtt(TAttMarker* marker, Int_t index)
590{
591 if (!marker) return;
592 CheckIndex(index);
593 SetOption(index, op_MarkerColor, marker->GetMarkerColor());
594 SetOption(index, op_MarkerSize, int(marker->GetMarkerSize()));
595 SetOption(index, op_MarkerStyle, marker->GetMarkerStyle());
596}
597
598Bool_t TGo4Picture::GetMarkerAtt(TAttMarker* marker, Int_t index) const
599{
600 if (!marker) return kFALSE;
601 CheckIndex(index);
602 Long_t color = -111, size = -111, style = -111;
603 if (GetOption(index, op_MarkerColor, color)) marker->SetMarkerColor(color);
604 if (GetOption(index, op_MarkerSize, size)) marker->SetMarkerSize(size);
605 if (GetOption(index, op_MarkerStyle, style)) marker->SetMarkerStyle(style);
606 return (color != -111) && (size != -111) && (style != -111);
607}
608
610{
611 CheckIndex(index);
615}
616
617void TGo4Picture::SetRebinX(Int_t ngroupx, Int_t index)
618{
619 CheckIndex(index);
620 if (ngroupx>0) SetOption(index, op_RebinX, ngroupx);
621 else ClearOption(index, op_RebinX);
622}
623
624void TGo4Picture::SetRebinY(Int_t ngroupy, Int_t index)
625{
626 CheckIndex(index);
627 if (ngroupy>0) SetOption(index, op_RebinY, ngroupy);
628 else ClearOption(index, op_RebinY);
629}
630
631Int_t TGo4Picture::GetRebinX(Int_t index) const
632{
633 CheckIndex(index);
634 Long_t ngroupx = 0;
635 if (!GetOption(index, op_RebinX, ngroupx)) ngroupx = 0;
636 return ngroupx;
637}
638
639Int_t TGo4Picture::GetRebinY(Int_t index) const
640{
641 CheckIndex(index);
642 Long_t ngroupy = 0;
643 if (!GetOption(index, op_RebinY, ngroupy)) ngroupy = 0;
644 return ngroupy;
645}
646
647void TGo4Picture::ClearRebin(Int_t index)
648{
649 CheckIndex(index);
650 ClearOption(index, op_RebinX);
651 ClearOption(index, op_RebinY);
652}
653
654void TGo4Picture::GetDrawAttributes(TObject *obj, Int_t index) const
655{
656 if (!obj) return;
657 CheckIndex(index);
658 GetLineAtt(Cast<TAttLine>(obj), index);
659 GetFillAtt(Cast<TAttFill>(obj), index);
660 GetMarkerAtt(Cast<TAttMarker>(obj), index);
661 GetH1Att(Cast<TH1>(obj), index);
662 GetPadAtt(Cast<TPad>(obj), index);
663}
664
665void TGo4Picture::SetDrawAttributes(TObject *obj, Int_t index)
666{
667 if (!obj) return;
668 CheckIndex(index);
669 SetLineAtt(Cast<TAttLine>(obj), index);
670 SetFillAtt(Cast<TAttFill>(obj), index);
671 SetMarkerAtt(Cast<TAttMarker>(obj), index);
672 SetH1Att(Cast<TH1>(obj), index);
673 SetPadAtt(Cast<TPad>(obj), index);
674}
675
676void TGo4Picture::SetH1Att(TH1 *h1, Int_t index)
677{
678 if (!h1) return;
679 CheckIndex(index);
680 SetAxisAtt(0, h1->GetXaxis(), index);
681 SetAxisAtt(1, h1->GetYaxis(), index);
682 SetAxisAtt(2, h1->GetZaxis(), index);
683}
684
685void TGo4Picture::GetH1Att(TH1 *h1, Int_t index) const
686{
687 if (!h1) return;
688 CheckIndex(index);
689 GetAxisAtt(0, h1->GetXaxis(), index);
690 GetAxisAtt(1, h1->GetYaxis(), index);
691 GetAxisAtt(2, h1->GetZaxis(), index);
692}
693
694void TGo4Picture::SetAxisLabelFontSize(Int_t naxis, Float_t LabelSize, Int_t index)
695{
696 if ((naxis<0) || (naxis>2)) return;
697 CheckIndex(index);
698 Int_t op = op_AxisX;
699 if (naxis==1) op = op_AxisY; else
700 if (naxis==2) op = op_AxisZ;
701
702 SetOptionF(index, op+4, LabelSize);
703
704}
705
706void TGo4Picture::SetAxisTitleFontSize(Int_t naxis, Float_t TitleSize, Int_t index)
707{
708 if ((naxis<0) || (naxis>2)) return;
709 CheckIndex(index);
710 Int_t op = op_AxisX;
711 if (naxis==1) op = op_AxisY; else
712 if (naxis==2) op = op_AxisZ;
713
714 SetOptionF(index, op+10, TitleSize);
715}
716
717void TGo4Picture::SetXAxisAttTime(Bool_t timedisplay, const char *format, Int_t index)
718{
719 CheckIndex(index);
720 SetOption (index, op_TimeAxisX, timedisplay);
721 SetStrOption(index, op_TimeAxisXFmt, format);
722}
723
728
729void TGo4Picture::SetXAxisTimeFormat(const char *format)
730{
732}
733
735{
736 Long_t value = 0;
738 return value;
739}
740
742{
743 return GetStrOption(PictureIndex, op_TimeAxisXFmt, "%H:%M:%S");
744}
745
750
752{
753 Long_t value = 0;
755 return value;
756}
757
758//void TGo4Picture::SetDefaultRatio(Bool_t on)
759//{
760// SetOption (PictureIndex, op_DefaultRatio, on);
761//}
762//
763//Bool_t TGo4Picture::CheckDefaultRatio()
764//{
765// Long_t value = 0;
766// GetOption(PictureIndex, op_DefaultRatio, value);
767// return value;
768//}
769
770
771void TGo4Picture::SetAxisAtt(Int_t naxis,
772 Color_t AxisColor,
773 Color_t LabelColor,
774 Style_t LabelFont,
775 Float_t LabelOffset,
776 Float_t LabelSize,
777 Int_t Ndivisions,
778 Float_t TickLength,
779 Color_t TitleColor,
780 Style_t TitleFont,
781 Float_t TitleOffset,
782 Float_t TitleSize,
783 Bool_t decimals,
784 const char *ticks,
785 Int_t bits,
786 Int_t index)
787{
788 if ((naxis<0) || (naxis>2)) return;
789 CheckIndex(index);
790 Int_t op = op_AxisX;
791 if (naxis==1) op = op_AxisY; else
792 if (naxis==2) op = op_AxisZ;
793
794 SetOption (index, op+0, AxisColor);
795 SetOption (index, op+1, LabelColor);
796 SetOption (index, op+2, LabelFont);
797 SetOptionF(index, op+3, LabelOffset);
798 SetOptionF(index, op+4, LabelSize);
799 SetOption (index, op+5, Ndivisions);
800 SetOptionF(index, op+6, TickLength);
801 SetOption (index, op+7, TitleColor);
802 SetOption (index, op+8, TitleFont);
803 SetOptionF(index, op+9, TitleOffset);
804 SetOptionF(index, op+10, TitleSize);
805 // copy all user defined bits
806 if (decimals) bits = bits | 1;
807 if (ticks) {
808 if (strchr(ticks,'+')) bits = bits | 2;
809 if (strchr(ticks,'-')) bits = bits | 4;
810 }
811 SetOption (index, op+11, bits);
812}
813
814void TGo4Picture::SetAxisAtt(Int_t naxis, TAxis *axis, Int_t index)
815{
816 if (axis)
817 SetAxisAtt(naxis,
818 axis->GetAxisColor(),
819 axis->GetLabelColor(),
820 axis->GetLabelFont(),
821 axis->GetLabelOffset(),
822 axis->GetLabelSize(),
823 axis->GetNdivisions(),
824 axis->GetTickLength(),
825 axis->GetTitleColor(),
826 axis->GetTitleFont(),
827 axis->GetTitleOffset(),
828 axis->GetTitleSize(),
829 axis->GetDecimals(),
830 axis->GetTicks(),
831 axis->TestBits(0x0ff0),
832 index);
833 if(naxis == 0) {
834 // support time format only for x axis for the moment
835 SetXAxisAttTime(axis->GetTimeDisplay(), axis->GetTimeFormat(), index);
836 }
837}
838
839void TGo4Picture::GetAxisAtt(Int_t naxis, TAxis *axis, Int_t index) const
840{
841 if (!axis || (naxis<0) || (naxis>2)) return;
842 CheckIndex(index);
843 Int_t op = op_AxisX;
844 if (naxis==1) op = op_AxisY; else
845 if (naxis==2) op = op_AxisZ;
846
847 Long_t lv;
848 Float_t fv;
849 if (GetOption (index, op+0, lv)) axis->SetAxisColor(lv);
850 if (GetOption (index, op+1, lv)) axis->SetLabelColor(lv);
851 if (GetOption (index, op+2, lv)) axis->SetLabelFont(lv);
852 if (GetOptionF(index, op+3, fv)) axis->SetLabelOffset(fv);
853 if (GetOptionF(index, op+4, fv)) axis->SetLabelSize(fv);
854 if (GetOption (index, op+5, lv)) axis->SetNdivisions(lv);
855 if (GetOptionF(index, op+6, fv)) axis->SetTickLength(fv);
856 if (GetOption (index, op+7, lv)) axis->SetTitleColor(lv);
857 if (GetOption (index, op+8, lv)) axis->SetTitleFont(lv);
858 if (GetOptionF(index, op+9, fv)) axis->SetTitleOffset(fv);
859 if (GetOptionF(index, op+10, fv)) axis->SetTitleSize(fv);
860 if (GetOption (index, op+11, lv)) {
861 axis->SetDecimals((lv & 1) != 0);
862 TString ticks;
863 if ((lv & 2) != 0) ticks+="+";
864 if ((lv & 4) != 0) ticks+="-";
865 axis->SetTicks(ticks.Data());
866 for(int n=9;n<24;n++) {
867 if (n==13) continue;
868 Int_t mask = BIT(n);
869 axis->SetBit(mask, (lv & mask) != 0);
870 }
871 }
872
873 if(naxis == 0) {
874 // time format x axis
875 if (GetOption (index, op_TimeAxisX, lv)) axis->SetTimeDisplay(lv);
876 axis->SetTimeFormat(GetStrOption(index, op_TimeAxisXFmt, "%H:%M:%S"));
877 }
878
879}
880
881void TGo4Picture::SetPadAtt(Int_t BorderMode,
882 Int_t BorderSize,
883 Int_t Gridx,
884 Int_t Gridy,
885 Double_t Phi,
886 Double_t Theta,
887 Int_t Tickx,
888 Int_t Ticky,
889 Int_t index)
890{
891 CheckIndex(index);
892 SetOption (index, op_Pad+ 0, BorderMode);
893 SetOption (index, op_Pad+ 1, BorderSize);
894 SetOption (index, op_Pad+ 2, Gridx);
895 SetOption (index, op_Pad+ 3, Gridy);
896 SetOptionD(index, op_Pad+ 4, Phi);
897 SetOptionD(index, op_Pad+ 5, Theta);
898 SetOption (index, op_Pad+ 6, Tickx);
899 SetOption (index, op_Pad+ 7, Ticky);
900}
901
902void TGo4Picture::SetPadAtt(TPad *pad, Int_t index)
903{
904 if (!pad) return;
905 CheckIndex(index);
906 SetPadAtt(pad->GetBorderMode(),
907 pad->GetBorderSize(),
908 pad->GetGridx(),
909 pad->GetGridy(),
910 pad->GetPhi(),
911 pad->GetTheta(),
912 pad->GetTickx(),
913 pad->GetTicky(),
914 index);
915 SetDrawAttributes(pad->GetFrame(), index);
916}
917
918void TGo4Picture::GetPadAtt(TPad *pad, Int_t index) const
919{
920 if (!pad) return;
921 CheckIndex(index);
922
923 Long_t lv;
924 Double_t dv;
925 if (GetOption (index, op_Pad+ 0, lv)) pad->SetBorderMode(lv);
926 if (GetOption (index, op_Pad+ 1, lv)) pad->SetBorderSize(lv);
927 if (GetOption (index, op_Pad+ 2, lv)) pad->SetGridx(lv);
928 if (GetOption (index, op_Pad+ 3, lv)) pad->SetGridy(lv);
929 if (GetOptionD(index, op_Pad+ 4, dv)) pad->SetPhi(dv);
930 if (GetOptionD(index, op_Pad+ 5, dv)) pad->SetTheta(dv);
931 if (GetOption (index, op_Pad+ 6, lv)) pad->SetTickx(lv);
932 if (GetOption (index, op_Pad+ 7, lv)) pad->SetTicky(lv);
933 GetDrawAttributes(pad->GetFrame(), index);
934}
935
936void TGo4Picture::SetFrameAttr(Double_t left, Double_t top, Double_t right, Double_t bottom)
937{
942}
943
945{
946 if (!pad) return;
947
948 if ((TMath::Abs( pad->GetLeftMargin() - gStyle->GetPadLeftMargin()) > 0.001) ||
949 (TMath::Abs( pad->GetTopMargin() - gStyle->GetPadTopMargin()) > 0.001) ||
950 (TMath::Abs( pad->GetRightMargin() - gStyle->GetPadRightMargin()) > 0.001) ||
951 (TMath::Abs( pad->GetBottomMargin() - gStyle->GetPadBottomMargin()) > 0.001))
952 SetFrameAttr(pad->GetLeftMargin(), pad->GetTopMargin(), pad->GetRightMargin(), pad->GetBottomMargin());
953}
954
955Bool_t TGo4Picture::GetFrameAttr(TPad *pad) const
956{
957 if (!pad) return kFALSE;
958
959 Double_t v;
960 if (GetOptionD(PictureIndex, op_FrameLeft, v)) pad->SetLeftMargin(v);
961 if (GetOptionD(PictureIndex, op_FrameTop, v)) pad->SetTopMargin(v);
962 if (GetOptionD(PictureIndex, op_FrameRight, v)) pad->SetRightMargin(v);
963 if (GetOptionD(PictureIndex, op_FrameBottom, v)) pad->SetBottomMargin(v);
964 return kTRUE;
965}
966
968{
969 SetOption(PictureIndex, op_HisStats, on ? 1 : 0);
970}
971
973{
974 Long_t zn = kTRUE;
976 return zn != 0;
977}
978
979void TGo4Picture::SetStatsAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2,
980 Int_t optstat, const char *statformat,
981 Int_t optfit, const char *fitformat)
982{
987
992}
993
994void TGo4Picture::SetStatsAttr(TPaveStats* stats)
995{
996 if (stats)
997 SetStatsAttr(stats->GetX1NDC(), stats->GetY1NDC(),
998 stats->GetX2NDC(), stats->GetY2NDC(),
999 stats->GetOptStat(), stats->GetStatFormat(),
1000 stats->GetOptFit(), stats->GetFitFormat());
1001}
1002
1003Bool_t TGo4Picture::GetStatsAttr(TPaveStats* stats) const
1004{
1005 if (!stats) return kFALSE;
1006
1007 Double_t x1, y1, x2, y2;
1012 stats->SetX1NDC(x1);
1013 stats->SetY1NDC(y1);
1014 stats->SetX2NDC(x2);
1015 stats->SetY2NDC(y2);
1016 stats->ConvertNDCtoPad();
1017 }
1018
1019 Long_t optstat, optfit;
1020 if (GetOption(PictureIndex, op_HisStatsOpt, optstat))
1021 stats->SetOptStat(optstat);
1022
1024 stats->SetOptFit(optfit);
1025
1026 const char *fmtstat = GetStrOption(PictureIndex, op_HisStatsOptF);
1027 if (fmtstat) stats->SetStatFormat(fmtstat);
1028
1029 const char *fmtfit = GetStrOption(PictureIndex, op_HisStatsFitF);
1030 if (fmtfit) stats->SetFitFormat(fmtfit);
1031
1032 return kTRUE;
1033}
1034
1036{
1038}
1039
1041{
1042 Long_t nlvl = 0;
1044 return nlvl;
1045}
1046
1048{
1049 SetOption(PictureIndex, op_HisTitle, on ? 1 : 0);
1050}
1051
1053{
1054 Long_t zn = 1;
1056 return zn != 0;
1057}
1058
1059void TGo4Picture::SetTitleAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t textsize)
1060{
1065
1066 if (textsize != 0.)
1068}
1069
1070void TGo4Picture::SetTitleAttr(TPaveText* titl)
1071{
1072 if (titl)
1073 SetTitleAttr(titl->GetX1NDC(), titl->GetY1NDC(),
1074 titl->GetX2NDC(), titl->GetY2NDC(),
1075 titl->GetTextSize());
1076}
1077
1079{
1080 return (FindOptPos(PictureIndex, op_TitleX1) >= 0) &&
1084}
1085
1086Bool_t TGo4Picture::GetTitleAttr(TPaveText* titl) const
1087{
1088 if (!titl) return kFALSE;
1089
1090 Double_t x1, y1, x2, y2, sz = 0.;
1095 titl->SetX1NDC(x1);
1096 titl->SetY1NDC(y1);
1097 titl->SetX2NDC(x2);
1098 titl->SetY2NDC(y2);
1099 titl->ConvertNDCtoPad();
1100 }
1101
1103 titl->SetTextSize(sz);
1104 else
1105 titl->SetTextSize(0);
1106
1107 return kTRUE;
1108}
1109
1111{
1112 SetOption(PictureIndex, op_TitleTime, on ? 1 : 0);
1113}
1114
1116{
1117 Long_t zn = kTRUE;
1119 return zn != 0;
1120}
1121
1123{
1124 SetOption(PictureIndex, op_TitleDate, on ? 1 : 0);
1125}
1126
1128{
1129 Long_t zn = 0;
1131 return zn != 0;
1132}
1133
1135{
1136 SetOption(PictureIndex, op_TitleItem, on ? 1 : 0);
1137}
1138
1140{
1141 Long_t zn = 0;
1143 return zn != 0;
1144}
1145
1147{
1148 SetOption(PictureIndex, op_LegendDraw, on ? 1 : 0);
1149}
1150
1152{
1153 Long_t zn = kTRUE;
1155 return zn != 0;
1156}
1157
1159{
1160 SetOption(PictureIndex, op_Crosshair, on ? 1 : 0);
1161}
1162
1164{
1165 Long_t zn = 0;
1167 return zn != 0;
1168}
1169
1171{
1172 SetOption(PictureIndex, op_AutoScale, on ? 1 : 0);
1173}
1174
1176{
1177 Long_t zn = kTRUE;
1179 return zn != 0;
1180}
1181
1183{
1185}
1186
1188{
1189 Long_t zn = 0;
1191 return zn != 0;
1192}
1193
1195{
1196 SetOption(PictureIndex, op_ApplyToAll, on ? 1 : 0);
1197}
1198
1200{
1201 Long_t zn = 0;
1203 return zn != 0;
1204}
1205
1207{
1208 SetOption(PictureIndex, op_AutoZoom, on ? 1 : 0);
1209}
1210
1212{
1213 Long_t zn = 0;
1215 return zn != 0;
1216}
1217
1219{
1221}
1222
1224{
1225 Long_t zn = 0;
1227 return zn != 0;
1228}
1229
1231{
1233}
1234
1236{
1237 Long_t zn = 0;
1239 return zn != 0;
1240}
1241
1242void TGo4Picture::ChangeDrawOption(Int_t kind, Int_t value)
1243{
1244 switch(kind) {
1245 case 0: break;
1246 case 1: break;
1247 case 2: break;
1248 case 3: SetLogScale(0, value); break;
1249 case 4: SetLogScale(1, value); break;
1250 case 5: SetLogScale(2, value); break;
1251 case 6: SetHisStats(value != 0); break;
1252 case 7: SetHisTitle(value != 0); break;
1253 case 8: SetLegendDraw(value != 0); break;
1254 case 9: SetCrosshair(value != 0); break;
1255 case 10: {
1256 Int_t numdim = GetFullRangeDim();
1257 SetAutoScale(value != 0);
1258 Double_t min, max;
1259 if (!IsAutoScale()) { // keep current selection if not autoscale
1260 if ((numdim==1) && !GetRange(1, min, max)) {
1261 GetFullRange(1, min, max);
1262 SetRange(1, min, max);
1263 } else
1264 if ((numdim==2) && !GetRange(1, min, max)) {
1265 GetFullRange(2, min, max);
1266 SetRange(2, min, max);
1267 }
1268 }
1269 break;
1270 }
1271 case 11: SetSuperimpose(value != 0); break;
1272 case 12: SetTitleTime(value != 0); break;
1273 case 13: SetTitleDate(value != 0); break;
1274 case 14: SetTitleItem(value != 0); break;
1275 case 15: SetXAxisTimeDisplay(value != 0); break;
1276 case 17:
1277 SetXYRatioOne(value != 0);
1278 //if (value == 0) SetDefaultRatio(true); //
1279 break;
1280 case 18: SetHisContour(value); break;
1281
1282 }
1284}
1285
1287{
1289}
1290
1292{
1293 Long_t zn = 0;
1295 return zn;
1296}
1297
1298void TGo4Picture::SetFullRange(Int_t naxis, Double_t min, Double_t max)
1299{
1300 Int_t op;
1301 switch (naxis) {
1302 case 1: op = op_FullYMin; break;
1303 case 2: op = op_FullZMin; break;
1304 default: op = op_FullXMin; break;
1305 }
1306 SetOptionD(PictureIndex, op, min);
1307 SetOptionD(PictureIndex, op+1, max);
1308}
1309
1310Bool_t TGo4Picture::GetFullRange(Int_t naxis, Double_t& min, Double_t& max) const
1311{
1312 Int_t op;
1313 switch (naxis) {
1314 case 1: op = op_FullYMin; break;
1315 case 2: op = op_FullZMin; break;
1316 default: op = op_FullXMin; break;
1317 }
1318 return GetOptionD(PictureIndex, op, min) && GetOptionD(PictureIndex, op+1, max);
1319}
1320
1322{
1323 if (naxis < 0) {
1324 for (int n = 0; n < 3; n++)
1325 ClearFullRange(n);
1327 }
1328 Int_t op;
1329 switch (naxis) {
1330 case 1: op = op_FullYMin; break;
1331 case 2: op = op_FullZMin; break;
1332 default: op = op_FullXMin; break;
1333 }
1336}
1337
1338void TGo4Picture::UpdateFrom(TGo4Picture *source, TClass *selectedobjclass)
1339{
1340 if (!source) return;
1341 Clear();
1342
1343 SetName(source->GetName());
1344 SetTitle(source->GetTitle());
1345
1346 fiNDivX = source->fiNDivX;
1347 fiNDivY = source->fiNDivY;
1348 fiPosX = source->fiPosX;
1349 fiPosY = source->fiPosY;
1350
1351 for (Int_t n = 0; n < source->GetNumObjNames(); n++)
1352 AddObjName(source->GetObjName(n));
1353
1354 if (source->GetSpecialObjects())
1355 fxSpecialObjects = (TList *) source->GetSpecialObjects()->Clone();
1356
1357 CopyOptionsFrom(source);
1358
1359 if (source->fxSubPictures) {
1360 fxSubPictures = new TObjArray();
1361 fxSubPictures->SetOwner(kTRUE);
1362 for (Int_t n = 0; n <= source->fxSubPictures->GetLast(); n++) {
1363 TGo4Picture *sub =
1364 dynamic_cast<TGo4Picture *>(source->fxSubPictures->At(n));
1365 if (sub) {
1366 TGo4Picture *newsub = new TGo4Picture;
1367 newsub->UpdateFrom(sub, selectedobjclass);
1368 fxSubPictures->Add(newsub);
1369 }
1370 }
1371 }
1372}
1373
1375{
1376 fiOptSize = source->fiOptSize;
1377 source->fxOptIndex.Copy(fxOptIndex);
1378 source->fxOptValue.Copy(fxOptValue);
1379 if (fxOptObjects) delete fxOptObjects;
1380 fxOptObjects = nullptr;
1381 if (source->fxOptObjects)
1382 fxOptObjects = (TObjArray *) source->fxOptObjects->Clone();
1383}
1384
1385
1386void TGo4Picture::Clear(Option_t *)
1387{
1388 fiNDivX = 1;
1389 fiNDivY = 1;
1390 fiPosX = 0;
1391 fiPosY = 0;
1392 if (fxNames) { delete fxNames; fxNames = nullptr; }
1393 if (fxSubPictures) { delete fxSubPictures; fxSubPictures = nullptr; }
1394 fiLastIndex = 0;
1395 fiOptSize = 0;
1396 fxOptIndex.Set(0);
1397 fxOptValue.Set(0);
1398 if (fxOptObjects) { delete fxOptObjects; fxOptObjects = nullptr; }
1399}
1400
1401Int_t TGo4Picture::FindOptPos(Short_t index, Short_t typ) const
1402{
1403 Long_t zn = index + 1 + (typ << 16);
1404 for (Int_t i = 0; i < fiOptSize; i++)
1405 if (fxOptIndex[i] == zn)
1406 return i;
1407 return -1;
1408}
1409
1410Int_t TGo4Picture::ExtendOptPos(Short_t index, Short_t typ)
1411{
1412 Long_t zn = index + 1 + (typ << 16);
1413 if (fxOptIndex.GetSize()==fiOptSize) {
1414 fxOptIndex.Set(fiOptSize+8);
1415 fxOptValue.Set(fiOptSize+8);
1416 }
1417 fxOptIndex[fiOptSize] = zn;
1418 fiOptSize++;
1419 return fiOptSize-1;
1420}
1421
1422void TGo4Picture::SetOption(Short_t index, Short_t typ, Long_t value)
1423{
1424 if (typ>=op_ObjsBound) return;
1425 Int_t pos = FindOptPos(index,typ);
1426 if (pos < 0) pos = ExtendOptPos(index, typ);
1427 fxOptValue[pos] = value;
1428}
1429
1430Bool_t TGo4Picture::GetOption(Short_t index, Short_t typ, Long_t& value) const
1431{
1432 if (typ>=op_ObjsBound) return kFALSE;
1433 Int_t pos = FindOptPos(index, typ);
1434 if (pos < 0) return kFALSE;
1435 value = fxOptValue[pos];
1436 return kTRUE;
1437}
1438
1439Long_t TGo4Picture::GetI(Short_t index, Short_t typ, Long_t def) const
1440{
1441 Long_t value = 0;
1442 if (!GetOption(index, typ, value)) return def;
1443 return value;
1444}
1445
1446void TGo4Picture::SetOptionF(Short_t index, Short_t typ, Float_t value)
1447{
1448 Long_t buf;
1449
1450#ifdef R__B64
1451 Double_t v = value;
1452 memcpy(&buf, &v, sizeof(Long_t));
1453#else
1454 memcpy(&buf, &value, sizeof(Long_t));
1455#endif
1456 SetOption(index, typ, buf);
1457}
1458
1459Bool_t TGo4Picture::GetOptionF(Short_t index, Short_t typ, Float_t& value) const
1460{
1461 Long_t buf;
1462 Bool_t res = GetOption(index, typ, buf);
1463
1464 if (res) {
1465#ifdef R__B64
1466 Double_t v;
1467 memcpy(&v, &buf, sizeof(Long_t));
1468 value = v;
1469#else
1470 memcpy(&value, &buf, sizeof(Long_t));
1471#endif
1472 }
1473 return res;
1474}
1475
1476void TGo4Picture::SetOptionD(Short_t index, Short_t typ, Double_t value)
1477{
1478 Long_t buf;
1479#ifdef R__B64
1480 memcpy(&buf, &value, sizeof(Long_t));
1481#else
1482 Float_t v(value);
1483 memcpy(&buf, &v, sizeof(Long_t));
1484#endif
1485 SetOption(index, typ, buf);
1486}
1487
1488Bool_t TGo4Picture::GetOptionD(Short_t index, Short_t typ, Double_t& value) const
1489{
1490 Long_t buf;
1491 Bool_t res = GetOption(index, typ, buf);
1492
1493 if (res) {
1494#ifdef R__B64
1495 memcpy(&value, &buf, sizeof(Long_t));
1496#else
1497 Float_t v;
1498 memcpy(&v, &buf, sizeof(Long_t));
1499 value = v;
1500#endif
1501 }
1502 return res;
1503}
1504
1505Double_t TGo4Picture::GetD(Short_t index, Short_t typ, Double_t def) const
1506{
1507 Double_t value;
1508 if (!GetOptionD(index, typ, value)) return def;
1509 return value;
1510}
1511
1512void TGo4Picture::SetObjOption(Short_t index, Short_t typ, TObject *obj)
1513{
1514 if (!obj) return;
1515 if (typ<op_ObjsBound) { delete obj; return; }
1516 Int_t pos = FindOptPos(index, typ);
1517 if (pos >= 0) {
1518 TObject *old = fxOptObjects->RemoveAt(fxOptValue[pos]);
1519 delete old;
1520 fxOptObjects->AddAt(obj, fxOptValue[pos]);
1521 } else {
1522 pos = ExtendOptPos(index, typ);
1523 if (!fxOptObjects) {
1524 fxOptObjects = new TObjArray();
1525 fxOptObjects->SetOwner(kTRUE);
1526 }
1527 fxOptObjects->Add(obj);
1528 fxOptValue[pos] = fxOptObjects->GetLast();
1529 }
1530}
1531
1532TObject *TGo4Picture::GetObjOption(Short_t index, Short_t typ) const
1533{
1534 if (typ < op_ObjsBound) return nullptr;
1535 Int_t pos = FindOptPos(index, typ);
1536 if (pos < 0) return nullptr;
1537 return fxOptObjects->At(fxOptValue[pos]);
1538}
1539
1540void TGo4Picture::SetStrOption(Short_t index, Short_t typ, const char *value)
1541{
1542 if (!value) return;
1543 SetObjOption(index, typ, new TObjString(value));
1544}
1545
1546const char *TGo4Picture::GetStrOption(Short_t index, Short_t typ, const char *defvalue) const
1547{
1548 TObjString *ostr = dynamic_cast<TObjString*> (GetObjOption(index, typ));
1549 if (!ostr) return defvalue;
1550 return ostr->String().Data();
1551}
1552
1553void TGo4Picture::SetDrawOption(Option_t *option, Int_t index)
1554{
1555 CheckIndex(index);
1556 if (!option) ClearOption(index, op_Draw);
1557 else SetStrOption(index, op_Draw, option);
1558}
1559
1560Option_t *TGo4Picture::GetDrawOption(Int_t index) const
1561{
1562 CheckIndex(index);
1563 return (Option_t *) GetStrOption(index, op_Draw);
1564}
1565
1566void TGo4Picture::SetStyle(TStyle* style, Int_t index)
1567{
1568 if (!style) return;
1569 CheckIndex(index);
1570 SetObjOption(index, op_Style, new TStyle(*style));
1571}
1572
1573TStyle* TGo4Picture::FindStyle(Int_t index)
1574{
1575 CheckIndex(index);
1576 Int_t pos = FindOptPos(index, op_Style);
1577 if (pos < 0) return nullptr;
1578 return dynamic_cast<TStyle*> (GetObjOption(index, op_Style));
1579}
1580
1581TStyle* TGo4Picture::GetStyle(Int_t index)
1582{
1583 CheckIndex(index);
1584 TStyle* style = FindStyle(index);
1585 if (!style) {
1586 style = new TStyle(*gStyle);
1587 SetObjOption(index, op_Style, style);
1588 }
1589 return style;
1590}
1591
1592void TGo4Picture::ClearOption(Short_t index, Short_t typ)
1593{
1594 ClearOption(FindOptPos(index,typ));
1595}
1596
1598{
1599 if (pos < 0) return;
1600 Int_t bnd = op_ObjsBound << 16;
1601
1602 if (fxOptIndex[pos]>=bnd) {
1603 for (Int_t i = 0; i < fiOptSize; i++)
1604 if (fxOptIndex[i] >= bnd)
1605 if (fxOptValue[i] > fxOptValue[pos])
1606 fxOptValue[i] -= 1;
1607 TObject *obj = fxOptObjects->RemoveAt(fxOptValue[pos]);
1608 delete obj;
1609 fxOptObjects->Compress();
1610 if (fxOptObjects->GetLast() < 0) {
1611 delete fxOptObjects;
1612 fxOptObjects = nullptr;
1613 }
1614 }
1615
1616 for (Int_t i=pos;i<fiOptSize-1;i++) {
1617 fxOptIndex[i] = fxOptIndex[i+1];
1618 fxOptValue[i] = fxOptValue[i+1];
1619 }
1620 fiOptSize--;
1621}
1622
1623void TGo4Picture::CheckIndex(Int_t &index) const
1624{
1625 if (index == UndefIndex) {
1627 index = fiLastIndex;
1628 else
1629 index = PictureIndex;
1630 }
1631}
1632
1634{
1635 if (index<0) {
1636 fxOptIndex.Set(0);
1637 fxOptValue.Set(0);
1638 if (fxOptObjects) {
1639 delete fxOptObjects;
1640 fxOptObjects = nullptr;
1641 }
1642 } else {
1643 Int_t pos = 0;
1644 while (pos<fiOptSize)
1645 if ((fxOptIndex[pos] & 0x7fff)==index+1) ClearOption(pos);
1646 else pos++;
1647 }
1648}
1649
1650Int_t TGo4Picture::GetObjAttIndex(TObject *obj) const
1651{
1652 if (!obj) return UndefIndex;
1653 for (Int_t n = 0; n < GetNumObjNames(); n++)
1654 if (strcmp(GetObjName(n), obj->GetName()) == 0)
1655 return n;
1656 return UndefIndex;
1657}
1658
1659void TGo4Picture::DrawPic(TVirtualPad *pad)
1660{
1661 if (!pad) return;
1662 double txt_y = 0.9;
1663 if (IsDivided()) {
1664 pad->Divide(GetDivX(), GetDivY());
1665 for (Int_t posx = 0; posx < GetDivX(); posx++)
1666 for (Int_t posy = 0; posy < GetDivY(); posy++) {
1667 TGo4Picture *sub = FindPic(posy, posx);
1668 if (sub)
1669 sub->DrawPic(pad->GetPad(posy * GetDivX() + posx + 1));
1670 }
1671 } else
1672 for (Int_t indx = 0; indx < GetNumObjNames(); indx++) {
1673 TString str = "Obj: ";
1674 str += GetObjName(indx);
1675 const char *opt = GetDrawOption(indx);
1676 if (!opt && (indx == 0))
1678 if (opt) {
1679 str += " Opt: ";
1680 str += opt;
1681 }
1682 Int_t numobj = GetNumObjNames();
1683 TText *txt = new TText(0.1, txt_y, str.Data());
1684 pad->cd();
1685 txt->Draw();
1686 if (numobj < 8)
1687 txt_y -= 0.1;
1688 else
1689 txt_y -= 0.8 / numobj;
1690 }
1691}
1692
1693void TGo4Picture::Draw(Option_t *option)
1694{
1695 TCanvas *c = nullptr;
1696 if (!gPad) {
1697 c = new TCanvas();
1698 c->cd();
1699 } else {
1700 c = gPad->GetCanvas();
1701 c->Clear();
1702 c->cd();
1703 }
1704 if (!c) return;
1705
1706 if (IsDrawHeader()) {
1707 TString txt = c->GetName();
1708 txt += " Pic: ";
1709 txt += GetName();
1710 if (strcmp(GetName(), GetTitle()) != 0) {
1711 txt += " Title: ";
1712 txt += GetTitle();
1713 }
1714 c->SetTitle(txt.Data());
1715 }
1716
1717 DrawPic(c);
1718}
1719
1720void TGo4Picture::PrintPic(int shift, Bool_t showopt)
1721{
1722 for (int n = 0; n < shift; n++)
1723 std::cout << ' ';
1724 if (IsDivided()) {
1725 std::cout << "Divided numx:" << GetDivX() << " numy:" << GetDivY() << std::endl;
1726 for (Int_t posx = 0; posx < GetDivX(); posx++)
1727 for (Int_t posy = 0; posy < GetDivY(); posy++) {
1728 for (int n = 0; n < shift + 2; n++)
1729 std::cout << ' ';
1730 std::cout << "subpic x:" << posx << " y:" << posy << std::endl;
1731 TGo4Picture *sub = FindPic(posy, posx);
1732 if (sub)
1733 sub->PrintPic(shift + 4, showopt);
1734 }
1735 } else {
1736 std::cout << "Objects:" << std::endl;
1737 for (Int_t num = 0; num < GetNumObjNames(); num++) {
1738 const char *objname = GetObjName(num);
1739 for (int n = 0; n < shift + 2; n++)
1740 std::cout << ' ';
1741 std::cout << objname;
1742
1743 Option_t *drawopt = GetDrawOption(num);
1744 if (drawopt)
1745 std::cout << " opt: " << drawopt;
1746 std::cout << std::endl;
1747 }
1748 if (!showopt)
1749 return;
1750 for (int n = 0; n < shift; n++)
1751 std::cout << ' ';
1752 std::cout << "Options:" << std::endl;
1753 for (Int_t nop = 0; nop < fiOptSize; nop++) {
1754 Int_t indx = (fxOptIndex[nop] & 0x00ff);
1755 Int_t op = fxOptIndex[nop] >> 16;
1756 for (int n = 0; n < shift + 2; n++)
1757 std::cout << ' ';
1758 std::cout << indx << " " << op << " " << fxOptValue[nop] << std::endl;
1759 }
1760 }
1761}
1762
1763void TGo4Picture::Print(Option_t *option) const
1764{
1765 std::cout << "Picture " << GetName() << std::endl;
1766 const_cast<TGo4Picture *>(this)->PrintPic(2, strstr(option,"attr") != nullptr);
1767}
1768
1770{
1771 if (!pic) return;
1772 if (!fxSubPictures) {
1773 fxSubPictures = new TObjArray();
1774 fxSubPictures->SetOwner(kTRUE);
1775 }
1776 fxSubPictures->Add(pic);
1777}
1778
1779void TGo4Picture::AddSpecialObject(TObject *obj, Option_t *drawopt)
1780{
1781 if (!fxSpecialObjects) {
1782 fxSpecialObjects = new TList;
1783 fxSpecialObjects->SetOwner(kTRUE);
1784 }
1785
1786 fxSpecialObjects->Add(obj, drawopt);
1787}
1788
1789void TGo4Picture::AddSpecialObjectXml(const char *xmlcode, Option_t *drawopt)
1790{
1791 TObject *obj = TBufferXML::ConvertFromXML(xmlcode);
1792 if (obj) AddSpecialObject(obj, drawopt);
1793}
1794
1796{
1797 Long_t sz = IsA()->Size();
1798
1799 if (fxNames) {
1800 sz += TObjArray::Class()->Size() + fxNames->GetSize() * sizeof(void *);
1801 for (int n = 0; n <= fxNames->GetLast(); n++) {
1802 TObjString *str = (TObjString *)fxNames->At(n);
1803 if (str) sz += str->IsA()->Size() + str->GetString().Length();
1804 }
1805 }
1806
1807 if (fxSubPictures)
1808 sz += TObjArray::Class()->Size() + fxSubPictures->GetSize() * sizeof(void *);
1809
1810 if (fxOptObjects) {
1811 sz += TObjArray::Class()->Size() + fxOptObjects->GetSize() * sizeof(void *);
1812 for (int n = 0; n <= fxOptObjects->GetLast(); n++) {
1813 TObject *obj = fxOptObjects->At(n);
1814 if (obj) sz += obj->IsA()->Size();
1815 }
1816 }
1817
1818 if (fxSpecialObjects) {
1819 sz += TList::Class()->Size();
1820 TListIter iter(fxSpecialObjects);
1821
1822 while (auto obj = iter())
1823 sz += sizeof(TObjLink) + obj->IsA()->Size();
1824 }
1825
1826 sz += fxOptIndex.GetSize() * sizeof(Long_t);
1827 sz += fxOptValue.GetSize() * sizeof(Long_t);
1828
1829 if (IsDivided())
1830 for (int ny = 0; ny < GetDivY(); ny++)
1831 for (int nx = 0; nx < GetDivX(); nx++)
1832 sz += Pic(ny, nx)->GetTotalSize();
1833
1834 return sz;
1835}
1836
1837
1838void TGo4Picture::SavePrimitive(std::ostream &fs, Option_t *)
1839{
1840 fs << "TGo4Picture *" << GetName() << " = new TGo4Picture(\"" << GetName()
1841 << "\", \"" << GetTitle() << "\");" << std::endl;
1842 TString name = GetName();
1843 name+="->";
1844
1845 fs << name << "SetCrosshair(" << (IsCrosshair() ? "true" : "false") << ");" << std::endl;
1846
1847 MakeScript(fs, name.Data());
1848}
1849
1850void TGo4Picture::MakeAxisScript(std::ostream &fs, const char *name, Int_t index, Int_t naxis)
1851{
1852 if ((naxis<0) || (naxis>2)) return;
1853 const char *axisname = "X";
1854 Int_t op = op_AxisX;
1855 if (naxis==1) { op = op_AxisY; axisname = "Y"; } else
1856 if (naxis==2) { op = op_AxisZ; axisname = "Z"; }
1857
1858 Long_t lv;
1859 Float_t fv;
1860 if (!GetOption (index, op+0, lv)) return;
1861
1862 fs << name << "SetAxisAtt(" << naxis << ", ";
1863 fs << lv << ", ";
1864 if (!GetOption (index, op+1, lv)) lv = gStyle->GetLabelColor(axisname);
1865 fs << lv << ", ";
1866 if (!GetOption (index, op+2, lv)) lv = gStyle->GetLabelFont(axisname);
1867 fs << lv << ", ";
1868 if (!GetOptionF(index, op+3, fv)) fv = gStyle->GetLabelOffset(axisname);
1869 fs << fv << ", ";
1870 if (!GetOptionF(index, op+4, fv)) fv = gStyle->GetLabelSize(axisname);
1871 fs << fv << ", ";
1872 if (!GetOption (index, op+5, lv)) lv = gStyle->GetNdivisions(axisname);
1873 fs << lv << ", ";
1874 if (!GetOptionF(index, op+6, fv)) fv = gStyle->GetTickLength(axisname);
1875 fs << fv << ", ";
1876 if (!GetOption (index, op+7, lv)) lv = gStyle->GetTitleColor(axisname);
1877 fs << lv << ", ";
1878 if (!GetOption (index, op+8, lv)) lv = gStyle->GetTitleFont(axisname);
1879 fs << lv << ", ";
1880 if (!GetOptionF(index, op+9, fv)) fv = gStyle->GetTitleOffset(axisname);
1881 fs << fv << ", ";
1882 if (!GetOptionF(index, op+10, fv)) fv = gStyle->GetTitleSize(axisname);
1883 fs << fv << ", ";
1884
1885 if (GetOption (index, op+11, lv)) {
1886 if ((lv & 1) != 0) fs << "kTRUE, ";
1887 else fs << "kFALSE, ";
1888 TString ticks;
1889 if ((lv & 2) != 0) ticks+="+";
1890 if ((lv & 4) != 0) ticks+="-";
1891 fs << "\"" << ticks <<"\", ";
1892 fs << (lv & 0x0ff0) << ", ";
1893 } else
1894 fs << "kTRUE, \"+\", 0, ";
1895
1896 fs << index << ");" << std::endl;
1897
1898 // TODO: add this to script
1899 // note: take this attribute independent of displayed object
1900 // this is necessary to correctly restore TGraph axis
1901 //SetXAxisAttTime(axis->GetTimeDisplay(), axis->GetTimeFormat(), index);
1902 // if (naxis == 0) {
1903 // Bool_t tdisp=kFALSE;
1904 // if (GetOption (index, op_TimeAxisX, lv) && lv) tdisp=kTRUE;
1905 // TString format=GetStrOption(index, op_TimeAxisXFmt, "%H:%M:%S");
1906 // fs << name << "SetXAxisAttTime(";
1907 // fs << tdisp << ", ";
1908 // fs << "\"" << format.Data()<< "\"" <<", ";
1909 // //fs << index << ");" << std::endl; // does not work?
1910 // fs << PictureIndex << ");" << std::endl; // this works
1911 // }
1912
1913}
1914
1915void TGo4Picture::MakeScript(std::ostream &fs, const char *name)
1916{
1917 for (Int_t naxis = 0; naxis < 3; naxis++)
1918 if (GetLogScale(naxis) > 0)
1919 fs << name << "SetLogScale(" << naxis << ", 1);" << std::endl;
1920
1921 Double_t min, max;
1922 if (GetRangeX(min, max))
1923 fs << name << "SetRangeX(" << min << ", " << max << ");" << std::endl;
1924 if (GetRangeY(min, max))
1925 fs << name << "SetRangeY(" << min << ", " << max << ");" << std::endl;
1926 if (GetRangeZ(min, max))
1927 fs << name << "SetRangeZ(" << min << ", " << max << ");" << std::endl;
1928
1929 Double_t v1,v2,v3,v4;
1934 fs << name << "SetFrameAttr(" << v1 << ", " << v2 << ", " << v3 << ", " << v4 << ");" << std::endl;
1935
1936 TAttLine latt;
1937 TAttFill fatt;
1938 TAttMarker matt;
1939
1940 if (GetLineAtt(&latt,PictureIndex))
1941 fs << name << "SetLineAtt("
1942 << latt.GetLineColor() << ", "
1943 << latt.GetLineStyle() << ", "
1944 << latt.GetLineWidth() << ", " << PictureIndex << ");" << std::endl;
1945 if (GetFillAtt(&fatt, PictureIndex))
1946 fs << name << "SetFillAtt("
1947 << fatt.GetFillColor() << ", "
1948 << fatt.GetFillStyle() << ", " << PictureIndex << ");" << std::endl;
1949 if (GetMarkerAtt(&matt, PictureIndex))
1950 fs << name << "SetMarkerAtt("
1951 << matt.GetMarkerColor() << ", "
1952 << matt.GetMarkerSize() << ", "
1953 << matt.GetMarkerStyle()<< ", " << PictureIndex << ");" << std::endl;
1954
1955 fs << name << "SetHisStats(" << (IsHisStats() ? "true" : "false") << ");" << std::endl;
1956
1957 if (IsHisStats() && (FindOptPos(PictureIndex, op_HisStatsX1) >= 0)) {
1958 fs << name << "SetStatsAttr("
1959 << GetD(PictureIndex, op_HisStatsX1, gStyle->GetStatX()-gStyle->GetStatW()) << ", "
1960 << GetD(PictureIndex, op_HisStatsY1, gStyle->GetStatY()-gStyle->GetStatH()) << ", "
1961 << GetD(PictureIndex, op_HisStatsX2, gStyle->GetStatX()) << ", "
1962 << GetD(PictureIndex, op_HisStatsY2, gStyle->GetStatY()) << ", "
1963 << GetI(PictureIndex, op_HisStatsOpt, 1111) << ", \""
1964 << GetStrOption(PictureIndex, op_HisStatsOptF, "6.4g") << "\", "
1965 << GetI(PictureIndex, op_HisStatsFit, 111) << ", \""
1966 << GetStrOption(PictureIndex, op_HisStatsFitF, "5.4g") << "\");" << std::endl;
1967 }
1968
1969 fs << name << "SetHisTitle(" << (IsHisTitle() ? "true" : "false") << ");" << std::endl;
1970 if (HasTitleAttr()) {
1971 fs << name << "SetTitleAttr("
1972 << GetD(PictureIndex, op_TitleX1, gStyle->GetTitleX()-gStyle->GetTitleW()) << ", "
1973 << GetD(PictureIndex, op_TitleY1, gStyle->GetTitleY()-gStyle->GetTitleH()) << ", "
1974 << GetD(PictureIndex, op_TitleX2, gStyle->GetTitleX()) << ", "
1975 << GetD(PictureIndex, op_TitleY2, gStyle->GetTitleY());
1976
1977 Double_t sz = 0.;
1979 fs << ", " << sz;
1980
1981 fs << ");" << std::endl;
1982
1983 fs << name << "SetTitleTime(" << (IsTitleTime() ? "true" : "false") << ");" << std::endl;
1984 fs << name << "SetTitleDate(" << (IsTitleDate() ? "true" : "false") << ");" << std::endl;
1985 fs << name << "SetTitleItem(" << (IsTitleItem() ? "true" : "false") << ");" << std::endl;
1986 }
1987
1988 Int_t nlvl = GetHisContour();
1989 if (nlvl > 0) fs << name << "SetHisContour(" << nlvl << ");" << std::endl;
1990
1991 fs << name << "SetAutoScale(" << (IsAutoScale() ? "true" : "false") << ");" << std::endl;
1992
1993 if (IsSuperimpose()) {
1994 fs << name << "SetSuperimpose(true);" << std::endl;
1995 fs << name << "SetLegendDraw(" << (IsLegendDraw() ? "true" : "false") << ");" << std::endl;
1996 }
1997
1998 fs << name << "SetApplyToAll(" << (IsApplyToAll() ? "true" : "false") << ");" << std::endl;
1999 fs << name << "SetAutoZoom(" << (IsAutoZoom() ? "true" : "false") << ");" << std::endl;
2000
2001 // JAM2016 add 1:1 coordinate ratio property:
2002 fs << name << "SetXYRatioOne(" << (IsXYRatioOne() ? "true" : "false") << ");" << std::endl;
2003
2004
2005 Long_t lv;
2006 Double_t dv;
2007 fs << name << "SetPadAtt(";
2008 if (!GetOption (PictureIndex, op_Pad+ 0, lv)) lv = gStyle->GetPadBorderMode();
2009 fs << lv << ", ";
2010 if (!GetOption (PictureIndex, op_Pad+ 1, lv)) lv = gStyle->GetPadBorderSize();
2011 fs << lv << ", ";
2012 if (!GetOption (PictureIndex, op_Pad+ 2, lv)) lv = gStyle->GetPadGridX();
2013 fs << lv << ", ";
2014 if (!GetOption (PictureIndex, op_Pad+ 3, lv)) lv = gStyle->GetPadGridY();
2015 fs << lv << ", ";
2016 if (!GetOptionD(PictureIndex, op_Pad+ 4, dv)) dv = 0.;
2017 fs << dv << ", ";
2018 if (!GetOptionD(PictureIndex, op_Pad+ 5, dv)) dv = 0.;
2019 fs << dv << ", ";
2020 if (!GetOption (PictureIndex, op_Pad+ 6, lv)) lv = gStyle->GetPadTickX();
2021 fs << lv << ", ";
2022 if (!GetOption (PictureIndex, op_Pad+ 7, lv)) lv = gStyle->GetPadTickY();
2023 fs << lv << ");" << std::endl;
2024
2025 const char *drawopt = GetDrawOption(PictureIndex);
2026 if (drawopt)
2027 fs << name << "SetDrawOption(\"" << drawopt << "\", " << PictureIndex << ");" << std::endl;
2028
2029 // export x axis time attribute independent of objects. needed for TGraph pads
2030 Bool_t tdisp=kFALSE;
2031 if (GetOption (PictureIndex, op_TimeAxisX, lv) && lv) tdisp=kTRUE;
2032 TString format=GetStrOption(PictureIndex, op_TimeAxisXFmt, "%H:%M:%S");
2033 fs << name << "SetXAxisAttTime(";
2034 fs << tdisp << ", ";
2035 fs << "\"" << format.Data()<< "\"" <<", ";
2036 fs << PictureIndex << ");" << std::endl;
2037
2038 for (Int_t indx = 0; indx < GetNumObjNames(); indx++) {
2039 const char *objname = GetObjName(indx);
2040 const char *objopt = GetDrawOption(indx);
2041
2042 fs << name << "AddObjName(\"" << objname << "\"";
2043 if (objopt) fs << ", \"" << objopt << "\"";
2044 fs << ");" << std::endl;
2045 if (GetLineAtt(&latt,indx))
2046 fs << name << "SetLineAtt("
2047 << latt.GetLineColor() << ", "
2048 << latt.GetLineStyle() << ", "
2049 << latt.GetLineWidth() << ", " << indx << ");" << std::endl;
2050 if (GetFillAtt(&fatt, indx))
2051 fs << name << "SetFillAtt("
2052 << fatt.GetFillColor() << ", "
2053 << fatt.GetFillStyle() << ", " << indx << ");" << std::endl;
2054 if (GetMarkerAtt(&matt, indx))
2055 fs << name << "SetMarkerAtt("
2056 << matt.GetMarkerColor() << ", "
2057 << matt.GetMarkerSize() << ", "
2058 << matt.GetMarkerStyle() << ", " << indx << ");" << std::endl;
2059
2060 MakeAxisScript(fs, name, indx, 0);
2061 MakeAxisScript(fs, name, indx, 1);
2062 MakeAxisScript(fs, name, indx, 2);
2063
2064 if (GetRebinX(indx)>0)
2065 fs << name << "SetRebinX(" << GetRebinX(indx) << ", " << indx << ");" << std::endl;
2066
2067 if (GetRebinY(indx)>0)
2068 fs << name << "SetRebinY(" << GetRebinY(indx) << ", " << indx << ");" << std::endl;
2069 }
2070
2071 TListIter iter(fxSpecialObjects);
2072 while (auto obj = iter()) {
2073
2074 TString xmlbuf = TBufferXML::ConvertToXML(obj);
2075
2076 TString buf = xmlbuf;
2077 Int_t len = 0;
2078 do {
2079 len = buf.Length();
2080 buf.ReplaceAll("\n ","\n");
2081 } while (len!=buf.Length());
2082
2083 buf.ReplaceAll("\n"," ");
2084 buf.ReplaceAll("\"","\\\"");
2085
2086 buf.Prepend("\"");
2087 buf.Append("\"");
2088
2089 if (buf.Length()>950) {
2090 fs << "TString sbuf = \"\";" << std::endl;
2091 const char *pos = xmlbuf.Data();
2092 while (*pos != 0) {
2093 const char *lastpos = pos;
2094 while ((*pos != 0) && (*pos!='\n')) pos++;
2095 TString subbuf(lastpos, pos-lastpos);
2096 subbuf.ReplaceAll("\"","\\\"");
2097 fs << "TGo4Picture::Add(sbuf,\"" << subbuf << "\");" << std::endl;
2098 if (*pos == 0) break;
2099 pos++;
2100 }
2101 buf = "sbuf";
2102 }
2103
2104 fs << name << "AddSpecialObjectXml(" << buf;
2105
2106 Option_t *opt = iter.GetOption();
2107
2108 if (opt && (*opt != 0))
2109 fs << ", \"" << opt << "\"";
2110 fs << ");" << std::endl;
2111 }
2112
2113 if (IsDivided()) {
2114 fs << name << "SetDivision(" << GetDivY() << ", " << GetDivX() << ");" << std::endl;
2115 for (int ny = 0; ny < GetDivY(); ny++)
2116 for (int nx = 0; nx < GetDivX(); nx++) {
2117 TString subname = name;
2118 subname += "Pic(";
2119 subname += ny;
2120 subname += ",";
2121 subname += nx;
2122 subname += ")->";
2123 Pic(ny, nx)->MakeScript(fs, subname.Data());
2124 }
2125 }
2126}
T * Cast(TObject *obj)
OptionsIdentifiers
@ op_TitleTextSz
@ op_RangeYMax
@ op_DefaultRatio
@ op_Draw
@ op_AxisZ
@ op_LogScaleX
@ op_AxisX
@ op_LogScaleZ
@ op_MarkerColor
@ op_AutoScale
@ op_FullXMin
@ op_ObjsBound
@ op_Crosshair
@ op_FrameTop
@ op_TitleItem
@ op_XYRatioOne
@ op_RangeXMax
@ op_TimeAxisXFmt
@ op_MarkerSize
@ op_FrameLeft
@ op_FullDim
@ op_TitleTime
@ op_MarkerStyle
@ op_HisStatsY1
@ op_HisStats
@ op_LineStyle
@ op_FillStyle
@ op_PadModified
@ op_RangeYMin
@ op_LineWidth
@ op_HisContour
@ op_HisStatsFit
@ op_LineColor
@ op_RangeZMax
@ op_FillColor
@ op_Style
@ op_FullZMax
@ op_AxisY
@ op_TitleDate
@ op_Pad
@ op_RangeXMin
@ op_FullZMin
@ op_TimeAxisX
@ op_FullYMin
@ op_Superimpose
@ op_LogScaleY
@ op_AutoZoom
@ op_RebinY
@ op_FrameRight
@ op_TitleX2
@ op_TitleY2
@ op_LegendDraw
@ op_FullYMax
@ op_HisStatsX1
@ op_ApplyToAll
@ op_HisStatsOptF
@ op_HisTitle
@ op_FrameBottom
@ op_HisStatsY2
@ op_TitleX1
@ op_RebinX
@ op_FullXMax
@ op_ContentModified
@ op_TitleY1
@ op_HisStatsX2
@ op_HisStatsOpt
@ op_HisStatsFitF
@ op_RangeZMin
Int_t GetNumObjNames() const
Bool_t GetStatsAttr(TPaveStats *stats) const
Bool_t GetOptionD(Short_t index, Short_t typ, Double_t &value) const
void ClearOption(Short_t index, Short_t typ)
Bool_t IsXYRatioOne() const
bool IsCrosshair() const
void SetOptionF(Short_t index, Short_t typ, Float_t value)
Bool_t GetLineAtt(TAttLine *line, Int_t index=UndefIndex) const
void DrawPic(TVirtualPad *pad)
TList * GetSpecialObjects() const
Bool_t IsTitleDate() const
void SetHisStats(Bool_t on)
void SetLogScale(Int_t nscale=0, Int_t zn=1)
void SetOptionD(Short_t index, Short_t typ, Double_t value)
void ClearRangeZ()
void SetRebinY(Int_t ngroupy, Int_t index=UndefIndex)
void SetAxisLabelFontSize(Int_t naxis, Float_t LabelSize, Int_t index=UndefIndex)
void SetPosition(Int_t posy, Int_t posx)
void SetSuperimpose(bool on)
Bool_t GetFillAtt(TAttFill *fill, Int_t index=UndefIndex) const
void ClearRange(Int_t naxis=-1)
void ClearObjNames(Bool_t recursive=kFALSE)
Int_t GetRebinX(Int_t index=UndefIndex) const
void CopyOptionsFrom(TGo4Picture *source)
Bool_t IsHisStats() const
Int_t GetDivY() const
Definition TGo4Picture.h:57
void ClearMarkerAtt(Int_t index=UndefIndex)
void SetRebinX(Int_t ngroupx, Int_t index=UndefIndex)
Int_t GetLogScale(Int_t nscale=0) const
Double_t GetD(Short_t index, Short_t typ, Double_t def=0.) const
void SetRange(Int_t naxis, Double_t min, Double_t max)
void SetLinesDivision(Int_t numlines, const Int_t *numbers)
void SetXAxisTimeDisplay(Bool_t on)
Bool_t IsDivided() const
Definition TGo4Picture.h:58
void SetCrosshair(bool on)
void UpdateFrom(TGo4Picture *source, TClass *selectedobjclass=nullptr)
void CheckIndex(Int_t &index) const
void AddObject(TObject *obj, Option_t *DrawOption=nullptr)
void SetXAxisTimeFormat(const char *format)
void SetRangeY(Double_t min, Double_t max)
Option_t * GetDrawOption() const override
void SetPadModified(bool on=true)
void SetAxisTitleFontSize(Int_t naxis, Float_t TitleSize, Int_t index=UndefIndex)
void SetHisTitle(bool on)
void SetApplyToAll(bool on)
TStyle * GetStyle(Int_t index=UndefIndex)
void AddObjName(const char *name, Option_t *DrawOption=nullptr)
bool IsAutoScale() const
void SetPadAtt(Int_t BorderMode, Int_t BorderSize, Int_t Gridx, Int_t Gridy, Double_t Phi, Double_t Theta, Int_t Tickx, Int_t Ticky, Int_t index=PictureIndex)
void SetMarkerAtt(Color_t color, Size_t size, Style_t style, Int_t index=UndefIndex)
TGo4Picture * LPic(Int_t nline, Int_t ncol)
void GetDrawAttributes(TObject *obj, Int_t index=UndefIndex) const
const char * GetObjName(Int_t n) const
TGo4Picture * FindPic(Int_t posy, Int_t posx)
Bool_t GetOption(Short_t index, Short_t typ, Long_t &value) const
void SetAxisAtt(Int_t naxis, Color_t AxisColor, Color_t LabelColor, Style_t LabelFont, Float_t LabelOffset, Float_t LabelSize, Int_t Ndivisions, Float_t TickLength, Color_t TitleColor, Style_t TitleFont, Float_t TitleOffset, Float_t TitleSize, Bool_t decimals, const char *ticks, Int_t bits, Int_t index=UndefIndex)
void AddSubPicture(TGo4Picture *pic)
void SetTitleAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t textsize=0.)
bool IsAutoZoom() const
void SetFillAtt(Color_t color, Style_t style, Int_t index=UndefIndex)
Bool_t GetFullRange(Int_t naxis, Double_t &min, Double_t &max) const
Bool_t IsObjNames() const
TObjArray * fxObjects
void AddHStack(THStack *st, Option_t *DrawOption=nullptr)
void ClearAllOptions(Short_t index=UndefIndex)
TObject * GetObjOption(Short_t index, Short_t typ) const
Bool_t GetRangeY(Double_t &min, Double_t &max) const
virtual ~TGo4Picture()
void GetAxisAtt(Int_t naxis, TAxis *axis, Int_t index=UndefIndex) const
void SetXAxisAttTime(Bool_t timedisplay, const char *format, Int_t index=UndefIndex)
Int_t fiOptSize
TStyle * FindStyle(Int_t index=UndefIndex)
Int_t GetFullRangeDim() const
Int_t GetObjAttIndex(TObject *obj) const
void SetDrawAttributes(TObject *obj, Int_t index=UndefIndex)
const char * GetStrOption(Short_t index, Short_t typ, const char *defvalue=nullptr) const
Int_t fiLastIndex
void SetLineAtt(Color_t color, Style_t style, Width_t width, Int_t index=UndefIndex)
Bool_t GetMarkerAtt(TAttMarker *marker, Int_t index=UndefIndex) const
void SetStatsAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t optstat=1111, const char *statformat="6.4g", Int_t optfit=1111, const char *fitformat="5.4g")
void ClearLogScales()
Long_t GetTotalSize()
Returns total size, used by picture in memory.
void AddCondition(TNamed *cond=nullptr)
void GetLogScales(TVirtualPad *pad)
TObjArray * fxOptObjects
void SetContentModified(bool on=true)
void SetDrawOption(Option_t *option="") override
bool IsPadModified() const
Int_t GetHisContour() const
void SetTitleItem(Bool_t on=kTRUE)
void AddSpecialObjectXml(const char *xmlcode, Option_t *drawopt=nullptr)
void SetH1Att(TH1 *h1, Int_t index=UndefIndex)
TList * fxSpecialObjects
void SetOption(Short_t index, Short_t typ, Long_t value)
Bool_t IsHisTitle() const
void ClearFullRange(Int_t naxis=-1)
Long_t GetI(Short_t index, Short_t typ, Long_t def=0) const
void Clear(Option_t *option="") override
Bool_t IsXAxisTimeDisplay() const
void GetPadAtt(TPad *pad, Int_t index=UndefIndex) const
void SetStyle(TStyle *style, Int_t index=UndefIndex)
Bool_t CheckPosition(Int_t posy, Int_t posx) const
void ChangeDrawOption(Int_t kind, Int_t value)
Int_t ExtendOptPos(Short_t index, Short_t typ)
bool IsLegendDraw() const
TObjArray * fxNames
bool IsSuperimpose() const
void PrintPic(int shift, Bool_t showopt)
void SetFrameAttr(Double_t left, Double_t top, Double_t right, Double_t bottom)
void SetAutoZoom(bool on)
Int_t GetRebinY(Int_t index=UndefIndex) const
void SetObjOption(Short_t index, Short_t typ, TObject *obj)
void MakeAxisScript(std::ostream &fs, const char *name, Int_t indx, Int_t naxis)
void Print(Option_t *option="") const override
void AddH1(TH1 *histo, Option_t *DrawOption=nullptr)
void AddGraph(TGraph *gr, Option_t *DrawOption=nullptr)
Bool_t GetFrameAttr(TPad *pad) const
TArrayL fxOptIndex
void AddSpecialObject(TObject *obj, Option_t *drawopt=nullptr)
void ClearRangeY()
void SetTitleTime(Bool_t on=kTRUE)
void ClearLineAtt(Int_t index=UndefIndex)
Bool_t GetRangeZ(Double_t &min, Double_t &max) const
void ClearRebin(Int_t index=UndefIndex)
Int_t FindOptPos(Short_t index, Short_t typ) const
TObjArray * fxSubPictures
void SetLegendDraw(bool on)
void ClearFillAtt(Int_t index=UndefIndex)
Bool_t IsDrawHeader() const
const char * GetXAxisTimeFormat() const
void Draw(Option_t *option="") override
void SetDrawHeader(Bool_t draw=kTRUE)
void GetH1Att(TH1 *h1, Int_t index=UndefIndex) const
void SetTitleDate(Bool_t on=kTRUE)
Bool_t HasTitleAttr()
TGo4Picture * Pic(Int_t posy, Int_t posx)
void SetFullRange(Int_t naxis, Double_t min, Double_t max)
void SetXYRatioOne(Bool_t on)
void SetRangeX(Double_t min, Double_t max)
Bool_t GetOptionF(Short_t index, Short_t typ, Float_t &value) const
void MakeScript(std::ostream &fs, const char *name)
Bool_t GetTitleAttr(TPaveText *title) const
void SavePrimitive(std::ostream &fs, Option_t *opt="") override
Bool_t GetRangeX(Double_t &min, Double_t &max) const
Bool_t GetRange(Int_t naxis, Double_t &min, Double_t &max) const
void SetAutoScale(bool on)
void SetHisContour(Int_t nlvl)
bool IsContentModified() const
void SetDivision(Int_t ndivy, Int_t ndivx)
bool IsApplyToAll() const
void SetStrOption(Short_t index, Short_t typ, const char *value)
Bool_t IsTitleItem() const
Int_t GetDivX() const
Definition TGo4Picture.h:56
Bool_t IsTitleTime() const
void ClearRangeX()
TArrayL fxOptValue
void SetRangeZ(Double_t min, Double_t max)
void SetFullRangeDim(Int_t ndim)