changed name of a function for a more precise self description. Added function to collect to mu minus parameters.

This commit is contained in:
2016-04-25 12:15:36 +02:00
parent be9498f37d
commit 4dc36ffbae
3 changed files with 68 additions and 19 deletions

View File

@ -334,23 +334,24 @@ Double_t PRunListCollection::GetNonMusrChisq(const std::vector<Double_t>& par) c
}
//--------------------------------------------------------------------------
// GetSingleHistoChisqExpected (public)
// GetSingleRunChisqExpected (public)
//--------------------------------------------------------------------------
/**
* <p>Calculates expected chi-square of the single histogram with run block index idx of a msr-file.
* <p>Calculates expected chi-square of the run block index idx of a msr-file.
* Currently this is only possible for Single Histo, and Mu Minus fits.
*
* <b>return:</b>
* - expected chi-square of for a single histogram
* - expected chi-square of for a single run block
*
* \param par fit parameter vector
* \param idx run block index
*/
Double_t PRunListCollection::GetSingleHistoChisqExpected(const std::vector<Double_t>& par, const UInt_t idx) const
Double_t PRunListCollection::GetSingleRunChisqExpected(const std::vector<Double_t>& par, const UInt_t idx) const
{
Double_t expectedChisq = 0.0;
if (idx > fMsrInfo->GetMsrRunList()->size()) {
cerr << ">> PRunListCollection::GetSingleHistoChisqExpected() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << endl << endl;
cerr << ">> PRunListCollection::GetSingleRunChisqExpected() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << endl << endl;
return expectedChisq;
}
@ -371,21 +372,9 @@ Double_t PRunListCollection::GetSingleHistoChisqExpected(const std::vector<Doubl
case PRUN_SINGLE_HISTO:
expectedChisq = fRunSingleHistoList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_SINGLE_HISTO_RRF:
expectedChisq = fRunSingleHistoRRFList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_ASYMMETRY:
expectedChisq = fRunAsymmetryList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_ASYMMETRY_RRF:
expectedChisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_MU_MINUS:
expectedChisq = fRunMuMinusList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_NON_MUSR:
expectedChisq = fRunNonMusrList[subIdx]->CalcChiSquareExpected(par);
break;
default:
break;
}
@ -1084,6 +1073,10 @@ Int_t PRunListCollection::GetStartTimeBin(Int_t fitType, UInt_t idx)
if (idx < fRunAsymmetryList.size())
result = fRunAsymmetryList[idx]->GetStartTimeBin();
break;
case MSR_FITTYPE_MU_MINUS:
if (idx < fRunMuMinusList.size())
result = fRunMuMinusList[idx]->GetStartTimeBin();
break;
default:
break;
}
@ -1113,6 +1106,10 @@ Int_t PRunListCollection::GetEndTimeBin(Int_t fitType, UInt_t idx)
if (idx < fRunAsymmetryList.size())
result = fRunAsymmetryList[idx]->GetEndTimeBin();
break;
case MSR_FITTYPE_MU_MINUS:
if (idx < fRunMuMinusList.size())
result = fRunMuMinusList[idx]->GetEndTimeBin();
break;
default:
break;
}
@ -1258,6 +1255,57 @@ Int_t PRunListCollection::GetAsymmetryParams(UInt_t idx, const std::vector<Doubl
return ierr;
}
//--------------------------------------------------------------------------
// GetMuMinusParams (public)
//--------------------------------------------------------------------------
/**
* @brief PRunListCollection::GetMuMinusParams
* @param idx
* @param par
* @param shp
* @return
*/
Int_t PRunListCollection::GetMuMinusParams(UInt_t idx, const std::vector<Double_t>& par, PDKSParams &dksp)
{
Int_t ierr = 0;
// make sure idx is within proper bounds
if (idx >= fRunMuMinusList.size())
return 1;
// get run block
PMsrRunBlock runInfo = fMsrInfo->GetMsrRunList()->at(idx);
// init param
InitDKSParams(dksp);
// get packed time resolution
dksp.fPackedTimeResolution = fRunMuMinusList[idx]->GetData()->GetDataTimeStep();
// get start time
// fRunSingleHistoList[idx]->GetData()->GetDataTimeStart() : time of fgb, which is 0-bin of the fit-data-set
// fRunSingleHistoList[idx]->GetStartTimeBin() * dksp.fPackedTimeResolution : time-offset from fgb-time to fit start time
dksp.fStartTime = fRunMuMinusList[idx]->GetData()->GetDataTimeStart() + fRunMuMinusList[idx]->GetStartTimeBin() * dksp.fPackedTimeResolution;
// get number of bins fitted
dksp.fNoOfFitBins = fRunMuMinusList[idx]->GetNoOfFitBins();
// calculate functions
Int_t funcNo = 0;
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
funcNo = fMsrInfo->GetFuncNo(i);
dksp.fFun.push_back(fMsrInfo->EvalFunc(funcNo, *runInfo.GetMap(), par));
}
// get map vector
dksp.fMap = *runInfo.GetMap();
dksp.fMap.erase(dksp.fMap.begin()+GetNoOfMaps(), dksp.fMap.end());
// need to reduce map indexes by 1 since in C/C++ arrays start at 0
for (UInt_t i=0; i<dksp.fMap.size(); i++)
dksp.fMap[i] -= 1;
return ierr;
}
//--------------------------------------------------------------------------
// InitDKSParams (private)
//--------------------------------------------------------------------------