Test program for the classes TUnfoldDensity and TUnfoldBinning.
A toy test of the TUnfold package
This is an example of unfolding a two-dimensional distribution also using an auxiliary measurement to constrain some background
The example comprises several macros
- testUnfold5a.C create root files with TTree objects for signal, background and data
- write files testUnfold5_signal.root testUnfold5_background.root testUnfold5_data.root
- testUnfold5b.C create a root file with the TUnfoldBinning objects
- write file testUnfold5_binning.root
- testUnfold5c.C loop over trees and fill histograms based on the TUnfoldBinning objects
- read testUnfold5_binning.root testUnfold5_signal.root testUnfold5_background.root testUnfold5_data.root
- write testUnfold5_histograms.root
- testUnfold5d.C run the unfolding
- read testUnfold5_histograms.root
- write testUnfold5_result.root testUnfold5_result.ps
TUnfoldBinning "detector" has 360 bins [1,361] nTH1x=360
TUnfoldBinning "detectordistribution" has 360 bins [1,361] nTH1x=360
distribution: 360 bins
"pt" nbin=8 plus overflow
"eta" nbin=10
"discriminator" nbin=4
TUnfoldBinning "generator" has 115 bins [1,116] nTH1x=115
TUnfoldBinning "signal" has 25 bins [1,26] nTH1x=25
distribution: 25 bins
"ptgen" nbin=3 plus underflow plus overflow
"etagen" nbin=3 plus underflow plus overflow
TUnfoldBinning "background" has 90 bins [26,116] nTH1x=90
distribution: 90 bins
"ptrec" nbin=8 plus overflow
"etarec" nbin=10
loop over data events
loop over MC signal events
loop over MC background events
#include <iostream>
#include <cmath>
#ifndef READ_BINNING_CINT
#else
#endif
using std::cout;
{
#ifdef READ_BINNING_CINT
#endif
#ifndef READ_BINNING_CINT
if(error) cout<<"error="<<error<<" from TDOMParser\n";
#else
#endif
} 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";
}
} else {
}
}
cout<<"could not read 'signal' tree\n";
}
cout<<"loop over MC signal events\n";
}
}
cout<<"could not read 'background' tree\n";
}
bgrTree->SetBranchStatus(
"*",
true);
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.
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 file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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.
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 ...
unsigned int binNumber(double x, double coef, double const *boundaries, unsigned int nBoundaries, int nbins, int blo)
Version 17.6, in parallel to changes in TUnfold
History:
- Version 17.5, updated for reading binning from XML file
- Version 17.4, updated for reading binning from XML file
- Version 17.3, updated for reading binning from XML file
- Version 17.2, updated for reading binning from XML file
- Version 17.1, in parallel to changes in TUnfold
- Version 17.0 example for multi-dimensional unfolding
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 testUnfold5c.C.