Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions hist/hist/src/TGraph2D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ TGraph2D& TGraph2D::operator=(const TGraph2D &g)

void TGraph2D::Build(Int_t n)
{
if (n <= 0) {
if (n < 0) {
Error("TGraph2D", "Invalid number of points (%d)", n);
return;
}
Expand All @@ -609,12 +609,18 @@ void TGraph2D::Build(Int_t n)
fNpy = 40;
fDirectory = nullptr;
fHistogram = nullptr;
fDelaunay = nullptr;
fDelaunay = nullptr;
fMaximum = -1111;
fMinimum = -1111;
fX = new Double_t[fSize];
fY = new Double_t[fSize];
fZ = new Double_t[fSize];
if (n>0) {
fX = new Double_t[fSize];
fY = new Double_t[fSize];
fZ = new Double_t[fSize];
} else {
fX = nullptr;
fY = nullptr;
fZ = nullptr;
}
fZout = 0;
fMaxIter = 100000;
fFunctions = new TList;
Expand Down
46 changes: 32 additions & 14 deletions hist/hist/src/TGraph2DAsymmErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,26 @@ TGraph2DAsymmErrors::TGraph2DAsymmErrors() {}
TGraph2DAsymmErrors::TGraph2DAsymmErrors(Int_t n)
: TGraph2D(n)
{
if (n <= 0) {
if (n < 0) {
Error("TGraph2DAsymmErrors", "Invalid number of points (%d)", n);
return;
}

fEXlow = new Double_t[n];
fEXhigh = new Double_t[n];
fEYlow = new Double_t[n];
fEYhigh = new Double_t[n];
fEZlow = new Double_t[n];
fEZhigh = new Double_t[n];
if (n>0) {
fEXlow = new Double_t[n];
fEXhigh = new Double_t[n];
fEYlow = new Double_t[n];
fEYhigh = new Double_t[n];
fEZlow = new Double_t[n];
fEZhigh = new Double_t[n];
} else {
fEXlow = nullptr;
fEXhigh = nullptr;
fEYlow = nullptr;
fEYhigh = nullptr;
fEZlow = nullptr;
fEZhigh = nullptr;
}

for (Int_t i=0;i<n;i++) {
fEXlow[i] = 0;
Expand All @@ -111,17 +120,26 @@ TGraph2DAsymmErrors::TGraph2DAsymmErrors(Int_t n)
TGraph2DAsymmErrors::TGraph2DAsymmErrors(Int_t n, Double_t *x, Double_t *y, Double_t *z, Double_t *exl, Double_t *exh, Double_t *eyl, Double_t *eyh, Double_t *ezl, Double_t *ezh, Option_t *)
:TGraph2D(n, x, y, z)
{
if (n <= 0) {
if (n < 0) {
Error("TGraph2DAsymmErrorsErrors", "Invalid number of points (%d)", n);
return;
}

fEXlow = new Double_t[n];
fEXhigh = new Double_t[n];
fEYlow = new Double_t[n];
fEYhigh = new Double_t[n];
fEZlow = new Double_t[n];
fEZhigh = new Double_t[n];
if (n>0) {
fEXlow = new Double_t[n];
fEXhigh = new Double_t[n];
fEYlow = new Double_t[n];
fEYhigh = new Double_t[n];
fEZlow = new Double_t[n];
fEZhigh = new Double_t[n];
} else {
fEXlow = nullptr;
fEXhigh = nullptr;
fEYlow = nullptr;
fEYhigh = nullptr;
fEZlow = nullptr;
fEZhigh = nullptr;
}

for (Int_t i=0;i<n;i++) {
if (exl) fEXlow[i] = exl[i];
Expand Down
28 changes: 20 additions & 8 deletions hist/hist/src/TGraph2DErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,20 @@ TGraph2DErrors::TGraph2DErrors() {}
TGraph2DErrors::TGraph2DErrors(Int_t n)
: TGraph2D(n)
{
if (n <= 0) {
if (n < 0) {
Error("TGraph2DErrors", "Invalid number of points (%d)", n);
return;
}

fEX = new Double_t[n];
fEY = new Double_t[n];
fEZ = new Double_t[n];
if (n>0) {
fEX = new Double_t[n];
fEY = new Double_t[n];
fEZ = new Double_t[n];
} else {
fEX = nullptr;
fEY = nullptr;
fEZ = nullptr;
}

for (Int_t i=0;i<n;i++) {
fEX[i] = 0;
Expand All @@ -102,14 +108,20 @@ TGraph2DErrors::TGraph2DErrors(Int_t n, Double_t *x, Double_t *y, Double_t *z,
Double_t *ex, Double_t *ey, Double_t *ez, Option_t *)
:TGraph2D(n, x, y, z)
{
if (n <= 0) {
if (n < 0) {
Error("TGraph2DErrors", "Invalid number of points (%d)", n);
return;
}

fEX = new Double_t[n];
fEY = new Double_t[n];
fEZ = new Double_t[n];
if (n>0) {
fEX = new Double_t[n];
fEY = new Double_t[n];
fEZ = new Double_t[n];
} else {
fEX = nullptr;
fEY = nullptr;
fEZ = nullptr;
}

for (Int_t i=0;i<n;i++) {
if (ex) fEX[i] = ex[i];
Expand Down
Loading