Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TUnfoldBinningXML.cxx
Go to the documentation of this file.
1// @(#)root/unfold:$Id$
2// Author: Stefan Schmitt DESY, 10/08/11
3
4/** \class TUnfoldBinningXML
5\ingroup Unfold
6XML interfate to binning schemes, for use with the unfolding algorithm
7TUnfoldDensity.
8
9Binning schemes are used to map analysis bins on a single histogram
10axis and back. The analysis bins may include unconnected bins (e.g
11nuisances for background normalisation) or various multidimensional
12histograms (signal bins, differential background normalisation bins, etc).
13
14If you use this software, please consider the following citation
15
16<b>S.Schmitt, JINST 7 (2012) T10003 [arXiv:1205.6201]</b>
17
18Detailed documentation and updates are available on
19http://www.desy.de/~sschmitt
20
21Please consult the documentation of the class TUnfoldBinning about how to use
22binning schemes. This class provides methods to read and write binning
23schemes in the XML language. There is also a method which writes out
24a dtd file for validation.
25
26### Example XML code
27The example below encodes two binning schemes, _detector_ and
28_generator_. The detector scheme consists of a single,
29three-dimensional distribution (pt,eta,discriminator). The generator
30scheme consists of two two-dimensional distributions, signal and background.
31
32~~~
33<?xml version="1.0" encoding="UTF-8" standalone="no"?>
34<!DOCTYPE TUnfoldBinning SYSTEM "tunfoldbinning.dtd">
35<TUnfoldBinning>
36<BinningNode name="detector" firstbin="1" factor="1">
37 <BinningNode name="detectordistribution" firstbin="1" factor="1">
38 <Axis name="pt" lowEdge="3.5">
39 <Bin repeat="3" width="0.5" />
40 <Bin repeat="3" width="1" />
41 <Bin width="2" />
42 <Bin width="3" />
43 <Bin location="overflow"/>
44 <Axis name="eta" lowEdge="-3">
45 <Bin repeat="2" width="0.5" />
46 <Bin width="1" />
47 <Bin repeat="4" width="0.5" />
48 <Bin width="1" />
49 <Bin repeat="2" width="0.5" />
50 <Axis name="discriminator" lowEdge="0">
51 <Bin width="0.15" />
52 <Bin repeat="2" width="0.35" />
53 <Bin width="0.15" />
54 </Axis>
55 </Axis>
56 </Axis>
57 </BinningNode>
58</BinningNode>
59<BinningNode name="generator" firstbin="1" factor="1">
60 <BinningNode name="signal" firstbin="1" factor="1">
61 <Axis name="ptgen" lowEdge="4">
62 <Bin location="underflow" />
63 <Bin width="1" />
64 <Bin width="2" />
65 <Bin width="3" />
66 <Bin location="overflow" />
67 <Axis name="etagen" lowEdge="-2">
68 <Bin location="underflow" />
69 <Bin width="1.5" />
70 <Bin width="1" />
71 <Bin width="1.5" />
72 <Bin location="overflow" />
73 </Axis>
74 </Axis>
75 </BinningNode>
76 <BinningNode name="background" firstbin="26" factor="1">
77 <Axis name="ptrec" lowEdge="3.5">
78 <Bin repeat="3" width="0.5" />
79 <Bin repeat="3" width="1" />
80 <Bin width="2" />
81 <Bin width="3" />
82 <Bin location="overflow" />
83 <Axis name="etarec" lowEdge="-3">
84 <Bin repeat="2" width="0.5" />
85 <Bin width="1" />
86 <Bin repeat="4" width="0.5" />
87 <Bin width="1" />
88 <Bin repeat="2" width="0.5" />
89 </Axis>
90 </Axis>
91 </BinningNode>
92</BinningNode>
93</TUnfoldBinning>
94~~~
95
96--------------------------------------------------------------------------------
97 This file is part of TUnfold.
98
99 TUnfold is free software: you can redistribute it and/or modify
100 it under the terms of the GNU General Public License as published by
101 the Free Software Foundation, either version 3 of the License, or
102 (at your option) any later version.
103
104 TUnfold is distributed in the hope that it will be useful,
105 but WITHOUT ANY WARRANTY; without even the implied warranty of
106 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107 GNU General Public License for more details.
108
109 You should have received a copy of the GNU General Public License
110 along with TUnfold. If not, see <http://www.gnu.org/licenses/>.
111
112<b>Version 17.6, with updated doxygen comments</b>
113
114#### History:
115 - Version 17.5, in parallel to changes in TUnfold
116 - Version 17.4, in parallel to changes in TUnfoldBinning
117 - Version 17.3, support for the "repeat" attribute for element Bin
118 - Version 17.2, initial version, numbered in parallel to TUnfold
119 */
120
121
122#include "TUnfold.h"
123#include "TUnfoldBinningXML.h"
124
125#include <TXMLDocument.h>
126#include <TXMLNode.h>
127#include <TXMLAttr.h>
128#include <TList.h>
129#include <TVectorD.h>
130
131#include <fstream>
132#include <sstream>
133
134// #define DEBUG
135
136using namespace std;
137
139
140/********************* XML **********************/
141
142////////////////////////////////////////////////////////////////////////////////
143/// Write dtd file.
144///
145/// \param[out] out stream for writing the dtd
146
147void TUnfoldBinningXML::WriteDTD(std::ostream &out) {
148 out
149 <<"<!-- TUnfold Version "<<TUnfold::GetTUnfoldVersion()<<" -->\n"
150 <<"<!ELEMENT TUnfoldBinning (BinningNode)+ >\n"
151 <<"<!ELEMENT BinningNode (BinningNode+|(Binfactorlist?,Axis)|Bins) >\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";
165}
166
167////////////////////////////////////////////////////////////////////////////////
168/// Write dtd file.
169///
170/// \param[in] file regular file for writing the dtd
171
173 ofstream out(file);
174 WriteDTD(out);
175}
176
177////////////////////////////////////////////////////////////////////////////////
178/// Import a binning scheme from an XML file.
179///
180/// \param[in] document XMP document tree
181/// \param[in] name identifier of the binning scheme
182///
183/// returns a new TUnfoldBinningXML, if <b>name</b> is found in <b>document</b>
184///
185/// import binning scheme from a XML document
186/// - document: the XML document
187/// - name: the name of the binning scheme to import
188/// if name==0, the first binning scheme found in the tree is imported
189
191(const TXMLDocument *document,const char *name) {
193 TXMLNode *root=document->GetRootNode();
194 TXMLNode *binningNode=0;
195 if(root && (!TString(root->GetNodeName()).CompareTo("TUnfoldBinning")) &&
197 // loop over all "BinningNode" entities
198 for(TXMLNode *node=root->GetChildren();node && !binningNode;
199 node=node->GetNextNode()) {
200 if(node->GetNodeType()==TXMLNode::kXMLElementNode &&
201 !TString(node->GetNodeName()).CompareTo("BinningNode") &&
202 node->GetAttributes()) {
203 // localize the BinningNode with the given name
204 TIterator *i=node->GetAttributes()->MakeIterator();
205 TXMLAttr *attr;
206 while((attr=(TXMLAttr *)i->Next())) {
207 if((!TString(attr->GetName()).CompareTo("name")) &&
208 ((!TString(attr->GetValue()).CompareTo(name)) ||
209 !name)) {
210 binningNode=node;
211 }
212 }
213 }
214 }
215 }
216
217 if(binningNode) {
218 r=ImportXMLNode(binningNode);
219 }
220 return r;
221}
222
223////////////////////////////////////////////////////////////////////////////////
224/// Recursively import one node from the XML tree.
225///
226/// \param[in] node node in the XML document tree
227///
228/// returns a new TUnfoldBinningXML
229///
230/// import data from a given "BinningNode"
231
233(TXMLNode *node) {
234 const char *name=0;
235 Double_t factor=1.0;
237 Int_t nBins=0;
238 const char *binNames=0;
240 TXMLAttr *attr;
241 // extract name and global factor
242 while((attr=(TXMLAttr *)i->Next())) {
243 TString attName(attr->GetName());
244 if(!attName.CompareTo("name")) {
245 name=attr->GetValue();
246 }
247 if(!attName.CompareTo("factor")) {
248 factor=TString(attr->GetValue()).Atof();
249 }
250 }
251 if(name) {
252 TString binNameList="";
253 // loop over all children of this BinningNode
254 for(TXMLNode *child=node->GetChildren();child;
255 child=child->GetNextNode()) {
256 // unconnected bins: children are of type "Bins"
257 if(child->GetNodeType()==TXMLNode::kXMLElementNode &&
258 !TString(child->GetNodeName()).CompareTo("Bins")) {
259 // this node has unconnected bins, no axes
260 // extract number of bins
261 if(child->GetAttributes()) {
262 i=child->GetAttributes()->MakeIterator();
263 while((attr=(TXMLAttr *)i->Next())) {
264 TString attName(attr->GetName());
265 if(!attName.CompareTo("nbin")) {
266 // number of unconnected bins
267 nBins=TString(attr->GetValue()).Atoi();
268 }
269 }
270 }
271 // extract names of unconnected bins
272 TObjArray theBinNames;
273 for(TXMLNode *binName=child->GetChildren();binName;
274 binName=binName->GetNextNode()) {
275 if(binName->GetNodeType()==TXMLNode::kXMLElementNode &&
276 !TString(binName->GetNodeName()).CompareTo("BinLabel")) {
277 i=binName->GetAttributes()->MakeIterator();
278 const char *binLabelName=0;
279 Int_t index=0;
280 while((attr=(TXMLAttr *)i->Next())) {
281 TString attName(attr->GetName());
282 if(!attName.CompareTo("index")) {
283 index=TString(attr->GetValue()).Atoi();
284 }
285 if(!attName.CompareTo("name")) {
286 binLabelName=attr->GetValue();
287 }
288 }
289 if((index>=0)&&(binLabelName)) {
290 if(index>=theBinNames.GetEntriesFast()) {
291 theBinNames.AddAtAndExpand
292 (new TObjString(binLabelName),index);
293 }
294 }
295 }
296 }
297 Int_t emptyName=0;
298 for(Int_t ii=0;ii<theBinNames.GetEntriesFast()&&(ii<nBins);ii++) {
299 if(theBinNames.At(ii)) {
300 for(Int_t k=0;k<emptyName;k++) binNameList+=";";
301 emptyName=0;
302 binNameList+=
303 ((TObjString *)theBinNames.At(ii))->GetString();
304 }
305 emptyName++;
306 }
307 if(binNameList.Length()>0) {
308 binNames=binNameList;
309 }
310 }
311 }
312 r=new TUnfoldBinningXML(name,nBins,binNames);
313
314 // add add axis information
315 r->AddAxisXML(node);
316
317 // import per-bin normalisation factors if there are any
318 TVectorD *perBinFactors=0;
319 for(TXMLNode *child=node->GetChildren();child;
320 child=child->GetNextNode()) {
321 // unconnected bins: children are of type "Bins"
322 if(child->GetNodeType()==TXMLNode::kXMLElementNode &&
323 !TString(child->GetNodeName()).CompareTo("Binfactorlist")) {
324 int length=0;
325 i=child->GetAttributes()->MakeIterator();
326 while((attr=(TXMLAttr *)i->Next())) {
327 TString attName(attr->GetName());
328 if(!attName.CompareTo("length")) {
329 length=TString(attr->GetValue()).Atoi();
330 }
331 }
332 int nread=0;
333 if(length==r->GetDistributionNumberOfBins()) {
334 perBinFactors=new TVectorD(length);
335 const char *text=child->GetText();
336 if(text) {
337 stringstream readFactors(text);
338 for(;nread<length;nread++) {
339 readFactors>> (*perBinFactors)(nread);
340 if(readFactors.fail()) break;
341 }
342 }
343 }
344 if(!perBinFactors) {
345 child->Error("ImportXMLNode","while reading per-bin factors"
346 " node=%s length=%d (expected %d)",r->GetName(),
347 length,r->GetDistributionNumberOfBins());
348 } else if(nread!=length) {
349 child->Error("ImportXMLNode","while reading per-bin factors"
350 " TUnfoldBinning=%s expected %d found %d",
351 r->GetName(),length,nread);
352 delete perBinFactors;
353 perBinFactors=0;
354 }
355 }
356 }
357
358 // set normalisation factors
359 r->SetBinFactor(factor,perBinFactors);
360
361 // now: loop over all child binning and add them
362 for(TXMLNode *child=node->GetChildren();child;
363 child=child->GetNextNode()) {
364 if(child->GetNodeType()==TXMLNode::kXMLElementNode &&
365 !TString(child->GetNodeName()).CompareTo("BinningNode") &&
366 child->GetAttributes()) {
367 TUnfoldBinning *childBinning=ImportXMLNode(child);
368 r->AddBinning(childBinning);
369 }
370 }
371 }
372 return r;
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Import axis from XML node.
377///
378/// \param[in] node node in the XML document tree
379///
380/// find axis if there is one
381
383 TXMLNode *axis=0;
384 for(TXMLNode *child=node->GetChildren();child;
385 child=child->GetNextNode()) {
386 if(child->GetNodeType()==TXMLNode::kXMLElementNode) {
387 TString nodeName(child->GetNodeName());
388 if(!nodeName.CompareTo("Axis")) axis=child;
389 }
390 }
391 if(axis) {
392 const char *axisName=0;
393 TArrayD binEdges(1);
395 TXMLAttr *attr;
396 while((attr=(TXMLAttr *)i->Next())) {
397 TString attName(attr->GetName());
398 if(!attName.CompareTo("name")) {
399 axisName=attr->GetValue();
400 }
401 if(!attName.CompareTo("lowEdge")) {
402 binEdges[0]=TString(attr->GetValue()).Atof();
403 }
404 }
405 Bool_t hasMoreAxes=kFALSE;
406 Bool_t underflow=kFALSE,overflow=kFALSE;
407 for(TXMLNode *child=axis->GetChildren();child;
408 child=child->GetNextNode()) {
409 if(child->GetNodeType()==TXMLNode::kXMLElementNode) {
410 TString nodeName(child->GetNodeName());
411 if(!nodeName.CompareTo("Axis")) hasMoreAxes=kTRUE;
412 if(!nodeName.CompareTo("Bin")) {
413 Bool_t isUnderflow=kFALSE,isOverflow=kFALSE;
414 Int_t repeat=1;
415 i=child->GetAttributes()->MakeIterator();
416 while((attr=(TXMLAttr *)i->Next())) {
417 TString attName(attr->GetName());
418 TString attText(attr->GetValue());
419 if(!attName.CompareTo("location")) {
420 isUnderflow= !attText.CompareTo("underflow");
421 isOverflow= !attText.CompareTo("overflow");
422 }
423 if(!attName.CompareTo("repeat")) {
424 repeat=attText.Atof();
425 }
426 }
427 if(repeat<1) {
428 node->Warning("AddAxisXML",
429 "attribute repeat=%d changed to repeat=1",
430 repeat);
431 repeat=1;
432 }
433 if((isUnderflow || isOverflow)&&(repeat!=1)) {
434 node->Error("AddAxisXML",
435 "underflow/overflow can not have repeat!=1 attribute");
436 }
437 if(isUnderflow || isOverflow) {
438 underflow |= isUnderflow;
439 overflow |= isOverflow;
440 } else {
441 Int_t iBin0=binEdges.GetSize();
442 Int_t iBin1=iBin0+repeat;
443 Double_t binWidth=0.0;
444 binEdges.Set(iBin1);
445 i=child->GetAttributes()->MakeIterator();
446 while((attr=(TXMLAttr *)i->Next())) {
447 TString attName(attr->GetName());
448 if(!attName.CompareTo("width")) {
449 binWidth=TString(attr->GetValue()).Atof();
450 }
451 }
452 if(binWidth<=0.0) {
453 node->Error("AddAxisXML",
454 "bin width can not be smaller than zero");
455 }
456 for(int iBin=iBin0;iBin<iBin1;iBin++) {
457 binEdges[iBin]=binEdges[iBin0-1]+(iBin-iBin0+1)*binWidth;
458 }
459 }
460 }
461 }
462 }
463 AddAxis(axisName,binEdges.GetSize()-1,binEdges.GetArray(),
464 underflow,overflow);
465 if(hasMoreAxes) {
466 AddAxisXML(axis);
467 }
468 }
469}
470
471////////////////////////////////////////////////////////////////////////////////
472/// Export a binning scheme to a stream in XML format.
473///
474/// \param[in] binning the binning scheme to export
475/// \param[in] out stream to write to
476/// \param[in] writeHeader set true when writing the first binning
477/// scheme to this stream
478/// \param[in] writeFooter set true when writing the last binning
479/// scheme to this stream
480/// \param[in] indent indentation of the XML output
481///
482/// returns true if the writing succeeded
483
485(const TUnfoldBinning &binning,std::ostream &out,Bool_t writeHeader,
486 Bool_t writeFooter,Int_t indent) {
487 if(writeHeader) {
488 out<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
489 <<"<!DOCTYPE TUnfoldBinning SYSTEM \"tunfoldbinning.dtd\">\n"
490 <<"<TUnfoldBinning>\n";
491 }
492 TString trailer(' ',indent);
493 out<<trailer<<"<BinningNode name=\""<<binning.GetName()<<"\" firstbin=\""
494 <<binning.GetStartBin();
495 if(binning.IsBinFactorGlobal()) {
496 out<<"\" factor=\""<<binning.GetGlobalFactor()<<"\">\n";
497 } else {
498 out<<"\">\n";
499 out<<trailer<<" <Binfactorlist length=\""
500 <<binning.GetDistributionNumberOfBins()<<"\">\n";
501 for(int i=0;i<binning.GetDistributionNumberOfBins();i++) {
502 if(!(i % 10)) out<<trailer<<" ";
503 out<<" "<<binning.GetBinFactor(i+binning.GetStartBin());
504 if(((i %10)==9)||(i==binning.GetDistributionNumberOfBins()-1))
505 out<<"\n";
506 }
507 out<<trailer<<" </Binfactorlist>\n";
508 }
509 if(binning.HasUnconnectedBins()) {
510 out<<trailer<<" <Bins nbin=\""<<binning.GetDistributionNumberOfBins()
511 <<"\">\n";
512 for(Int_t i=0;i<binning.GetDistributionNumberOfBins();i++) {
513 const TObjString *name=binning.GetUnconnectedBinName(i);
514 if(!name) break;
515 out<<trailer<<" <BinLabel index=\""<<i<<"\" name=\""
516 <<name->GetString()<<"\" />\n";
517 }
518 out<<trailer<<" </Bins>\n";
519 } else {
520 for(Int_t axis=0;axis<binning.GetDistributionDimension();axis++) {
521 TString axisTrailer(' ',indent+1+axis);
522 TVectorD const *edges=binning.GetDistributionBinning(axis);
523 out<<axisTrailer<<"<Axis name=\""<<binning.GetDistributionAxisLabel(axis)
524 <<"\" lowEdge=\""<<(*edges)[0]<<"\">\n";
525 if(binning.HasUnderflow(axis)) {
526 out<<axisTrailer<<" <Bin location=\"underflow\" width=\""
527 <<binning.GetDistributionUnderflowBinWidth(axis)<<"\" center=\""
528 <<binning.GetDistributionBinCenter(axis,-1)<<"\" />\n";
529 }
530 for(Int_t i=0;i<edges->GetNrows()-1;i++) {
531 Int_t repeat=1;
532 Double_t width=(*edges)[i+1]-(*edges)[i];
533 Double_t center=binning.GetDistributionBinCenter(axis,i);
534 for(Int_t j=i+1;j<edges->GetNrows()-1;j++) {
535 double xEnd=(j-i+1)*width+(*edges)[i];
536 double xCent=center+(j-i)*width;
537 if((TMath::Abs(xEnd-(*edges)[j+1])<width*1.E-7)&&
538 (TMath::Abs(xCent-binning.GetDistributionBinCenter(axis,j))<
539 width*1.E-7)) {
540 ++repeat;
541 } else {
542 break;
543 }
544 }
545 if(repeat==1) {
546 out<<axisTrailer<<" <Bin width=\""
547 <<width<<"\" center=\""<<center<<"\" />\n";
548 } else {
549 out<<axisTrailer<<" <Bin repeat=\""<<repeat
550 <<"\" width=\""<<width<<"\" center=\""<<center<<"\" />\n";
551 i += repeat-1;
552 }
553 }
554 if(binning.HasOverflow(axis)) {
555 out<<axisTrailer<<" <Bin location=\"overflow\" width=\""
556 <<binning.GetDistributionOverflowBinWidth(axis)<<"\" center=\""
557 <<binning.GetDistributionBinCenter(axis,edges->GetNrows()-1)<<"\"/>\n";
558 }
559 }
560 for(Int_t axis=binning.GetDistributionDimension()-1;axis>=0;axis--) {
561 TString axisTrailer(' ',indent+1+axis);
562 out<<axisTrailer<<"</Axis>\n";
563 }
564 }
565 for(TUnfoldBinning const *child=binning.GetChildNode();child;
566 child=child->GetNextNode()) {
567 ExportXML(*child,out,kFALSE,kFALSE,indent+1);
568 }
569 out<<trailer<<"</BinningNode>\n";
570 if(writeFooter) {
571 out<<"</TUnfoldBinning>\n";
572 }
573 return out.fail() ? 0 : 1;
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Export this binning scheme to a file.
578///
579/// \param[in] fileName name of the file
580///
581/// returns true if the writing succeeded
582///
583/// export this binning scheme to a file
584/// - fileName: name of the xml file
585
586Int_t TUnfoldBinningXML::ExportXML(char const *fileName) const {
587 ofstream outFile(fileName);
588 Int_t r=ExportXML(*this,outFile,kTRUE,kTRUE);
589 outFile.close();
590 return r;
591}
void writeHeader(THtml &html, ostream &out, const char *title, const char *relPath="../")
ROOT::R::TRInterface & r
Definition Object.C:4
const Bool_t kFALSE
Definition RtypesCore.h:92
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
static void indent(ostringstream &buf, int indent_level)
include TDocParser_001 C image html pict1_TDocParser_001 png width
char name[80]
Definition TGX11.cxx:110
TVectorT< Double_t > TVectorD
Definition TVectorDfwd.h:23
Array of doubles (64 bits per element).
Definition TArrayD.h:27
void Set(Int_t n)
Set size of this array to n doubles.
Definition TArrayD.cxx:106
const Double_t * GetArray() const
Definition TArrayD.h:43
Int_t GetSize() const
Definition TArray.h:47
Iterator abstract base class.
Definition TIterator.h:30
virtual TObject * Next()=0
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition TList.cxx:722
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
An array of TObjects.
Definition TObjArray.h:37
Int_t GetEntriesFast() const
Definition TObjArray.h:64
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
TObject * At(Int_t idx) const
Definition TObjArray.h:166
Collectable string class.
Definition TObjString.h:28
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:359
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:879
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:893
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition TString.cxx:438
Int_t Atoi() const
Return integer value of string.
Definition TString.cxx:1941
Double_t Atof() const
Return floating-point value contained in string.
Definition TString.cxx:2007
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.
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.
Definition TUnfold.cxx:3681
Int_t GetNrows() const
Definition TVectorT.h:75
TXMLAttribute is the attribute of an Element.
Definition TXMLAttr.h:18
const char * GetValue() const
Definition TXMLAttr.h:33
const char * GetName() const
Returns name of object.
Definition TXMLAttr.h:31
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.
Definition TXMLNode.h:20
TList * GetAttributes()
Returns a list of node's attribute if any, returns 0 if no attribute.
Definition TXMLNode.cxx:108
@ kXMLElementNode
Definition TXMLNode.h:37
TXMLNode * GetNextNode()
Returns the next sibling XMLNode in the DOM tree, if any return 0 if no next node.
Definition TXMLNode.cxx:130
TXMLNode * GetChildren()
Returns the node's child if any, returns 0 if no child.
Definition TXMLNode.cxx:74
const char * GetNodeName() const
Returns the node's name.
Definition TXMLNode.cxx:66
EXMLElementType GetNodeType() const
Returns the node's type.
Definition TXMLNode.cxx:58
TText * text
Short_t Abs(Short_t d)
Definition TMathBase.h:120
Definition file.py:1