138using std::ofstream, std::stringstream;
 
  150      <<
"<!ELEMENT TUnfoldBinning (BinningNode)+ >\n" 
  151      <<
"<!ELEMENT BinningNode ((Bins?,BinningNode*)|(Binfactorlist?,Axis,BinningNode*)) >\n" 
  152      <<
"<!ATTLIST BinningNode name ID #REQUIRED firstbin CDATA \"-1\"\n" 
  153      <<
"    factor CDATA \"1.\">\n" 
  154      <<
"<!ELEMENT Axis ((Bin+,Axis?)|(Axis)) >\n" 
  155      <<
"<!ATTLIST Axis name CDATA #REQUIRED lowEdge CDATA #REQUIRED>\n" 
  156      <<
"<!ELEMENT Binfactorlist (#PCDATA)>\n" 
  157      <<
"<!ATTLIST Binfactorlist length CDATA #REQUIRED>\n" 
  158      <<
"<!ELEMENT Bin EMPTY>\n" 
  159      <<
"<!ATTLIST Bin width CDATA #REQUIRED location CDATA #IMPLIED\n" 
  160      <<
"    center CDATA #IMPLIED repeat CDATA #IMPLIED>\n" 
  161      <<
"<!ELEMENT Bins (BinLabel)* >\n" 
  162      <<
"<!ATTLIST Bins nbin CDATA #REQUIRED>\n" 
  163      <<
"<!ELEMENT BinLabel EMPTY>\n" 
  164      <<
"<!ATTLIST BinLabel index CDATA #REQUIRED name CDATA #REQUIRED>\n";
 
 
  196          node=node->GetNextNode()) {
 
  199            node->GetAttributes()) {
 
  201            TIterator *i=node->GetAttributes()->MakeIterator();
 
 
  230   const char *
name=
nullptr;
 
  240      if(!
attName.CompareTo(
"name")) {
 
  243      if(!
attName.CompareTo(
"factor")) {
 
  257            if(
child->GetAttributes()) {
 
  258               i=
child->GetAttributes()->MakeIterator();
 
  261                  if(!
attName.CompareTo(
"nbin")) {
 
  273                  i=
binName->GetAttributes()->MakeIterator();
 
  278                     if(!
attName.CompareTo(
"index")) {
 
  281                     if(!
attName.CompareTo(
"name")) {
 
  321            i=
child->GetAttributes()->MakeIterator();
 
  324               if(!
attName.CompareTo(
"length")) {
 
  329            if(
length==
r->GetDistributionNumberOfBins()) {
 
  341               child->Error(
"ImportXMLNode",
"while reading per-bin factors" 
  342                            " node=%s length=%d (expected %d)",
r->GetName(),
 
  343                            length,
r->GetDistributionNumberOfBins());
 
  345               child->Error(
"ImportXMLNode",
"while reading per-bin factors" 
  346                            " TUnfoldBinning=%s expected %d found %d",
 
  362            child->GetAttributes()) {
 
 
  393         if(!
attName.CompareTo(
"name")) {
 
  396         if(!
attName.CompareTo(
"lowEdge")) {
 
  410               i=
child->GetAttributes()->MakeIterator();
 
  414                  if(!
attName.CompareTo(
"location")) {
 
  418                  if(!
attName.CompareTo(
"repeat")) {
 
  424                                "attribute repeat=%d changed to repeat=1",
 
  429                  node->
Error(
"AddAxisXML",
 
  430     "underflow/overflow can not have repeat!=1 attribute");
 
  440                  i=
child->GetAttributes()->MakeIterator();
 
  443                     if(!
attName.CompareTo(
"width")) {
 
  448                     node->
Error(
"AddAxisXML",
 
  449                                 "bin withd can not be smaller than zero");
 
 
  483     out<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" 
  484        <<
"<!DOCTYPE TUnfoldBinning SYSTEM \"tunfoldbinning.dtd\">\n" 
  485        <<
"<TUnfoldBinning>\n";
 
  488  out<<
trailer<<
"<BinningNode name=\""<<binning.
GetName()<<
"\" firstbin=\"" 
  494     out<<
trailer<<
" <Binfactorlist length=\"" 
  497        if(!(i % 10)) out<<
trailer<<
" ";
 
  502     out<<
trailer<<
" </Binfactorlist>\n";
 
  510       out<<
trailer<<
"  <BinLabel index=\""<<i<<
"\" name=\"" 
  511     <<
name->GetString()<<
"\" />\n";
 
  519     <<
"\" lowEdge=\""<<(*edges)[0]<<
"\">\n";
 
  521   out<<
axisTrailer<<
" <Bin location=\"underflow\" width=\"" 
  529        for(
Int_t j=i+1;
j<edges->GetNrows()-1;
j++) {
 
  542              <<
width<<
"\" center=\""<<center<<
"\" />\n";
 
  545              <<
"\" width=\""<<
width<<
"\" center=\""<<center<<
"\" />\n";
 
  550   out<<
axisTrailer<<
" <Bin location=\"overflow\" width=\"" 
  564  out<<
trailer<<
"</BinningNode>\n";
 
  566     out<<
"</TUnfoldBinning>\n";
 
  568  return out.fail() ? 0 : 1;
 
 
static void indent(ostringstream &buf, int indent_level)
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
 
Option_t Option_t TPoint TPoint const char text
 
TVectorT< Double_t > TVectorD
 
Array of doubles (64 bits per element).
 
void Set(Int_t n) override
Set size of this array to n doubles.
 
const Double_t * GetArray() const
 
Iterator abstract base class.
 
virtual TObject * Next()=0
 
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Return a list iterator.
 
const char * GetName() const override
Returns name of object.
 
Collectable string class.
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
 
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
 
Int_t Atoi() const
Return integer value of string.
 
Double_t Atof() const
Return floating-point value contained in string.
 
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
 
void AddAxisXML(TXMLNode *node)
import axis from XML node
 
static TUnfoldBinningXML * ImportXMLNode(TXMLNode *node)
recursively import one node from the XML tree
 
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
 
TUnfoldBinningXML(const char *name=nullptr, Int_t nBins=0, const char *binNames=nullptr)
construct a new binning scheme, for use with the root streamer
 
Binning schemes for use with the unfolding algorithm TUnfoldDensity.
 
Bool_t HasOverflow(int axis) const
check whether the axis has an overflow bin
 
virtual Double_t GetDistributionOverflowBinWidth(Int_t axis) const
return bin width assigned to the overflow bin
 
Int_t GetDistributionDimension(void) const
query dimension of this node's distribution
 
virtual Double_t GetDistributionUnderflowBinWidth(Int_t axis) const
return bin width assigned to the underflow bin
 
Int_t GetDistributionNumberOfBins(void) const
number of bins in the distribution possibly including under/overflow
 
Double_t GetGlobalFactor(void) const
return global scaling factor for this node
 
Bool_t HasUnconnectedBins(void) const
check whether there are bins but no axis
 
virtual Double_t GetBinFactor(Int_t iBin) const
return scaling factor for the given global bin number
 
Bool_t HasUnderflow(int axis) const
check whether an axis has an underflow bin
 
virtual Double_t GetDistributionBinCenter(Int_t axis, Int_t bin) const
return bin center for a given axis and bin number
 
virtual Bool_t IsBinFactorGlobal(void) const
check whether there is only a global scaling factor for this node
 
TString GetDistributionAxisLabel(Int_t axis) const
get name of an axis
 
const TObjString * GetUnconnectedBinName(Int_t bin) const
return the bin names of unconnected bins
 
TVectorD const * GetDistributionBinning(Int_t axis) const
get vector of bin borders for one axis
 
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
 
Int_t GetStartBin(void) const
first bin of this node
 
TUnfoldBinning const * GetChildNode(void) const
first daughter node
 
static const char * GetTUnfoldVersion(void)
return a string describing the TUnfold version
 
TXMLAttribute is the attribute of an Element.
 
TXMLDocument contains a pointer to an xmlDoc structure, after the parser returns a tree built during ...
 
TXMLNode * GetRootNode() const
Returns the root element node.
 
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
 
TList * GetAttributes()
Returns a list of node's attribute if any, returns 0 if no attribute.
 
TXMLNode * GetChildren()
Returns the node's child if any, returns 0 if no child.
 
const char * GetNodeName() const
Returns the node's name.
 
EXMLElementType GetNodeType() const
Returns the node's type.
 
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.