当前位置: 首页>>代码示例>>C++>>正文


C++ RooFitResult::numStatusHistory方法代码示例

本文整理汇总了C++中RooFitResult::numStatusHistory方法的典型用法代码示例。如果您正苦于以下问题:C++ RooFitResult::numStatusHistory方法的具体用法?C++ RooFitResult::numStatusHistory怎么用?C++ RooFitResult::numStatusHistory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RooFitResult的用法示例。


在下文中一共展示了RooFitResult::numStatusHistory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: check_fit_bias_sim


//.........这里部分代码省略.........
  RooDataSet *data_HI2040[N];
  RooDataSet *data_HI40100[N];
  RooDataSet *redData;

  for (int i=0;i<N;++i) {
    cout << "Generating event " << i << "/" << N << endl;
    // cout << "Generate N = " << Nevents << " events with R_{psi} = " << ws->var("fracP_pp")->getVal() << endl;
    //    data[i] = model->generateSimGlobal(*Jpsi_Mass,ProtoData(*protoData), Verbose(1));
    data_pp[i] = model_pp->generate(*Jpsi_Mass, ProtoData(*protoData_pp),Verbose(0));
    data_HI020[i] = model_HI020->generate(*Jpsi_Mass, ProtoData(*protoData_HI020),Verbose(0));
    data_HI2040[i] = model_HI2040->generate(*Jpsi_Mass, ProtoData(*protoData_HI2040),Verbose(0));
    data_HI40100[i] = model_HI40100->generate(*Jpsi_Mass, ProtoData(*protoData_HI40100),Verbose(0));

    data[i] = new RooDataSet("data","data",RooArgSet(*Jpsi_Mass),Index(*sample),Import("HI020",*data_HI020[i]),Import("HI2040",*data_HI2040[i]),Import("HI40100",*data_HI40100[i]),Import("pp",*data_pp[i]));
  }
    
  RooPlot *frame2 = Jpsi_Mass->frame();
  data_pp[0]->plotOn(frame2);
  data[N-1]->plotOn(frame2, Cut("sample==sample::pp"),MarkerColor(kRed), MarkerStyle(24));
  data[N-1]->plotOn(frame2, Cut("sample==sample::HI020"), MarkerColor(kRed));
  data[N-1]->plotOn(frame2, Cut("sample==sample::HI2040"), MarkerStyle(25), MarkerColor(kBlue));
  data[N-1]->plotOn(frame2, Cut("sample==sample::HI40100"), MarkerStyle(24), MarkerColor(kGreen+2));
  // data[N-1]->plotOn(frame2, Cut("sample!=sample::pp"), MarkerColor(kRed));
  //  model->plotOn(frame, Slice(*sample,"pp"), ProjWData(*sample,*protoData));
  TCanvas *c0a = new TCanvas("c0a","c0a");
  c0a->cd();
  frame2->Draw();
  //  return;
  // cout << data->sumEntries() << endl;

  for (int i=0;i<N;++i) {
    cout << "Fitting event " << i << "/" << N << endl;
    fitMall = ws->pdf("sigMassPDFSim")->fitTo(*data[i],Extended(1),Hesse(1),Save(1),NumCPU(8),PrintEvalErrors(-1),Verbose(0),PrintLevel(-1));
    if (fitMall->statusCodeHistory(fitMall->numStatusHistory()-1) != 0) {i--; continue;}
    //    fitMall->Print("v");

    //    cout << "Fitted R_{psi} = " << ws->var("fracP_pp")->getVal() << " +/- " << ws->var("fracP_pp")->getPropagatedError(*fitMall) << endl;
    double R1850_pp = ws->var("fracP_pp")->getVal();
    double R1850_HI020 = ws->var("doubleRatio_HI020")->getVal();
    double R1850_HI2040 = ws->var("doubleRatio_HI2040")->getVal();
    double R1850_HI40100 = ws->var("doubleRatio_HI40100")->getVal();
    double R1850_HI0100 = ws->function("doubleRatio_HI0100")->getVal();
    h0_pp->Fill(R1850_pp);
    h0_HI020->Fill(R1850_HI020);
    h0_HI2040->Fill(R1850_HI2040);
    h0_HI40100->Fill(R1850_HI40100);
    h0_HI0100->Fill(R1850_HI0100);


    redData = (RooDataSet*)data[i]->reduce("Jpsi_Mass>2.2&&Jpsi_Mass<4.2");
    //  cout << redData->sumEntries() << endl;

    fitM = ws->pdf("sigMassPDFSim_M2242")->fitTo(*redData,Extended(1),Hesse(1),Save(1),NumCPU(8),PrintEvalErrors(-1),Verbose(0),PrintLevel(-1),Range("M2242"));
    if (fitM->statusCodeHistory(fitM->numStatusHistory()-1) != 0) {i--; continue;}

    //    fitM->Print("v");
    // cout << "Fit over M2242: R_{psi} = " << ws->var("fracP_pp")->getVal() << " +/- " << ws->var("fracP_pp")->getPropagatedError(*fitM) << endl;

    // RooPlot *frame = Jpsi_Mass->frame(Range("M2242"));
    // redData->plotOn(frame);
    // ws->pdf("sigMassPDF_M2242")->plotOn(frame,Range("M2242"));
    //  redData->plotOn(frame,MarkerStyle(24),MarkerColor(kRed),Range("M2242"));

    double R2242_pp = ws->var("fracP_pp")->getVal();
    double R2242_HI020 = ws->var("doubleRatio_HI020")->getVal();
    double R2242_HI2040 = ws->var("doubleRatio_HI2040")->getVal();
开发者ID:tdahms,项目名称:CMS-HIN-12-007,代码行数:67,代码来源:check_fit_bias_sim.C


注:本文中的RooFitResult::numStatusHistory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。