本文整理汇总了C++中RooAbsReal::getPropagatedError方法的典型用法代码示例。如果您正苦于以下问题:C++ RooAbsReal::getPropagatedError方法的具体用法?C++ RooAbsReal::getPropagatedError怎么用?C++ RooAbsReal::getPropagatedError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RooAbsReal
的用法示例。
在下文中一共展示了RooAbsReal::getPropagatedError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fitTo
RooFitResult* GenericModel::fitTo(RooDataSet* data)
{
// Perform fit of the pseudo-PDF to the data
// On multi-core machines, this automatically uses all available processor cores
SafeDelete(fLastFit);
#ifdef WITH_MULTICORE_CPU
fLastFit = fModelPseudoPDF->fitTo(*data, Save(), NumCPU(WITH_MULTICORE_CPU));
#else
fLastFit = fModelPseudoPDF->fitTo(*data, Save());
#endif
SafeDelete(fParamDataHist);
fParamDataHist = new RooDataHist("params", "params", GetParameters());
// store weights of component pdfs => distribution of parameters
fWeights.removeAll();
const RooArgList& coefs = fModelPseudoPDF->coefList();
for (int i = 0; i < GetNumberOfDataSets(); i++) {
RooAbsReal* coef = (RooAbsReal*)coefs.at(i);
RooRealVar w(Form("w%d", i), Form("Fitted weight of kernel#%d", i), coef->getVal());
if (coef->InheritsFrom(RooRealVar::Class())) {
w.setError(((RooRealVar*)coef)->getError());
} else {
w.setError(coef->getPropagatedError(*fLastFit));
}
fWeights.addClone(w);
fParamDataHist->set(*GetParametersForDataset(i), w.getVal(), w.getError());
}
SafeDelete(fParameterPDF);
fParameterPDF = new RooHistPdf("paramPDF", "paramPDF", GetParameters(), *fParamDataHist);
return fLastFit;
}
示例2: BackgroundPrediction
//.........这里部分代码省略.........
error_curve[4]->SetLineColor(kYellow);
error_curve[2]->SetLineColor(kBlue);
error_curve[2]->SetLineWidth(3);
double binSize = rebin;
for (int i=0; i!=nPoints; ++i) {
double x0,y0, x1,y1;
error_curve[2]->GetPoint(i,x0,y0);
RooAbsReal* nlim = new RooRealVar("nlim","y0",y0,-100000,100000);
//double lowedge = x0 - (SR_hi - SR_lo)/double(2*nPoints);
//double upedge = x0 + (SR_hi - SR_lo)/double(2*nPoints);
double lowedge = x0 - binSize/2.;
double upedge = x0 + binSize/2.;
x.setRange("errRange",lowedge,upedge);
RooExtendPdf* epdf = new RooExtendPdf("epdf","extpdf",bg, *nlim,"errRange");
// Construct unbinned likelihood
RooAbsReal* nll = epdf->createNLL(pred2,NumCPU(2));
// Minimize likelihood w.r.t all parameters before making plots
RooMinimizer* minim = new RooMinimizer(*nll);
minim->setMinimizerType("Minuit2");
minim->setStrategy(2);
minim->setPrintLevel(-1);
minim->migrad();
minim->hesse();
RooFitResult* result = minim->lastMinuitFit();
double errm = nlim->getPropagatedError(*result);
//std::cout<<x0<<" "<<lowedge<<" "<<upedge<<" "<<y0<<" "<<nlim->getVal()<<" "<<errm<<std::endl;
error_curve[0]->SetPoint(i,x0,(y0-errm));
error_curve[0]->SetPoint(2*nPoints-i-1,x0,y0+errm);
error_curve[1]->SetPoint(i,x0,(y0-2*errm));
error_curve[1]->SetPoint(2*nPoints-i-1,x0,(y0+2*errm));
error_curve[3]->SetPoint(i,x0,-errm/sqrt(y0));
error_curve[3]->SetPoint(2*nPoints-i-1,x0,errm/sqrt(y0));
error_curve[4]->SetPoint(i,x0,-2*errm/sqrt(y0));
error_curve[4]->SetPoint(2*nPoints-i-1,x0,2*errm/sqrt(y0));
}
int npois = 0;
dataGr->SetMarkerSize(1.0);
dataGr->SetMarkerStyle (20);
const double alpha = 1 - 0.6827;
for (int i=0; i!=h_SR_Prediction->GetNbinsX(); ++i){
if (h_SR_Prediction->GetBinContent(i+1) > 0) {
int N = h_SR_Prediction->GetBinContent(i+1);
double L = (N==0) ? 0 : (ROOT::Math::gamma_quantile(alpha/2,N,1.));
double U = ROOT::Math::gamma_quantile_c(alpha/2,N+1,1) ;
dataGr->SetPoint(npois,h_SR_Prediction->GetBinCenter(i+1),h_SR_Prediction->GetBinContent(i+1));
dataGr->SetPointEYlow(npois, N-L);