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


C++ TProfile::GetStats方法代码示例

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


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

示例1: modifySSHistAndLegend

void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend)
{
  // Add mean-y-values to the legend and scale the histograms.

  Double_t legendY = 0.80;
  if (hs->GetHists()->GetSize() > 3)
    legendY -= 0.01 * (hs->GetHists()->GetSize() - 3);
  if (legendY < 0.6) {
    std::cerr << "Warning: Huge legend!" << std::endl;
    legendY = 0.6;
  }
  legend->SetY1(legendY);

  // Loop over all profiles
  TProfile* prof = 0;
  TIter next(hs->GetHists());
  Int_t index = 0;
  while ((prof = (TProfile*)next())) {
    //Scaling: from cm to um
    Double_t scale = 10000;
    prof->Scale(scale);

    Double_t stats[6] = {0};
    prof->GetStats(stats);

    std::ostringstream legendtext;
    legendtext.precision(3);
    legendtext << fixed; // to always show 3 decimals
    legendtext << ": y mean = " << stats[4]/stats[0]*scale << " #mum";

    TLegendEntry* entry = (TLegendEntry*)legend->GetListOfPrimitives()->At(index);
    if (entry == 0)
      cout << "PlotAlignmentValidation::PlotAlignmentValidation::modifySSLegend: Bad legend!" << endl;
    else
      entry->SetLabel((entry->GetLabel() + legendtext.str()).c_str());
    index++;
  }

}
开发者ID:gouskos,项目名称:cmssw,代码行数:39,代码来源:PlotAlignmentValidation.C

示例2: recoil_analysis


//.........这里部分代码省略.........
   parmA.clear();
   parmB.clear();
   parmC.clear();
   parmD.clear();

  for (int i=0; i<ptnbinszphi; i++) {
     //this is zbset and response, in bins of luminosity
     if (i!=theBin && theBin != -4) continue;

    if (RecoilRespData[i]->numEntries() < 5) continue;
     cout<<"RESP bin "<<i<<endl;

    RecoilRespData[i]->printMultiline(cout, 1);
    TH2D* genHist(0);
  
    double twopi = 2*TMath::Pi();
    cout<<"RESP bin start HIST "<<i<<endl;
    genHist = (TH2D*) RecoilRespData[i]->createHistogram(TString::Format("recoil_resp_zphi_hist_bin_%d", i).Data(), 
							 resp, Binning(500, 0., resp_bdr[i]),
							    YVar(zphi, Binning(64, 0., twopi)));//was 40 0 20    
  
   
    cout<<"RESP bin start Write "<<i<<endl;
   
    genHist->SetName(TString::Format("recoil_resp_zphi_hist_bin_%d", i));
    genHist->SetTitle(TString::Format("recoil_resp_zphi_hist_bin_%d", i));      
    TProfile *myhisty = genHist->ProfileY();

    ROOTout->cd();
    myhisty->Write(TString::Format("recoil_resp_zphi_hist_bin_%d", i),TObject::kOverwrite);
    TF1 *pol3 = new TF1("pol3", "pol3");
    myhisty->Fit("pol3");
    double stats[7];
    myhisty->GetStats(stats); 
    parmMean.push_back(myhisty->GetMean(2));
    parmA.push_back(pol3->GetParameter(0));
    parmB.push_back(pol3->GetParameter(1));
    parmC.push_back(pol3->GetParameter(2));
    parmD.push_back(pol3->GetParameter(3));

    myhisty->Draw();  
    c1->Print(psoutput); 
  }

  if (theBin == -4){
    
      cout<<"HardRecoil_zphiresp_Mean:       ";
    for (int i=0; i<ptnbinszphi-1; i++) {
      cout<<parmMean[i]<<" ";
    }
    cout<<parmMean[ptnbinszphi-1]<<endl;;

      cout<<"HardRecoil_zphiresp_ParameterA: ";
    for (int i=0; i<ptnbinszphi-1; i++) {
      cout<<parmA[i]<<" ";
    }
    cout<<parmA[ptnbinszphi-1]<<endl;;

      cout<<"HardRecoil_zphiresp_ParameterB: ";
    for (int i=0; i<ptnbinszphi-1; i++) {
      cout<<parmB[i]<<" ";
    }
    cout<<parmB[ptnbinszphi-1]<<endl;;

      cout<<"HardRecoil_zphiresp_ParameterC: ";
    for (int i=0; i<ptnbinszphi-1; i++) {
开发者ID:hengne,项目名称:d0wmass,代码行数:67,代码来源:recoil_analysis_FINAL2_lessbins5_FINAL.C


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