Binning scheme:
 =================================
TUnfoldBinning "binning" has 20 bins [1,21] nTH1x=20
  TUnfoldBinning "branch1" has 12 bins [1,13] nTH1x=12
   distribution: 12 bins
    "x" nbin=4
    "y" nbin=3
  TUnfoldBinning "branch2" has 6 bins [13,19] nTH1x=6
   distribution: 6 bins
    "x" nbin=3
    "y" nbin=2
  TUnfoldBinning "branch3" has 2 bins [19,21] nTH1x=2
   distribution: 2 bins
    "x" nbin=2
 
CreateEmptyBinMap
=======================
global bin:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
mapped to:  -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
 
branch1->FillBinMap1D(...,"y[C]",...,2)
=======================
global bin:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
mapped to:  -1  2  3  4  5  2  3  4  5  2  3  4  5 -1 -1 -1 -1 -1 -1 -1 -1 -1
 
dest |contributing bins
=====+======================================
   2 |#1 (branch1:y[0,1]:x[0,1])
   2 |#5 (branch1:y[1,2]:x[0,1])
   2 |#9 (branch1:y[2,3]:x[0,1])
=====+======================================
   3 |#2 (branch1:y[0,1]:x[1,2])
   3 |#6 (branch1:y[1,2]:x[1,2])
   3 |#10 (branch1:y[2,3]:x[1,2])
=====+======================================
   4 |#3 (branch1:y[0,1]:x[2,3])
   4 |#7 (branch1:y[1,2]:x[2,3])
   4 |#11 (branch1:y[2,3]:x[2,3])
=====+======================================
   5 |#4 (branch1:y[0,1]:x[3,4])
   5 |#8 (branch1:y[1,2]:x[3,4])
   5 |#12 (branch1:y[2,3]:x[3,4])
=====+======================================
 
branch2->FillBinMap1D(...,"x[C]",...,7)
=======================
global bin:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
mapped to:  -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  7  7  7  8  8  8 -1 -1 -1
 
dest |contributing bins
=====+======================================
   7 |#13 (branch2:y[0,1]:x[0,1])
   7 |#14 (branch2:y[0,1]:x[1,2])
   7 |#15 (branch2:y[0,1]:x[2,3])
=====+======================================
   8 |#16 (branch2:y[1,2]:x[0,1])
   8 |#17 (branch2:y[1,2]:x[1,2])
   8 |#18 (branch2:y[1,2]:x[2,3])
=====+======================================
 
binning->FillBinMap1D(...,"y[C]",...,1)
=======================
global bin:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
mapped to:  -1  1  2  3  4  1  2  3  4  1  2  3  4  5  6  7  5  6  7  8  9 -1
 
dest |contributing bins
=====+======================================
   1 |#1 (branch1:y[0,1]:x[0,1])
   1 |#5 (branch1:y[1,2]:x[0,1])
   1 |#9 (branch1:y[2,3]:x[0,1])
=====+======================================
   2 |#2 (branch1:y[0,1]:x[1,2])
   2 |#6 (branch1:y[1,2]:x[1,2])
   2 |#10 (branch1:y[2,3]:x[1,2])
=====+======================================
   3 |#3 (branch1:y[0,1]:x[2,3])
   3 |#7 (branch1:y[1,2]:x[2,3])
   3 |#11 (branch1:y[2,3]:x[2,3])
=====+======================================
   4 |#4 (branch1:y[0,1]:x[3,4])
   4 |#8 (branch1:y[1,2]:x[3,4])
   4 |#12 (branch1:y[2,3]:x[3,4])
=====+======================================
   5 |#13 (branch2:y[0,1]:x[0,1])
   5 |#16 (branch2:y[1,2]:x[0,1])
=====+======================================
   6 |#14 (branch2:y[0,1]:x[1,2])
   6 |#17 (branch2:y[1,2]:x[1,2])
=====+======================================
   7 |#15 (branch2:y[0,1]:x[2,3])
   7 |#18 (branch2:y[1,2]:x[2,3])
=====+======================================
   8 |#19 (branch3:x[0,1])
=====+======================================
   9 |#20 (branch3:x[1,2])
=====+======================================
   
#include <iostream>
#include <fstream>
#include <iomanip>
#include <map>
 
using namespace std;
 
 
void testUnfold6()
{
  ofstream dtdFile("tunfoldbinning.dtd");
  dtdFile.close();
  if(error) cout<<"error="<<error<<" from TDOMParser\n";
  if(!binning) {
     cout<<"error: can not read binning (document empty?)\n";
  } else {
     cout<<"Binning scheme:\n =================================\n";
     PrintBinMap(binning,"CreateEmptyBinMap",binMap);
 
     PrintBinMap(binning,"branch1->FillBinMap1D(...,\"y[C]\",...,2)",binMap);
 
     delete [] binMap;
     PrintBinMap(binning,"branch2->FillBinMap1D(...,\"x[C]\",...,7)",binMap);
 
     delete [] binMap;
     PrintBinMap(binning,"binning->FillBinMap1D(...,\"y[C]\",...,1)",binMap);
 
 
     delete [] binMap;
 
  }
}
 
 
   cout<<"\n"<<where<<"\n=======================\n";
   cout<<"global bin:";
      cout<<setw(3)<<i;
   }
   cout<<"\n";
   cout<<"mapped to: ";
      cout<<setw(3)<<binMap[i];
   }
   cout<<"\n";
   map<int,vector<int> > destBin;
      destBin[binMap[i]].push_back(i);
   }
   bool printed=false;
   for(map<int,vector<int> >::const_iterator i=destBin.begin();i!=destBin.end();i++) {
      if((*i).first>=0) {
         if(!printed) {
            cout<<"\ndest |contributing bins\n"
                <<"=====+======================================\n";
            printed=true;
         }
         for(size_t j=0;j<(*i).second.size();j++) {
            cout<<setw(4)<<(*i).first<<" |";
            cout<<setw(3)<<binning->
GetBinName((*i).second[j])<<
"\n";
 
         }
         cout<<"=====+======================================\n";
      }
   }
}
R__EXTERN TSystem * gSystem
 
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
 
Int_t ParseFile(const char *filename) override
Parse the XML file where filename is the XML file name.
 
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
 
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
 
XML interfate to binning schemes, for use with the unfolding algorithm TUnfoldDensity.
 
static Int_t ExportXML(const TUnfoldBinning &binning, std::ostream &out, Bool_t writeHeader, Bool_t writeFooter, Int_t indent=0)
Export a binning scheme to a stream in XML format.
 
static TUnfoldBinningXML * ImportXML(const TXMLDocument *document, const char *name)
Import a binning scheme from an XML file.
 
static void WriteDTD(const char *fileName="tunfoldbinning.dtd")
Write dtd file.
 
Binning schemes for use with the unfolding algorithm TUnfoldDensity.
 
void PrintStream(std::ostream &out, Int_t indent=0, int debug=0) const
Print some information about this binning tree.
 
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,...
 
TString GetBinName(Int_t iBin) const
Get the name of a bin.
 
Int_t GetEndBin(void) const
last+1 bin of this node (includes children)
 
Int_t * CreateEmptyBinMap(void) const
Create an empty bin map, useful together with the getter methods of class TUnfold and TUnfoldSys.
 
TUnfoldBinning const * FindNode(char const *name) const
Traverse the tree and return the first node which matches the given name.
 
TXMLDocument contains a pointer to an xmlDoc structure, after the parser returns a tree built during ...