149 Initialize(0., 0., 0., 0., 25, 25);
159 TH2Poly::TH2Poly(
const char *name,
const char *title, Double_t xlow,Double_t xup
160 , Double_t ylow,Double_t yup)
162 Initialize(xlow, xup, ylow, yup, 25, 25);
171 TH2Poly::TH2Poly(
const char *name,
const char *title,
172 Int_t nX, Double_t xlow, Double_t xup,
173 Int_t nY, Double_t ylow, Double_t yup)
175 Initialize(xlow, xup, ylow, yup, nX, nY);
188 delete[] fCompletelyInside;
200 TH2PolyBin *TH2Poly::CreateBin(TObject *poly)
210 Int_t ibin = fNcells - kNOverflow;
212 if (fSumw2.fN) fSumw2.Set(fNcells);
213 return new TH2PolyBin(poly, ibin);
222 Int_t TH2Poly::AddBin(TObject *poly)
224 auto *bin = CreateBin(poly);
225 Int_t ibin = fNcells-kNOverflow;
230 Bool_t flag = kFALSE;
232 if (fXaxis.GetXmin() > bin->GetXMin()) {
233 fXaxis.Set(100, bin->GetXMin(), fXaxis.GetXmax());
236 if (fXaxis.GetXmax() < bin->GetXMax()) {
237 fXaxis.Set(100, fXaxis.GetXmin(), bin->GetXMax());
240 if (fYaxis.GetXmin() > bin->GetYMin()) {
241 fYaxis.Set(100, bin->GetYMin(), fYaxis.GetXmax());
244 if (fYaxis.GetXmax() < bin->GetYMax()) {
245 fYaxis.Set(100, fYaxis.GetXmin(), bin->GetYMax());
248 if (flag) ChangePartition(fCellX, fCellY);
253 fBins->Add((TObject*) bin);
254 SetNewBinAdded(kTRUE);
257 AddBinToPartition(bin);
267 Int_t TH2Poly::AddBin(Int_t n,
const Double_t *x,
const Double_t *y)
269 TGraph *g =
new TGraph(n, x, y);
270 Int_t bin = AddBin(g);
278 Int_t TH2Poly::AddBin(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
280 Double_t x[] = {x1, x1, x2, x2, x1};
281 Double_t y[] = {y1, y2, y2, y1, y1};
282 TGraph *g =
new TGraph(5, x, y);
283 Int_t bin = AddBin(g);
290 Bool_t TH2Poly::Add(
const TH1 *h1, Double_t c1)
294 TH2Poly *h1p = (TH2Poly *)h1;
297 if (h1p->GetNumberOfBins() != GetNumberOfBins()) {
298 Error(
"Add",
"Attempt to add histograms with different number of bins");
303 TList *h1pBins = h1p->GetBins();
304 TH2PolyBin *thisBin, *h1pBin;
305 for (bin = 1; bin <= GetNumberOfBins(); bin++) {
306 thisBin = (TH2PolyBin *)fBins->At(bin - 1);
307 h1pBin = (TH2PolyBin *)h1pBins->At(bin - 1);
308 if (thisBin->GetXMin() != h1pBin->GetXMin() ||
309 thisBin->GetXMax() != h1pBin->GetXMax() ||
310 thisBin->GetYMin() != h1pBin->GetYMin() ||
311 thisBin->GetYMax() != h1pBin->GetYMax()) {
312 Error(
"Add",
"Attempt to add histograms with different bin limits");
319 if (fSumw2.fN == 0 && h1p->GetSumw2N() != 0) Sumw2();
323 Bool_t resetStats = (c1 < 0);
324 Double_t s1[kNstat] = {0};
325 Double_t s2[kNstat] = {0};
333 Double_t entries = TMath::Abs( GetEntries() + c1 * h1->GetEntries() );
338 if (h1p->GetNormFactor() != 0)
339 factor = h1p->GetNormFactor() / h1p->GetSumOfWeights();
340 for (bin = 0; bin < fNcells; bin++) {
341 Double_t y = this->RetrieveBinContent(bin) + c1 * h1p->RetrieveBinContent(bin);
342 UpdateBinContent(bin, y);
344 Double_t esq = factor * factor * h1p->GetBinErrorSqUnchecked(bin);
345 fSumw2.fArray[bin] += c1 * c1 * factor * factor * esq;
354 for (Int_t i = 0; i < kNstat; i++) {
355 if (i == 1) s1[i] += c1 * c1 * s2[i];
356 else s1[i] += c1 * s2[i];
368 void TH2Poly::AddBinToPartition(TH2PolyBin *bin)
371 Int_t nl, nr, mb, mt;
372 Double_t xclipl, xclipr, yclipb, yclipt;
373 Double_t binXmax, binXmin, binYmax, binYmin;
375 binXmax = bin->GetXMax();
376 binXmin = bin->GetXMin();
377 binYmax = bin->GetYMax();
378 binYmin = bin->GetYMin();
379 nl = (Int_t)(floor((binXmin - fXaxis.GetXmin())/fStepX));
380 nr = (Int_t)(floor((binXmax - fXaxis.GetXmin())/fStepX));
381 mb = (Int_t)(floor((binYmin - fYaxis.GetXmin())/fStepY));
382 mt = (Int_t)(floor((binYmax - fYaxis.GetXmin())/fStepY));
385 if (nr>=fCellX) nr = fCellX-1;
386 if (mt>=fCellY) mt = fCellY-1;
392 fNCells = fCellX*fCellY;
395 for (
int i = nl; i <= nr; i++) {
396 xclipl = fXaxis.GetXmin() + i*fStepX;
397 xclipr = xclipl + fStepX;
398 for (
int j = mb; j <= mt; j++) {
399 yclipb = fYaxis.GetXmin() + j*fStepY;
400 yclipt = yclipb + fStepY;
404 if ((binXmin >= xclipl) && (binXmax <= xclipr) &&
405 (binYmax <= yclipt) && (binYmin >= yclipb)){
406 fCells[i + j*fCellX].Add((TObject*) bin);
407 fIsEmpty[i + j*fCellX] = kFALSE;
413 if (IsIntersecting(bin, xclipl, xclipr, yclipb, yclipt)) {
414 fCells[i + j*fCellX].Add((TObject*) bin);
415 fIsEmpty[i + j*fCellX] = kFALSE;
420 if((bin->IsInside(xclipl,yclipb)) || (bin->IsInside(xclipl,yclipt))){
421 fCells[i + j*fCellX].Add((TObject*) bin);
422 fIsEmpty[i + j*fCellX] = kFALSE;
423 fCompletelyInside[i + fCellX*j] = kTRUE;
426 if((bin->IsInside(xclipr,yclipb)) || (bin->IsInside(xclipr,yclipt))){
427 fCells[i + j*fCellX].Add((TObject*) bin);
428 fIsEmpty[i + j*fCellX] = kFALSE;
429 fCompletelyInside[i + fCellX*j] = kTRUE;
440 void TH2Poly::ChangePartition(Int_t n, Int_t m)
449 fNCells = fCellX*fCellY;
450 fCells =
new TList [fNCells];
452 fStepX = (fXaxis.GetXmax() - fXaxis.GetXmin())/fCellX;
453 fStepY = (fYaxis.GetXmax() - fYaxis.GetXmin())/fCellY;
456 delete [] fCompletelyInside;
457 fIsEmpty =
new Bool_t [fNCells];
458 fCompletelyInside =
new Bool_t [fNCells];
461 for (
int i = 0; i<fNCells; i++) {
463 fCompletelyInside[i] = kFALSE;
470 while((obj = next())){
471 AddBinToPartition((TH2PolyBin*) obj);
479 TObject* TH2Poly::Clone(
const char* newname)
const
485 return TNamed::Clone(newname);
491 void TH2Poly::ClearBinContents()
498 while ((obj = next())) {
499 bin = (TH2PolyBin*) obj;
516 void TH2Poly::Reset(Option_t *opt)
523 while ((obj = next())) {
524 bin = (TH2PolyBin*) obj;
546 Int_t TH2Poly::FindBin(Double_t x, Double_t y, Double_t)
551 if (y > fYaxis.GetXmax()) overflow += -1;
552 else if (y > fYaxis.GetXmin()) overflow += -4;
554 if (x > fXaxis.GetXmax()) overflow += -2;
555 else if (x > fXaxis.GetXmin()) overflow += -1;
556 if (overflow != -5)
return overflow;
559 Int_t n = (Int_t)(floor((x-fXaxis.GetXmin())/fStepX));
560 Int_t m = (Int_t)(floor((y-fYaxis.GetXmin())/fStepY));
563 if (n>=fCellX) n = fCellX-1;
564 if (m>=fCellY) m = fCellY-1;
568 if (fIsEmpty[n+fCellX*m])
return -5;
572 TIter next(&fCells[n+fCellX*m]);
576 while ((obj=next())) {
577 bin = (TH2PolyBin*)obj;
578 if (bin->IsInside(x,y))
return bin->GetBinNumber();
589 Int_t TH2Poly::Fill(Double_t x, Double_t y)
591 return Fill(x, y, 1.0);
598 Int_t TH2Poly::Fill(Double_t x, Double_t y, Double_t w)
607 if (fNcells <= kNOverflow)
return 0;
610 if (!fSumw2.fN && w != 1.0 && !TestBit(TH1::kIsNotW) ) Sumw2();
613 if (y > fYaxis.GetXmax()) overflow += -1;
614 else if (y > fYaxis.GetXmin()) overflow += -4;
616 if (x > fXaxis.GetXmax()) overflow += -2;
617 else if(x > fXaxis.GetXmin()) overflow += -1;
618 if (overflow != -5) {
619 fOverflow[-overflow - 1]+= w;
620 if (fSumw2.fN) fSumw2.fArray[-overflow - 1] += w*w;
625 Int_t n = (Int_t)(floor((x-fXaxis.GetXmin())/fStepX));
626 Int_t m = (Int_t)(floor((y-fYaxis.GetXmin())/fStepY));
629 if (n>=fCellX) n = fCellX-1;
630 if (m>=fCellY) m = fCellY-1;
634 if (fIsEmpty[n+fCellX*m]) {
636 if (fSumw2.fN) fSumw2.fArray[4] += w*w;
643 TIter next(&fCells[n+fCellX*m]);
646 while ((obj=next())) {
647 bin = (TH2PolyBin*)obj;
649 bi = bin->GetBinNumber()-1+kNOverflow;
650 if (bin->IsInside(x,y)) {
655 fTsumw2 = fTsumw2 + w*w;
656 fTsumwx = fTsumwx + w*x;
657 fTsumwx2 = fTsumwx2 + w*x*x;
658 fTsumwy = fTsumwy + w*y;
659 fTsumwy2 = fTsumwy2 + w*y*y;
661 assert(bi < fSumw2.fN);
662 fSumw2.fArray[bi] += w*w;
666 SetBinContentChanged(kTRUE);
668 return bin->GetBinNumber();
673 if (fSumw2.fN) fSumw2.fArray[4] += w*w;
680 Int_t TH2Poly::Fill(
const char* name, Double_t w)
688 while ((obj = next())) {
689 bin = (TH2PolyBin*) obj;
690 if (!sname.CompareTo(bin->GetPolygon()->GetName())) {
693 SetBinContentChanged(kTRUE);
694 return bin->GetBinNumber();
711 void TH2Poly::FillN(Int_t ntimes,
const Double_t* x,
const Double_t* y,
712 const Double_t* w, Int_t stride)
714 for (
int i = 0; i < ntimes; i += stride) {
715 Fill(x[i], y[i], w[i]);
725 Double_t TH2Poly::Integral(Option_t* option)
const
727 TString opt = option;
730 if ((opt.Contains(
"width")) || (opt.Contains(
"area"))) {
732 Double_t integral = 0.;
737 while ((obj=next())) {
738 bin = (TH2PolyBin*) obj;
740 integral += w*(bin->GetContent());
761 Double_t TH2Poly::GetBinContent(Int_t bin)
const
763 if (bin > GetNumberOfBins() || bin == 0 || bin < -kNOverflow)
return 0;
764 if (bin<0)
return fOverflow[-bin - 1];
765 return ((TH2PolyBin*) fBins->At(bin-1))->GetContent();
776 Double_t TH2Poly::GetBinError(Int_t bin)
const
778 if (bin == 0 || bin > GetNumberOfBins() || bin < - kNOverflow)
return 0;
779 if (fBuffer) ((TH1*)
this)->BufferEmpty();
786 Int_t binIndex = (bin > 0) ? bin+kNOverflow-1 : -(bin+1);
787 Double_t err2 = fSumw2.fArray[binIndex];
788 return TMath::Sqrt(err2);
790 Double_t error2 = TMath::Abs(GetBinContent(bin));
791 return TMath::Sqrt(error2);
803 void TH2Poly::SetBinError(Int_t bin, Double_t error)
805 if (bin == 0 || bin > GetNumberOfBins() || bin < - kNOverflow)
return;
806 if (!fSumw2.fN) Sumw2();
807 SetBinErrorOption(kNormal);
809 Int_t binIndex = (bin > 0) ? bin+kNOverflow-1 : -(bin+1);
810 fSumw2.fArray[binIndex] = error * error;
818 const char *TH2Poly::GetBinName(Int_t bin)
const
820 if (bin > GetNumberOfBins())
return "";
821 if (bin < 0)
return "";
822 return ((TH2PolyBin*) fBins->At(bin-1))->GetPolygon()->GetName();
828 const char *TH2Poly::GetBinTitle(Int_t bin)
const
830 if (bin > GetNumberOfBins())
return "";
831 if (bin < 0)
return "";
832 return ((TH2PolyBin*) fBins->At(bin-1))->GetPolygon()->GetTitle();
838 Double_t TH2Poly::GetMaximum()
const
840 if (fNcells <= kNOverflow)
return 0;
841 if (fMaximum != -1111)
return fMaximum;
849 max = ((TH2PolyBin*) next())->GetContent();
851 while ((obj=next())) {
852 b = (TH2PolyBin*)obj;
862 Double_t TH2Poly::GetMaximum(Double_t maxval)
const
864 if (fNcells <= kNOverflow)
return 0;
865 if (fMaximum != -1111)
return fMaximum;
873 max = ((TH2PolyBin*) next())->GetContent();
875 while ((obj=next())) {
876 b = (TH2PolyBin*)obj;
878 if (c>max && c<maxval) max=c;
886 Double_t TH2Poly::GetMinimum()
const
888 if (fNcells <= kNOverflow)
return 0;
889 if (fMinimum != -1111)
return fMinimum;
897 min = ((TH2PolyBin*) next())->GetContent();
899 while ((obj=next())) {
900 b = (TH2PolyBin*)obj;
910 Double_t TH2Poly::GetMinimum(Double_t minval)
const
912 if (fNcells <= kNOverflow)
return 0;
913 if (fMinimum != -1111)
return fMinimum;
921 min = ((TH2PolyBin*) next())->GetContent();
923 while ((obj=next())) {
924 b = (TH2PolyBin*)obj;
926 if (c<min && c>minval) min=c;
934 void TH2Poly::Honeycomb(Double_t xstart, Double_t ystart, Double_t a,
938 Double_t numberOfHexagonsInTheRow;
940 Double_t xloop, yloop, xtemp;
941 xloop = xstart; yloop = ystart + a/2.0;
942 for (
int sCounter = 0; sCounter < s; sCounter++) {
947 if(sCounter%2 == 0){numberOfHexagonsInTheRow = k;}
948 else{numberOfHexagonsInTheRow = k - 1;}
950 for (
int kCounter = 0; kCounter < numberOfHexagonsInTheRow; kCounter++) {
957 x[2] = x[1] + a*TMath::Sqrt(3)/2.0;
959 x[3] = x[2] + a*TMath::Sqrt(3)/2.0;
966 this->AddBin(6, x, y);
969 xtemp += a*TMath::Sqrt(3);
973 if (sCounter%2 == 0) xloop += a*TMath::Sqrt(3)/2.0;
974 else xloop -= a*TMath::Sqrt(3)/2.0;
982 void TH2Poly::Initialize(Double_t xlow, Double_t xup,
983 Double_t ylow, Double_t yup, Int_t n, Int_t m)
989 fNcells = kNOverflow;
992 fXaxis.Set(100, xlow, xup);
993 fYaxis.Set(100, ylow, yup);
995 for (i=0; i<9; i++) fOverflow[i] = 0.;
1011 fNCells = fCellX*fCellY;
1012 fCells =
new TList [fNCells];
1013 fStepX = (fXaxis.GetXmax() - fXaxis.GetXmin())/fCellX;
1014 fStepY = (fYaxis.GetXmax() - fYaxis.GetXmin())/fCellY;
1016 fIsEmpty =
new Bool_t [fNCells];
1017 fCompletelyInside =
new Bool_t [fNCells];
1019 for (i = 0; i<fNCells; i++) {
1020 fIsEmpty[i] = kTRUE;
1021 fCompletelyInside[i] = kFALSE;
1025 SetNewBinAdded(kFALSE);
1026 SetBinContentChanged(kFALSE);
1033 Bool_t TH2Poly::IsIntersecting(TH2PolyBin *bin,
1034 Double_t xclipl, Double_t xclipr,
1035 Double_t yclipb, Double_t yclipt)
1040 Bool_t inter = kFALSE;
1041 TObject *poly = bin->GetPolygon();
1043 if (poly->IsA() == TGraph::Class()) {
1044 TGraph *g = (TGraph*)poly;
1048 inter = IsIntersectingPolygon(gn, gx, gy, xclipl, xclipr, yclipb, yclipt);
1051 if (poly->IsA() == TMultiGraph::Class()) {
1052 TMultiGraph *mg = (TMultiGraph*)poly;
1053 TList *gl = mg->GetListOfGraphs();
1054 if (!gl)
return inter;
1057 while ((g = (TGraph*) next())) {
1061 inter = IsIntersectingPolygon(gn, gx, gy, xclipl, xclipr,
1063 if (inter)
return inter;
1074 Bool_t TH2Poly::IsIntersectingPolygon(Int_t bn, Double_t *x, Double_t *y,
1075 Double_t xclipl, Double_t xclipr,
1076 Double_t yclipb, Double_t yclipt)
1078 Bool_t p0R, p0L, p0T, p0B, p0xM, p0yM, p1R, p1L, p1T;
1079 Bool_t p1B, p1xM, p1yM, p0In, p1In;
1081 for (
int counter = 0; counter < (bn-1); counter++) {
1083 p0L = x[counter] <= xclipl;
1084 p1L = x[counter + 1] <= xclipl;
1085 if (p0L && p1L)
continue;
1086 p0R = x[counter] >= xclipr;
1087 p1R = x[counter + 1] >= xclipr;
1088 if (p0R && p1R)
continue;
1089 p0T = y[counter] >= yclipt;
1090 p1T = y[counter + 1] >= yclipt;
1091 if (p0T && p1T)
continue;
1092 p0B = y[counter] <= yclipb;
1093 p1B = y[counter + 1] <= yclipb;
1094 if (p0B && p1B)
continue;
1097 p0xM = !p0R && !p0L;
1098 p0yM = !p0T && !p0B;
1099 p1xM = !p1R && !p1L;
1100 p1yM = !p1T && !p1B;
1101 p0In = p0xM && p0yM;
1102 p1In = p1xM && p1yM;
1107 if (p1In)
return kTRUE;
1114 if (p0xM && p1xM)
return kTRUE;
1115 if (p0yM && p1yM)
return kTRUE;
1119 Double_t xcoord[3], ycoord[3];
1120 xcoord[0] = x[counter];
1121 xcoord[1] = x[counter + 1];
1122 ycoord[0] = y[counter];
1123 ycoord[1] = y[counter + 1];
1129 if((TMath::IsInside(xclipl, yclipt, 3, xcoord, ycoord)) ||
1130 (TMath::IsInside(xclipr, yclipb, 3, xcoord, ycoord)))
continue;
1135 if((TMath::IsInside(xclipl, yclipb, 3, xcoord, ycoord)) ||
1136 (TMath::IsInside(xclipr, yclipt, 3, xcoord, ycoord)))
continue;
1142 if (TMath::IsInside(xclipr, yclipt, 3, xcoord, ycoord))
continue;
1148 if (TMath::IsInside(xclipr, yclipb, 3, xcoord, ycoord))
continue;
1156 if ((TMath::IsInside(xclipr, yclipb, 3, xcoord, ycoord)) ||
1157 (TMath::IsInside(xclipl, yclipt, 3, xcoord, ycoord)))
continue;
1162 if ((TMath::IsInside(xclipl, yclipb, 3, xcoord, ycoord)) ||
1163 (TMath::IsInside(xclipr, yclipt, 3, xcoord, ycoord)))
continue;
1169 if (TMath::IsInside(xclipl, yclipt, 3, xcoord, ycoord))
continue;
1175 if (TMath::IsInside(xclipl, yclipb, 3, xcoord, ycoord))
continue;
1188 Long64_t TH2Poly::Merge(TCollection *coll)
1190 for (
auto h2pAsObj : *coll) {
1191 if (!Add((TH1*)h2pAsObj, 1.)) {
1192 Warning(
"Merge",
"An issue was encountered during the merge operation.");
1196 return GetEntries();
1202 void TH2Poly::SavePrimitive(std::ostream &out, Option_t *option)
1204 out <<
" "<<std::endl;
1205 out <<
" "<< ClassName() <<
" *";
1210 static Int_t hcounter = 0;
1211 TString histName = GetName();
1212 if (!fDirectory && !histName.Contains(
"Graph")) {
1215 histName += hcounter;
1217 const char *hname = histName.Data();
1220 out << hname <<
" = new " << ClassName() <<
"(\"" << hname <<
"\", \""
1221 << GetTitle() <<
"\", " << fCellX <<
", " << fXaxis.GetXmin()
1222 <<
", " << fXaxis.GetXmax()
1223 <<
", " << fCellY <<
", " << fYaxis.GetXmin() <<
", "
1224 << fYaxis.GetXmax() <<
");" << std::endl;
1229 TH2PolyBin *th2pBin;
1231 while((obj = next())){
1232 th2pBin = (TH2PolyBin*) obj;
1233 th2pBin->GetPolygon()->SavePrimitive(out,
1234 TString::Format(
"th2poly%s",histName.Data()));
1238 out<<
" "<<std::endl;
1240 for (bin=1;bin<=GetNumberOfBins();bin++) {
1241 Double_t bc = GetBinContent(bin);
1243 out<<
" "<<hname<<
"->SetBinContent("<<bin<<
","<<bc<<
");"<<std::endl;
1249 for (bin=1;bin<=GetNumberOfBins();bin++) {
1250 Double_t be = GetBinError(bin);
1252 out<<
" "<<hname<<
"->SetBinError("<<bin<<
","<<be<<
");"<<std::endl;
1256 TH1::SavePrimitiveHelp(out, hname, option);
1262 void TH2Poly::Scale(Double_t c1, Option_t*)
1264 for(
int i = 0; i < this->GetNumberOfBins(); i++ ) {
1265 this->SetBinContent(i+1, c1*this->GetBinContent(i+1));
1267 for(
int i = 0; i < kNOverflow; i++ ) {
1268 this->SetBinContent(-i-1, c1*this->GetBinContent(-i-1) );
1276 void TH2Poly::SetBinContent(Int_t bin, Double_t content)
1278 if (bin > GetNumberOfBins() || bin == 0 || bin < -9 )
return;
1280 ((TH2PolyBin*) fBins->At(bin-1))->SetContent(content);
1283 fOverflow[-bin - 1] = content;
1285 SetBinContentChanged(kTRUE);
1293 void TH2Poly::SetFloat(Bool_t flag)
1301 Bool_t TH2Poly::IsInsideBin(Int_t binnr, Double_t x, Double_t y)
1303 if (!fBins)
return false;
1304 TH2PolyBin* bin = (TH2PolyBin*)fBins->At(binnr);
1305 if (!bin)
return false;
1306 return bin->IsInside(x,y);
1309 void TH2Poly::GetStats(Double_t *stats)
const
1314 stats[3] = fTsumwx2;
1316 stats[5] = fTsumwy2;
1317 stats[6] = fTsumwxy;
1328 TH2PolyBin::TH2PolyBin()
1344 TH2PolyBin::TH2PolyBin(TObject *poly, Int_t bin_number)
1347 fNumber = bin_number;
1360 TH2PolyBin::~TH2PolyBin()
1362 if (fPoly)
delete fPoly;
1368 Double_t TH2PolyBin::GetArea()
1373 if (fPoly->IsA() == TGraph::Class()) {
1374 TGraph *g = (TGraph*)fPoly;
1376 fArea = g->Integral(0,bn-1);
1379 if (fPoly->IsA() == TMultiGraph::Class()) {
1380 TMultiGraph *mg = (TMultiGraph*)fPoly;
1381 TList *gl = mg->GetListOfGraphs();
1382 if (!gl)
return fArea;
1385 while ((g = (TGraph*) next())) {
1387 fArea = fArea + g->Integral(0,bn-1);
1398 Double_t TH2PolyBin::GetXMax()
1400 if (fXmax != -1111)
return fXmax;
1405 if (fPoly->IsA() == TGraph::Class()) {
1406 TGraph *g = (TGraph*)fPoly;
1410 for (i=1; i<bn; i++) {
if (fXmax < bx[i]) fXmax = bx[i];}
1413 if (fPoly->IsA() == TMultiGraph::Class()) {
1414 TMultiGraph *mg = (TMultiGraph*)fPoly;
1415 TList *gl = mg->GetListOfGraphs();
1416 if (!gl)
return fXmax;
1419 Bool_t first = kTRUE;
1420 while ((g = (TGraph*) next())) {
1423 if (first) {fXmax = bx[0]; first = kFALSE;}
1424 for (i=0; i<bn; i++) {
if (fXmax < bx[i]) fXmax = bx[i];}
1434 Double_t TH2PolyBin::GetXMin()
1436 if (fXmin != -1111)
return fXmin;
1441 if (fPoly->IsA() == TGraph::Class()) {
1442 TGraph *g = (TGraph*)fPoly;
1446 for (i=1; i<bn; i++) {
if (fXmin > bx[i]) fXmin = bx[i];}
1449 if (fPoly->IsA() == TMultiGraph::Class()) {
1450 TMultiGraph *mg = (TMultiGraph*)fPoly;
1451 TList *gl = mg->GetListOfGraphs();
1452 if (!gl)
return fXmin;
1455 Bool_t first = kTRUE;
1456 while ((g = (TGraph*) next())) {
1459 if (first) {fXmin = bx[0]; first = kFALSE;}
1460 for (i=0; i<bn; i++) {
if (fXmin > bx[i]) fXmin = bx[i];}
1470 Double_t TH2PolyBin::GetYMax()
1472 if (fYmax != -1111)
return fYmax;
1477 if (fPoly->IsA() == TGraph::Class()) {
1478 TGraph *g = (TGraph*)fPoly;
1482 for (i=1; i<bn; i++) {
if (fYmax < by[i]) fYmax = by[i];}
1485 if (fPoly->IsA() == TMultiGraph::Class()) {
1486 TMultiGraph *mg = (TMultiGraph*)fPoly;
1487 TList *gl = mg->GetListOfGraphs();
1488 if (!gl)
return fYmax;
1491 Bool_t first = kTRUE;
1492 while ((g = (TGraph*) next())) {
1495 if (first) {fYmax = by[0]; first = kFALSE;}
1496 for (i=0; i<bn; i++) {
if (fYmax < by[i]) fYmax = by[i];}
1506 Double_t TH2PolyBin::GetYMin()
1508 if (fYmin != -1111)
return fYmin;
1513 if (fPoly->IsA() == TGraph::Class()) {
1514 TGraph *g = (TGraph*)fPoly;
1518 for (i=1; i<bn; i++) {
if (fYmin > by[i]) fYmin = by[i];}
1521 if (fPoly->IsA() == TMultiGraph::Class()) {
1522 TMultiGraph *mg = (TMultiGraph*)fPoly;
1523 TList *gl = mg->GetListOfGraphs();
1524 if (!gl)
return fYmin;
1527 Bool_t first = kTRUE;
1528 while ((g = (TGraph*) next())) {
1531 if (first) {fYmin = by[0]; first = kFALSE;}
1532 for (i=0; i<bn; i++) {
if (fYmin > by[i]) fYmin = by[i];}
1542 Bool_t TH2PolyBin::IsInside(Double_t x, Double_t y)
const
1546 if (fPoly->IsA() == TGraph::Class()) {
1547 TGraph *g = (TGraph*)fPoly;
1548 in = g->IsInside(x, y);
1551 if (fPoly->IsA() == TMultiGraph::Class()) {
1552 TMultiGraph *mg = (TMultiGraph*)fPoly;
1553 in = mg->IsInside(x, y);
1566 Bool_t TH2Poly::Add(TF1 *, Double_t, Option_t *)
1568 Error(
"Add",
"Not implement for TH2Poly");
1574 Bool_t TH2Poly::Add(
const TH1 *,
const TH1 *, Double_t, Double_t)
1576 Error(
"Add",
"Not implement for TH2Poly");
1582 Bool_t TH2Poly::Divide(TF1 *, Double_t)
1584 Error(
"Divide",
"Not implement for TH2Poly");
1590 Bool_t TH2Poly::Multiply(TF1 *, Double_t)
1592 Error(
"Multiply",
"Not implement for TH2Poly");
1597 Double_t TH2Poly::ComputeIntegral(Bool_t )
1599 Error(
"ComputeIntegral",
"Not implement for TH2Poly");
1600 return TMath::QuietNaN();
1604 TH1 * TH2Poly::FFT(TH1*, Option_t * )
1606 Error(
"FFT",
"Not implement for TH2Poly");
1611 TH1 * TH2Poly::GetAsymmetry(TH1* , Double_t, Double_t)
1613 Error(
"GetAsymmetry",
"Not implement for TH2Poly");
1618 Double_t TH2Poly::Interpolate(Double_t, Double_t)
1620 Error(
"Interpolate",
"Not implement for TH2Poly");
1621 return TMath::QuietNaN();