Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGraph2DAsymmErrors.cxx
Go to the documentation of this file.
1// @(#)root/hist:$Id: TGraph2DAsymmErrors.cxx,v 1.00
2// Author: Olivier Couet
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include <iostream>
13#include "TBuffer.h"
14#include "TGraph2DAsymmErrors.h"
15#include "TMath.h"
16#include "TH2.h"
17#include "TVirtualPad.h"
18#include "TVirtualFitter.h"
19#include "THLimitsFinder.h"
20
21
22/** \class TGraph2DAsymmErrors
23 \ingroup Graphs
24Graph 2D class with errors.
25
26A TGraph2DAsymmErrors is a TGraph2D with asymmetric errors. It behaves like a TGraph2D and has
27the same drawing options.
28
29The "ERR" drawing option allows to display the error bars. The
30following example shows how to use it:
31
32Begin_Macro(source)
33{
34 auto c = new TCanvas("c","TGraph2DAsymmErrors example",0,0,600,600);
35
36 Double_t P = 6.;
37 const Int_t np = 200;
38 std::vector<Double_t> rx(np), ry(np), rz(np), exl(np), exh(np), eyl(np), eyh(np), ezl(np), ezh(np);
39 TRandom r;
40
41 for (Int_t N=0; N<np;N++) {
42 rx[N] = 2*P*(r.Rndm(N))-P;
43 ry[N] = 2*P*(r.Rndm(N))-P;
44 rz[N] = rx[N]*rx[N]-ry[N]*ry[N];
45 rx[N] += 10.;
46 ry[N] += 10.;
47 rz[N] += 40.;
48 exl[N] = r.Rndm(N);
49 exh[N] = r.Rndm(N);
50 eyl[N] = r.Rndm(N);
51 eyh[N] = r.Rndm(N);
52 ezl[N] = 10*r.Rndm(N);
53 ezh[N] = 10*r.Rndm(N);
54 }
55
56 auto g = new TGraph2DAsymmErrors(np, rx.data(), ry.data(), rz.data(), exl.data(), exh.data(), eyl.data(), eyh.data(), ezl.data(), ezh.data());
57
58 g->SetTitle("TGraph2D with asymmetric error bars: option \"ERR\"");
59 g->SetFillColor(29);
60 g->SetMarkerSize(0.8);
61 g->SetMarkerStyle(20);
62 g->SetMarkerColor(kRed);
63 g->SetLineColor(kBlue-3);
64 g->SetLineWidth(2);
65 gPad->SetLogy(1);
66 g->Draw("err p0");
67}
68End_Macro
69*/
70
71
72////////////////////////////////////////////////////////////////////////////////
73/// TGraph2DAsymmErrors default constructor
74
76
77
78////////////////////////////////////////////////////////////////////////////////
79/// TGraph2DAsymmErrors normal constructor
80/// the arrays are preset to zero
81
83 : TGraph2D(n)
84{
85 if (n < 0) {
86 Error("TGraph2DAsymmErrors", "Invalid number of points (%d)", n);
87 return;
88 }
89
90 if (n>0) {
91 fEXlow = new Double_t[n];
92 fEXhigh = new Double_t[n];
93 fEYlow = new Double_t[n];
94 fEYhigh = new Double_t[n];
95 fEZlow = new Double_t[n];
96 fEZhigh = new Double_t[n];
97 } else {
98 fEXlow = nullptr;
99 fEXhigh = nullptr;
100 fEYlow = nullptr;
101 fEYhigh = nullptr;
102 fEZlow = nullptr;
103 fEZhigh = nullptr;
104 }
105
106 for (Int_t i=0;i<n;i++) {
107 fEXlow[i] = 0;
108 fEXhigh[i] = 0;
109 fEYlow[i] = 0;
110 fEYhigh[i] = 0;
111 fEZlow[i] = 0;
112 fEZhigh[i] = 0;
113 }
114}
115
116
117////////////////////////////////////////////////////////////////////////////////
118/// TGraph2DAsymmErrors constructor with doubles vectors as input.
119
121 :TGraph2D(n, x, y, z)
122{
123 if (n < 0) {
124 Error("TGraph2DAsymmErrorsErrors", "Invalid number of points (%d)", n);
125 return;
126 }
127
128 if (n>0) {
129 fEXlow = new Double_t[n];
130 fEXhigh = new Double_t[n];
131 fEYlow = new Double_t[n];
132 fEYhigh = new Double_t[n];
133 fEZlow = new Double_t[n];
134 fEZhigh = new Double_t[n];
135 } else {
136 fEXlow = nullptr;
137 fEXhigh = nullptr;
138 fEYlow = nullptr;
139 fEYhigh = nullptr;
140 fEZlow = nullptr;
141 fEZhigh = nullptr;
142 }
143
144 for (Int_t i=0;i<n;i++) {
145 if (exl) fEXlow[i] = exl[i];
146 else fEXlow[i] = 0;
147 if (exh) fEXhigh[i] = exh[i];
148 else fEXhigh[i] = 0;
149 if (eyl) fEYlow[i] = eyl[i];
150 else fEYlow[i] = 0;
151 if (eyh) fEYhigh[i] = eyh[i];
152 else fEYhigh[i] = 0;
153 if (ezl) fEZlow[i] = ezl[i];
154 else fEZlow[i] = 0;
155 if (ezh) fEZhigh[i] = ezh[i];
156 else fEZhigh[i] = 0;
157 }
158}
159
160
161////////////////////////////////////////////////////////////////////////////////
162/// TGraph2DAsymmErrors destructor.
163
165{
166 delete [] fEXlow;
167 delete [] fEXhigh;
168 delete [] fEYlow;
169 delete [] fEYhigh;
170 delete [] fEZlow;
171 delete [] fEZhigh;
172}
173
174////////////////////////////////////////////////////////////////////////////////
175/// Copy constructor.
176/// Copy everything except list of functions
177
179: TGraph2D(g), fEXlow(nullptr), fEXhigh(nullptr), fEYlow(nullptr), fEYhigh(nullptr), fEZlow(nullptr), fEZhigh(nullptr)
180{
181 if (fSize > 0) {
182 fEXlow = new Double_t[fSize];
183 fEXhigh = new Double_t[fSize];
184 fEYlow = new Double_t[fSize];
185 fEYhigh = new Double_t[fSize];
186 fEZlow = new Double_t[fSize];
187 fEZhigh = new Double_t[fSize];
188 for (Int_t n = 0; n < fSize; n++) {
189 fEXlow[n] = g.fEXlow[n];
190 fEXhigh[n] = g.fEXhigh[n];
191 fEYlow[n] = g.fEYlow[n];
192 fEYhigh[n] = g.fEYhigh[n];
193 fEZlow[n] = g.fEZlow[n];
194 fEZhigh[n] = g.fEZhigh[n];
195 }
196 }
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Assignment operator
201/// Copy everything except list of functions
202
204{
205 if (this == &g) return *this;
206
207 // call operator= on TGraph2D
208 this->TGraph2D::operator=(static_cast<const TGraph2D&>(g) );
209
210 // delete before existing contained objects
211 if (fEXlow) delete [] fEXlow;
212 if (fEXhigh) delete [] fEXhigh;
213 if (fEYlow) delete [] fEYlow;
214 if (fEYhigh) delete [] fEYhigh;
215 if (fEZlow) delete [] fEZlow;
216 if (fEZhigh) delete [] fEZhigh;
217
218 fEXlow = (fSize > 0) ? new Double_t[fSize] : nullptr;
219 fEXhigh = (fSize > 0) ? new Double_t[fSize] : nullptr;
220 fEYlow = (fSize > 0) ? new Double_t[fSize] : nullptr;
221 fEYhigh = (fSize > 0) ? new Double_t[fSize] : nullptr;
222 fEZlow = (fSize > 0) ? new Double_t[fSize] : nullptr;
223 fEZhigh = (fSize > 0) ? new Double_t[fSize] : nullptr;
224
225
226 // copy error arrays
227 for (Int_t n = 0; n < fSize; n++) {
228 fEXlow[n] = g.fEXlow[n];
229 fEXhigh[n] = g.fEXhigh[n];
230 fEYlow[n] = g.fEYlow[n];
231 fEYhigh[n] = g.fEYhigh[n];
232 fEZlow[n] = g.fEZlow[n];
233 fEZhigh[n] = g.fEZhigh[n];
234 }
235 return *this;
236}
237
238////////////////////////////////////////////////////////////////////////////////
239/// Add a 3D point with asymmetric errorbars to an existing graph
240
247
248////////////////////////////////////////////////////////////////////////////////
249/// Returns the combined error along X at point i by computing the average
250/// of the lower and upper variance.
251
253{
254 if (i < 0 || i >= fNpoints) return -1;
255 if (!fEXlow && !fEXhigh) return -1;
256 Double_t elow=0, ehigh=0;
257 if (fEXlow) elow = fEXlow[i];
258 if (fEXhigh) ehigh = fEXhigh[i];
259 return TMath::Sqrt(0.5*(elow*elow + ehigh*ehigh));
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Returns the low error along X at point i.
264
266{
267 if (i < 0 || i >= fNpoints) return -1;
268 if (fEXlow) return fEXlow[i];
269 return -1;
270}
271
272////////////////////////////////////////////////////////////////////////////////
273/// Returns the high error along X at point i.
274
276{
277 if (i < 0 || i >= fNpoints) return -1;
278 if (fEXhigh) return fEXhigh[i];
279 return -1;
280}
281
282////////////////////////////////////////////////////////////////////////////////
283/// Returns the combined error along Y at point i by computing the average
284/// of the lower and upper variance.
285
287{
288 if (i < 0 || i >= fNpoints) return -1;
289 if (!fEYlow && !fEYhigh) return -1;
290 Double_t elow=0, ehigh=0;
291 if (fEYlow) elow = fEYlow[i];
292 if (fEYhigh) ehigh = fEYhigh[i];
293 return TMath::Sqrt(0.5*(elow*elow + ehigh*ehigh));
294}
295
296
297////////////////////////////////////////////////////////////////////////////////
298/// Returns the low error along Y at point i.
299
301{
302 if (i < 0 || i >= fNpoints) return -1;
303 if (fEYlow) return fEYlow[i];
304 return -1;
305}
306
307////////////////////////////////////////////////////////////////////////////////
308/// Returns the high error along Y at point i.
309
311{
312 if (i < 0 || i >= fNpoints) return -1;
313 if (fEYhigh) return fEYhigh[i];
314 return -1;
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Returns the combined error along Z at point i by computing the average
319/// of the lower and upper variance.
320
322{
323 if (i < 0 || i >= fNpoints) return -1;
324 if (!fEZlow && !fEZhigh) return -1;
325 Double_t elow=0, ehigh=0;
326 if (fEZlow) elow = fEZlow[i];
327 if (fEZhigh) ehigh = fEZhigh[i];
328 return TMath::Sqrt(0.5*(elow*elow + ehigh*ehigh));
329}
330
331////////////////////////////////////////////////////////////////////////////////
332/// Returns the low error along Z at point i.
333
335{
336 if (i < 0 || i >= fNpoints) return -1;
337 if (fEZlow) return fEZlow[i];
338 return -1;
339}
340
341////////////////////////////////////////////////////////////////////////////////
342/// Returns the high error along Z at point i.
343
345{
346 if (i < 0 || i >= fNpoints) return -1;
347 if (fEZhigh) return fEZhigh[i];
348 return -1;
349}
350
351
352////////////////////////////////////////////////////////////////////////////////
353/// Returns the X maximum with errors.
354
356{
357 Double_t v = fX[0]+fEXhigh[0];
358 for (Int_t i=1; i<fNpoints; i++) if (fX[i]+fEXhigh[i]>v) v=fX[i]+fEXhigh[i];
359 return v;
360}
361
362
363////////////////////////////////////////////////////////////////////////////////
364/// Returns the X minimum with errors.
365
367{
368 Double_t v = fX[0]-fEXlow[0];
369 for (Int_t i=1; i<fNpoints; i++) if (fX[i]-fEXlow[i]<v) v=fX[i]-fEXlow[i];
370 return v;
371}
372
373
374////////////////////////////////////////////////////////////////////////////////
375/// Returns the Y maximum with errors.
376
378{
379 Double_t v = fY[0]+fEYhigh[0];
380 for (Int_t i=1; i<fNpoints; i++) if (fY[i]+fEYhigh[i]>v) v=fY[i]+fEYhigh[i];
381 return v;
382}
383
384
385////////////////////////////////////////////////////////////////////////////////
386/// Returns the Y minimum with errors.
387
389{
390 Double_t v = fY[0]-fEYlow[0];
391 for (Int_t i=1; i<fNpoints; i++) if (fY[i]-fEYlow[i]<v) v=fY[i]-fEYlow[i];
392 return v;
393}
394
395
396////////////////////////////////////////////////////////////////////////////////
397/// Returns the Z maximum with errors.
398
400{
401 Double_t v = fZ[0]+fEZhigh[0];
402 for (Int_t i=1; i<fNpoints; i++) if (fZ[i]+fEZhigh[i]>v) v=fZ[i]+fEZhigh[i];
403 return v;
404}
405
406
407////////////////////////////////////////////////////////////////////////////////
408/// Returns the Z minimum with errors.
409
411{
412 Double_t v = fZ[0]-fEZlow[0];
413 for (Int_t i=1; i<fNpoints; i++) if (fZ[i]-fEZlow[i]<v) v=fZ[i]-fEZlow[i];
414 return v;
415}
416
417
418////////////////////////////////////////////////////////////////////////////////
419/// Print 2D graph and errors values.
420
422{
423 for (Int_t i = 0; i < fNpoints; i++) {
424 printf("x[%d]=%g, y[%d]=%g, z[%d]=%g, exl[%d]=%g, exh[%d]=%g, eyl[%d]=%g, eyh[%d]=%g, ezl[%d]=%g, ezh[%d]=%g\n",
425 i, fX[i], i, fY[i], i, fZ[i], i, fEXlow[i], i, fEXhigh[i], i, fEYlow[i], i, fEYhigh[i], i, fEZlow[i], i, fEZhigh[i]);
426 }
427}
428
429////////////////////////////////////////////////////////////////////////////////
430/// Multiply the values and errors of a TGraph2DAsymmErrors by a constant c1.
431///
432/// If option contains "x" the x values and errors are scaled
433/// If option contains "y" the y values and errors are scaled
434/// If option contains "z" the z values and errors are scaled
435/// If option contains "xyz" all three x, y and z values and errors are scaled
436
438{
440 TString opt = option; opt.ToLower();
441 if (opt.Contains("x") && GetEXlow()) {
442 for (Int_t i=0; i<GetN(); i++)
443 GetEXlow()[i] *= c1;
444 }
445 if (opt.Contains("x") && GetEXhigh()) {
446 for (Int_t i=0; i<GetN(); i++)
447 GetEXhigh()[i] *= c1;
448 }
449 if (opt.Contains("y") && GetEYlow()) {
450 for (Int_t i=0; i<GetN(); i++)
451 GetEYlow()[i] *= c1;
452 }
453 if (opt.Contains("y") && GetEYhigh()) {
454 for (Int_t i=0; i<GetN(); i++)
455 GetEYhigh()[i] *= c1;
456 }
457 if (opt.Contains("z") && GetEZlow()) {
458 for (Int_t i=0; i<GetN(); i++)
459 GetEZlow()[i] *= c1;
460 }
461 if (opt.Contains("z") && GetEZhigh()) {
462 for (Int_t i=0; i<GetN(); i++)
463 GetEZhigh()[i] *= c1;
464 }
465}
466
467////////////////////////////////////////////////////////////////////////////////
468/// Set number of points in the 2D graph.
469/// Existing coordinates are preserved.
470/// New coordinates above fNpoints are preset to 0.
471
473{
474 if (n < 0) n = 0;
475 if (n == fNpoints) return;
476 if (n > fNpoints) SetPointError(n,0,0,0,0,0,0);
477 fNpoints = n;
478}
479
480////////////////////////////////////////////////////////////////////////////////
481/// Deletes point number ipoint
482
484{
485 if (ipoint < 0) return -1;
486 if (ipoint >= fNpoints) return -1;
487
488 fNpoints--;
498
499 Int_t j = -1;
500 for (Int_t i = 0; i < fNpoints + 1; i++) {
501 if (i == ipoint) continue;
502 j++;
503 newX[j] = fX[i];
504 newY[j] = fY[i];
505 newZ[j] = fZ[i];
506 newEXlow[j] = fEXlow[i];
507 newEXhigh[j] = fEXhigh[i];
508 newEYlow[j] = fEYlow[i];
509 newEYhigh[j] = fEYhigh[i];
510 newEZlow[j] = fEZlow[i];
511 newEZhigh[j] = fEZhigh[i];
512 }
513 delete [] fX;
514 delete [] fY;
515 delete [] fZ;
516 delete [] fEXlow;
517 delete [] fEXhigh;
518 delete [] fEYlow;
519 delete [] fEYhigh;
520 delete [] fEZlow;
521 delete [] fEZhigh;
522 fX = newX;
523 fY = newY;
524 fZ = newZ;
531 fSize = fNpoints;
532 if (fHistogram) {
533 delete fHistogram;
534 fHistogram = nullptr;
535 fDelaunay = nullptr;
536 }
537 return ipoint;
538}
539
540////////////////////////////////////////////////////////////////////////////////
541/// Set x, y and z values for point number i
542
544{
545 if (i < 0) return;
546 if (i >= fNpoints) {
547 // re-allocate the object
548 Double_t *savex = new Double_t[i+1];
549 Double_t *savey = new Double_t[i+1];
550 Double_t *savez = new Double_t[i+1];
551 Double_t *saveexl = new Double_t[i+1];
552 Double_t *saveexh = new Double_t[i+1];
553 Double_t *saveeyl = new Double_t[i+1];
554 Double_t *saveeyh = new Double_t[i+1];
555 Double_t *saveezl = new Double_t[i+1];
556 Double_t *saveezh = new Double_t[i+1];
557 if (fNpoints > 0) {
558 memcpy(savex, fX, fNpoints*sizeof(Double_t));
559 memcpy(savey, fY, fNpoints*sizeof(Double_t));
560 memcpy(savez, fZ, fNpoints*sizeof(Double_t));
567 }
568 if (fX) delete [] fX;
569 if (fY) delete [] fY;
570 if (fZ) delete [] fZ;
571 if (fEXlow) delete [] fEXlow;
572 if (fEXhigh) delete [] fEXhigh;
573 if (fEYlow) delete [] fEYlow;
574 if (fEYhigh) delete [] fEYhigh;
575 if (fEZlow) delete [] fEZlow;
576 if (fEZhigh) delete [] fEZhigh;
577 fX = savex;
578 fY = savey;
579 fZ = savez;
580 fEXlow = saveexl;
582 fEYlow = saveeyl;
584 fEZlow = saveezl;
586 fNpoints = i+1;
587 }
588 fX[i] = x;
589 fY[i] = y;
590 fZ[i] = z;
591}
592
593
594////////////////////////////////////////////////////////////////////////////////
595/// Saves primitive as a C++ statement(s) on output stream out
596
598{
599 TString arrx = SavePrimitiveVector(out, "gr2daerr_x", fNpoints, fX, kTRUE);
600 TString arry = SavePrimitiveVector(out, "gr2daerr_y", fNpoints, fY);
601 TString arrz = SavePrimitiveVector(out, "gr2daerr_z", fNpoints, fZ);
602 TString arrexl = SavePrimitiveVector(out, "gr2daerr_exl", fNpoints, fEXlow, 111);
603 TString arrexh = SavePrimitiveVector(out, "gr2daerr_exh", fNpoints, fEXhigh, 111);
604 TString arreyl = SavePrimitiveVector(out, "gr2daerr_eyl", fNpoints, fEYlow, 111);
605 TString arreyh = SavePrimitiveVector(out, "gr2daerr_eyh", fNpoints, fEYhigh, 111);
606 TString arrezl = SavePrimitiveVector(out, "gr2daerr_ezl", fNpoints, fEZlow, 111);
607 TString arrezh = SavePrimitiveVector(out, "gr2daerr_ezh", fNpoints, fEZhigh, 111);
608
610 out, Class(), "gr2daerr",
612 "%d, %s.data(), %s.data(), %s.data(), %s, %s, %s, %s, %s, %s",
613 fNpoints, arrx.Data(), arry.Data(), arrz.Data(), arrexl.Data(), arrexh.Data(), arreyl.Data(), arreyh.Data(),
614 arrezl.Data(), arrezh.Data()),
615 kFALSE);
616
617 if (strcmp(GetName(), "Graph2D"))
618 out << " gr2daerr->SetName(\"" << TString(GetName()).ReplaceSpecialCppChars() << "\");\n";
619
620 TString title = GetTitle();
621 if (fHistogram)
622 title = TString(fHistogram->GetTitle()) + ";" + fHistogram->GetXaxis()->GetTitle() + ";" +
624
625 out << " gr2daerr->SetTitle(\"" << title.ReplaceSpecialCppChars() << "\");\n";
626
627 if (!fDirectory)
628 out << " gr2daerr->SetDirectory(nullptr);\n";
629
630 SaveFillAttributes(out, "gr2daerr", 0, 1001);
631 SaveLineAttributes(out, "gr2daerr", 1, 1, 1);
632 SaveMarkerAttributes(out, "gr2daerr", 1, 1, 1);
633
634 TH1::SavePrimitiveFunctions(out, "gr2daerr", fFunctions);
635
636 SavePrimitiveDraw(out, "gr2daerr", option);
637}
638
639////////////////////////////////////////////////////////////////////////////////
640/// Set ex, ey and ez values for point number i
641
643{
644 if (i < 0) return;
645 if (i >= fNpoints) {
646 // re-allocate the object
648 }
649 fEXlow[i] = exl;
650 fEXhigh[i] = exh;
651 fEYlow[i] = eyl;
652 fEYhigh[i] = eyh;
653 fEZlow[i] = ezl;
654 fEZhigh[i] = ezh;
655}
656
657
658////////////////////////////////////////////////////////////////////////////////
659/// Stream an object of class TGraph2DAsymmErrors.
660
662{
663 if (b.IsReading()) {
665 Version_t R__v = b.ReadVersion(&R__s, &R__c);
666 b.ReadClassBuffer(TGraph2DAsymmErrors::Class(), this, R__v, R__s, R__c);
667 } else {
668 b.WriteClassBuffer(TGraph2DAsymmErrors::Class(),this);
669 }
670}
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Definition TAttFill.cxx:238
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition TAttLine.cxx:274
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
const char * GetTitle() const override
Returns title of object.
Definition TAxis.h:137
Buffer base class used for serializing objects.
Definition TBuffer.h:43
Graph 2D class with errors.
Double_t GetErrorY(Int_t bin) const override
Returns the combined error along Y at point i by computing the average of the lower and upper varianc...
Double_t * GetEYlow() const override
void SavePrimitive(std::ostream &out, Option_t *option="") override
Saves primitive as a C++ statement(s) on output stream out.
Double_t * fEYlow
[fNpoints] array of Y low errors
Double_t GetYminE() const override
Returns the Y minimum with errors.
Double_t GetErrorZlow(Int_t i) const
Returns the low error along Z at point i.
virtual void SetPointError(Int_t i, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh, Double_t ezl, Double_t ezh)
Set ex, ey and ez values for point number i.
Double_t * GetEYhigh() const override
Double_t * fEZlow
[fNpoints] array of Z low errors
Double_t GetErrorZhigh(Int_t i) const
Returns the high error along Z at point i.
Double_t GetYmaxE() const override
Returns the Y maximum with errors.
Double_t * fEXlow
[fNpoints] array of X low errors
Double_t GetErrorZ(Int_t bin) const override
Returns the combined error along Z at point i by computing the average of the lower and upper varianc...
Double_t GetErrorYlow(Int_t i) const
Returns the low error along Y at point i.
Double_t GetZmaxE() const override
Returns the Z maximum with errors.
Double_t * GetEZhigh() const override
Double_t * fEXhigh
[fNpoints] array of X high errors
Int_t RemovePoint(Int_t ipoint)
Deletes point number ipoint.
Double_t * fEZhigh
[fNpoints] array of Z high errors
Double_t * GetEXhigh() const override
Double_t * GetEZlow() const override
Double_t * fEYhigh
[fNpoints] array of Y high errors
Double_t GetErrorX(Int_t bin) const override
Returns the combined error along X at point i by computing the average of the lower and upper varianc...
Double_t GetErrorXhigh(Int_t i) const
Returns the high error along X at point i.
void Streamer(TBuffer &) override
Stream an object of class TGraph2DAsymmErrors.
Double_t GetErrorYhigh(Int_t i) const
Returns the high error along Y at point i.
virtual void AddPointError(Double_t x, Double_t y, Double_t z, Double_t exl=0., Double_t exh=0., Double_t eyl=0., Double_t eyh=0., Double_t ezl=0., Double_t ezh=0.)
Add a 3D point with asymmetric errorbars to an existing graph.
Double_t GetErrorXlow(Int_t i) const
Returns the low error along X at point i.
void Set(Int_t n) override
Set number of points in the 2D graph.
void SetPoint(Int_t i, Double_t x, Double_t y, Double_t z) override
Set x, y and z values for point number i.
TGraph2DAsymmErrors()
TGraph2DAsymmErrors default constructor.
Double_t GetXminE() const override
Returns the X minimum with errors.
void Print(Option_t *chopt="") const override
Print 2D graph and errors values.
void Scale(Double_t c1=1., Option_t *option="z") override
Multiply the values and errors of a TGraph2DAsymmErrors by a constant c1.
Double_t GetXmaxE() const override
Returns the X maximum with errors.
TGraph2DAsymmErrors & operator=(const TGraph2DAsymmErrors &)
Assignment operator Copy everything except list of functions.
Double_t GetZminE() const override
Returns the Z minimum with errors.
Double_t * GetEXlow() const override
static TClass * Class()
~TGraph2DAsymmErrors() override
TGraph2DAsymmErrors destructor.
Graphics object made of three arrays X, Y and Z with the same number of points each.
Definition TGraph2D.h:41
Int_t fNpoints
Number of points in the data set.
Definition TGraph2D.h:45
Double_t * fZ
[fNpoints]
Definition TGraph2D.h:52
TH2D * fHistogram
!2D histogram of z values linearly interpolated on the triangles
Definition TGraph2D.h:58
TObject * fDelaunay
! Pointer to Delaunay interpolator object
Definition TGraph2D.h:59
Int_t GetN() const
Definition TGraph2D.h:121
TGraph2D & operator=(const TGraph2D &)
Graph2D operator "=".
Definition TGraph2D.cxx:556
Double_t * fX
[fNpoints]
Definition TGraph2D.h:50
Double_t * fY
[fNpoints] Data set to be plotted
Definition TGraph2D.h:51
TDirectory * fDirectory
!Pointer to directory holding this 2D graph
Definition TGraph2D.h:60
virtual void Scale(Double_t c1=1., Option_t *option="z")
Multiply the values of a TGraph2D by a constant c1.
virtual void AddPoint(Double_t x, Double_t y, Double_t z)
Append a new point to the graph.
Definition TGraph2D.h:91
TList * fFunctions
Pointer to list of functions (fits and user)
Definition TGraph2D.h:57
Int_t fSize
!Real size of fX, fY and fZ
Definition TGraph2D.h:49
TAxis * GetZaxis()
Definition TH1.h:573
TAxis * GetXaxis()
Definition TH1.h:571
TAxis * GetYaxis()
Definition TH1.h:572
static void SavePrimitiveFunctions(std::ostream &out, const char *varname, TList *lst)
Save list of functions Also can be used by TGraph classes.
Definition TH1.cxx:7528
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1089
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
Definition TObject.cxx:840
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Definition TObject.cxx:772
static TString SavePrimitiveVector(std::ostream &out, const char *prefix, Int_t len, Double_t *arr, Int_t flag=0)
Save array in the output stream "out" as vector.
Definition TObject.cxx:791
Basic string class.
Definition TString.h:138
void ToLower()
Change string to lower-case.
Definition TString.cxx:1189
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
Definition TString.cxx:1121
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:641
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673