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


C++ TPaveText::GetX2NDC方法代码示例

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


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

示例1: Draw_Time_Hists

void Draw_Time_Hists(TTree* t) {
   // Draw processing time, CPU time, and latency per packet
   // distributions from the input tree

   if (!t) {
      cout << "Invalid input tree" << endl;
      return;
   }

   gROOT->SetStyle("Plain");
   gStyle->SetOptStat(0);
   gStyle->SetNdivisions(505);
   gStyle->SetTitleFontSize(0.1);

   if(!TString(gSystem->GetLibraries()).Contains("Proof"))
      gSystem->Load("libProof.so");

   TCanvas* canvas = new TCanvas("ProfHists","Profile Histograms",800,600);
   canvas->Divide(3,1);

   canvas->cd(1);
   gPad->SetLogy();
   t->Draw("fProcTime");
   TH1* h = dynamic_cast<TH1*>(gROOT->FindObject("htemp"));
   h->SetTitle("Processing Time per Packet");
   h->GetXaxis()->SetTitle("Processing Time [s]");

   gPad->Update();
   TPaveText* titlepave = 0;
   titlepave = dynamic_cast<TPaveText*>(gPad->GetListOfPrimitives()->FindObject("title"));
   if (titlepave) {
      Double_t x1ndc = titlepave->GetX1NDC();
      Double_t x2ndc = titlepave->GetX2NDC();
      titlepave->SetX1NDC((1.0-x2ndc+x1ndc)/2.);
      titlepave->SetX2NDC((1.0+x2ndc-x1ndc)/2.);
      titlepave->SetBorderSize(0);
      gPad->Update();
   }
   gPad->Modified();

   canvas->cd(2);
   gPad->SetLogy();
   t->Draw("fCpuTime");
   h = dynamic_cast<TH1*>(gROOT->FindObject("htemp"));
   h->SetTitle("CPU Time per Packet");
   h->GetXaxis()->SetTitle("CPU Time [s]");

   gPad->Update();
   titlepave = dynamic_cast<TPaveText*>(gPad->GetListOfPrimitives()->FindObject("title"));
   if (titlepave) {
      Double_t x1ndc = titlepave->GetX1NDC();
      Double_t x2ndc = titlepave->GetX2NDC();
      titlepave->SetX1NDC((1.0-x2ndc+x1ndc)/2.);
      titlepave->SetX2NDC((1.0+x2ndc-x1ndc)/2.);
      titlepave->SetBorderSize(0);
      gPad->Update();
   }
   gPad->Modified();

   canvas->cd(3);
   gPad->SetLogy();
   t->Draw("fLatency");
   h = dynamic_cast<TH1*>(gROOT->FindObject("htemp"));
   h->SetTitle("Request Packet Latency");
   h->GetXaxis()->SetTitle("Latency [s]");

   gPad->Update();
   titlepave = dynamic_cast<TPaveText*>(gPad->GetListOfPrimitives()->FindObject("title"));
   if (titlepave) {
      Double_t x1ndc = titlepave->GetX1NDC();
      Double_t x2ndc = titlepave->GetX2NDC();
      titlepave->SetX1NDC((1.0-x2ndc+x1ndc)/2.);
      titlepave->SetX2NDC((1.0+x2ndc-x1ndc)/2.);
      titlepave->SetBorderSize(0);
      gPad->Update();
   }
   gPad->Modified();

}
开发者ID:My-Source,项目名称:root,代码行数:79,代码来源:Draw_Time_Hists.C


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