Test program for the classes TUnfoldDensity and TUnfoldBinning
A toy test of the TUnfold package
This example is documented in conference proceedings:
arXiv:1611.01927 12th Conference on Quark Confinement and the Hadron Spectrum (Confinement XII)
This is an example of unfolding a two-dimensional distribution also using an auxiliary measurement to constrain some background
The example comprises several macros
- testUnfold7a.C create root files with TTree objects for signal, background and data
- write files testUnfold7_signal.root testUnfold7_background.root testUnfold7_data.root
- testUnfold7b.C loop over trees and fill histograms based on the TUnfoldBinning objects
- read testUnfold7binning.xml testUnfold7_signal.root testUnfold7_background.root testUnfold7_data.root
- write testUnfold7_histograms.root
- testUnfold7c.C run the unfolding
- read testUnfold7_histograms.root
- write testUnfold7_result.root testUnfold7_result.ps
TUnfoldBinning "fine" has 33 bins [1,34] nTH1x=32
distribution: 33 bins
"pt" nbin=32 plus overflow
TUnfoldBinning "coarse" has 17 bins [1,18] nTH1x=16
distribution: 17 bins
"pt" nbin=16 plus overflow
loop over data events
loop over MC signal events
loop over MC background events
#include <iostream>
#include <cmath>
using std::cout;
{
if(error) {
cout<<"error="<<error<<" from TDOMParser\n";
cout<<"==============================================================\n";
cout<<"Maybe the file testUnfold7binning.xml is missing?\n";
cout<<"The content of the file is included in the comments section\n";
cout<<"of this macro \"testUnfold7b.C\"\n";
cout<<"==============================================================\n";
}
} else {
cout<<"could not read 'detector' binning\n";
}
} else {
cout<<"could not read 'generator' binning\n";
}
cout<<"could not read 'data' tree\n";
}
cout<<"loop over data events\n";
#define VAR_REC (ptRec[2])
#define VAR_GEN (ptGen[2])
}
}
}
}
cout<<"could not read 'signal' tree\n";
}
cout<<"loop over MC signal events\n";
}
}
cout<<"could not read 'background' tree\n";
}
bgrTree->SetBranchAddress(
"weight",&weight);
cout<<"loop over MC background events\n";
}
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
TH1 is the base class of all histogram classes in ROOT.
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
When this static function is called with sumw2=kTRUE, all new histograms will automatically activate ...
Service class for 2-D histogram classes.
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.
A TTree represents a columnar dataset.
static TUnfoldBinningXML * ImportXML(const TXMLDocument *document, const char *name)
import a binning scheme from an XML file
Binning schemes for use with the unfolding algorithm TUnfoldDensity.
static TH2D * CreateHistogramOfMigrations(TUnfoldBinning const *xAxis, TUnfoldBinning const *yAxis, char const *histogramName, Bool_t originalXAxisBinning=kFALSE, Bool_t originalYAxisBinning=kFALSE, char const *histogramTitle=nullptr)
create a TH2D histogram capable to hold the bins of the two input binning schemes on the x and y axes...
TXMLDocument contains a pointer to an xmlDoc structure, after the parser returns a tree built during ...
Version 17.6, in parallel to changes in TUnfold
This file is part of TUnfold.
TUnfold is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
TUnfold is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with TUnfold. If not, see http://www.gnu.org/licenses/.
- Author
- Stefan Schmitt DESY, 14.10.2008
Definition in file testUnfold7b.C.