first DKS running version. Still a lot of testing needed. Currently only single histogram fitting with a limited number of functions is supported to run on the GPU.
This commit is contained in:
@ -605,7 +605,7 @@ UInt_t PRunListCollection::GetNoOfBinsFitted(const UInt_t idx) const
|
||||
}
|
||||
|
||||
Int_t type = fMsrInfo->GetMsrRunList()->at(idx).GetFitType();
|
||||
if (type == -1) { // i.e. not forun in the RUN block, try the GLOBAL block
|
||||
if (type == -1) { // i.e. not found in the RUN block, try the GLOBAL block
|
||||
type = fMsrInfo->GetMsrGlobal()->GetFitType();
|
||||
}
|
||||
|
||||
@ -1062,9 +1062,50 @@ const Char_t* PRunListCollection::GetYAxisTitle(const TString &runName, const UI
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetStartTimeBin (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PRunListCollection::GetStartTimeBin
|
||||
* @param idx
|
||||
* @return
|
||||
*/
|
||||
Int_t PRunListCollection::GetStartTimeBin(UInt_t idx)
|
||||
{
|
||||
// make sure idx is within proper bounds
|
||||
if (idx >= fRunSingleHistoList.size())
|
||||
return -1;
|
||||
|
||||
return fRunSingleHistoList[idx]->GetStartTimeBin();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetEndTimeBin (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PRunListCollection::GetEndTimeBin
|
||||
* @param idx
|
||||
* @return
|
||||
*/
|
||||
Int_t PRunListCollection::GetEndTimeBin(UInt_t idx)
|
||||
{
|
||||
// make sure idx is within proper bounds
|
||||
if (idx >= fRunSingleHistoList.size())
|
||||
return -1;
|
||||
|
||||
return fRunSingleHistoList[idx]->GetEndTimeBin();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetSingleHistoParams (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief PRunListCollection::GetSingleHistoParams
|
||||
* @param idx
|
||||
* @param par
|
||||
* @param shp
|
||||
* @return
|
||||
*/
|
||||
Int_t PRunListCollection::GetSingleHistoParams(UInt_t idx, const std::vector<Double_t>& par, PSingleHistoParams &shp)
|
||||
{
|
||||
Int_t ierr = 0;
|
||||
@ -1075,6 +1116,9 @@ Int_t PRunListCollection::GetSingleHistoParams(UInt_t idx, const std::vector<Dou
|
||||
// init param
|
||||
InitSingleHistoParams(shp);
|
||||
|
||||
// get flag if scaling of N0 and Nbkg is wished
|
||||
shp.fScaleN0AndBkg = fRunSingleHistoList[idx]->GetScaleN0AndBkg();
|
||||
|
||||
// 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
|
||||
@ -1085,14 +1129,14 @@ Int_t PRunListCollection::GetSingleHistoParams(UInt_t idx, const std::vector<Dou
|
||||
// evaluate function
|
||||
shp.fN0 = fMsrInfo->EvalFunc(funNo, *runInfo.GetMap(), par);
|
||||
}
|
||||
cout << "debug> shp.fN0 = " << shp.fN0 << endl;
|
||||
// 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;
|
||||
// cout << "debug> shp.fTau = " << shp.fTau << endl;
|
||||
|
||||
// get background
|
||||
if (runInfo.GetBkgFitParamNo() == -1) { // bkg not fitted
|
||||
@ -1104,7 +1148,24 @@ Int_t PRunListCollection::GetSingleHistoParams(UInt_t idx, const std::vector<Dou
|
||||
} else { // bkg fitted
|
||||
shp.fNbkg = par[runInfo.GetBkgFitParamNo()-1];
|
||||
}
|
||||
cout << "debug> shp.fNbkg = " << shp.fNbkg << endl;
|
||||
// cout << "debug> shp.fNbkg = " << shp.fNbkg << endl;
|
||||
|
||||
// get packed time resolution
|
||||
shp.fPackedTimeResolution = fRunSingleHistoList[idx]->GetData()->GetDataTimeStep();
|
||||
|
||||
// cout << "debug> fPackedTimeResolution = " << shp.fPackedTimeResolution*1.0e3 << " (ns)" << endl;
|
||||
|
||||
// get start time
|
||||
// fRunSingleHistoList[idx]->GetData()->GetDataTimeStart() : time of fgb, which is 0-bin of the fit-data-set
|
||||
// fRunSingleHistoList[idx]->GetStartTimeBin() * shp.fPackedTimeResolution : time-offset from fgb-time to fit start time
|
||||
shp.fStartTime = fRunSingleHistoList[idx]->GetData()->GetDataTimeStart() + fRunSingleHistoList[idx]->GetStartTimeBin() * shp.fPackedTimeResolution;
|
||||
|
||||
// cout << "debug> startTime = " << shp.fStartTime << " (us)" << endl;
|
||||
|
||||
// get number of bins fitted
|
||||
shp.fNoOfFitBins = fRunSingleHistoList[idx]->GetNoOfFitBins();
|
||||
|
||||
// cout << "debug> startTimeBin = " << fRunSingleHistoList[idx]->GetStartTimeBin() << ", endTimeBin = " << fRunSingleHistoList[idx]->GetEndTimeBin() << ", noOfFittedBins = " << shp.fNoOfFitBins << endl;
|
||||
|
||||
// calculate functions
|
||||
Int_t funcNo = 0;
|
||||
@ -1112,14 +1173,21 @@ Int_t PRunListCollection::GetSingleHistoParams(UInt_t idx, const std::vector<Dou
|
||||
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());
|
||||
// need to reduce map indexes by 1 since in C/C++ arrays start at 0
|
||||
for (UInt_t i=0; i<shp.fMap.size(); i++)
|
||||
shp.fMap[i] -= 1;
|
||||
/*
|
||||
for (UInt_t i=0; i<shp.fMap.size(); i++)
|
||||
cout << "debug> map" << i+1 << " = " << shp.fMap[i] << endl;
|
||||
*/
|
||||
|
||||
return ierr;
|
||||
}
|
||||
@ -1133,9 +1201,13 @@ Int_t PRunListCollection::GetSingleHistoParams(UInt_t idx, const std::vector<Dou
|
||||
*/
|
||||
void PRunListCollection::InitSingleHistoParams(PSingleHistoParams ¶m)
|
||||
{
|
||||
param.fScaleN0AndBkg = false;
|
||||
param.fN0 = -1.0;
|
||||
param.fNbkg = -1.0;
|
||||
param.fTau = -1.0;
|
||||
param.fPackedTimeResolution = -1.0;
|
||||
param.fStartTime = -1.0;
|
||||
param.fNoOfFitBins = -1;
|
||||
param.fFun.clear();
|
||||
param.fMap.clear();
|
||||
}
|
||||
|
Reference in New Issue
Block a user