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


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

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


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

示例1: fitHist


//.........这里部分代码省略.........
    pdfMet.plotOn(wmframe,Components(RooArgSet(*lQCD)),LineColor(linecolorQCD));
    pdfMet.plotOn(wmframe,Components(RooArgSet(pdfW)),LineColor(linecolorW),LineStyle(2));
    dataMet.plotOn(wmframe,MarkerStyle(kFullCircle),MarkerSize(0.9),DrawOption("ZP"));

    sprintf(ylabel,"Events / %.1f GeV",iData->GetBinWidth(1));
    CPlot plotMet(("fitmet"+iName).c_str(),wmframe,"","",ylabel);
    plotMet.SetLegend(0.68,0.57,0.93,0.77);
    plotMet.GetLegend()->AddEntry(hDummyData,"data","PL");
    plotMet.GetLegend()->AddEntry(hDummyW,"W#rightarrow#mu#nu","F");
    plotMet.GetLegend()->AddEntry(hDummyEWK,"EWK+t#bar{t}","F");
    plotMet.GetLegend()->AddEntry(hDummyQCD,"QCD","F");
    plotMet.AddTextBox(lumitext,0.55,0.80,0.90,0.86,0);
    plotMet.AddTextBox("CMS Preliminary",0.63,0.92,0.95,0.99,0);
    plotMet.SetYRange(0.1,1.1*(iData->GetMaximum()));
    plotMet.Draw(iC,kFALSE,format,1);

    CPlot plotMetDiff(("fitmet"+iName).c_str(),"","#slash{E}_{T} [GeV]","#chi");
    plotMetDiff.AddHist1D(hMetDiff,"EX0",ratioColor);
    plotMetDiff.SetYRange(-8,8);
    plotMetDiff.AddLine(0, 0,METMAX, 0,kBlack,1);
    plotMetDiff.AddLine(0, 5,METMAX, 5,kBlack,3);
    plotMetDiff.AddLine(0,-5,METMAX,-5,kBlack,3);
    plotMetDiff.Draw(iC,kTRUE,format,2);
    plotMet.Draw(iC,kTRUE,format,1);

    plotMet.SetName(("fitmetlog"+iName).c_str());
    plotMet.SetLogy();
    plotMet.SetYRange(1e-3*(iData->GetMaximum()),10*(iData->GetMaximum()));
    plotMet.Draw(iC,kTRUE,format,1);

    if(iDoMu) {
        RooPlot *awmframe = pfmet.frame(Bins(NBINS));
        antiMet.plotOn(awmframe,MarkerStyle(kFullCircle),MarkerSize(0.9),DrawOption("ZP"));
        apdfMet.plotOn(awmframe,FillColor(fillcolorW),DrawOption("F"));
        apdfMet.plotOn(awmframe,LineColor(linecolorW));
        apdfMet.plotOn(awmframe,Components(RooArgSet(apdfEWK,*lQCD)),FillColor(fillcolorEWK),DrawOption("F"));
        apdfMet.plotOn(awmframe,Components(RooArgSet(apdfEWK,*lQCD)),LineColor(linecolorEWK));
        apdfMet.plotOn(awmframe,Components(RooArgSet(*lQCD)),FillColor(fillcolorQCD),DrawOption("F"));
        apdfMet.plotOn(awmframe,Components(RooArgSet(*lQCD)),LineColor(linecolorQCD));
        apdfMet.plotOn(awmframe,Components(RooArgSet(apdfW)),LineColor(linecolorW),LineStyle(2));
        antiMet.plotOn(awmframe,MarkerStyle(kFullCircle),MarkerSize(0.9),DrawOption("ZP"));

        sprintf(ylabel,"Events / %.1f GeV",iAntiData->GetBinWidth(1));
        CPlot plotAntiMet(("fitantimet"+iName).c_str(),awmframe,"","",ylabel);
        plotAntiMet.SetLegend(0.68,0.57,0.93,0.77);
        plotAntiMet.GetLegend()->AddEntry(hDummyData,"data","PL");
        plotAntiMet.GetLegend()->AddEntry(hDummyW,"W#rightarrow#mu#nu","F");
        plotAntiMet.GetLegend()->AddEntry(hDummyEWK,"EWK+t#bar{t}","F");
        plotAntiMet.GetLegend()->AddEntry(hDummyQCD,"QCD","F");
        plotAntiMet.AddTextBox(lumitext,0.55,0.80,0.90,0.86,0);
        plotAntiMet.AddTextBox("CMS Preliminary",0.63,0.92,0.95,0.99,0);
        plotAntiMet.SetYRange(0.1,1.1*(iAntiData->GetMaximum()));
        plotAntiMet.Draw(iC,kFALSE,format,1);

        CPlot plotAntiMetDiff(("fitantimet"+iName).c_str(),"","#slash{E}_{T} [GeV]","#chi");
        plotAntiMetDiff.AddHist1D(hMetDiff,"EX0",ratioColor);
        plotAntiMetDiff.SetYRange(-8,8);
        plotAntiMetDiff.AddLine(0, 0,METMAX, 0,kBlack,1);
        plotAntiMetDiff.AddLine(0, 5,METMAX, 5,kBlack,3);
        plotAntiMetDiff.AddLine(0,-5,METMAX,-5,kBlack,3);
        plotAntiMetDiff.Draw(iC,kTRUE,format,2);

        plotAntiMet.SetName(("fitantimetlog"+iName).c_str());
        plotAntiMet.SetLogy();
        plotAntiMet.SetYRange(1e-3*(iAntiData->GetMaximum()),10*(iAntiData->GetMaximum()));
        plotAntiMet.Draw(iC,kTRUE,format,1);
    }
    if(iPlot == 1) return lResults;

    ofstream txtfile;
    std::string txtfName = "fitres"+iName;
    if( iDoMu) txtfName + "Mu.txt";
    if(!iDoMu) txtfName + "Mu.txt";
    ios_base::fmtflags flags;
    cout << " --- test " << iData->Integral() << " -- " << hPdfMet->Integral() << endl;
    Double_t chi2prob = iData->Chi2Test(hPdfMet,"PUW");
    Double_t chi2ndf  = iData->Chi2Test(hPdfMet,"CHI2/NDFUW");
    Double_t ksprob   = iData->KolmogorovTest(hPdfMet);
    Double_t ksprobpe = 1;//iData->KolmogorovTest(hPdfMet,"DX");
    txtfile.open(txtfName.c_str());
    assert(txtfile.is_open());

    flags = txtfile.flags();
    txtfile << setprecision(10);
    txtfile << " *** Yields *** " << endl;
    txtfile << "Selected: " << iData->Integral() << endl;
    txtfile << "  Signal: " << nSig.getVal() << " +/- " << nSig.getPropagatedError(*fitRes) << endl;
    txtfile << "     QCD: " << nQCD.getVal() << " +/- " << nQCD.getPropagatedError(*fitRes) << endl;
    txtfile << "   Other: " << nEWK.getVal() << " +/- " << nEWK.getPropagatedError(*fitRes) << endl;
    txtfile << endl;
    txtfile.flags(flags);

    fitRes->printStream(txtfile,RooPrintable::kValue,RooPrintable::kVerbose);
    txtfile << endl;
    printCorrelations(txtfile, fitRes);
    txtfile << endl;
    printChi2AndKSResults(txtfile, chi2prob, chi2ndf, ksprob, ksprobpe);
    txtfile.close();
    return lResults;
}
开发者ID:violatingcp,项目名称:sm_cms_das,代码行数:101,代码来源:fitWe.C

示例2: fitWm


//.........这里部分代码省略.........
  //==============================================================================================================
   
  cout << "*" << endl;
  cout << "* SUMMARY" << endl;
  cout << "*--------------------------------------------------" << endl;  
  
  //
  // Write fit results
  //
  ofstream txtfile;
  char txtfname[100];    
  
  ios_base::fmtflags flags;
  
  Double_t chi2prob, chi2ndf;
  Double_t ksprob, ksprobpe;
  
  chi2prob = hDataMet->Chi2Test(hPdfMet,"PUW");
  chi2ndf  = hDataMet->Chi2Test(hPdfMet,"CHI2/NDFUW");
  ksprob   = hDataMet->KolmogorovTest(hPdfMet);
  ksprobpe = hDataMet->KolmogorovTest(hPdfMet,"DX");
  sprintf(txtfname,"%s/fitresWm.txt",CPlot::sOutDir.Data());
  txtfile.open(txtfname);
  assert(txtfile.is_open());
  
  flags = txtfile.flags();
  txtfile << setprecision(10);
  txtfile << " *** Yields *** " << endl;
  txtfile << "Selected: " << hDataMet->Integral() << endl;
  txtfile << "  Signal: " << nSig.getVal() << " +/- " << nSig.getPropagatedError(*fitRes) << endl;
  txtfile << "     QCD: " << nQCD.getVal() << " +/- " << nQCD.getPropagatedError(*fitRes) << endl;
  txtfile << "   Other: " << nEWK.getVal() << " +/- " << nEWK.getPropagatedError(*fitRes) << endl;
  txtfile << endl;
  txtfile.flags(flags);
  
  fitRes->printStream(txtfile,RooPrintable::kValue,RooPrintable::kVerbose);
  txtfile << endl;
  printCorrelations(txtfile, fitRes);
  txtfile << endl;
  printChi2AndKSResults(txtfile, chi2prob, chi2ndf, ksprob, ksprobpe);
  txtfile.close();
  
  chi2prob = hDataMetp->Chi2Test(hPdfMetp,"PUW");
  chi2ndf  = hDataMetp->Chi2Test(hPdfMetp,"CHI2/NDFUW");
  ksprob   = hDataMetp->KolmogorovTest(hPdfMetp);
  ksprobpe = hDataMetp->KolmogorovTest(hPdfMetp,"DX");  
  sprintf(txtfname,"%s/fitresWmp.txt",CPlot::sOutDir.Data());
  txtfile.open(txtfname);
  assert(txtfile.is_open());
  
  flags = txtfile.flags();
  txtfile << setprecision(10);
  txtfile << " *** Yields *** " << endl;
  txtfile << "Selected: " << hDataMetp->Integral() << endl;
  txtfile << "  Signal: " << nSigp.getVal() << " +/- " << nSigp.getPropagatedError(*fitResp) << endl;
  txtfile << "     QCD: " << nQCDp.getVal() << " +/- " << nQCDp.getPropagatedError(*fitResp) << endl;
  txtfile << "   Other: " << nEWKp.getVal() << " +/- " << nEWKp.getPropagatedError(*fitResp) << endl;
  txtfile << endl; 
  txtfile.flags(flags);
  
  fitResp->printStream(txtfile,RooPrintable::kValue,RooPrintable::kVerbose);
  txtfile << endl;
  printCorrelations(txtfile, fitResp);
  txtfile << endl;
  printChi2AndKSResults(txtfile, chi2prob, chi2ndf, ksprob, ksprobpe);
  txtfile.close();

  chi2prob = hDataMetm->Chi2Test(hPdfMetm,"PUW");
  chi2ndf  = hDataMetm->Chi2Test(hPdfMetm,"CHI2/NDFUW");
  ksprob   = hDataMetm->KolmogorovTest(hPdfMetm);
  ksprobpe = hDataMetm->KolmogorovTest(hPdfMetm,"DX");  
  sprintf(txtfname,"%s/fitresWmm.txt",CPlot::sOutDir.Data());
  txtfile.open(txtfname);
  assert(txtfile.is_open());
  
  flags = txtfile.flags();
  txtfile << setprecision(10);
  txtfile << " *** Yields *** " << endl;
  txtfile << "Selected: " << hDataMetm->Integral() << endl;
  txtfile << "  Signal: " << nSigm.getVal() << " +/- " << nSigm.getPropagatedError(*fitResm) << endl;
  txtfile << "     QCD: " << nQCDm.getVal() << " +/- " << nQCDm.getPropagatedError(*fitResm) << endl;
  txtfile << "   Other: " << nEWKm.getVal() << " +/- " << nEWKm.getPropagatedError(*fitResm) << endl;
  txtfile << endl;
  txtfile.flags(flags);
  
  fitResm->printStream(txtfile,RooPrintable::kValue,RooPrintable::kVerbose);
  txtfile << endl;
  printCorrelations(txtfile, fitResm);
  txtfile << endl;
  printChi2AndKSResults(txtfile, chi2prob, chi2ndf, ksprob, ksprobpe);
  txtfile.close();

  makeHTML(outputDir);
  
  cout << endl;
  cout << "  <> Output saved in " << outputDir << "/" << endl;    
  cout << endl;     
  
  gBenchmark->Show("fitWm");
}
开发者ID:ksung25,项目名称:UserCode,代码行数:101,代码来源:fitWm.C

示例3: fitWe


//.........这里部分代码省略.........
  //==============================================================================================================
   
  cout << "*" << endl;
  cout << "* SUMMARY" << endl;
  cout << "*--------------------------------------------------" << endl;  
  
  //
  // Write fit results
  //
  ofstream txtfile;
  char txtfname[100];    
  
  ios_base::fmtflags flags;
  
  Double_t chi2prob, chi2ndf;
  Double_t ksprob, ksprobpe;
  
  chi2prob = hDataMet->Chi2Test(hPdfMet,"PUW");
  chi2ndf  = hDataMet->Chi2Test(hPdfMet,"CHI2/NDFUW");
  ksprob   = hDataMet->KolmogorovTest(hPdfMet);
  ksprobpe = hDataMet->KolmogorovTest(hPdfMet,"DX");
  sprintf(txtfname,"%s/fitresWe.txt",CPlot::sOutDir.Data());
  txtfile.open(txtfname);
  assert(txtfile.is_open());
  
  flags = txtfile.flags();
  txtfile << setprecision(10);
  txtfile << " *** Yields *** " << endl;
  txtfile << "Selected: " << hDataMet->Integral() << endl;
  txtfile << "  Signal: " << nSig.getVal() << " +/- " << nSig.getPropagatedError(*fitRes) << endl;
  txtfile << "     QCD: " << nQCD.getVal() << " +/- " << nQCD.getPropagatedError(*fitRes) << endl;
  txtfile << "   Other: " << nEWK.getVal() << " +/- " << nEWK.getPropagatedError(*fitRes) << endl;
  txtfile << endl; 
  txtfile.flags(flags);
  
  fitRes->printStream(txtfile,RooPrintable::kValue,RooPrintable::kVerbose);
  txtfile << endl;
  printCorrelations(txtfile, fitRes);
  txtfile << endl;
  printChi2AndKSResults(txtfile, chi2prob, chi2ndf, ksprob, ksprobpe);
  txtfile.close();
  
  chi2prob = hDataMetp->Chi2Test(hPdfMetp,"PUW");
  chi2ndf  = hDataMetp->Chi2Test(hPdfMetp,"CHI2/NDFUW");
  ksprob   = hDataMetp->KolmogorovTest(hPdfMetp);
  ksprobpe = hDataMetp->KolmogorovTest(hPdfMetp,"DX");  
  sprintf(txtfname,"%s/fitresWep.txt",CPlot::sOutDir.Data());
  txtfile.open(txtfname);
  assert(txtfile.is_open());
  
  flags = txtfile.flags();
  txtfile << setprecision(10);
  txtfile << " *** Yields *** " << endl;
  txtfile << "Selected: " << hDataMetp->Integral() << endl;
  txtfile << "  Signal: " << nSigp.getVal() << " +/- " << nSigp.getPropagatedError(*fitResp) << endl;
  txtfile << "     QCD: " << nQCDp.getVal() << " +/- " << nQCDp.getPropagatedError(*fitResp) << endl;
  txtfile << "   Other: " << nEWKp.getVal() << " +/- " << nEWKp.getPropagatedError(*fitResp) << endl;
  txtfile << endl;  
  txtfile.flags(flags);
  
  fitResp->printStream(txtfile,RooPrintable::kValue,RooPrintable::kVerbose);
  txtfile << endl;
  printCorrelations(txtfile, fitResp);
  txtfile << endl;
  printChi2AndKSResults(txtfile, chi2prob, chi2ndf, ksprob, ksprobpe);
  txtfile.close();

  chi2prob = hDataMetm->Chi2Test(hPdfMetm,"PUW");
  chi2ndf  = hDataMetm->Chi2Test(hPdfMetm,"CHI2/NDFUW");
  ksprob   = hDataMetm->KolmogorovTest(hPdfMetm);
  ksprobpe = hDataMetm->KolmogorovTest(hPdfMetm,"DX");  
  sprintf(txtfname,"%s/fitresWem.txt",CPlot::sOutDir.Data());
  txtfile.open(txtfname);
  assert(txtfile.is_open());
  
  flags = txtfile.flags();
  txtfile << setprecision(10);
  txtfile << " *** Yields *** " << endl;
  txtfile << "Selected: " << hDataMetm->Integral() << endl;
  txtfile << "  Signal: " << nSigm.getVal() << " +/- " << nSigm.getPropagatedError(*fitResm) << endl;
  txtfile << "     QCD: " << nQCDm.getVal() << " +/- " << nQCDm.getPropagatedError(*fitResm) << endl;
  txtfile << "   Other: " << nEWKm.getVal() << " +/- " << nEWKm.getPropagatedError(*fitResm) << endl;
  txtfile << endl;
  txtfile.flags(flags);
  
  fitResm->printStream(txtfile,RooPrintable::kValue,RooPrintable::kVerbose);
  txtfile << endl;
  printCorrelations(txtfile, fitResm);
  txtfile << endl;
  printChi2AndKSResults(txtfile, chi2prob, chi2ndf, ksprob, ksprobpe);
  txtfile.close();

  makeHTML(outputDir);
  
  cout << endl;
  cout << "  <> Output saved in " << outputDir << "/" << endl;    
  cout << endl;     
  
  gBenchmark->Show("fitWe");
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:101,代码来源:fitWe.C


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