Error in TUnfolding

Dear experts,
I am trying to do unfolding using TUnfold with regularization, scanning LCurve method. I am using 12 bins for reco MC and 6 bins for Gen MC and data. I am getting errors like-

Info in TUnfold::SetConstraint: fConstraint=0
Info in TUnfold::TUnfold: 12 input bins and 8 output bins (includes 2 underflow/overflow bins)
Warning in TUnfold::SetInput: 7/12 input bins have zero error, and are ignored.
Error in TUnfold::GetInputInverseEmatrix: number of parameters 8 > 5 (rank of input covariance). Problem can not be solved
Info in TUnfold::InvertMSparseSymmPos: cholesky-decomposition failed, try eigenvalue analysis
Warning in TUnfold::DoUnfold: rank of matrix E 5 expect 8
Info in TUnfold::InvertMSparseSymmPos: cholesky-decomposition failed, try eigenvalue analysis
Warning in TUnfold::DoUnfold: rank of output covariance is 5 expect 8
Error in TUnfold::ScanLcurve: too few input bins, NDF<=0 -3
Info in TUnfold::ScanLcurve: logtau=-Infinity X=-28.254760 Y=7.000336
Fatal in TUnfold::AddMSparse: Nan detected 0 1 1
[/opt/homebrew/Cellar/root/6.28.06/lib/root/] ErrorHandler (no debug info)
[/opt/homebrew/Cellar/root/6.28.06/lib/root/] TObject::Fatal(char const*, char const*, …) const (no debug info)
[/opt/homebrew/Cellar/root/6.28.06/lib/root/] TUnfold::AddMSparse(TMatrixTSparse, double, TMatrixTSparse const) const (no debug info)
[/opt/homebrew/Cellar/root/6.28.06/lib/root/] TUnfold::DoUnfold() (no debug info)
[/opt/homebrew/Cellar/root/6.28.06/lib/root/] TUnfold::ScanLcurve(int, double, double, TGraph**, TSpline**, TSpline**, TSpline**) (no debug info)
[] (no debug info)
[] (no debug info)
[/opt/homebrew/Cellar/root/6.28.06/lib/root/] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (no debug info)

The part of the code for unfolding is given below-

TUnfold::ERegMode regMode=TUnfold::kRegModeSize;

TUnfold::EConstraint constraintMode=TUnfold::kEConstraintNone;
TUnfoldDensity::EDensityMode densityFlags = TUnfoldDensity::kDensityModeBinWidth;
TUnfold::EHistMap outputMap = TUnfold::kHistMapOutputHoriz;
TUnfold unfold(hEleMu_RecoGenTauPt[0],
unfold.SetInput( hMu_Pt_data_bkgSub,1.0);
TGraph *lcurve=0;
TSpline *logTauX=0,*logTauY=0;
double tau=unfold.GetTau();
double logTau=TMath::Log10(tau);
double lcurveX=logTauX->Eval(logTau);
double lcurveY=logTauY->Eval(logTau);

TH1 *hUnfold_TauPt_data;

How can I solve this problem?
Just to mention non-regularization worked (Not proper unfolding but code ran) for this case with simple case tau=0.
Any help would be appreciated. Thanks in advance!


Hi @pjana,
thanks for reaching out! Can you post a code snippet to reproduce the error?


Hi @mdessole ,
I have attached the script.
makeUnfold_data.C (20.7 KB)


hi @pjana,

You will have to put a bit more effort in this piece of code to reproduce the error. For starters, you have to supply an input file, like the one mentioned in

TFile *f1=new TFile("RootFile/GenMatch/Data_MuMuFSR_4thOctober.root","r");

In these 592 lines, probable a lot is not used. Please remove it so that
one can concentrate on the real issue.