\param [in] histo the 2D histogram describing the DP distribution
\param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
\param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors
\param [in] useUpperHalfOnly boolean flag to determine whether, in the case of a symmetric DP, the histogram supplied only includes the upper half of the DP
\param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
//! Set the background histogram and generate a spline
/*!
\param [in] histo the 2D histogram describing the DP distribution
\param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors
\param [in] useUpperHalfOnly boolean flag to determine whether, in the case of a symmetric DP, the histogram supplied only includes the upper half of the DP
\param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
Double_t value = bgHistDPPdf_->interpolateXY(xVal, yVal);
+ // Check that the value is greater than zero
+ // If we're using a spline then negative values can be caused by adjacent bins that all contain a value of zero.
+ // The spline requires the value, its first derivatives and the mixed second derivative to be continuous and to match the input histogram
+ // at the bin centres. Derivatives are calculated using a finite difference approximation taking the difference between the neighbouring bins.
+ // If two bins are zero but the third is not then the second bin will have a positive first derivative causing the spline to dip below zero
+ // between the two zero bins to remain smooth. Such dips are unavoidable but are correctly removed here.
+ if ( value < 0.0 ) {
+ if(!lowBinWarningIssued_) {
+ std::cerr << "WARNING in LauBkgndDPModel::calcHistValue : Value " << value << " is less than 0 - setting to 0. You may want to check your histogram!" << std::endl
+ << " : If you are using a spline then this could be caused by adjacent empty bins. Further warnings will be suppressed." << std::endl;
cerr << "WARNING in LauBkgndDPModel::generate : We don't have a histogram so generating flat in the square DP, which won't be flat in the conventional DP!" << endl;
cerr << "WARNING in LauBkgndDPModel::generate : This should never happen!! What have you done?!" << endl;
// Check that the efficiency is in the allowed range (0-1)
// If we're using a spline then out-of-range efficiencies can be caused by adjacent bins that all contain a value of either zero or one.
// The spline requires the efficiency, its first derivatives and the mixed second derivative to be continuous and to match the input histogram
// at the bin centres. Derivatives are calculated using a finite difference approximation taking the difference between the neighbouring bins.
// If two bins are zero but the third is not then the second bin will have a positive first derivative causing the spline to dip below zero
// between the two zero bins to remain smooth. The analogous case with adjacent maximised bins will cause peaks above one. Such dips are
// unavoidable but are correctly removed here.
if ( eff < 0.0 ) {
if(!lowBinWarningIssued_) {
std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency " << eff << " is less than 0 - setting to 0. You may want to check your histogram!" << std::endl
- << "If you are using a spline then this could be caused by adjacent empty bins. Further warnings will be suppressed." << std::endl;
+ << " : If you are using a spline then this could be caused by adjacent empty bins. Further warnings will be suppressed." << std::endl;
lowBinWarningIssued_=kTRUE;
}
eff = 0.0;
} else if ( eff > 1.0 ) {
if(!highBinWarningIssued_) {
std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency " << eff << " is greater than 1 - setting to 1. You may want to check your histogram!" << std::endl
- << "If you are using a spline then this could be caused by adjacent full bins. Further warnings will be suppressed." << std::endl;
+ << " : If you are using a spline then this could be caused by adjacent full bins. Further warnings will be suppressed." << std::endl;