npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0

Public Member Functions

 UnfoldingBandwidthScanner1D (AbsUnfold1D &unfold, const double *observed, unsigned lenObserved, const Matrix< double > *observationCovariance, const double *oracle, unsigned lenOracle, int symbetaPower, double maxDegree, double xMinUnfolded, double xMaxUnfolded, const BoundaryHandling &filterBoundaryMethod, double nDoFCorrectionFactor, const std::vector< const AbsBinnedComparison1D * > &foldedComparators, const std::vector< const AbsBinnedComparison1D * > &oracleComparators)
 
virtual std::vector< std::string > variableNames () const
 
virtual unsigned variableCount () const
 
virtual unsigned ntuplize (double *buf, unsigned len) const
 
bool process (double bandwidth)
 
MinSearchStatus1D processAICcBandwidth (double bwmin, double bwmax, unsigned nsteps, double startBw, double startingFactor, bool useEntropicNDoF=true)
 
double lastBandwidth () const
 
virtual void setObservedData (const double *observed, unsigned len, const Matrix< double > *observCovariance)
 
virtual void setBias (const double *unfoldingBias, unsigned len)
 
const std::vector< double > & getBias () const
 
virtual void clearBias ()
 
unsigned observedSize () const
 
unsigned unfoldedSize () const
 
virtual bool lastUnfoldingStatus () const
 
const std::vector< double > & unfoldedResult () const
 
const Matrix< double > & unfoldedCovariance () const
 
const Matrix< double > & responseMatrix () const
 
const std::vector< double > & getOracleData () const
 
const std::vector< double > & smoothedOracleData () const
 
const std::vector< double > & eigenDeltas () const
 
const std::vector< double > & covEigenValues () const
 
bool usingConvolutions () const
 
void setInitialApproximation (const double *approx, unsigned lenApprox)
 
void clearInitialApproximation ()
 
const std::vector< double > & getInitialApproximation () const
 
double nDoFCorrectionFactor () const
 
void setNDoFCorrectionFactor (const double f)
 
std::pair< double, double > smoothingNDoF () const
 
std::pair< double, double > responseNDoF () const
 
std::pair< double, double > smoothedResponseNDoF () const
 

Static Public Member Functions

static void addNamesWithPrefix (const char *prefix, unsigned count, std::vector< std::string > *names)
 

Protected Member Functions

virtual bool performUnfolding ()
 

Protected Attributes

AbsUnfold1Dunfold_
 
std::vector< double > observed_
 
std::vector< double > oracle_
 
double maxLOrPEDegree_
 
double xmin_
 
double xmax_
 
double binwidth_
 
double nDoFCorr_
 
double nObserved_
 
double obsNonZeroFraction_
 
BoundaryHandling bm_
 
std::vector< const AbsBinnedComparison1D * > foldedComparators_
 
std::vector< const AbsBinnedComparison1D * > oracleComparators_
 
int symbetaPower_
 
Matrix< double > observationCovariance_
 
Matrix< double > observationErr_
 
double bandwidth_
 
bool useEntropicNDoFinAICc_
 
std::vector< double > unfoldedVec_
 
Matrix< double > unfoldedCovmat_
 
std::vector< double > smoothedOracleVec_
 
std::vector< double > eigenDeltas_
 
std::vector< double > covEigenValues_
 

Friends

class Private::UnfoldingBandwidthScanner1DHelper
 

Constructor & Destructor Documentation

◆ UnfoldingBandwidthScanner1D()

npstat::UnfoldingBandwidthScanner1D::UnfoldingBandwidthScanner1D ( AbsUnfold1D unfold,
const double *  observed,
unsigned  lenObserved,
const Matrix< double > *  observationCovariance,
const double *  oracle,
unsigned  lenOracle,
int  symbetaPower,
double  maxDegree,
double  xMinUnfolded,
double  xMaxUnfolded,
const BoundaryHandling filterBoundaryMethod,
double  nDoFCorrectionFactor,
const std::vector< const AbsBinnedComparison1D * > &  foldedComparators,
const std::vector< const AbsBinnedComparison1D * > &  oracleComparators 
)

The constructor arguments are as follows:

unfold – An instance of AbsUnfold1D class.

observed, lenObserved – Observed data and its length. Can be modified later using "setObservedData" method.

observationCovariance – Covariance matrix for the observed values (can be NULL). If provided, this matrix should be symmetric and positive-definite. An internal copy will be made.

oracle, lenOracle – The "correct" unfolded distribution for use in various comparisons with unfolded results. If lenOracle == 0, this distribution will be considered unknown (in this case "oracle" pointer can be NULL), and the corresponding comparisons will not be made.

symbetaPower – This code will create smoothing filters maxDegree for the unfolded space using the xMinUnfolded function "symbetaLOrPEFilter1D". xMaxUnfolded These parameters will be passed to filterBoundaryMethod the "symbetaLOrPEFilter1D" call.

nDoFCorrectionFactor – The correction factor to use for determining the number of effective parameters in the fit. If this argument is positive, it will be multiplied by the number of parameters determined by the standard procedure (so set it to 1.0 in order not to apply any correction). If this argument is 0 or negative, the correction factor will be calculated as the fraction of bins filled in the observed data.

foldedComparators – The comparator objects to use in order to compare observed data with its fit.

oracleComparators – The comparator objects to use in order to compare unfolded data with the oracle (in case the oracle is actually provided).

Member Function Documentation

◆ addNamesWithPrefix()

static void npstat::UnfoldingBandwidthScanner1D::addNamesWithPrefix ( const char *  prefix,
unsigned  count,
std::vector< std::string > *  names 
)
static

Add a number of names to the given vector of strings

◆ clearBias()

virtual void npstat::UnfoldingBandwidthScanner1D::clearBias ( )
inlinevirtual

Clear bias data

◆ clearInitialApproximation()

void npstat::UnfoldingBandwidthScanner1D::clearInitialApproximation ( )
inline

Clear the initial approximation to the unfolded solution

◆ covEigenValues()

const std::vector<double>& npstat::UnfoldingBandwidthScanner1D::covEigenValues ( ) const
inline

Return covariance matrix eigenvalues (in the decreasing order)

◆ eigenDeltas()

const std::vector<double>& npstat::UnfoldingBandwidthScanner1D::eigenDeltas ( ) const
inline

Return eigenvector differences divided by sigma

◆ getBias()

const std::vector<double>& npstat::UnfoldingBandwidthScanner1D::getBias ( ) const
inline

Return the bias data provided by the last "setBias" call

◆ getInitialApproximation()

const std::vector<double>& npstat::UnfoldingBandwidthScanner1D::getInitialApproximation ( ) const
inline

Return the initial approximation to the unfolded solution

◆ getOracleData()

const std::vector<double>& npstat::UnfoldingBandwidthScanner1D::getOracleData ( ) const
inline

Oracle data. Empty vector is returned if the oracle was not provided in the constructor.

◆ lastBandwidth()

double npstat::UnfoldingBandwidthScanner1D::lastBandwidth ( ) const
inline

Last bandwidth processed

◆ lastUnfoldingStatus()

virtual bool npstat::UnfoldingBandwidthScanner1D::lastUnfoldingStatus ( ) const
inlinevirtual

Status of the last unfolding call ("true" means success)

◆ nDoFCorrectionFactor()

double npstat::UnfoldingBandwidthScanner1D::nDoFCorrectionFactor ( ) const
inline

Correction factor for the number of degrees of freedom

◆ ntuplize()

virtual unsigned npstat::UnfoldingBandwidthScanner1D::ntuplize ( double *  buf,
unsigned  len 
) const
virtual

Write out produced variables into a common buffer. The order of the values will be consistent with the names returned by the "variableNames" method. The function returns the number of variables filled.

◆ observedSize()

unsigned npstat::UnfoldingBandwidthScanner1D::observedSize ( ) const
inline

Length of the observed data vector

◆ process()

bool npstat::UnfoldingBandwidthScanner1D::process ( double  bandwidth)

Perform unfolding with the given bandwidth. This method returns "true" on success and "false" on failure.

◆ processAICcBandwidth()

MinSearchStatus1D npstat::UnfoldingBandwidthScanner1D::processAICcBandwidth ( double  bwmin,
double  bwmax,
unsigned  nsteps,
double  startBw,
double  startingFactor,
bool  useEntropicNDoF = true 
)

Find the optimal bandwidth according to the AICc criterion and process that bandwidth. The arguments "bwmin", "bwmax", and "nsteps" specify the initial grid in the log space on which bandwidth search is performed ("nsteps" must be larger than 2). "startBw" is the bandwidth from which to start the search and "startingFactor" (>1.0) is an aproximate stepping factor for the beginning of the search. The argument "useEntropicNDoF" specifies whether the code should calculate effective NDoF for AICc using eigenspectrum entropy (if "true") or the trace (if "false") of the relevant matrix. Correspondingly, the code will minimize AICcEntropic or AICcTrace.

As the intermediate results are memoized (filters, degrees of freedom, etc), it is best to call this function on different observed data with the same values of "bwmin", "bwmax", and "nsteps" arguments.

This function returns the status of the search for the minimum AICc. The results of the "process" call for the corresponding bandwidth can be retrieved in the usual manner, using methods "ntuplize", "lastUnfoldingStatus", "lastBandwidth", "unfoldedResult", etc.

◆ responseMatrix()

const Matrix<double>& npstat::UnfoldingBandwidthScanner1D::responseMatrix ( ) const
inline

Response matrix

◆ setBias()

virtual void npstat::UnfoldingBandwidthScanner1D::setBias ( const double *  unfoldingBias,
unsigned  len 
)
virtual

Set the bias (this is useful for various studies of uncertainties). If set, this bias will be added to the smoothed oracle data. The length must be compatible with the length of the unfolded result.

◆ setInitialApproximation()

void npstat::UnfoldingBandwidthScanner1D::setInitialApproximation ( const double *  approx,
unsigned  lenApprox 
)
inline

Set the initial approximation to the unfolded solution

◆ setNDoFCorrectionFactor()

void npstat::UnfoldingBandwidthScanner1D::setNDoFCorrectionFactor ( const double  f)
inline

Set the correction factor for the number of degrees of freedom

◆ setObservedData()

virtual void npstat::UnfoldingBandwidthScanner1D::setObservedData ( const double *  observed,
unsigned  len,
const Matrix< double > *  observCovariance 
)
virtual

Change the vector of observations. Array size must be compatible with that given in the constructor. The pointer to the covariance matrix of observations can be NULL. If provided, this matrix should be symmetric and positive-definite.

◆ smoothedOracleData()

const std::vector<double>& npstat::UnfoldingBandwidthScanner1D::smoothedOracleData ( ) const
inline

Return oracle data smoothed with the last processed bandwidth. If the bias was set, it was added to this data.

◆ smoothingNDoF()

std::pair<double, double> npstat::UnfoldingBandwidthScanner1D::smoothingNDoF ( ) const
inline

Function forwarded from AbsUnfold1D

◆ unfoldedCovariance()

const Matrix<double>& npstat::UnfoldingBandwidthScanner1D::unfoldedCovariance ( ) const
inline

Last unfolded covariance matrix

◆ unfoldedResult()

const std::vector<double>& npstat::UnfoldingBandwidthScanner1D::unfoldedResult ( ) const
inline

Last unfolded distribution

◆ unfoldedSize()

unsigned npstat::UnfoldingBandwidthScanner1D::unfoldedSize ( ) const
inline

Length of the unfolded data vector

◆ usingConvolutions()

bool npstat::UnfoldingBandwidthScanner1D::usingConvolutions ( ) const
inline

Are we using convolutions with our filters?

◆ variableCount()

virtual unsigned npstat::UnfoldingBandwidthScanner1D::variableCount ( ) const
virtual

Number of variables calculated by the "process" method. See the description of "variableNames" method for details.

◆ variableNames()

virtual std::vector<std::string> npstat::UnfoldingBandwidthScanner1D::variableNames ( ) const
virtual

Names of the variables calculated by calling the "process" method. The meaning of the variables is described below. Variables which have * in front of their names will have meaningful values only in case the known "oracle" distribution was provided in the constructor.

bandwidth – Last bandwidth processed. Will be set to -1.0 if processing has failed and to -2.0 if "ntuplize" was called before the first call to "process". In case bandwidth is negative, values of all other variables are undefined (might simply remain unchanged from the previous "process" call). Always check that the bandwidth is non-negative before looking at other variables.

foldedSum – Sum of the Poisson means fitted to the observations.

unfoldedSum – Sum of the unfolded values.

*smoothedOracleSum – Sum of the smoothed oracle data.

foldedLogli – Poisson log-likelihood for the observations assuming that the Poisson means are given by the fit. If the covariance matrix of the observations was provided by the user, this variable will be set to -chi^2/2 instead.

*unfoldedLogli – Poisson log-likelihood for the unfolded distribution assuming that the Poisson means are given by the oracle data.

*unfoldedISE – Integrated squared error for the unfolded distribution w.r.t. the oracle (both distributions are normalized to 1). This variable is the easiest one to check in order to find out whether an oracle was provided (its value will be negative if it wasn't).

*unfoldedDiagChisq – Chi-squared of the unfolded distribution w.r.t. the oracle using only the diagonal elements of the unfolding covariance matrix.

*smoothedUnfoldedLogli – Poisson log-likelihood for the unfolded distribution assuming that the Poisson means are given by the smoothed oracle data.

*smoothedUnfoldedISE – Integrated squared error for the unfolded distribution w.r.t. the smoothed oracle (both distributions are normalized to 1).

*smoothedUnfoldedDiagChisq – Chi-squared of the unfolded distribution w.r.t. the smoothed oracle using only the diagonal elements of the covariance matrix.

filterNDoFEntropic – Effective number of degrees of filterNDoFTrace freedom for the smoothing matrix, (defined for S * S^T). "Entropic" means that the exponent of the eigenspectrum entropy is used to define effective NDoF, and "Trace" means that the ratio of the matrix trace to the largest eigenvalue is used.

foldingNDoFEntropic – Effective NDoF for the "folding" foldingNDoFTrace matrix F = K*S (defined for F * F^T. K is the response matrix here). F "folds" the unsmoothed distribution in the expectation-maximization iterations.

unfoldedNDoFEntropic – Effective NDoF for the unfolding unfoldedNDoFTrace covariance matrix.

modelNDoFEntropic – Effective NDoF for the matrix modelNDoFTrace H = K*E*(K*E)^T which plays a role similar to the hat matrix in regression. Here, E is the error propagation matrix for unfolding uniform observed distribution.

AICcEntropic – AIC (Akaike information criterion) AICcTrace with a correction for the finite sample size. Calculated using "foldedLogli" and corresponding "modelNDoF".

smoothingNormfactor – Normalization factor applied during the last smoothing procedure.

integratedVariance – Product of the covariance matrix trace and the bin width in the unfolded space.

nIterations – Number of iterations used to process this bandwidth (e.g., by the expectation-maximization method).

unfoldingStatus – Status returned by the "unfold" call of the unfolding object.

foldedDistance_N – With N = 0, 1, ..., up to foldedPValue_N foldedComparators.size() - 1. Distances and p-values between the observations and their fitted values, calculated by distribution comparators provided in the "foldedComparators" argument of the constructor.

*oracleDistance_N – With N = 0, 1, ..., up to *oraclePValue_N oracleComparators.size() - 1. Distances and p-values between oracle data and unfolded values, calculated by distribution comparators provided in the "oracleComparators" argument of the constructor.

*smoothedOracleDistance_N – With N = 0, 1, ..., up to *smoothedOraclePValue_N oracleComparators.size() - 1. Distances and p-values between smoothed oracle data and unfolded values, calculated by distribution comparators provided in the "oracleComparators" argument of the constructor.


The documentation for this class was generated from the following file: