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