128 while(childNode)
delete childNode;
130 if(GetParentNode() && (GetParentNode()->GetChildNode()==
this)) {
131 parentNode->childNode=nextNode;
133 if(GetPrevNode()) prevNode->nextNode=nextNode;
134 if(GetNextNode()) nextNode->prevNode=prevNode;
136 delete fAxisLabelList;
137 if(fBinFactorFunction) {
138 if(!dynamic_cast<TF1 *>(fBinFactorFunction))
139 delete fBinFactorFunction;
156 fAxisList->SetOwner();
157 fAxisLabelList->SetOwner();
160 fDistributionSize=nBins;
161 fBinFactorFunction=0;
162 fBinFactorConstant=1.0;
172 if(startWithRootNode) {
173 return GetRootNode()->UpdateFirstLastBin(
kFALSE);
178 fFirstBin=GetPrevNode()->GetEndBin();
179 }
else if(GetParentNode()) {
182 fFirstBin=GetParentNode()->GetStartBin()+
183 GetParentNode()->GetDistributionNumberOfBins();
191 if((!GetChildNode())&&(GetDistributionDimension()==1)&&
192 (fHasUnderflow==1)) {
196 fLastBin=fFirstBin+fDistributionSize;
199 fLastBin=node->UpdateFirstLastBin(
kFALSE);
213 :
TNamed(name ? name :
"",name ? name :
"")
217 TString nameString(binNames);
218 delete fAxisLabelList;
219 fAxisLabelList=nameString.Tokenize(
";");
221 UpdateFirstLastBin();
236 AddAxis(axis,includeUnderflow,includeOverflow);
237 UpdateFirstLastBin();
250 (
const char *name,
Int_t nBins,
const char *binNames)
268 "binning \"%s\" already has parent \"%s\", can not be added to %s",
274 "binning \"%s\" has previous node \"%s\", can not be added to %s",
280 "binning \"%s\" has next node \"%s\", can not be added to %s",
299 UpdateFirstLastBin();
323 Fatal(
"AddAxis",
"number of bins %d is not positive",
327 Fatal(
"AddAxis",
"xmin=%f required to be smaller than xmax=%f",
333 for(
Int_t i=0;i<=nBin;i++) {
334 binBorders[i]=x+i*dx;
336 r=AddAxis(name,nBin,binBorders,hasUnderflow,hasOverflow);
337 delete [] binBorders;
358 for(
Int_t i=0;i<nBin;i++) {
362 Bool_t r=AddAxis(axis.
GetTitle(),nBin,binBorders,hasUnderflow,hasOverflow);
363 delete [] binBorders;
383 if(HasUnconnectedBins()) {
384 Fatal(
"AddAxis",
"node already has %d bins without axis",
385 GetDistributionNumberOfBins());
387 Fatal(
"AddAxis",
"number of bins %d is not positive",
392 for(
Int_t i=0;i<=nBin;i++) {
393 (*bins)(i)=binBorders[i];
395 Fatal(
"AddAxis",
"bin border %d is not finite",i);
397 }
else if((i>0)&&((*bins)(i)<=(*bins)(i-1))) {
398 Fatal(
"AddAxis",
"bins not in order x[%d]=%f <= %f=x[%d]",
399 i,(*bins)(i),(*bins)(i-1),i-1);
404 Int_t axis=fAxisList->GetEntriesFast();
405 Int_t bitMask=1<<axis;
408 fHasUnderflow |= bitMask;
411 fHasUnderflow &= ~bitMask;
414 fHasOverflow |= bitMask;
417 fHasOverflow &= ~bitMask;
419 fAxisList->AddLast(bins);
420 fAxisLabelList->AddLast(
new TObjString(name));
421 if(!fDistributionSize) fDistributionSize=1;
422 fDistributionSize *= nBinUO;
423 UpdateFirstLastBin();
438 for(
Int_t i=0;i<indent;i++) out<<
" ";
439 out<<
"TUnfoldBinning \""<<
GetName()<<
"\" has ";
440 Int_t nBin=GetEndBin()-GetStartBin();
447 <<GetStartBin()<<
","<<GetEndBin()<<
"] nTH1x=" 448 <<GetTH1xNumberOfBins()
450 if(GetDistributionNumberOfBins()) {
451 for(
Int_t i=0;i<indent;i++) out<<
" ";
452 out<<
" distribution: "<<GetDistributionNumberOfBins()<<
" bins\n";
453 if(fAxisList->GetEntriesFast()) {
456 for(
Int_t axis=0;axis<GetDistributionDimension();axis++) {
457 for(
Int_t i=0;i<indent;i++) out<<
" ";
459 <<GetDistributionAxisLabel(axis)
460 <<
"\" nbin="<<GetDistributionBinning(axis)->GetNrows()-1;
461 if(HasUnderflow(axis)) out<<
" plus underflow";
462 if(HasOverflow(axis)) out<<
" plus overflow";
466 for(
Int_t i=0;i<indent;i++) out<<
" ";
468 for(
Int_t i=0;i<indent;i++) out<<
" ";
470 for(
Int_t ibin=0;(ibin<GetDistributionNumberOfBins())&&
471 (ibin<fAxisLabelList->GetEntriesFast());ibin++) {
473 if(GetDistributionAxisLabel(ibin)) {
474 out<<GetDistributionAxisLabel(ibin);
481 for(
int iBin=GetStartBin();iBin<GetEndBin();iBin++) {
482 for(
Int_t i=0;i<indent;i++) out<<
" ";
483 out<<GetBinName(iBin)
484 <<
" size="<<GetBinSize(iBin)
485 <<
" factor="<<GetBinFactor(iBin);
512 fBinFactorConstant=normalisation;
513 if(fBinFactorFunction) {
514 if(!dynamic_cast<TF1 *>(fBinFactorFunction))
515 delete fBinFactorFunction;
517 fBinFactorFunction=binfactor;
529 SetBinFactor(normalisation,userFunc);
545 if((!name)||(!TString(
GetName()).CompareTo(name))) {
590 (
const char *histogramName,
const char *histogramTitle,
Int_t const *axisList)
599 for(iEnd=2;iEnd>0;iEnd--) {
600 if(axisList[iEnd]>=0)
break;
602 for(
Int_t i=0;i<=iEnd;i++) {
607 r += GetNonemptyNode()->GetDistributionAxisLabel(axisList[i]);
634 (
const char *histogramName,
const char *histogramTitle,
645 }
else if(xAxis>=0) {
646 r += GetNonemptyNode()->GetDistributionAxisLabel(xAxis);
651 }
else if(yAxis>=0) {
684 (
Bool_t originalAxisBinning,
const char *axisSteering)
const 686 Int_t axisBins[3],axisList[3];
687 GetTHxxBinning(originalAxisBinning ? 1 : 0,axisBins,axisList,
742 (
const char *histogramName,
Bool_t originalAxisBinning,
Int_t **binMap,
743 const char *histogramTitle,
const char *axisSteering)
const 745 Int_t nBin[3],axisList[3];
746 Int_t nDim=GetTHxxBinning(originalAxisBinning ? 3 : 0,nBin,axisList,
749 TString title=BuildHistogramTitle(histogramName,histogramTitle,axisList);
760 r=
new TH3D(histogramName,title,
765 r=
new TH2D(histogramName,title,
773 if(originalAxisBinning) {
775 "Original binning can not be represented as THxx");
777 r=
new TH1D(histogramName,title,nBin[0],0.5,nBin[0]+0.5);
781 *binMap=CreateBinMap(r,nDim,axisList,axisSteering);
803 (
const char *histogramName,
Bool_t originalAxisBinning,
Int_t **binMap,
804 const char *histogramTitle,
const char *axisSteering)
const 806 Int_t nBin[3],axisList[3];
807 Int_t nDim=GetTHxxBinning(originalAxisBinning ? 1 : 0,nBin,axisList,
809 TString title=BuildHistogramTitle(histogramName,histogramTitle,axisList);
813 GetNonemptyNode()->fAxisList->At(axisList[0]);
817 if(originalAxisBinning) {
818 Info(
"CreateErrorMatrixHistogram",
819 "Original binning can not be represented on one axis");
821 r=
new TH2D(histogramName,title,nBin[0],0.5,nBin[0]+0.5,
822 nBin[0],0.5,nBin[0]+0.5);
826 *binMap=CreateBinMap(r,nDim,axisList,axisSteering);
847 char const *histogramName,
Bool_t originalXAxisBinning,
848 Bool_t originalYAxisBinning,
char const *histogramTitle)
850 Int_t nBinX[3],axisListX[3];
852 xAxis->
GetTHxxBinning(originalXAxisBinning ? 1 : 0,nBinX,axisListX,0);
854 Int_t nBinY[3],axisListY[3];
856 yAxis->
GetTHxxBinning(originalYAxisBinning ? 1 : 0,nBinY,axisListY,0);
859 (histogramName,histogramTitle,axisListX[0],yAxis,axisListY[0]);
866 return new TH2D(histogramName,title,
870 return new TH2D(histogramName,title,
872 nBinY[0],0.5,0.5+nBinY[0]);
878 return new TH2D(histogramName,title,
879 nBinX[0],0.5,0.5+nBinX[0],
882 return new TH2D(histogramName,title,
883 nBinX[0],0.5,0.5+nBinX[0],
884 nBinY[0],0.5,0.5+nBinY[0]);
905 const char *axisSteering)
const 907 for(
Int_t i=0;i<3;i++) {
914 (maxDim,axisBins,axisList,axisSteering);
917 axisBins[0]=GetTHxxBinsRecursive(axisSteering);
969 Int_t isOptionGiven[3];
970 DecodeAxisSteering(axisSteering,
"CUO",isOptionGiven);
972 Int_t numDimension=GetDistributionDimension();
974 for(
Int_t i=0;i<numDimension;i++) {
975 if(isOptionGiven[0] & (1<<i))
continue;
978 if((r>0)&&(r<=maxDim)) {
984 for(
Int_t i=0;i<numDimension;i++) {
985 if(isOptionGiven[0] & (1<<i))
continue;
987 axisBins[
r]=GetDistributionBinning(i)->GetNrows()-1;
993 if(HasUnconnectedBins() || (GetDistributionNumberOfBins()<=0)) {
994 axisBins[0] = GetDistributionNumberOfBins();
997 for(
Int_t i=0;i<numDimension;i++) {
999 if(isOptionGiven[0] & mask)
continue;
1000 Int_t nBinI=GetDistributionBinning(i)->GetNrows()-1;
1001 if((fHasUnderflow & mask)&& !(isOptionGiven[1] & mask)) nBinI++;
1002 if((fHasOverflow & mask)&& !(isOptionGiven[2] & mask)) nBinI++;
1026 r +=child->GetTHxxBinsRecursive(axisSteering);
1029 Int_t axisBins[3],axisList[3];
1030 GetTHxxBinningSingleNode(0,axisBins,axisList,axisSteering);
1044 Int_t nMax=GetRootNode()->GetEndBin()+1;
1046 for(
Int_t i=0;i<nMax;i++) {
1061 Int_t nMax=GetRootNode()->GetEndBin()+1;
1062 if((globalBin<0)||(globalBin>=nMax)) {
1063 Error(
"SetBinMapEntry",
"global bin number %d outside range (max=%d)",
1066 binMap[globalBin]=destBin;
1085 Int_t axisBins[3],axisList[3];
1086 Int_t nDim=GetTHxxBinningSingleNode(3,axisBins,axisList,axisSteering);
1087 if((nDim==1)|| !GetDistributionDimension()) {
1088 r+=FillBinMapSingleNode(0,r,0,0,axisSteering,binMap);
1090 Error(
"FillBinMap1D",
"distribution %s with steering=%s is not 1D",
1091 (
char *)
GetName(),axisSteering);
1095 r =child->FillBinMap1D(binMap,axisSteering,r);
1147 Int_t *
r=CreateEmptyBinMap();
1148 Int_t startBin=GetRootNode()->GetStartBin();
1153 FillBinMapSingleNode(hist,startBin,nDim,axisList,axisSteering,r);
1155 Fatal(
"CreateBinMap",
"called with nDim=%d but GetNonemptyNode()=0",
1159 FillBinMapRecursive(startBin,axisSteering,r);
1179 nbin = FillBinMapSingleNode(0,startBin,0,0,axisSteering,binMap);
1182 nbin += child->FillBinMapRecursive(startBin+nbin,axisSteering,binMap);
1215 const char *axisSteering,
Int_t *binMap)
const 1221 Int_t isOptionGiven[3+10];
1222 DecodeAxisSteering(axisSteering,
"CUO0123456789",isOptionGiven);
1223 Int_t haveSelectedBin=0;
1224 for(
Int_t i=3;i<3+10;i++) {
1225 haveSelectedBin |= isOptionGiven[i];
1228 Int_t axisBins[MAXDIM];
1229 Int_t dimension=GetDistributionDimension();
1230 Int_t axisNbin[MAXDIM];
1231 for(
Int_t i=0;i<dimension;i++) {
1232 const TVectorD *binning=GetDistributionBinning(i);
1235 for(
Int_t i=0;i<GetDistributionNumberOfBins();i++) {
1236 Int_t globalBin=GetStartBin()+i;
1240 Fatal(
"FillBinMapSingleNode",
1241 "bin %d outside binning scheme",
1244 Fatal(
"FillBinMapSingleNode",
1245 "bin %d located in %s %d-%d rather than %s %d=%d",
1246 i,(
const char *)dest->
GetName(),
1248 (
const char *)
GetName(),GetStartBin(),GetEndBin());
1253 for(
Int_t axis=0;axis<dimension;axis++) {
1254 Int_t mask=(1<<axis);
1256 if(((axisBins[axis]<0)&&(isOptionGiven[1] & mask))||
1257 ((axisBins[axis]>=axisNbin[axis])&&(isOptionGiven[2] & mask)))
1260 if((axisBins[axis]>=0)&&(axisBins[axis]<axisNbin[axis])&&
1261 (haveSelectedBin & mask)) {
1262 if(!(isOptionGiven[3+axisBins[axis]] & mask)) skip=
kTRUE;
1273 ibin[0]=ibin[1]=ibin[2]=0;
1274 for(
Int_t hdim=0;hdim<nDim;hdim++) {
1275 Int_t axis=axisList[hdim];
1276 ibin[hdim]=axisBins[axis]+1;
1278 binMap[globalBin]=hist->
GetBin(ibin[0],ibin[1],ibin[2]);
1279 }
else if(nDim==1) {
1287 Error(
"FillBinMapSingleNode",
"inconsistent dimensions %d %d",nDim,
1291 if(axisList[ii]>=0) {
1292 binMap[globalBin]=axisBins[axisList[ii]]+1;
1297 Fatal(
"FillBinMapSingleNode",
"inconsistent dimensions %d %d",nDim,
1307 for(
Int_t axis=dimension-1;axis>=0;axis--) {
1308 Int_t mask=(1<<axis);
1309 if(isOptionGiven[0] & mask) {
1313 Int_t iBin=axisBins[axis];
1314 Int_t nMax=axisNbin[axis];
1315 if((fHasUnderflow & ~isOptionGiven[1]) & mask) {
1319 if((fHasOverflow & ~isOptionGiven[2]) & mask) {
1324 binMap[globalBin] = startBin +
r;
1326 binMap[globalBin] = startBin + axisBins[0];
1333 for(
Int_t axis=dimension-1;axis>=0;axis--) {
1334 Int_t mask=(1<<axis);
1335 if(isOptionGiven[0] & mask) {
1339 Int_t nMax=axisNbin[axis];
1340 if((fHasUnderflow & ~isOptionGiven[1]) & mask) {
1343 if((fHasOverflow & ~isOptionGiven[2]) & mask) {
1349 nbin=GetDistributionNumberOfBins();
1375 (
const char *histogramName,
const TH1 *globalBins,
1376 const TH2 *globalBinsEmatrix,
Bool_t originalAxisBinning,
1377 const char *axisSteering)
const 1380 TH1 *
r=CreateHistogram(histogramName,originalAxisBinning,&binMap,0,
1386 if(binMap[iSrc]>nMax) nMax=binMap[iSrc];
1394 Int_t iDest=binMap[iSrc];
1398 if(!globalBinsEmatrix) {
1403 if(binMap[jSrc]==iDest) {
1411 for(
Int_t i=0;i<nMax;i++) {
1435 if(GetDistributionDimension()!=1) {
1436 Fatal(
"GetBinNumber",
1437 "called with 1 argument for %d dimensional distribution",
1438 GetDistributionDimension());
1440 return GetGlobalBinNumber(&x);
1455 if(GetDistributionDimension()!=2) {
1456 Fatal(
"GetBinNumber",
1457 "called with 2 arguments for %d dimensional distribution",
1458 GetDistributionDimension());
1463 return GetGlobalBinNumber(xx);
1484 if(GetDistributionDimension()!=3) {
1485 Fatal(
"GetBinNumber",
1486 "called with 3 arguments for %d dimensional distribution",
1487 GetDistributionDimension());
1493 return GetGlobalBinNumber(xx);
1515 if(GetDistributionDimension()!=4) {
1516 Fatal(
"GetBinNumber",
1517 "called with 4 arguments for %d dimensional distribution",
1518 GetDistributionDimension());
1525 return GetGlobalBinNumber(xx);
1548 if(GetDistributionDimension()!=5) {
1549 Fatal(
"GetBinNumber",
1550 "called with 5 arguments for %d dimensional distribution",
1551 GetDistributionDimension());
1559 return GetGlobalBinNumber(xx);
1583 if(GetDistributionDimension()!=6) {
1584 Fatal(
"GetBinNumber",
1585 "called with 6 arguments for %d dimensional distribution",
1586 GetDistributionDimension());
1595 return GetGlobalBinNumber(xx);
1630 if(!GetDistributionDimension()) {
1631 Fatal(
"GetBinNumber",
1632 "no axes are defined for node %s",
1635 Int_t iAxisBins[MAXDIM] = {0};
1636 for(
Int_t dim=0;dim<GetDistributionDimension();dim++) {
1641 if(!(x[dim]>=(*bins)[i0])) {
1644 }
else if(!(x[dim]<(*bins)[i1])) {
1650 if(x[dim]<(*bins)[i2]) {
1658 iAxisBins[dim]=iBin;
1660 Int_t r=ToGlobalBin(iAxisBins,isBelow,isAbove);
1679 Int_t axisBins[MAXDIM];
1688 for(
Int_t axis=0;axis<dimension;axis++) {
1689 TString thisAxisString=
1692 Int_t i=axisBins[axis];
1693 if(i<0) thisAxisString +=
"[ufl]";
1694 else if(i>=bins->
GetNrows()-1) thisAxisString +=
"[ofl]";
1699 axisString =
":"+thisAxisString+axisString;
1704 Int_t i=axisBins[0];
1705 if((i>=0)&&(i<distribution->fAxisLabelList->GetEntriesFast())) {
1725 Int_t axisBins[MAXDIM];
1732 Int_t pos=axisBins[axis];
1735 }
else if(pos>=bins->
GetNrows()-1) {
1738 r *= (*bins)(pos+1)-(*bins)(pos);
1757 return fBinFactorConstant;
1773 Int_t axisBins[MAXDIM];
1782 for(
Int_t axis=0;axis<dimension;axis++) {
1784 (axis,axisBins[axis]);
1786 r *=
function->EvalPar(x,
function->GetParameters());
1789 r *=
function->Eval(x[0]);
1795 r=(*vect)[iBin-GetStartBin()];
1797 Error(
"GetBinFactor",
1798 "internal error: user function is neither TF1 or TVectorD");
1829 Int_t axisBins[MAXDIM];
1837 if((axis>=0)&&(axis<dimension)) {
1840 Int_t nMax=GetDistributionBinning(axis)->GetNrows()-1;
1841 Int_t centerBin= axisBins[axis];
1842 axisBins[axis] =centerBin-1;
1844 if(HasUnderflow(axis)) {
1846 }
else if((axisBins[axis]<0)&&(nMax>=3)) {
1847 axisBins[axis]=nMax-1;
1850 *prev=ToGlobalBin(axisBins);
1855 axisBins[axis] =centerBin+1;
1857 if(HasOverflow(axis)) {
1859 }
else if((axisBins[axis]==nMax)&&(nMax>=3)) {
1863 *next=ToGlobalBin(axisBins);
1882 Int_t axisBins[MAXDIM];
1887 for(
Int_t axis=0;axis<dimension;axis++) {
1890 if(axisBins[axis]<0) *uStatus |= (1<<axis);
1891 if(axisBins[axis]>=nBin) *oStatus |= (1<<axis);
1900 return (!GetDistributionDimension())&&(GetDistributionNumberOfBins()>0);
1910 if(HasUnconnectedBins()) {
1911 if(bin<fAxisLabelList->GetEntriesFast()) {
1912 r=((
TObjString *
const)fAxisLabelList->At(bin));
1930 if((axis>=0)&&(axis<GetDistributionDimension())) {
1931 TVectorD const *bins=GetDistributionBinning(axis);
1934 if(includeUnderflow && HasUnderflow(axis)) {
1935 Double_t w=GetDistributionUnderflowBinWidth(axis);
1941 if(includeOverflow && HasOverflow(axis)) {
1942 Double_t w=GetDistributionOverflowBinWidth(axis);
1952 Error(
"GetDistributionAverageBinSize",
"axis %d does not exist",axis);
1970 TVectorD const *bins=GetDistributionBinning(axis);
1971 return (*bins)[1]-(*bins)[0];
1987 TVectorD const *bins=GetDistributionBinning(axis);
2010 TVectorD const *bins=GetDistributionBinning(axis);
2014 r=(*bins)[0]-0.5*GetDistributionUnderflowBinWidth(axis);
2015 }
else if(bin>=bins->
GetNrows()-1) {
2017 r=(*bins)[bins->
GetNrows()-1]+0.5*GetDistributionOverflowBinWidth(axis);
2019 r=0.5*((*bins)[bin+1]+(*bins)[bin]);
2038 Int_t dimension=GetDistributionDimension();
2040 if(isBelow) *isBelow=0;
2041 if(isAbove) *isAbove=0;
2043 for(
Int_t axis=dimension-1;axis>=0;axis--) {
2044 Int_t nMax=GetDistributionBinning(axis)->GetNrows()-1;
2045 Int_t i=axisBins[axis];
2046 if(HasUnderflow(axis)) {
2050 if(HasOverflow(axis)) nMax +=1;
2051 if((i>=0)&&(i<nMax)) {
2052 if(r>=0) r = r*nMax +i;
2055 if((i<0)&&(isBelow)) *isBelow |= 1<<axis;
2056 if((i>=nMax)&&(isAbove)) *isAbove |= 1<<axis;
2063 if((axisBins[0]>=0)&&(axisBins[0]<GetDistributionNumberOfBins()))
2064 r=GetStartBin()+axisBins[0];
2066 Fatal(
"ToGlobalBin",
"bad input %d for dimensionless binning %s %d",
2067 axisBins[0],(
const char *)
GetName(),
2068 GetDistributionNumberOfBins());
2087 if((globalBin>=GetStartBin())&&(globalBin<GetEndBin())) {
2089 for(node=GetChildNode();node && !
r; node=node->
GetNextNode()) {
2094 Int_t i=globalBin-GetStartBin();
2095 Int_t dimension=GetDistributionDimension();
2097 for(
int axis=0;axis<dimension;axis++) {
2098 Int_t nMax=GetDistributionBinning(axis)->GetNrows()-1;
2100 if(HasUnderflow(axis)) {
2104 if(HasOverflow(axis)) nMax +=1;
2105 axisBins[axis] += i % nMax;
2136 (
const char *axisSteering,
const char *options,
Int_t *isOptionGiven)
const 2138 Int_t nOpt=TString(options).Length();
2139 for(
Int_t i=0;i<nOpt;i++) isOptionGiven[i]=0;
2141 TObjArray *patterns=TString(axisSteering).Tokenize(
";");
2143 Int_t nAxis=fAxisLabelList->GetEntries();
2144 for(
Int_t i=0;i<nPattern;i++) {
2145 TString
const &pattern=((
TObjString *
const)patterns->
At(i))
2147 Int_t bracketBegin=pattern.Last(
'[');
2148 Int_t len=pattern.Length();
2149 if((bracketBegin>0)&&(pattern[len-1]==
']')) {
2150 TString axisId=pattern(0,bracketBegin);
2152 if((axisId[0]==
'*')&&(axisId.Length()==1)) {
2157 for(
Int_t j=0;j<nAxis;j++) {
2158 if(!axisId.CompareTo(GetDistributionAxisLabel(j))) {
2163 for(
Int_t o=0;o<nOpt;o++) {
2164 if(pattern.Last(options[o])>bracketBegin) {
2165 isOptionGiven[o] |= mask;
2169 Error(
"DecodeAxisSteering",
2170 "steering \"%s\" does not end with [options]",
2171 (
const char *)pattern);
virtual const char * GetName() const
Returns name of object.
Int_t FillBinMap1D(Int_t *binMap, const char *axisSteering, Int_t firstBinX) const
Map all global bins referenced by this node to the one-dimensional histogram destHist, starting with bin firstBinX.
std::string GetName(const std::string &scope_name)
const TObjString * GetUnconnectedBinName(Int_t bin) const
Return the bin names of unconnected bins.
TUnfoldBinning * parentNode
mother node
TH1 * CreateHistogram(const char *histogramName, Bool_t originalAxisBinning=kFALSE, Int_t **binMap=0, const char *histogramTitle=0, const char *axisSteering=0) const
Create a THxx histogram capable to hold the bins of this binning node and its children.
TH2D * CreateErrorMatrixHistogram(const char *histogramName, Bool_t originalAxisBinning, Int_t **binMap=0, const char *histogramTitle=0, const char *axisSteering=0) const
Create a TH2D histogram capable to hold a covariance matrix.
virtual Double_t GetDistributionBinCenter(Int_t axis, Int_t bin) const
return bin center for a given axis and bin number
const TUnfoldBinning * GetNonemptyNode(void) const
Find a node which has non-empty distributions if there is none or if there are many, return zero.
void Fatal(const char *location, const char *msgfmt,...)
Collectable string class.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Double_t GetDistributionAverageBinSize(Int_t axis, Bool_t includeUnderflow, Bool_t includeOverflow) const
Get average bin size on the specified axis.
Int_t * CreateBinMap(const TH1 *hist, Int_t nDim, const Int_t *axisList, const char *axisSteering) const
Create mapping from global bin number to a histogram for this node.
TString BuildHistogramTitle2D(const char *histogramName, const char *histogramTitle, Int_t xAxis, const TUnfoldBinning *yAxisBinning, Int_t yAxis) const
Construct a histogram title for a 2D histogram with different binning schemes on x and y axis...
TUnfoldBinning const * ToAxisBins(Int_t globalBin, Int_t *axisBins) const
Return distribution in which the bin is located and bin numbers on the corresponding axes...
Double_t GetBinSize(Int_t iBin) const
Get N-dimensional bin size.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
TUnfoldBinning * nextNode
next sister
void GetBinUnderflowOverflowStatus(Int_t iBin, Int_t *uStatus, Int_t *oStatus) const
Return bit maps indicating underflow and overflow status.
void SetBinFactor(Double_t normalisation, TObject *factors)
Set normalisation factors which are used in calls to GetBinFactor().
void PrintStream(std::ostream &out, Int_t indent=0, int debug=0) const
Print some information about this binning tree.
TObject * At(Int_t idx) const
Int_t GetTHxxBinning(Int_t maxDim, Int_t *axisBins, Int_t *axisList, const char *axisSteering) const
Calculate properties of a THxx histogram to store this binning.
virtual ~TUnfoldBinning(void)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
TUnfoldBinning const * GetNextNode(void) const
next sister node
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t UpdateFirstLastBin(Bool_t startWithRootNode=kTRUE)
Update fFirstBin and fLastBin members of this node and its children.
Int_t ToGlobalBin(Int_t const *axisBins, Int_t *isBelow=0, Int_t *isAbove=0) const
Get global bin number, given axis bin numbers.
Double_t fBinFactorConstant
common scale factor for all bins of this node
virtual Int_t GetDimension() const
static const double x2[5]
Int_t GetEndBin(void) const
last+1 bin of this node (includes children)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
void SetBinMapEntry(Int_t *binMap, Int_t globalBin, Int_t destBin) const
Set one entry in a bin map.
The TNamed class is the base class for all named ROOT classes.
Double_t GetGlobalFactor(void) const
Return global scaling factor for this node.
void Initialize(Int_t nBins)
Initialize variables for a given number of bins.
static const double x4[22]
void Info(const char *location, const char *msgfmt,...)
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Int_t GetBinNeighbours(Int_t globalBin, Int_t axis, Int_t *prev, Double_t *distPrev, Int_t *next, Double_t *distNext, Bool_t isPeriodic=kFALSE) const
Get neighbour bins along the specified axis.
Int_t GetStartBin(void) const
first bin of this node
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
void Error(const char *location, const char *msgfmt,...)
TVectorT< Double_t > TVectorD
TVectorD const * GetDistributionBinning(Int_t axis) const
get vector of bin borders for one axis
Int_t GetDistributionDimension(void) const
query dimension of this node's distribution
Element * GetMatrixArray()
TUnfoldBinning const * GetParentNode(void) const
mother node
THist< 3, double, THistStatContent, THistStatUncertainty > TH3D
TH1 * ExtractHistogram(const char *histogramName, const TH1 *globalBins, const TH2 *globalBinsEmatrix=0, Bool_t originalAxisBinning=kTRUE, const char *axisSteering=0) const
Extract a distribution from the given set of global bins.
Bool_t AddAxis(const char *name, Int_t nBins, const Double_t *binBorders, Bool_t hasUnderflow, Bool_t hasOverflow)
Add an axis with the specified bin borders.
void DecodeAxisSteering(const char *axisSteering, const char *options, Int_t *isOptionGiven) const
Decode axis steering.
void SetBinFactorFunction(Double_t normalisation, TF1 *userFunc=0)
Set normalisation factor and function which are used in calls to GetBinFactor().
const char * GetTitle() const
Returns title of object.
Service class for 2-Dim histogram classes.
Class to manage histogram axis.
void Initialize(Bool_t useTMVAStyle=kTRUE)
virtual Double_t GetDistributionUnderflowBinWidth(Int_t axis) const
Return bin width assigned to the underflow bin.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Bool_t IsBinFactorGlobal(void) const
Check whether there is only a global scaling factor for this node.
TUnfoldBinning const * GetPrevNode(void) const
previous sister node
void Warning(const char *location, const char *msgfmt,...)
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
static TH2D * CreateHistogramOfMigrations(TUnfoldBinning const *xAxis, TUnfoldBinning const *yAxis, char const *histogramName, Bool_t originalXAxisBinning=kFALSE, Bool_t originalYAxisBinning=kFALSE, char const *histogramTitle=0)
Create a TH2D histogram capable to hold the bins of the two input binning schemes on the x and y axes...
Binning schemes for use with the unfolding algorithm TUnfoldDensity.
TString GetDistributionAxisLabel(Int_t axis) const
get name of an axis
static const double x1[5]
TObject * fBinFactorFunction
function to calculate a scale factor from bin centres (may be a TF1 or a TVectorD ...
TUnfoldBinning * prevNode
previous sister
Int_t * CreateEmptyBinMap(void) const
Create an empty bin map, useful together with the getter methods of class TUnfold and TUnfoldSys...
THist< 2, double, THistStatContent, THistStatUncertainty > TH2D
Int_t FillBinMapSingleNode(const TH1 *hist, Int_t startBin, Int_t nDim, const Int_t *axisList, const char *axisSteering, Int_t *binMap) const
Fill bin map for a single node.
Int_t GetGlobalBinNumber(Double_t x) const
Locate a bin in a one-dimensional distribution.
TString GetBinName(Int_t iBin) const
Get the name of a bin.
Mother of all ROOT objects.
you should not use this method at all Int_t Int_t z
Int_t GetTH1xNumberOfBins(Bool_t originalAxisBinning=kTRUE, const char *axisSteering=0) const
Return the number of histogram bins required when storing this binning in a one-dimensional histogram...
Int_t FillBinMapRecursive(Int_t startBin, const char *axisSteering, Int_t *binMap) const
Recursively fill bin map.
Bool_t HasUnconnectedBins(void) const
Check whether there are bins but no axis.
TUnfoldBinning const * GetRootNode(void) const
return root node of the binnig scheme
TObjArray * fAxisList
for each axis the bin borders (TVectorD)
virtual Double_t GetDistributionOverflowBinWidth(Int_t axis) const
Return bin width assigned to the overflow bin.
#define dest(otri, vertexptr)
TUnfoldBinning(const char *name=0, Int_t nBins=0, const char *binNames=0)
Create a new node without axis.
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
Int_t GetEntries() const
Return the number of objects in array (i.e.
Int_t GetTHxxBinningSingleNode(Int_t maxDim, Int_t *axisBins, Int_t *axisList, const char *axisSteering) const
Get the properties of a histogram capable to hold the distribution attached to this node...
Double_t Sqrt(Double_t x)
TString BuildHistogramTitle(const char *histogramName, const char *histogramTitle, Int_t const *axisList) const
Construct a title.
Int_t GetTHxxBinsRecursive(const char *axisSteering) const
Calculate number of bins required to store this binning with the given axisSteering.
TUnfoldBinning * AddBinning(TUnfoldBinning *binning)
Add a TUnfoldBinning as the last child of this node.
static char * skip(char **buf, const char *delimiters)
TUnfoldBinning const * FindNode(char const *name) const
Traverse the tree and return the first node which matches the given name.
virtual Double_t GetBinFactor(Int_t iBin) const
Return scaling factor for the given global bin number.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
static const double x3[11]
2-D histogram with a double per channel (see TH1 documentation)}