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