some more work towards DKS/GPU integration

This commit is contained in:
2016-04-01 17:44:49 +02:00
parent ae77181f42
commit a29b790e04
5 changed files with 116 additions and 37 deletions

View File

@ -1063,43 +1063,96 @@ const Char_t* PRunListCollection::GetYAxisTitle(const TString &runName, const UI
}
//--------------------------------------------------------------------------
// GetN0Idx (public)
// GetSingleHistoParams (public)
//--------------------------------------------------------------------------
/**
* \brief PRunListCollection::GetN0Idx
* \param idx
* \return
*/
Int_t PRunListCollection::GetN0Idx(UInt_t idx)
Int_t PRunListCollection::GetSingleHistoParams(UInt_t idx, const std::vector<Double_t>& par, PSingleHistoParams &shp)
{
Int_t N0idx = -1;
Int_t ierr = 0;
// make sure idx is within proper bounds
if (idx >= fRunSingleHistoList.size())
return N0idx;
return 1;
N0idx = fMsrInfo->GetMsrRunList()->at(idx).GetNormParamNo();
// init param
InitSingleHistoParams(shp);
return N0idx;
// check if norm is a parameter or a function
PMsrRunBlock runInfo = fMsrInfo->GetMsrRunList()->at(idx);
if (runInfo.GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // norm is a parameter
shp.fN0 = par[runInfo.GetNormParamNo()-1];
} else { // norm is a function
// get function number
UInt_t funNo = runInfo.GetNormParamNo()-MSR_PARAM_FUN_OFFSET;
// evaluate function
shp.fN0 = fMsrInfo->EvalFunc(funNo, *runInfo.GetMap(), par);
}
cout << "debug> shp.fN0 = " << shp.fN0 << endl;
// get tau
if (runInfo.GetLifetimeParamNo() != -1)
shp.fTau = par[runInfo.GetLifetimeParamNo()-1];
else
shp.fTau = PMUON_LIFETIME;
cout << "debug> shp.fTau = " << shp.fTau << endl;
// get background
if (runInfo.GetBkgFitParamNo() == -1) { // bkg not fitted
if (runInfo.GetBkgFix(0) == PMUSR_UNDEFINED) { // no fixed background given (background interval)
shp.fNbkg = GetBackground(idx);
} else { // fixed bkg given
shp.fNbkg = runInfo.GetBkgFix(0);
}
} else { // bkg fitted
shp.fNbkg = par[runInfo.GetBkgFitParamNo()-1];
}
cout << "debug> shp.fNbkg = " << shp.fNbkg << endl;
// calculate functions
Int_t funcNo = 0;
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
funcNo = fMsrInfo->GetFuncNo(i);
shp.fFun.push_back(fMsrInfo->EvalFunc(funcNo, *runInfo.GetMap(), par));
}
for (UInt_t i=0; i<shp.fFun.size(); i++)
cout << "debug> fun" << i+1 << " = " << shp.fFun[i] << endl;
// get map vector
shp.fMap = *runInfo.GetMap();
shp.fMap.erase(shp.fMap.begin()+GetNoOfMaps(), shp.fMap.end());
for (UInt_t i=0; i<shp.fMap.size(); i++)
cout << "debug> map" << i+1 << " = " << shp.fMap[i] << endl;
return ierr;
}
//--------------------------------------------------------------------------
// GetNbkgIdx (public)
// InitSingleHistoParams (private)
//--------------------------------------------------------------------------
/**
* \brief PRunListCollection::GetNbkgIdx
* \param idx
* \return
* \brief PRunListCollection::InitSingleHistoParams
* \param param
*/
Int_t PRunListCollection::GetNbkgIdx(UInt_t idx)
void PRunListCollection::InitSingleHistoParams(PSingleHistoParams &param)
{
Int_t NbkgIdx = -1;
// make sure idx is within proper bounds
if (idx >= fRunSingleHistoList.size())
return NbkgIdx;
NbkgIdx = fMsrInfo->GetMsrRunList()->at(idx).GetBkgFitParamNo();
return NbkgIdx;
param.fN0 = -1.0;
param.fNbkg = -1.0;
param.fTau = -1.0;
param.fFun.clear();
param.fMap.clear();
}
//--------------------------------------------------------------------------
// GetBackground (private)
//--------------------------------------------------------------------------
/**
* @brief PRunListCollection::GetBackground
* @param idx
* @return
*/
Double_t PRunListCollection::GetBackground(Int_t idx)
{
// make sure idx is within proper bounds
if (idx >= (Int_t)fRunSingleHistoList.size())
return 0.0;
return fRunSingleHistoList[idx]->GetBackground();
}