94   if (
bdat->GetNbinsX() != 
bini->GetNbinsX() ||
 
   95       bdat->GetNbinsX() != 
xini->GetNbinsX() ||
 
   96       bdat->GetNbinsX() != 
Adet->GetNbinsX() ||
 
   97       bdat->GetNbinsX() != 
Adet->GetNbinsY()) {
 
   98      TString msg = 
"All histograms must have equal dimension.\n";
 
   99      msg += 
Form( 
"  Found: dim(bdat)=%i\n",    
bdat->GetNbinsX() );
 
  100      msg += 
Form( 
"  Found: dim(bini)=%i\n",    
bini->GetNbinsX() );
 
  101      msg += 
Form( 
"  Found: dim(xini)=%i\n",    
xini->GetNbinsX() );
 
  102      msg += 
Form( 
"  Found: dim(Adet)=%i,%i\n", 
Adet->GetNbinsX(), 
Adet->GetNbinsY() );
 
  103      msg += 
"Please start again!";
 
  110   for(
int i=1; i<=
fBdat->GetNbinsX(); i++){
 
  112      for(
int j=1; 
j<=
fBdat->GetNbinsX(); 
j++){
 
 
  148   if (
bdat->GetNbinsX() != 
bini->GetNbinsX() ||
 
  149       bdat->GetNbinsX() != 
xini->GetNbinsX() ||
 
  150       bdat->GetNbinsX() != 
Bcov->GetNbinsX() ||
 
  151       bdat->GetNbinsX() != 
Bcov->GetNbinsY() ||
 
  152       bdat->GetNbinsX() != 
Adet->GetNbinsX() ||
 
  153       bdat->GetNbinsX() != 
Adet->GetNbinsY()) {
 
  154      TString msg = 
"All histograms must have equal dimension.\n";
 
  155      msg += 
Form( 
"  Found: dim(bdat)=%i\n",    
bdat->GetNbinsX() );
 
  156      msg += 
Form( 
"  Found: dim(Bcov)=%i,%i\n",    
Bcov->GetNbinsX(), 
Bcov->GetNbinsY() );
 
  157      msg += 
Form( 
"  Found: dim(bini)=%i\n",    
bini->GetNbinsX() );
 
  158      msg += 
Form( 
"  Found: dim(xini)=%i\n",    
xini->GetNbinsX() );
 
  159      msg += 
Form( 
"  Found: dim(Adet)=%i,%i\n", 
Adet->GetNbinsX(), 
Adet->GetNbinsY() );
 
  160      msg += 
"Please start again!";
 
 
  177fNormalize  (
other.fNormalize),
 
  179fDHist      (
other.fDHist),
 
  180fSVHist     (
other.fSVHist),
 
  188fToyhisto   (
other.fToyhisto),
 
  189fToymat     (
other.fToymat),
 
  190fToyMode    (
other.fToyMode),
 
  191fMatToyMode (
other.fMatToyMode)
 
 
  285   for(
int i=0; i<
fNdim; i++){
 
  292   for(
int i=0; i<
fNdim; i++){
 
  385      Info( 
"Unfold", 
"Unfolding param: %i",k+1 );
 
  390   for(
int i=1; i<=
fNdim; i++){
 
  391      h->SetBinContent(i,0.);
 
  392      h->SetBinError(i,0.);
 
 
  412   unfcov->SetTitle(
"Toy covariance matrix");
 
  413   for(
int i=1; i<=
fNdim; i++)
 
  448   for (
int i=1; i<=
ntoys; i++) {
 
  476   for (
int i=1; i<=
ntoys; i++) {
 
 
  518   unfcov->SetTitle(
"Toy covariance matrix");
 
  519   for(
int i=1; i<=
fNdim; i++)
 
  530   for (
int i=1; i<=
ntoys; i++) {
 
  533            if (
fAdet->GetBinContent(k,
m)) {
 
  551   for (
int i=1; i<=
ntoys; i++) {
 
  554            if (
fAdet->GetBinContent(k,
m))
 
 
  661      for (
Int_t i=0; i<
mat.GetNrows(); i++) {
 
 
  673   for (
Int_t i=0; i<
vec1.GetNrows(); i++) {
 
 
  689   for (
Int_t i=0; i<
mat.GetNrows(); i++) {
 
 
  731   if (
fDdim == 0) 
for (
Int_t i=0; i<ndim; i++) 
tC(i,i) = 1;
 
  732   else if (
fDdim == 1) {
 
  733      for (
Int_t i=0; i<ndim; i++) {
 
  734         if (i < ndim-1) 
tC(i,i+1) = 1.0;
 
  738   else if (
fDdim == 2) {
 
  739      for (
Int_t i=0; i<ndim; i++) {
 
  740         if (i > 0)      
tC(i,i-1) = 1.0;
 
  741         if (i < ndim-1) 
tC(i,i+1) = 1.0;
 
  745      tC(ndim-1,ndim-1) = -1.0;
 
  747   else if (
fDdim == 3) {
 
  748      for (
Int_t i=1; i<ndim-2; i++) {
 
  756      for (
Int_t i=0; i<ndim; i++) {
 
  757         if (i > 0)      
tC(i,i-1) = -4.0;
 
  758         if (i < ndim-1) 
tC(i,i+1) = -4.0;
 
  759         if (i > 1)      
tC(i,i-2) =  1.0;
 
  760         if (i < ndim-2) 
tC(i,i+2) =  1.0;
 
  764      tC(ndim-1,ndim-1) = 2.0;
 
  766      tC(ndim-2,ndim-1) = -3.0;
 
  768      tC(ndim-1,ndim-2) = -3.0;
 
  770      tC(ndim-2,ndim-2) =  6.0;
 
  772   else if (
fDdim == 5) {
 
  773      for (
Int_t i=2; i < ndim-3; i++) {
 
  782   else if (
fDdim == 6) {
 
  783      for (
Int_t i = 3; i < ndim - 3; i++) {
 
  795   for (
Int_t i=0; i<ndim; i++) 
tC(i,i) = 
tC(i,i) + eps;
 
  798   for (
Int_t i=0; i<ndim; i++) {
 
  800         for (
Int_t k=0; k<ndim; k++) {
 
 
  853   for (
UInt_t in=0; in<nn; in++) {
 
  869   for (
UInt_t in=0; in<nn; in++) {
 
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
TMatrixT< Double_t > TMatrixD
 
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
 
Single Value Decomposition class.
 
1-D histogram with a double per channel (see TH1 documentation)
 
void SetTitle(const char *title) override
Change/set the title.
 
virtual Int_t GetNbinsY() const
 
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
 
virtual Int_t GetNbinsX() const
 
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
 
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
 
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
 
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
 
2-D histogram with a double per channel (see TH1 documentation)
 
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
 
Double_t GetBinContent(Int_t binx, Int_t biny) const override
 
Mother of all ROOT objects.
 
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.
 
Random number generator class based on M.
 
SVD Approach to Data Unfolding.
 
TH1D * GetSV() const
Returns singular values vector.
 
TH2D * GetBCov() const
Returns the covariance matrix.
 
TH1D * fSVHist
! Distribution of singular values
 
TH2D * GetXtau() const
Returns the computed regularized covariance matrix corresponding to total uncertainties on measured s...
 
Bool_t fToyMode
! Internal switch for covariance matrix propagation
 
static void V2H(const TVectorD &vec, TH1D &histo)
Fill vector into 1D histogram.
 
static void H2M(const TH2D *histo, TMatrixD &mat)
Fill 2D histogram into matrix.
 
static void RegularisedSymMatInvert(TMatrixDSym &mat, Double_t eps=1e-3)
naive regularised inversion cuts off small elements
 
static TVectorD CompProd(const TVectorD &vec1, const TVectorD &vec2)
Multiply entries of two vectors.
 
static void M2H(const TMatrixD &mat, TH2D &histo)
Fill 2D histogram into matrix.
 
Bool_t fMatToyMode
! Internal switch for evaluation of statistical uncertainties from response matrix
 
TSVDUnfold(const TH1D *bdat, const TH1D *bini, const TH1D *xini, const TH2D *Adet)
Alternative constructor User provides data and MC test spectra, as well as detector response matrix,...
 
Bool_t fNormalize
! Normalize unfolded spectrum to 1
 
const TH1D * fBini
Reconstructed distribution (MC)
 
TH1D * Unfold(Int_t kreg)
Perform the unfolding with regularisation parameter kreg.
 
Double_t ComputeChiSquared(const TH1D &truspec, const TH1D &unfspec)
Helper routine to compute chi-squared between distributions using the computed inverse of the covaria...
 
TH2D * fToymat
! Toy MC detector response matrix
 
static Double_t GetCurvature(const TVectorD &vec, const TMatrixD &curv)
Compute curvature of vector.
 
const TH1D * fBdat
Measured distribution (data)
 
~TSVDUnfold() override
Destructor.
 
static TMatrixD MatDivVec(const TMatrixD &mat, const TVectorD &vec, Int_t zero=0)
Divide matrix entries by vector.
 
TH2D * fXinv
! Computed inverse of covariance matrix
 
static TVectorD VecDiv(const TVectorD &vec1, const TVectorD &vec2, Int_t zero=0)
Divide entries of two vectors.
 
void FillCurvatureMatrix(TMatrixD &tCurv, TMatrixD &tC) const
 
TH1D * GetD() const
Returns d vector (for choosing appropriate regularisation)
 
TH2D * fXtau
! Computed regularized covariance matrix
 
TH1D * fDHist
! Distribution of d (for checking regularization)
 
static void H2Verr(const TH1D *histo, TVectorD &vec)
Fill 1D histogram errors into vector.
 
Int_t fDdim
! Derivative for curvature matrix
 
TH2D * GetUnfoldCovMatrix(const TH2D *cov, Int_t ntoys, Int_t seed=1)
Determine for given input error matrix covariance matrix of unfolded spectrum from toy simulation giv...
 
TH2D * GetAdetCovMatrix(Int_t ntoys, Int_t seed=1)
Determine covariance matrix of unfolded spectrum from finite statistics in response matrix using pseu...
 
const TH2D * fAdet
Detector response matrix.
 
TH2D * GetXinv() const
Returns the computed inverse of the covariance matrix.
 
static void H2V(const TH1D *histo, TVectorD &vec)
Fill 1D histogram into vector.
 
Int_t fKReg
! Regularisation parameter
 
TH1D * fToyhisto
! Toy MC histogram
 
TH2D * fBcov
Covariance matrix of measured distribution (data)
 
const TH1D * fXini
Truth distribution (MC)
 
Int_t fNdim
! Truth and reconstructed dimensions
 
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.
 
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.