added expected chisq calculation for single histogram fits (MUSR-194)
This commit is contained in:
@ -65,6 +65,8 @@ PFitterFcn::~PFitterFcn()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// operator()
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Minuit2 interface function call routine. This is the function which should be minimized.
|
||||
@ -90,3 +92,48 @@ Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetNoOfFittedBins()
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the number of fitted bins of the run block idx.
|
||||
*
|
||||
* \param idx index of the run block
|
||||
*/
|
||||
UInt_t PFitterFcn::GetNoOfFittedBins(const UInt_t idx)
|
||||
{
|
||||
UInt_t result = 0;
|
||||
|
||||
if (idx < fRunListCollection->GetNoOfSingleHisto())
|
||||
result = fRunListCollection->GetNoOfBinsFitted(idx);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CalcExpectedChiSquare()
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Calculates the expected chisq, if applicable.
|
||||
*
|
||||
* \param par
|
||||
* \param totalExpectedChisq expected chisq for all run blocks
|
||||
* \param expectedChisqPerRun expected chisq vector for all the run blocks
|
||||
*/
|
||||
void PFitterFcn::CalcExpectedChiSquare(const std::vector<Double_t> &par, Double_t &totalExpectedChisq, std::vector<Double_t> &expectedChisqPerRun)
|
||||
{
|
||||
// init expected chisq related variables
|
||||
totalExpectedChisq = 0.0;
|
||||
expectedChisqPerRun.clear();
|
||||
|
||||
// only do something for chisq
|
||||
if (fUseChi2) {
|
||||
Double_t value = 0.0;
|
||||
for (UInt_t i=0; i<fRunListCollection->GetNoOfSingleHisto(); i++) {
|
||||
value = fRunListCollection->GetSingleHistoChisqExpected(par, i); // calculate the expected chisq for single histo run block 'i'
|
||||
expectedChisqPerRun.push_back(value);
|
||||
totalExpectedChisq += value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user