245 Error(
"TUnfoldDensity",
246 "Invalid output binning scheme (node is not the root node)");
258 Error(
"TUnfoldDensity",
259 "Invalid input binning scheme (node is not the root node)");
268 Error(
"TUnfoldDensity",
269 "Output binning incompatible number of bins: axis %d binning scheme %d (%d)",
278 Error(
"TUnfoldDensity",
279 "Input binning incompatible number of bins:axis %d binning scheme %d (%d) ",
427 cout<<
"TUnfoldDensity::RegularizeOneDistribution node="
447 for(
Int_t i=0;i<7;i++) {
452 Error(
"RegularizeOneDistribution",
466 Info(
"RegularizeOneDistribution",
"regularizing %s regMode=%d"
467 " densityMode=%d axisSteering=%s",
483 cout<<
"initial number of bins "<<
nbin<<
"\n";
501 cout<<
"after underflow/overflow bin removal "<<
nbin<<
"\n";
508 if(factor[bin-
startBin]==0.0)
continue;
523 cout<<
"skip direction "<<
direction<<
"\n";
534 if(factor[bin-
startBin]==0.0)
continue;
542 Error(
"RegularizeOneDistribution",
543 "invalid option %s (isPeriodic) for axis %s"
559 if((
f0==0.0)||(
f1==0.0))
continue;
563 std::cout<<
"Added Reg: bin "<<bin<<
" "<<
f0
564 <<
" next: "<<
iNext<<
" "<<
f1<<
"\n";
585 if((
f0==0.0)||(
f1==0.0)||(f2==0.0))
continue;
589 std::cout<<
"Added Reg: prev "<<
iPrev<<
" "<<
f0
590 <<
" bin: "<<bin<<
" "<<
f1
591 <<
" next: "<<
iNext<<
" "<<f2<<
"\n";
832 if(
r->GetDimension()==1) {
841 Error(
"GetRhoItotal",
842 "can not return inverse of error matrix for this binning");
883 if(
r->GetDimension()==1) {
892 Error(
"GetRhoItotal",
893 "can not return inverse of error matrix for this binning");
1028 for(
Int_t i=0;i<=
r->GetNbinsX()+1;i++) {
1032 for(
Int_t j=0;
j<=
r->GetNbinsY()+1;
j++) {
1038 if((
e_i>0.0)&&(
e_j>0.0)) {
1041 r->SetBinContent(i,
j,0.0);
1045 for(
Int_t i=0;i<=
r->GetNbinsX()+1;i++) {
1046 if(
r->GetBinContent(i,i)>0.0) {
1047 r->SetBinContent(i,i,1.0);
1049 r->SetBinContent(i,i,0.0);
1219 "remove invalid scheme of regularisation conditions %d %d",
1226 Warning(
"GetL",
"create flat regularisation conditions scheme");
1259 "remove invalid scheme of regularisation conditions %d %d",
1266 Warning(
"GetLxMinusBias",
"create flat regularisation conditions scheme");
1272 for(
Int_t row=0;row<
Ldx->GetNrows();row++) {
1356 typedef std::map<Double_t,Double_t>
TauScan_t;
1357 typedef std::map<Double_t,std::pair<Double_t,Double_t> >
LCurve_t;
1392 Error(
"ScanTau",
"too few input bins, NDF<=0 %d",
GetNdf());
1397 Info(
"ScanTau",
"logtau=-Infinity y=%lf X=%lf Y=%lf",
y0,
X0,
Y0);
1405 Fatal(
"ScanTau",
"problem (missing regularisation?) X=%f Y=%f",
1411 Info(
"ScanTau",
"logtau=%lf y=%lf X=%lf Y=%lf",
logTau,
y,
1425 Info(
"ScanTay",
"logtau=%lf y=%lf X=%lf Y=%lf",
logTau,
y,
1464 if((*i0).second<
yMin) {
1482 if((dist<=0.0)||(dist>
distMax)) {
1484 logTau=0.5*((*i0).first+(*i1).first);
1492 Info(
"ScanTau",
"logtau=%lf y=%lf X=%lf Y=%lf",
logTau,
y,
1591 Info(
"ScanTau",
"Result logtau=%lf y=%lf X=%lf Y=%lf",
logTauFin,
y,
1599 if(!
curve.empty()) {
1630 x[
n]=(*i).second.first;
1631 y[
n]=(*i).second.second;
1637 (*lCurvePlot)->SetTitle(
"L curve");
1697 for(
Int_t i=0;i<=
rhoi->GetNbinsX()+1;i++) {
1716 Fatal(
"GetScanVariable",
"mode %d not implemented",
mode);
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 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 mode
const_iterator begin() const
const_iterator end() const
Class to manage histogram axis.
A TGraph is an object made of two arrays X and Y with npoints each.
TH1 is the base class of all histogram classes in ROOT.
Service class for 2-D histogram classes.
const char * GetName() const override
Returns name of object.
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.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Class to create third splines to interpolate knots Arbitrary conditions can be introduced for first a...
Base class for spline implementation containing the Draw/Paint methods.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Binning schemes for use with the unfolding algorithm TUnfoldDensity.
TH1 * CreateHistogram(const char *histogramName, Bool_t originalAxisBinning=kFALSE, Int_t **binMap=nullptr, const char *histogramTitle=nullptr, const char *axisSteering=nullptr) const
Create a THxx histogram capable to hold the bins of this binning node and its children.
Int_t GetDistributionDimension(void) const
query dimension of this node's distribution
Int_t GetDistributionNumberOfBins(void) const
number of bins in the distribution possibly including under/overflow
Int_t GetEndBin(void) const
last+1 bin of this node (includes children)
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...
void GetBinUnderflowOverflowStatus(Int_t iBin, Int_t *uStatus, Int_t *oStatus) const
Return bit maps indicating underflow and overflow status.
virtual Double_t GetDistributionAverageBinSize(Int_t axis, Bool_t includeUnderflow, Bool_t includeOverflow) const
Get average bin size on the specified axis.
void DecodeAxisSteering(const char *axisSteering, const char *options, Int_t *isOptionGiven) const
Decode axis steering.
TString GetDistributionAxisLabel(Int_t axis) const
get name of an axis
TUnfoldBinning * AddBinning(TUnfoldBinning *binning)
Add a TUnfoldBinning as the last child of this node.
Int_t GetBinNeighbours(Int_t globalBin, Int_t axis, Int_t *prev, Double_t *distPrev, Int_t *next, Double_t *distNext, Bool_t isPeriodic=kFALSE) const
Get neighbour bins along the specified axis.
TH2D * CreateErrorMatrixHistogram(const char *histogramName, Bool_t originalAxisBinning, Int_t **binMap=nullptr, const char *histogramTitle=nullptr, const char *axisSteering=nullptr) const
Create a TH2D histogram capable to hold a covariance matrix.
Int_t GetStartBin(void) const
first bin of this node
TUnfoldBinning const * GetChildNode(void) const
first daughter node
An algorithm to unfold distributions from detector to truth level.
void RegularizeOneDistribution(const TUnfoldBinning *binning, ERegMode regmode, EDensityMode densityMode, const char *axisSteering)
Regularize the distribution of the given node.
@ kEScanTauRhoAvg
average global correlation coefficient (from TUnfold::GetRhoI())
@ kEScanTauRhoMax
maximum global correlation coefficient (from TUnfold::GetRhoI())
@ kEScanTauRhoSquareAvgSys
average global correlation coefficient squared (from TUnfoldSys::GetRhoItotal())
@ kEScanTauRhoMaxSys
maximum global correlation coefficient (from TUnfoldSys::GetRhoItotal())
@ kEScanTauRhoSquareAvg
average global correlation coefficient squared (from TUnfold::GetRhoI())
@ kEScanTauRhoAvgSys
average global correlation coefficient (from TUnfoldSys::GetRhoItotal())
TH1 * GetRhoItotal(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE, TH2 **ematInv=nullptr)
Retrieve global correlation coefficients including all uncertainty sources.
TH2 * GetEmatrixSysUncorr(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Retrieve covariance contribution from uncorrelated (statistical) uncertainties of the response matrix...
Double_t GetDensityFactor(EDensityMode densityMode, Int_t iBin) const
Density correction factor for a given bin.
TH2 * GetRhoIJtotal(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Retrieve correlation coefficients, including all uncertainties.
TString GetOutputBinName(Int_t iBinX) const override
Get bin name of an output bin.
const TUnfoldBinning * fConstOutputBins
binning scheme for the output (truth level)
const TUnfoldBinning * GetOutputBinning(const char *distributionName=nullptr) const
Locate a binning node for the unfolded (truth level) quantities.
TH2 * GetEmatrixInput(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Get covariance contribution from the input uncertainties (data statistical uncertainties).
TUnfoldBinning * fRegularisationConditions
binning scheme for the regularisation conditions
TH2 * GetL(const char *histogramName, const char *histogramTitle=nullptr, Bool_t useAxisBinning=kTRUE)
Access matrix of regularisation conditions in a new histogram.
TUnfoldBinning * fOwnedOutputBins
pointer to output binning scheme if owned by this class
TH2 * GetEmatrixTotal(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Get covariance matrix including all contributions.
TUnfoldBinning * fOwnedInputBins
pointer to input binning scheme if owned by this class
TH1 * GetDeltaSysBackgroundScale(const char *bgrSource, const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Retrieve systematic 1-sigma shift corresponding to a background scale uncertainty.
void RegularizeDistribution(ERegMode regmode, EDensityMode densityMode, const char *distribution, const char *axisSteering)
Set up regularisation conditions.
TH2 * GetProbabilityMatrix(const char *histogramName, const char *histogramTitle=nullptr, Bool_t useAxisBinning=kTRUE) const
Get matrix of probabilities in a new histogram.
TH1 * GetOutput(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE) const
retrieve unfolding result as a new histogram
TH1 * GetFoldedOutput(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE, Bool_t addBgr=kFALSE) const
Retrieve unfolding result folded back as a new histogram.
const TUnfoldBinning * GetInputBinning(const char *distributionName=nullptr) const
Locate a binning node for the input (measured) quantities.
TH1 * GetInput(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE) const
Retrieve input distribution in a new histogram.
TH1 * GetRhoIstatbgr(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE, TH2 **ematInv=nullptr)
Retrieve global correlation coefficients including input (statistical) and background uncertainties.
TH1 * GetDeltaSysSource(const char *source, const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Retrieve a correlated systematic 1-sigma shift.
TH1 * GetDeltaSysTau(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Retrieve 1-sigma shift corresponding to the previously specified uncertainty on tau.
~TUnfoldDensity(void) override
TH2 * GetEmatrixSysBackgroundUncorr(const char *bgrSource, const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
Retrieve covariance contribution from uncorrelated background uncertainties.
const TUnfoldBinning * fConstInputBins
binning scheme for the input (detector level)
TH1 * GetLxMinusBias(const char *histogramName, const char *histogramTitle=nullptr)
Get regularisation conditions multiplied by result vector minus bias L(x-biasScale*biasVector).
void RegularizeDistributionRecursive(const TUnfoldBinning *binning, ERegMode regmode, EDensityMode densityMode, const char *distribution, const char *axisSteering)
Recursively add regularisation conditions for this node and its children.
TUnfoldDensity(void)
Only for use by root streamer or derived classes.
TH1 * GetBias(const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE) const
Retrieve bias vector as a new histogram.
virtual Int_t ScanTau(Int_t nPoint, Double_t tauMin, Double_t tauMax, TSpline **scanResult, Int_t mode=kEScanTauRhoAvg, const char *distribution=nullptr, const char *projectionMode=nullptr, TGraph **lCurvePlot=nullptr, TSpline **logTauXPlot=nullptr, TSpline **logTauYPlot=nullptr)
Scan a function wrt tau and determine the minimum.
virtual Double_t GetScanVariable(Int_t mode, const char *distribution, const char *projectionMode)
Calculate the function for ScanTau().
EDensityMode
choice of regularisation scale factors to cinstruct the matrix L
@ kDensityModeUser
scale factors from user function in TUnfoldBinning
@ kDensityModeBinWidthAndUser
scale factors from multidimensional bin width and user function
@ kDensityModeBinWidth
scale factors from multidimensional bin width
TH1 * GetBackground(const char *histogramName, const char *bgrSource=nullptr, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE, Int_t includeError=3) const
Retrieve a background source in a new histogram.
An algorithm to unfold distributions from detector to truth level, with background subtraction and pr...
void GetEmatrixTotal(TH2 *ematrix, const Int_t *binMap=nullptr)
Get total error matrix, summing up all contributions.
void GetRhoItotal(TH1 *rhoi, const Int_t *binMap=nullptr, TH2 *invEmat=nullptr)
Get global correlatiocn coefficients, summing up all contributions.
void GetBackground(TH1 *bgr, const char *bgrSource=nullptr, const Int_t *binMap=nullptr, Int_t includeError=3, Bool_t clearHist=kTRUE) const
Get background into a histogram.
Bool_t GetDeltaSysBackgroundScale(TH1 *delta, const char *source, const Int_t *binMap=nullptr)
Correlated one-sigma shifts from background normalisation uncertainty.
Bool_t GetDeltaSysTau(TH1 *delta, const Int_t *binMap=nullptr)
Correlated one-sigma shifts from shifting tau.
Bool_t GetDeltaSysSource(TH1 *hist_delta, const char *source, const Int_t *binMap=nullptr)
Correlated one-sigma shifts correspinding to a given systematic uncertainty.
void GetEmatrixInput(TH2 *ematrix, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE)
Covariance matrix contribution from input measurement uncertainties.
void GetEmatrixSysBackgroundUncorr(TH2 *ematrix, const char *source, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE)
Covariance contribution from background uncorrelated uncertainty.
void GetEmatrixSysUncorr(TH2 *ematrix, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE)
Covariance contribution from uncorrelated uncertainties of the response matrix.
TArrayI fHistToX
mapping of histogram bins to matrix indices
virtual Double_t GetLcurveY(void) const
Get value on y-axis of L-curve determined in recent unfolding.
TMatrixDSparse * MultiplyMSparseM(const TMatrixDSparse *a, const TMatrixD *b) const
Multiply sparse matrix and a non-sparse matrix.
virtual Double_t DoUnfold(void)
Core unfolding algorithm.
TMatrixD * fX0
bias vector x0
void GetBias(TH1 *bias, const Int_t *binMap=nullptr) const
Get bias vector including bias scale.
void GetProbabilityMatrix(TH2 *A, EHistMap histmap) const
Get matrix of probabilities.
virtual TString GetOutputBinName(Int_t iBinX) const
Get bin name of an output bin.
Double_t fBiasScale
scale factor for the bias
void GetFoldedOutput(TH1 *folded, const Int_t *binMap=nullptr) const
Get unfolding result on detector level.
Bool_t AddRegularisationCondition(Int_t i0, Double_t f0, Int_t i1=-1, Double_t f1=0., Int_t i2=-1, Double_t f2=0.)
Add a row of regularisation conditions to the matrix L.
void GetL(TH2 *l) const
Get matrix of regularisation conditions.
const TMatrixD * GetX(void) const
vector of the unfolding result
EConstraint
type of extra constraint
virtual Double_t GetLcurveX(void) const
Get value on x-axis of L-curve determined in recent unfolding.
Double_t GetRhoI(TH1 *rhoi, const Int_t *binMap=nullptr, TH2 *invEmat=nullptr) const
Get global correlation coefficients, possibly cumulated over several bins.
ERegMode
choice of regularisation scheme
@ kRegModeNone
no regularisation, or defined later by RegularizeXXX() methods
@ kRegModeDerivative
regularize the 1st derivative of the output distribution
@ kRegModeSize
regularise the amplitude of the output distribution
@ kRegModeCurvature
regularize the 2nd derivative of the output distribution
void GetInput(TH1 *inputData, const Int_t *binMap=nullptr) const
Input vector of measurements.
void GetOutput(TH1 *output, const Int_t *binMap=nullptr) const
Get output distribution, possibly cumulated over several bins.
EHistMap
arrangement of axes for the response matrix (TH2 histogram)
@ kHistMapOutputHoriz
truth level on x-axis of the response matrix
Double_t GetChi2A(void) const
get χ2A contribution determined in recent unfolding
TMatrixDSparse * fL
regularisation conditions L
Int_t GetNdf(void) const
get number of degrees of freedom determined in recent unfolding
Int_t Finite(Double_t x)
Check if it is finite with a mask in order to be consistent in presence of fast math.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
static uint64_t sum(uint64_t i)