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


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

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


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

示例1: getGLWADScor

void getGLWADScor()
{
	TFile *f = TFile::Open("winter2012ADSGLWResult.root");
  RooFitResult *r = (RooFitResult*)f->Get("fitresult_model_reducedData_binned");
  
  TString vars[] = {
        "A_CPP_b2dk_d2kk",
       "A_CPP_b2dpi_d2kk",
      "A_CPP_b2dk_d2pipi",
     "A_CPP_b2dpi_d2pipi",
       "A_FAV_b2dk_d2kpi",
      "A_FAV_b2dpi_d2kpi",
     "R_dk_vs_dpi_d2pipi",
       "R_dk_vs_dpi_d2kk",
      "R_dk_vs_dpi_d2kpi",
     "R_minus_b2dk_d2pik",
    "R_minus_b2dpi_d2pik",
      "R_plus_b2dk_d2pik",
     "R_plus_b2dpi_d2pik"
  };
  
  // for ( int i=0; i<13; i++ )
  // {
  //   printf("%20s", vars[i].Data());
  //   for ( int j=0; j<13; j++ )
  //   {
  //     float c = r->correlation(vars[i], vars[j]);
  //     // if ( fabs(c)<0.01 ) continue;
  //     // printf("%20s : %20s = %6.3f\n", vars[i].Data(), vars[j].Data(), c);
  //     if ( fabs(c)<0.00049 ) 
  //       printf("%7s", "");
  //     else 
  //       printf("%7.3f", c);
  //   }
  //   cout << endl;
  // }

  //
  // LATEX PRINTOUT
  //
  for ( int i=0; i<13; i++ )
  {
    printf(" & %20s ", varToTex(vars[i]).Data());
  }
  cout << "\\\\" << endl;
  cout << "\\hline" << endl;

  for ( int i=0; i<13; i++ )
  {
    printf("%20s & ", varToTex(vars[i]).Data());
    for ( int j=0; j<13; j++ )
    {
      float c = r->correlation(vars[i], vars[j]);
      if ( j>=i )
        if ( fabs(c)<0.001 ) printf("%7.0f ", 0);
        else if ( c==1 )    printf("%7.0f ", 1);
        else printf("%7.3f ", c);
      else
        printf("%7s ", " ");
      if ( j<12 ) cout << "&";
    }
    cout << "\\\\" << endl;
  }
}
开发者ID:PashaPodolsky,项目名称:PyBayCor,代码行数:64,代码来源:getDhhGLWADScor.C

示例2: TwoCategorySimZFitter


//.........这里部分代码省略.........
  TPaveText *plotlabel = new TPaveText(0.23,0.87,0.43,0.92,"NDC");
   plotlabel->SetTextColor(kBlack);
   plotlabel->SetFillColor(kWhite);
   plotlabel->SetBorderSize(0);
   plotlabel->SetTextAlign(12);
   plotlabel->SetTextSize(0.03);
   plotlabel->AddText("CMS Preliminary 2010");
  TPaveText *plotlabel2 = new TPaveText(0.23,0.82,0.43,0.87,"NDC");
   plotlabel2->SetTextColor(kBlack);
   plotlabel2->SetFillColor(kWhite);
   plotlabel2->SetBorderSize(0);
   plotlabel2->SetTextAlign(12);
   plotlabel2->SetTextSize(0.03);
   plotlabel2->AddText("#sqrt{s} = 7 TeV");
  TPaveText *plotlabel3 = new TPaveText(0.23,0.75,0.43,0.80,"NDC");
   plotlabel3->SetTextColor(kBlack);
   plotlabel3->SetFillColor(kWhite);
   plotlabel3->SetBorderSize(0);
   plotlabel3->SetTextAlign(12);
   plotlabel3->SetTextSize(0.03);
  char temp[100];
  sprintf(temp, "%.1f", intLumi);
  plotlabel3->AddText((string("#int#font[12]{L}dt = ") + 
  temp + string(" pb^{ -1}")).c_str());
  TPaveText *plotlabel4 = new TPaveText(0.6,0.87,0.8,0.92,"NDC");
   plotlabel4->SetTextColor(kBlack);
   plotlabel4->SetFillColor(kWhite);
   plotlabel4->SetBorderSize(0);
   plotlabel4->SetTextAlign(12);
   plotlabel4->SetTextSize(0.03);
   double nsig = eff.getVal()*xsec.getVal()*acc.getVal()*lumi.getVal();
   double xsecFrErr = xsec.getError()/xsec.getVal();
   double effFrErr = eff.getError()/eff.getVal();
   double effxsecCorr = fitResult->correlation(eff, xsec);
   double nsigerr = sqrt(effFrErr**2 +xsecFrErr**2 + 
   2.0*effxsecCorr*xsecFrErr*effFrErr)*nsig;
   sprintf(temp, "Signal = %.2f #pm %.2f", nsig, nsigerr);
   plotlabel4->AddText(temp);
  TPaveText *plotlabel5 = new TPaveText(0.6,0.82,0.8,0.87,"NDC");
   plotlabel5->SetTextColor(kBlack);
   plotlabel5->SetFillColor(kWhite);
   plotlabel5->SetBorderSize(0);
   plotlabel5->SetTextAlign(12);
   plotlabel5->SetTextSize(0.03);
   sprintf(temp, "#epsilon = %.4f #pm %.4f", eff.getVal(), eff.getError());
   plotlabel5->AddText(temp);
  TPaveText *plotlabel6 = new TPaveText(0.6,0.77,0.8,0.82,"NDC");
   plotlabel6->SetTextColor(kBlack);
   plotlabel6->SetFillColor(kWhite);
   plotlabel6->SetBorderSize(0);
   plotlabel6->SetTextAlign(12);
   plotlabel6->SetTextSize(0.03);
   sprintf(temp, "#sigma = %.1f #pm %.1f pb", xsec.getVal(), xsec.getError());
   plotlabel6->AddText(temp);

  plotlabel->Draw();
  plotlabel2->Draw();
  plotlabel3->Draw();
  plotlabel4->Draw();
  plotlabel5->Draw();
  plotlabel6->Draw();
  c->SaveAs( cname + TString(".eps"));
  c->SaveAs( cname + TString(".gif"));
  c->SaveAs( cname + TString(".root"));
  c->SaveAs( cname + TString(".png"));
  c->SaveAs( cname + TString(".C"));
开发者ID:kalanand,项目名称:UserCode,代码行数:67,代码来源:TwoCategorySimZFitter.C

示例3: FitTagAndProbev1


//.........这里部分代码省略.........

   RooFitResult *fitResult = totalPdf.fitTo(*data,RooFit::Save(true),
					    RooFit::Extended(true), RooFit::PrintLevel(-1));

   fitResult->Print("v");


  double numerator = nSigPass->getVal();
  double nfails    = nSigFail->getVal();
  double denominator = numerator + nfails;

  cout<<"num/den: "<< numerator <<" "<< denominator <<endl;

   RooAbsData::ErrorType errorType = RooAbsData::Poisson;

   TCanvas *can0 = new TCanvas("can0","c000",200,10,550,500);
   setTCanvasNicev1(can0);

   //RooPlot* frame1 = Mass.frame();
   RooPlot* frame1 = Mass.frame(Range(xminFit,xmaxFit),Bins(nbins));

   frame1->SetMinimum(0);
   data_pass->plotOn(frame1,RooFit::DataError(errorType));
   pdfPass.plotOn(frame1,RooFit::ProjWData(*data_pass),
		  RooFit::Components(*bkgShapePdf),RooFit::LineColor(kRed));
   pdfPass.plotOn(frame1,RooFit::ProjWData(*data_pass));
   frame1->Draw("e0");

   char *filename = new char[1000];
   sprintf(filename,"Probe Pass %s",passHistTitle);
   TLatex l;
   l.SetNDC();
   l.SetTextSize(0.04);
   l.SetTextColor(1);
   l.DrawLatex(0.2,0.9,filename);
   double nsig = numSignal->getVal();
   double nErr = numSignal->getError();
   double e = eff->getVal();
   double eErr = eff->getError();
   double corr = fitResult->correlation(*eff, *numSignal);
   double err = ErrorInProduct(nsig, nErr, e, eErr, corr);
   sprintf(filename, "N_{s} = %.2f #pm %.2f", nSigPass->getVal(), err);
   l.DrawLatex(0.62,0.8,filename);
   sprintf(filename, "N_{b} = %.2f #pm %.2f", nBkgPass->getVal(), nBkgPass->getError());
   l.DrawLatex(0.62,0.75,filename);
   sprintf(filename, "#epsilon^{Data}_{s} = %4.3f #pm %4.3f", eff->getVal(), eff->getError());
   l.DrawLatex(0.62,0.7,filename);
   sprintf(filename, "#epsilon^{MC}_{s} = %4.3f", effTP_MC);
   l.DrawLatex(0.62,0.65,filename);


   sprintf(filename,"resTP/hhu_probepass_%s.gif",passHistName);
   can0->Print(filename);
   sprintf(filename,"resTP/hhu_probepass_%s.pdf",passHistName);
   can0->Print(filename);


   //probel fail

   TCanvas *can1 = new TCanvas("can1","c001",200,10,550,500);
   setTCanvasNicev1(can1);
   //RooPlot* frame1f = Mass.frame();
   //RooPlot* frame1f = Mass.frame(Range(xminFit,xmaxFit),Bins(nbins));
   RooPlot* frame1f = Mass.frame(Range(xminFit,xmaxFit),Bins(30));
   frame1f->SetMinimum(0);
   data_fail->plotOn(frame1f,RooFit::DataError(errorType));
   pdfFail.plotOn(frame1f,RooFit::ProjWData(*data_fail),
		  RooFit::Components(*bkgShapePdff),RooFit::LineColor(kRed));
   pdfFail.plotOn(frame1f,RooFit::ProjWData(*data_fail));
   frame1f->Draw("e0");

   sprintf(filename,"Probe Fail %s", failHistTitle);
   l.DrawLatex(0.2,0.9,filename);
   nsig = numSignal->getVal();
   nErr = numSignal->getError();
   e = 1-eff->getVal();
   eErr = eff->getError();
   corr = fitResult->correlation(*eff, *numSignal);
   err = ErrorInProduct(nsig, nErr, e, eErr, corr);
   sprintf(filename, "N_{s} = %.2f #pm %.2f", nSigFail->getVal(), err);
   l.DrawLatex(0.6,0.8,filename);
   sprintf(filename, "N_{b} = %.2f #pm %.2f", nBkgFail->getVal(), nBkgFail->getError());
   l.DrawLatex(0.6,0.75,filename);
   sprintf(filename, "#epsilon^{Data}_{s} = %3.3f #pm %3.3f", eff->getVal(), eff->getError());
   //l.DrawLatex(0.65,0.6,filename);
   sprintf(filename, "#epsilon^{MC}_{s} = %3.3f", effTP_MC);
   //l.DrawLatex(0.6,0.5,filename);

   sprintf(filename,"resTP/hhu_probefail_%s.pdf",failHistName);
   can1->Print(filename);
   sprintf(filename,"resTP/hhu_probefail_%s.gif",failHistName);
   can1->Print(filename);


   cout<<"effMC: "<< effTP_MC <<" +/- " <<effTP_MCerr <<endl;
   cout<<"eff: "<< eff->getVal() <<" +/- " << eff->getError() <<endl;

   cout<<"ndataPeakFail " << ndataFailPeak <<endl;

}
开发者ID:janveverka,项目名称:JPsi,代码行数:101,代码来源:FitTagandProbev1.C

示例4: assert

void PDF_GLWADS_DKDpi_K3pi::setCorrelations(config c)
{
	resetCorrelations();
	switch(c)
	{
		case lumi1fb:{
						 corSource = "1fb-1, ExpNll/sept2012K3PIResult.root";
						 TString File = this->dir+"/ExpNll/sept2012K3PIResult.root";
						 if ( !FileExists(File) ){cout << "PDF_GLWADS_DKDpi_K3pi::setCorrelations : ERROR : File not found : " << File << endl; exit(1);}
						 TFile *fr = TFile::Open(File);
						 RooFitResult *r = (RooFitResult*)fr->Get("fitresult_model_reducedData_binned");
						 assert(r);
						 for ( int i=0; i<nObs; i++ )
							 for ( int j=0; j<nObs; j++ )
							 {
								 RooRealVar* pObs1 = (RooRealVar*)((RooArgList*)observables)->at(i);
								 RooRealVar* pObs2 = (RooRealVar*)((RooArgList*)observables)->at(j);
								 corStatMatrix[i][j] = r->correlation(obsTmkToMalcolm(pObs1->GetName()),obsTmkToMalcolm(pObs2->GetName()));
							 }
						 // no systematics correlation
						 fr->Close();
						 delete r;
						 delete fr;
						 break;
					 }
		case lumi1fbSystCor:{
								corSource = "1fb-1, ExpNll/sept2012K3PIResult.root, Malcolm's toys";
								TString File = this->dir+"/ExpNll/sept2012K3PIResult.root";
								if ( !FileExists(File) ){cout << "PDF_GLWADS_DKDpi_K3pi::setCorrelations : ERROR : File not found : " << File << endl; exit(1);}
								TFile *fr = TFile::Open(File);
								RooFitResult *r = (RooFitResult*)fr->Get("fitresult_model_reducedData_binned");
								assert(r);
								for ( int i=0; i<nObs; i++ )
									for ( int j=0; j<nObs; j++ ){
										RooRealVar* pObs1 = (RooRealVar*)((RooArgList*)observables)->at(i);
										RooRealVar* pObs2 = (RooRealVar*)((RooArgList*)observables)->at(j);
										corStatMatrix[i][j] = r->correlation(obsTmkToMalcolm(pObs1->GetName()),obsTmkToMalcolm(pObs2->GetName()));
									}
								// systematics correlations
								SystCor_K3pi mySystCor;
								for ( int i=0; i<nObs; i++ )
									for ( int j=0; j<nObs; j++ ){
										RooRealVar* tmkObs1 = (RooRealVar*)((RooArgList*)observables)->at(i);
										RooRealVar* tmkObs2 = (RooRealVar*)((RooArgList*)observables)->at(j);
										corSystMatrix[i][j] = mySystCor.getCor(obsTmkToMalcolm(tmkObs1->GetName()), obsTmkToMalcolm(tmkObs2->GetName()));
									}
								fr->Close();
								delete r;
								delete fr;
								break;
							}
		case zero:{
					  corSource = "zero";
					  break;
				  }
		default:{
					cout << "PDF_GLWADS_DKDpi_K3pi::setCorrelations() : ERROR : config "+ConfigToTString(c)+" not found." << endl;
					exit(1);
				}
	}
}
开发者ID:PashaPodolsky,项目名称:pygammacombo,代码行数:61,代码来源:PDF_GLWADS_DKDpi_K3pi.cpp

示例5: performFit


//.........这里部分代码省略.........
   plotlabel->SetTextColor(kBlack);
   plotlabel->SetFillColor(kWhite);
   plotlabel->SetBorderSize(0);
   plotlabel->SetTextAlign(12);
   plotlabel->SetTextSize(0.03);
   plotlabel->AddText("CMS Preliminary 2010");
  TPaveText *plotlabel2 = new TPaveText(0.23,0.82,0.43,0.87,"NDC");
   plotlabel2->SetTextColor(kBlack);
   plotlabel2->SetFillColor(kWhite);
   plotlabel2->SetBorderSize(0);
   plotlabel2->SetTextAlign(12);
   plotlabel2->SetTextSize(0.03);
   plotlabel2->AddText("#sqrt{s} = 7 TeV");
  TPaveText *plotlabel3 = new TPaveText(0.23,0.75,0.43,0.80,"NDC");
   plotlabel3->SetTextColor(kBlack);
   plotlabel3->SetFillColor(kWhite);
   plotlabel3->SetBorderSize(0);
   plotlabel3->SetTextAlign(12);
   plotlabel3->SetTextSize(0.03);
  char temp[100];
  sprintf(temp, "%.4f", LUMINOSITY);
  plotlabel3->AddText((string("#int#font[12]{L}dt = ") + 
  temp + string(" pb^{ -1}")).c_str());
  TPaveText *plotlabel4 = new TPaveText(0.6,0.82,0.8,0.87,"NDC");
   plotlabel4->SetTextColor(kBlack);
   plotlabel4->SetFillColor(kWhite);
   plotlabel4->SetBorderSize(0);
   plotlabel4->SetTextAlign(12);
   plotlabel4->SetTextSize(0.03);
   double nsig = ParNumSignal->getVal();
   double nErr = ParNumSignal->getError();
   double e = ParEfficiency->getVal();
   double eErr = ParEfficiency->getError();
   double corr = fitResult->correlation(*ParEfficiency, *ParNumSignal);
   double err = ErrorInProduct(nsig, nErr, e, eErr, corr);
   sprintf(temp, "Signal = %.2f #pm %.2f", NumSignalPass->getVal(), err);
   plotlabel4->AddText(temp);
   TPaveText *plotlabel5 = new TPaveText(0.6,0.77,0.8,0.82,"NDC");
   plotlabel5->SetTextColor(kBlack);
   plotlabel5->SetFillColor(kWhite);
   plotlabel5->SetBorderSize(0);
   plotlabel5->SetTextAlign(12);
   plotlabel5->SetTextSize(0.03);
   sprintf(temp, "Bkg = %.2f #pm %.2f", ParNumBkgPass->getVal(), ParNumBkgPass->getError());
   plotlabel5->AddText(temp);
   TPaveText *plotlabel6 = new TPaveText(0.6,0.87,0.8,0.92,"NDC");
   plotlabel6->SetTextColor(kBlack);
   plotlabel6->SetFillColor(kWhite);
   plotlabel6->SetBorderSize(0);
   plotlabel6->SetTextAlign(12);
   plotlabel6->SetTextSize(0.03);
   plotlabel6->AddText("Passing probes");
   TPaveText *plotlabel7 = new TPaveText(0.6,0.72,0.8,0.77,"NDC");
   plotlabel7->SetTextColor(kBlack);
   plotlabel7->SetFillColor(kWhite);
   plotlabel7->SetBorderSize(0);
   plotlabel7->SetTextAlign(12);
   plotlabel7->SetTextSize(0.03); 
   sprintf(temp, "Eff = %.3f #pm %.3f", ParEfficiency->getVal(), ParEfficiency->getErrorHi());
   plotlabel7->AddText(temp);
   TPaveText *plotlabel8 = new TPaveText(0.6,0.72,0.8,0.66,"NDC");
   plotlabel8->SetTextColor(kBlack);
   plotlabel8->SetFillColor(kWhite);
   plotlabel8->SetBorderSize(0);
   plotlabel8->SetTextAlign(12);
   plotlabel8->SetTextSize(0.03);
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:67,代码来源:ElectronTagAndProbeFitter.C


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