173 if(fOwnedOutputBins)
delete fOwnedOutputBins;
174 if(fOwnedInputBins)
delete fOwnedInputBins;
175 if(fRegularisationConditions)
delete fRegularisationConditions;
223 const TUnfoldBinning *inputBins,
const char *regularisationDistribution,
224 const char *regularisationAxisSteering) :
225 TUnfoldSys(hist_A,histmap,kRegModeNone,constraint)
231 TAxis const *genAxis,*detAxis;
248 Error(
"TUnfoldDensity",
249 "Invalid output binning scheme (node is not the root node)");
261 Error(
"TUnfoldDensity",
262 "Invalid input binning scheme (node is not the root node)");
270 if((nOutMappedT!= nOut)&&(nOutMappedF!=nOut)) {
271 Error(
"TUnfoldDensity",
272 "Output binning incompatible number of bins: axis %d binning scheme %d (%d)",
273 nOut,nOutMappedT,nOutMappedF);
280 if((nInputMappedT!= nInput)&&(nInputMappedF!= nInput)) {
281 Error(
"TUnfoldDensity",
282 "Input binning incompatible number of bins:axis %d binning scheme %d (%d) ",
283 nInput,nInputMappedT,nInputMappedF);
287 for (
Int_t ix = 0; ix <= nOut+1; ix++) {
289 Info(
"TUnfold",
"*NOT* unfolding bin %s",
297 (regmode,densityMode,regularisationDistribution,
298 regularisationAxisSteering);
342 if(binSize>0.0) factor /= binSize;
388 const char *axisSteering)
392 distribution,axisSteering);
405 EDensityMode densityMode,
const char *distribution,
const char *axisSteering) {
406 if((!distribution)|| !
TString(distribution).CompareTo(binning->
GetName())) {
429 cout<<
"TUnfoldDensity::RegularizeOneDistribution node="
430 <<binning->
GetName()<<
" "<<regmode<<
" "<<densityMode
431 <<
" "<<(axisSteering ? axisSteering :
"")<<
"\n";
440 Int_t isOptionGiven[8];
443 isOptionGiven[0] |= isOptionGiven[1];
445 isOptionGiven[2] |= isOptionGiven[3];
447 isOptionGiven[4] |= isOptionGiven[5];
449 for(
Int_t i=0;i<7;i++) {
450 isOptionGiven[7] &= ~isOptionGiven[i];
453 if(isOptionGiven[6] & (isOptionGiven[0]|isOptionGiven[2]) ) {
454 Error(
"RegularizeOneDistribution",
455 "axis steering %s is not valid",axisSteering);
458 cout<<
" "<<isOptionGiven[0]
459 <<
" "<<isOptionGiven[1]
460 <<
" "<<isOptionGiven[2]
461 <<
" "<<isOptionGiven[3]
462 <<
" "<<isOptionGiven[4]
463 <<
" "<<isOptionGiven[5]
464 <<
" "<<isOptionGiven[6]
465 <<
" "<<isOptionGiven[7]
468 Info(
"RegularizeOneDistribution",
"regularizing %s regMode=%d"
469 " densityMode=%d axisSteering=%s",
471 axisSteering ? axisSteering :
"");
474 std::vector<Double_t> factor(endBin-startBin);
475 [[maybe_unused]]
Int_t nbin=0;
476 for(
Int_t bin=startBin;bin<endBin;bin++) {
478 if(factor[bin-startBin] !=0.0) nbin++;
481 cout<<
"initial number of bins "<<nbin<<
"\n";
487 for(
Int_t bin=startBin;bin<endBin;bin++) {
488 Int_t uStatus,oStatus;
490 if(uStatus & isOptionGiven[1]) factor[bin-startBin]=0.;
491 if(oStatus & isOptionGiven[3]) factor[bin-startBin]=0.;
492 if(factor[bin-startBin] !=0.0) nbin++;
495 cout<<
"after underflow/overflow bin removal "<<nbin<<
"\n";
501 for(
Int_t bin=startBin;bin<endBin;bin++) {
502 if(factor[bin-startBin]==0.0)
continue;
508 thisRegularisationBinning->
AddBinning(
"size",nRegBins);
511 for(
Int_t direction=0;direction<dimension;direction++) {
514 Int_t directionMask=(1<<direction);
515 if(isOptionGiven[7] & directionMask) {
517 cout<<
"skip direction "<<direction<<
"\n";
522 (isOptionGiven[5] & directionMask) ?
524 (direction,isOptionGiven[0] & directionMask,
525 isOptionGiven[2] & directionMask) : 1.0;
526 for(
Int_t bin=startBin;bin<endBin;bin++) {
528 if(factor[bin-startBin]==0.0)
continue;
533 (bin,direction,&iPrev,&distPrev,&iNext,&distNext,
534 isOptionGiven[6] & directionMask);
536 Error(
"RegularizeOneDistribution",
537 "invalid option %s (isPeriodic) for axis %s"
538 " (has underflow or overflow)",axisSteering,
542 Double_t f0 = -factor[bin-startBin];
544 if(isOptionGiven[4] & directionMask) {
546 f0 *= binDistanceNormalisation/distNext;
547 f1 *= binDistanceNormalisation/distNext;
553 if((f0==0.0)||(
f1==0.0))
continue;
557 std::cout<<
"Added Reg: bin "<<bin<<
" "<<f0
558 <<
" next: "<<iNext<<
" "<<
f1<<
"\n";
562 Double_t f0 = factor[iPrev-startBin];
564 Double_t f2 = factor[iNext-startBin];
565 if(isOptionGiven[4] & directionMask) {
566 if((distPrev<0.)&&(distNext>0.)) {
571 f1 *=
f*(0.5/distPrev+0.5/distNext);
579 if((f0==0.0)||(
f1==0.0)||(f2==0.0))
continue;
583 std::cout<<
"Added Reg: prev "<<iPrev<<
" "<<f0
584 <<
" bin: "<<bin<<
" "<<
f1
585 <<
" next: "<<iNext<<
" "<<f2<<
"\n";
655(
const char *histogramName,
const char *histogramTitle,
656 const char *distributionName,
const char *axisSteering,
657 Bool_t useAxisBinning)
const
660 Int_t *binMap=
nullptr;
662 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
686(
const char *histogramName,
const char *histogramTitle,
687 const char *distributionName,
const char *axisSteering,
688 Bool_t useAxisBinning)
const
691 Int_t *binMap=
nullptr;
693 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
697 if(binMap)
delete [] binMap;
717(
const char *histogramName,
const char *histogramTitle,
718 const char *distributionName,
const char *axisSteering,
722 Int_t *binMap=
nullptr;
724 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
731 if(binMap)
delete [] binMap;
752(
const char *histogramName,
const char *bgrSource,
const char *histogramTitle,
753 const char *distributionName,
const char *axisSteering,
Bool_t useAxisBinning,
754 Int_t includeError)
const
757 Int_t *binMap=
nullptr;
759 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
763 if(binMap)
delete [] binMap;
782(
const char *histogramName,
const char *histogramTitle,
783 const char *distributionName,
const char *axisSteering,
784 Bool_t useAxisBinning)
const
787 Int_t *binMap=
nullptr;
789 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
793 if(binMap)
delete [] binMap;
814(
const char *histogramName,
const char *histogramTitle,
815 const char *distributionName,
const char *axisSteering,
818 Int_t *binMap=
nullptr;
820 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
822 TH2 *invEmat=
nullptr;
824 if(
r->GetDimension()==1) {
825 TString ematName(histogramName);
826 ematName +=
"_inverseEMAT";
827 Int_t *binMap2D=
nullptr;
829 (ematName,useAxisBinning,&binMap2D,histogramTitle,
831 if(binMap2D)
delete [] binMap2D;
833 Error(
"GetRhoItotal",
834 "can not return inverse of error matrix for this binning");
842 if(binMap)
delete [] binMap;
864(
const char *histogramName,
const char *histogramTitle,
865 const char *distributionName,
const char *axisSteering,
868 Int_t *binMap=
nullptr;
870 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
872 TH2 *invEmat=
nullptr;
874 if(
r->GetDimension()==1) {
875 TString ematName(histogramName);
876 ematName +=
"_inverseEMAT";
877 Int_t *binMap2D=
nullptr;
879 (ematName,useAxisBinning,&binMap2D,histogramTitle,
881 if(binMap2D)
delete [] binMap2D;
883 Error(
"GetRhoItotal",
884 "can not return inverse of error matrix for this binning");
892 if(binMap)
delete [] binMap;
912(
const char *source,
const char *histogramName,
913 const char *histogramTitle,
const char *distributionName,
914 const char *axisSteering,
Bool_t useAxisBinning) {
916 Int_t *binMap=
nullptr;
918 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
925 if(binMap)
delete [] binMap;
945(
const char *bgrSource,
const char *histogramName,
946 const char *histogramTitle,
const char *distributionName,
947 const char *axisSteering,
Bool_t useAxisBinning) {
949 Int_t *binMap=
nullptr;
951 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
958 if(binMap)
delete [] binMap;
977(
const char *histogramName,
const char *histogramTitle,
978 const char *distributionName,
const char *axisSteering,
Bool_t useAxisBinning)
981 Int_t *binMap=
nullptr;
983 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
990 if(binMap)
delete [] binMap;
1008(
const char *histogramName,
const char *histogramTitle,
1009 const char *distributionName,
const char *axisSteering,
1013 (histogramName,histogramTitle,distributionName,
1014 axisSteering,useAxisBinning);
1016 for(
Int_t i=0;i<=
r->GetNbinsX()+1;i++) {
1020 for(
Int_t j=0;j<=
r->GetNbinsY()+1;j++) {
1026 if((e_i>0.0)&&(e_j>0.0)) {
1027 r->SetBinContent(i,j,e_ij/e_i/e_j);
1029 r->SetBinContent(i,j,0.0);
1033 for(
Int_t i=0;i<=
r->GetNbinsX()+1;i++) {
1034 if(
r->GetBinContent(i,i)>0.0) {
1035 r->SetBinContent(i,i,1.0);
1037 r->SetBinContent(i,i,0.0);
1059(
const char *histogramName,
const char *histogramTitle,
1060 const char *distributionName,
const char *axisSteering,
1064 Int_t *binMap=
nullptr;
1066 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
1070 if(binMap)
delete [] binMap;
1089(
const char *bgrSource,
const char *histogramName,
1090 const char *histogramTitle,
const char *distributionName,
1091 const char *axisSteering,
Bool_t useAxisBinning)
1094 Int_t *binMap=
nullptr;
1096 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
1100 if(binMap)
delete [] binMap;
1120(
const char *histogramName,
const char *histogramTitle,
1121 const char *distributionName,
const char *axisSteering,
1125 Int_t *binMap=
nullptr;
1127 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
1131 if(binMap)
delete [] binMap;
1146(
const char *histogramName,
const char *histogramTitle,
1147 Bool_t useAxisBinning)
const
1151 useAxisBinning,useAxisBinning,histogramTitle);
1167(
const char *histogramName,
const char *histogramTitle,
1168 Bool_t useAxisBinning)
const
1172 useAxisBinning,useAxisBinning,histogramTitle);
1192(
const char *histogramName,
const char *histogramTitle,
1193 const char *distributionName,
const char *axisSteering,
1197 Int_t *binMap=
nullptr;
1199 (histogramName,useAxisBinning,&binMap,histogramTitle,axisSteering);
1203 if(binMap)
delete [] binMap;
1219(
const char *histogramName,
const char *histogramTitle,
Bool_t useAxisBinning)
1225 "remove invalid scheme of regularisation conditions %d %d",
1232 Warning(
"GetL",
"create flat regularisation conditions scheme");
1236 useAxisBinning,useAxisBinning,histogramTitle);
1256(
const char *histogramName,
const char *histogramTitle)
1264 "remove invalid scheme of regularisation conditions %d %d",
1271 Warning(
"GetLxMinusBias",
"create flat regularisation conditions scheme");
1274 (histogramName,
kFALSE,
nullptr,histogramTitle);
1278 if(Ldx_rows[row]<Ldx_rows[row+1]) {
1279 r->SetBinContent(row+1,Ldx_data[Ldx_rows[row]]);
1294(
const char *distributionName)
const
1310(
const char *distributionName)
const
1356 Int_t mode,
const char *distribution,
const char *axisSteering,
1359 typedef std::map<Double_t,Double_t> TauScan_t;
1360 typedef std::map<Double_t,std::pair<Double_t,Double_t> > LCurve_t;
1385 if((tauMin<=0)||(tauMax<=0.0)||(tauMin>=tauMax)) {
1395 Error(
"ScanTau",
"too few input bins, NDF<=nullptr %d",
GetNdf());
1400 Info(
"ScanTau",
"logtau=-Infinity y=%lf X=%lf Y=%lf",y0,X0,Y0);
1408 Fatal(
"ScanTau",
"problem (missing regularisation?) X=%f Y=%f",
1414 Info(
"ScanTau",
"logtau=%lf y=%lf X=%lf Y=%lf",logTau,
y,
1420 while(((
int)curve.size()<nPoint-1)&&
1423 Double_t logTau=(*curve.begin()).first-0.5;
1428 Info(
"ScanTay",
"logtau=%lf y=%lf X=%lf Y=%lf",logTau,
y,
1440 Info(
"ScanTau",
"logtau=%lf y=%lf X=%lf Y=%lf",logTauMax,
y,
1448 Info(
"ScanTau",
"logtau=%lf y=%lf X=%lf Y=%lf",logTauMin,
y,
1455 while((
int)curve.size()<nPoint-1) {
1461 TauScan_t::const_iterator i0,i1;
1466 for(;i0!=curve.end();i0++) {
1467 if((*i0).second<yMin) {
1469 logTauYMin=(*i0).first;
1478 for(i1++;i1!=curve.end();i1++) {
1483 +0.25*
TMath::Power(0.5*((*i0).first+(*i1).first)-logTauYMin,2.)/
1484 ((*curve.rbegin()).first-(*curve.begin()).first)/nPoint;
1485 if((dist<=0.0)||(dist>distMax)) {
1487 logTau=0.5*((*i0).first+(*i1).first);
1495 Info(
"ScanTau",
"logtau=%lf y=%lf X=%lf Y=%lf",logTau,
y,
1510 for(TauScan_t::const_iterator i=curve.begin();i!=curve.end();i++) {
1527 for(
Int_t i=iskip;i<
n-1-iskip;i++) {
1550 xx = m_p_half + discr;
1552 xx = m_p_half - discr;
1556 if((xx>0.0)&&(xx<dx)) {
1570 if((xx>0.0)&&(xx<dx)) {
1594 Info(
"ScanTau",
"Result logtau=%lf y=%lf X=%lf Y=%lf",logTauFin,
y,
1601 Int_t bestChoice=-1;
1602 if(!curve.empty()) {
1606 for( TauScan_t::const_iterator i=curve.begin();i!=curve.end();i++) {
1607 if(logTauFin==(*i).first) {
1617 if(distribution)
name+= distribution;
1619 if(axisSteering)
name += axisSteering;
1626 if(!lcurve.empty()) {
1631 for(LCurve_t::const_iterator i=lcurve.begin();i!=lcurve.end();i++) {
1633 x[
n]=(*i).second.first;
1634 y[
n]=(*i).second.second;
1640 (*lCurvePlot)->SetTitle(
"L curve");
1643 *logTauXPlot=
new TSpline3(
"log(chi**2)%log(tau)",logT,
x,
n);
1645 *logTauYPlot=
new TSpline3(
"log(reg.cond)%log(tau)",logT,
y,
n);
1681(
Int_t mode,
const char *distribution,
const char *axisSteering)
1686 if(distribution)
name += distribution;
1688 if(axisSteering)
name += axisSteering;
1705 if(
c>rhoMax) rhoMax=
c;
1721 Fatal(
"GetScanVariable",
"mode %d not implemented",
mode);
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
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.
virtual Int_t GetNbinsX() const
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Service class for 2-D histogram classes.
const Int_t * GetRowIndexArray() const override
const Element * GetMatrixArray() const override
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...
void GetCoeff(Int_t i, Double_t &x, Double_t &y, Double_t &b, Double_t &c, Double_t &d) const
Double_t Eval(Double_t x) const override
Eval this spline at x.
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
TString GetBinName(Int_t iBin) const
get the name of a bin
Int_t GetTH1xNumberOfBins(Bool_t originalAxisBinning=kTRUE, const char *axisSteering=nullptr) const
return the number of histogram bins required when storing this binning in a one-dimensional histogram
Double_t GetBinSize(Int_t iBin) const
get N-dimensional bin size
Int_t GetDistributionNumberOfBins(void) const
number of bins in the distribution possibly including under/overflow
virtual Double_t GetBinFactor(Int_t iBin) const
return scaling factor for the given global bin number
Int_t GetEndBin(void) const
last+1 bin of this node (includes children)
TUnfoldBinning const * GetParentNode(void) const
mother node
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 * FindNode(char const *name) const
traverse the tree and return the first node which matches the given name
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 fof 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)
retreive 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)
retreive covaraince 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)
retreive correlation coefficients, including all uncertainties
TString GetOutputBinName(Int_t iBinX) const override
Get bin name of an outpt 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)
retreive 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
retreive 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
retreive 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
retreive 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)
retreive 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)
retreive 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)
retreive1-sigma shift corresponding to the previously specified uncertainty on tau
TH2 * GetEmatrixSysBackgroundUncorr(const char *bgrSource, const char *histogramName, const char *histogramTitle=nullptr, const char *distributionName=nullptr, const char *projectionMode=nullptr, Bool_t useAxisBinning=kTRUE)
retreive 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
retreive 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
retreive 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 outpt 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 coefficiencts, 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
const TMatrixDSparse * GetDXDY(void) const
matrix of derivatives dx/dy
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)