本文整理汇总了C++中ModelConfig::LoadSnapshot方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelConfig::LoadSnapshot方法的具体用法?C++ ModelConfig::LoadSnapshot怎么用?C++ ModelConfig::LoadSnapshot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelConfig
的用法示例。
在下文中一共展示了ModelConfig::LoadSnapshot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slrts
//.........这里部分代码省略.........
poimax = int(poihat + 4 * poi->getError());
}
std::cout << "Doing a fixed scan in interval : " << poimin << " , " << poimax << std::endl;
calc.SetFixedScan(npoints,poimin,poimax);
}
else {
//poi->setMax(10*int( (poihat+ 10 *poi->getError() )/10 ) );
std::cout << "Doing an automatic scan in interval : " << poi->getMin() << " , " << poi->getMax() << std::endl;
}
tw.Start();
HypoTestInverterResult * r = calc.GetInterval();
std::cout << "Time to perform limit scan \n";
tw.Print();
if (mRebuild) {
std::cout << "\n***************************************************************\n";
std::cout << "Rebuild the upper limit distribution by re-generating new set of pseudo-experiment and re-compute for each of them a new upper limit\n\n";
allParams = sbModel->GetPdf()->getParameters(*data);
// define on which value of nuisance parameters to do the rebuild
// default is best fit value for bmodel snapshot
if (mRebuildParamValues != 0) {
// set all parameters to their initial workspace values
*allParams = initialParameters;
}
if (mRebuildParamValues == 0 || mRebuildParamValues == 1 ) {
RooArgSet constrainParams;
if (sbModel->GetNuisanceParameters() ) constrainParams.add(*sbModel->GetNuisanceParameters());
RooStats::RemoveConstantParameters(&constrainParams);
const RooArgSet * poiModel = sbModel->GetParametersOfInterest();
bModel->LoadSnapshot();
// do a profile using the B model snapshot
if (mRebuildParamValues == 0 ) {
RooStats::SetAllConstant(*poiModel,true);
sbModel->GetPdf()->fitTo(*data,InitialHesse(false), Hesse(false),
Minimizer(minimizerType.c_str(),"Migrad"), Strategy(0), PrintLevel(mPrintLevel), Constrain(constrainParams) );
std::cout << "rebuild using fitted parameter value for B-model snapshot" << std::endl;
constrainParams.Print("v");
RooStats::SetAllConstant(*poiModel,false);
}
}
std::cout << "StandardHypoTestInvDemo: Initial parameters used for rebuilding: ";
RooStats::PrintListContent(*allParams, std::cout);
delete allParams;
calc.SetCloseProof(1);
tw.Start();
SamplingDistribution * limDist = calc.GetUpperLimitDistribution(true,mNToyToRebuild);
std::cout << "Time to rebuild distributions " << std::endl;
tw.Print();
if (limDist) {
std::cout << "Expected limits after rebuild distribution " << std::endl;
std::cout << "expected upper limit (median of limit distribution) " << limDist->InverseCDF(0.5) << std::endl;
std::cout << "expected -1 sig limit (0.16% quantile of limit dist) " << limDist->InverseCDF(ROOT::Math::normal_cdf(-1)) << std::endl;
std::cout << "expected +1 sig limit (0.84% quantile of limit dist) " << limDist->InverseCDF(ROOT::Math::normal_cdf(1)) << std::endl;
std::cout << "expected -2 sig limit (.025% quantile of limit dist) " << limDist->InverseCDF(ROOT::Math::normal_cdf(-2)) << std::endl;
std::cout << "expected +2 sig limit (.975% quantile of limit dist) " << limDist->InverseCDF(ROOT::Math::normal_cdf(2)) << std::endl;
// Plot the upper limit distribution
SamplingDistPlot limPlot( (mNToyToRebuild < 200) ? 50 : 100);
limPlot.AddSamplingDistribution(limDist);
limPlot.GetTH1F()->SetStats(true); // display statistics
limPlot.SetLineColor(kBlue);
new TCanvas("limPlot","Upper Limit Distribution");
limPlot.Draw();
/// save result in a file
limDist->SetName("RULDist");
TFile * fileOut = new TFile("RULDist.root","RECREATE");
limDist->Write();
fileOut->Close();
//update r to a new updated result object containing the rebuilt expected p-values distributions
// (it will not recompute the expected limit)
if (r) delete r; // need to delete previous object since GetInterval will return a cloned copy
r = calc.GetInterval();
}
else
std::cout << "ERROR : failed to re-build distributions " << std::endl;
}
return r;
}