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


C++ TGraphErrors::Print方法代码示例

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


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

示例1: genieta16calib

void genieta16calib()
{
  glob_t globbuf;

  int stat = glob (fileglob.c_str(), GLOB_MARK, NULL, &globbuf);
  if (stat) {
    switch (stat) {
    case GLOB_NOMATCH: cerr << "No file matching glob pattern "; break;
    case GLOB_NOSPACE: cerr << "glob ran out of memory "; break;
    case GLOB_ABORTED: cerr << "glob read error "; break;
    default: cerr << "unknown glob error stat=" << stat << " "; break;
    }
    cerr << fileglob << endl;
    exit(-1);
  }
  if (gl_verbose)
    cout<<globbuf.gl_pathc<<" files match the glob pattern"<<endl;
      
  for (size_t i=0; i<std::max((size_t)1,globbuf.gl_pathc); i++) {
    TVectorD vxday,vyfcamp,vzlumi;

    string path = globbuf.gl_pathv[i];

    // pick out day of year and mean(sum(fC))
    loadVectorsFromFile(path.c_str(),"%*lf %lf %lf %*lf %*s %*s %lf",vxday,vzlumi,vyfcamp);
    TGraph *pwg = new TGraph(vxday,vyfcamp);
    pwg->SetNameTitle(path.c_str(),path.c_str());

    //pwg->Print();

    v_graphs.push_back(pwg);

    optimizenorm(i,path);

    //pwg->Print();
  }

  // calc average and rms
  int ngraphs = (int)v_graphs.size();
  int npts    = v_graphs[0]->GetN();
  cout << ngraphs << " graphs, " << npts << " points per graph" << endl;
  TVectorD vx(npts),vyavg(npts),vyrms(npts), vxerr(npts);
  for (int i=0; i<npts; i++) {
    double x,y;
    v_graphs[0]->GetPoint(i,x,y);
    vx[i] = x;
    vxerr[i]=0;
    double yavg = y;
    for (int j=1; j<ngraphs; j++) {
      v_graphs[j]->GetPoint(i,x,y);
      if (x!=vx[i]) {
	cerr << x << " != " << vx[i] << endl;
	exit(-1);
      }
      yavg += y;
    }
    yavg /= (double)ngraphs;
    vyavg[i] = yavg;
    double var = 0.0;
    for (int j=0; j<ngraphs; j++) {
      v_graphs[j]->GetPoint(i,x,y);
      var += (y-yavg)*(y-yavg);
    }
    vyrms[i] = sqrt(var/(double)ngraphs);
  }

  TCanvas *c1 = new TCanvas("c1","c1",1500,600);
  v_graphs[0]->Draw("ALP");
  v_graphs[0]->GetHistogram()->GetYaxis()->SetRangeUser(0.0,2.0);
  v_graphs[0]->SetTitle("Average laser response from i#eta=-16 depth 3 over 2016, selected channels; Day # ; Arbitrary norm");
  for (int i=1; i<ngraphs; i++) {
    v_graphs[i]->Draw("LP same");
    v_graphs[i]->SetLineColor(15);
  }

  TGraphErrors *gravg = new TGraphErrors(vx,vyavg,vxerr,vyrms);

  gravg->Draw("LPE same");
  gravg->SetLineWidth(2);
  gPad->SetRightMargin(0.03);
  gPad->SetLeftMargin(0.08);
  gPad->Update();
  gPad->SaveAs("ieta-16calib.png");

  gravg->Print();
}
开发者ID:pdudero,项目名称:usercode,代码行数:86,代码来源:genieta16calib.C

示例2: CompareChargedAndNeutralPionDataALICEpPb_MB


//.........这里部分代码省略.........
//    histoChargedPionSpecLowPtSyspPb->Add(histoChargedPionSpecLowPtSyspPbcent6,0.2);
   
//    histoChargedPionSpecLowPtStatpPb->Add(histoChargedPionSpecLowPtStatpPbcent0,histoChargedPionSpecLowPtStatpPbcent1,0.05,0.05);
//    histoChargedPionSpecLowPtStatpPb->Add(histoChargedPionSpecLowPtStatpPbcent2,0.1);
//    histoChargedPionSpecLowPtStatpPb->Add(histoChargedPionSpecLowPtStatpPbcent3,0.2);
//    histoChargedPionSpecLowPtStatpPb->Add(histoChargedPionSpecLowPtStatpPbcent4,0.2);
//    histoChargedPionSpecLowPtStatpPb->Add(histoChargedPionSpecLowPtStatpPbcent5,0.2);
//    histoChargedPionSpecLowPtStatpPb->Add(histoChargedPionSpecLowPtStatpPbcent6,0.2);

//    histoChargedPionSpecLowPtSyspPb->Scale(1/(2*TMath::Pi())); // divide by 2*pi
//    histoChargedPionSpecLowPtStatpPb->Scale(1/(2*TMath::Pi()));

   
   cout << "*************************************************************************"<< endl;  
   cout << "******************************  pPb *************************************"<< endl;
   cout << "*************************************************************************"<< endl;
   
   TGraphAsymmErrors* graphPCMForwardYieldPi0SysErrpPbCopy = (TGraphAsymmErrors*) graphPCMForwardYieldPi0SysErrpPb->Clone("graphPCMForwardYieldPi0SysErrpPbCopy");

   TGraphAsymmErrors* graphPCMMidYieldPi0SysErrpPbCopy = (TGraphAsymmErrors*) graphPCMMidYieldPi0SysErrpPb->Clone("graphPCMMidYieldPi0SysErrpPbCopy");

   cout << "*************************************************************************"<< endl;  
   cout << "******************************  pPb MinBias *****************************"<< endl;
   cout << "*************************************************************************"<< endl;

   TCanvas *can= new TCanvas("can","can",800,600);
   histoChargedPionSpecLowPtStatpPb->Draw();
   histoChargedPionSpecLowPtStatpPb->Draw("same");
   histoPCMForwardYieldPi0pPb->Draw("same");

   can->Update();

   cout << "PCM Spectrum forward - low Pt" << endl;



   TGraphErrors* graphRatioLowPtChargedPionsPCMForwardpPb = CalculateRatioBetweenSpectraWithDifferentBinning(histoPCMForwardYieldPi0pPb, graphPCMForwardYieldPi0SysErrpPbCopy, histoChargedPionSpecLowPtStatpPb, histoChargedPionSpecLowPtSyspPb,  kTRUE,  kTRUE)  ;
   graphRatioLowPtChargedPionsPCMForwardpPb->Print();
   cout << "PCM Spectrum mid - low Pt" << endl;
   TGraphErrors* graphRatioLowPtChargedPionsPCMMidpPb = CalculateRatioBetweenSpectraWithDifferentBinning(histoPCMMidYieldPi0pPb, graphPCMMidYieldPi0SysErrpPbCopy, histoChargedPionSpecLowPtStatpPb, histoChargedPionSpecLowPtSyspPb,  kTRUE,  kTRUE)  ;
   graphRatioLowPtChargedPionsPCMMidpPb->Print();
   
   cout << "PHOS Spectrum forward - low Pt" << endl;
   TGraphErrors* graphRatioLowPtChargedPionsPHOSpPb = CalculateRatioBetweenSpectraWithDifferentBinning(histoPHOSYieldPi0pPb, histoPHOSYieldPi0pPb, histoChargedPionSpecLowPtStatpPb, histoChargedPionSpecLowPtSyspPb,  kTRUE,  kTRUE)  ;
   graphRatioLowPtChargedPionsPHOSpPb->Print();
   

   
   //************************************************************************************************************
   //******************************  plotting just minBias individual measurements ******************************
   //************************************************************************************************************

   TCanvas* canvasCompYieldpPbInd = new TCanvas("canvasCompYieldpPbInd","",200,10,700,500);  // gives the page size
   DrawGammaCanvasSettings( canvasCompYieldpPbInd,  0.12, 0.02, 0.02, 0.12);
   
   canvasCompYieldpPbInd->SetLogx();
   TH2F * histo2DCompCombinedRatio2;
   histo2DCompCombinedRatio2 = new TH2F("histo2DCompCombinedRatio2","histo2DCompCombinedRatio2",1000,0.3,20.,1000,0.2,4.   );
   SetStyleHistoTH2ForGraphs(histo2DCompCombinedRatio2, "p_{T} (GeV/c)","#pi^{0}/#pi^{#pm}", 0.05,0.064, 0.05,0.06, 0.8,0.9, 512, 505);
   histo2DCompCombinedRatio2->GetXaxis()->SetRangeUser(0.,15.);
   histo2DCompCombinedRatio2->GetYaxis()->SetRangeUser(0.1,2.1);
   histo2DCompCombinedRatio2->DrawCopy();

      DrawGammaSetMarkerTGraphErr(graphRatioLowPtChargedPionsPCMForwardpPb,20,markerSizeComparison, kBlue+2, kBlue+2);
      graphRatioLowPtChargedPionsPCMForwardpPb->Draw("E1psame");
      DrawGammaSetMarkerTGraphErr(graphRatioLowPtChargedPionsPCMMidpPb,25,markerSizeComparison, kBlue+2, kBlue+2);
      graphRatioLowPtChargedPionsPCMMidpPb->Draw("E1psame");

//       DrawGammaSetMarkerTGraphErr(graphRatioLowPtChargedPionsPHOSpPb,20,markerSizeComparison,  kMagenta+1, kMagenta+1);
//       graphRatioLowPtChargedPionsPHOSpPb->Draw("E1psame");

      TLatex *labelRatioPi0pPb = new TLatex(0.16,0.9,collisionSystempPb.Data());
      SetStyleTLatex( labelRatioPi0pPb, 0.06,4);
      labelRatioPi0pPb->Draw();

      TLegend* legendPi0CompIndChargedPionspPb = new TLegend(0.13,0.15,0.98,0.25);
      legendPi0CompIndChargedPionspPb->SetFillColor(0);
      legendPi0CompIndChargedPionspPb->SetLineColor(0);
      legendPi0CompIndChargedPionspPb->SetNColumns(1);
      legendPi0CompIndChargedPionspPb->SetTextSize(0.038);
      legendPi0CompIndChargedPionspPb->SetMargin(0.14);
      legendPi0CompIndChargedPionspPb->AddEntry(graphRatioLowPtChargedPionsPCMForwardpPb,"#pi^{0}/#pi^{#pm} low pt (PCM, 0.165 < y < 0.765)","p");
      //legendPi0CompIndChargedPionspPb->AddEntry(graphRatioLowPtChargedPionsPHOSpPb,"#pi^{0}/#pi^{#pm} low pt (PHOS)","p");
       legendPi0CompIndChargedPionspPb->AddEntry(graphRatioLowPtChargedPionsPCMMidpPb,"#pi^{0}/#pi^{#pm} low pt (PCM, |y| < 0.4)","p");
       // legendPi0CompIndChargedPionspPb->AddEntry(graphRatioLowPtChargedPionsPCMForwardpPb,"#pi^{0}/#pi^{#pm} low pt midrapidity with pile up subtraction","p");
      //  legendPi0CompIndChargedPionspPb->AddEntry(graphRatioLowPtChargedPionsPHOSpPb,"#pi^{0}/#pi^{#pm} low pt (PHOS) - 2013-08-26","p");
       //  legendPi0CompIndChargedPionspPb->AddEntry(graphRatioLowPtChargedPionsPCMMidpPb,"#pi^{0}/#pi^{#pm} low pt midrapidity without subtraction","p");
      legendPi0CompIndChargedPionspPb->Draw();

      legendPi0CompIndChargedPionspPb->Draw();
      DrawGammaLines(0., 19.5 , 1, 1 ,1,kGray);
   
   DrawGammaLines(0., 20.,1., 1.,0.1,kGray,2);
   
   
   canvasCompYieldpPbInd->Update();
   canvasCompYieldpPbInd->Print(Form("%s/ComparisonChargedToNeutralInd_pPb.%s",outputDir.Data(),suffix.Data()));


}
开发者ID:dhruvdixit,项目名称:afterburner,代码行数:101,代码来源:CompareChargedAndNeutralPionDataALICEpPb_MB.C


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