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


C++ TBox::SetFillColorAlpha方法代码示例

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


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

示例1: plotGraph

void plotGraph(map<anabin, TGraphAsymmErrors*> theGraphs, map<anabin, TGraphAsymmErrors*> theGraphs_syst, string xaxis, string outputDir, map<anabin, syst> gsyst) {
   setTDRStyle();


   TCanvas *c1 = NULL;
   if (xaxis=="cent") c1 = new TCanvas("c1","c1",600/xfrac,600);
   else c1 = new TCanvas("c1","c1",600,600);

   // in the case of the centrality dependence, we need the minimum bias panel on the right
   TPad *padl=NULL, *padr=NULL;
   if (xaxis=="cent") {
         padl = new TPad("padl_left","",0,0,xfrac,1);
         padl->SetLeftMargin(gStyle->GetPadLeftMargin()/xfrac);
         padl->SetRightMargin(0);
         // padl->SetBottomMargin(gStyle->GetPadBottomMargin());
         // padl->SetTopMargin(gStyle->GetPadTopMargin());
         padl->SetFrameBorderMode(0);
         padl->SetBorderMode(0);
         padl->SetBorderSize(0);
         padl->Draw();

         padr = new TPad("padr_right","",xfrac,0,1,1);
         padr->SetRightMargin(gStyle->GetPadRightMargin()/(1.-xfrac));
         padr->SetLeftMargin(0);
         // padr->SetBottomMargin(gStyle->GetPadBottomMargin());
         // padr->SetTopMargin(gStyle->GetPadTopMargin());
         padr->SetFrameBorderMode(0);
         padr->SetBorderMode(0);
         padr->SetBorderSize(0);
         padr->Draw();

         padl->cd();
   }

   // the axes
   TH1F *haxes=NULL, *haxesr=NULL; TLine line, liner;
   if (xaxis=="pt") {
      haxes = new TH1F("haxes","haxes",1,0,30);
      line = TLine(0,1,30,1);
   }
   if (xaxis=="cent") {
      haxes = new TH1F("haxesl","haxesl",1,0,420);
      haxes->GetXaxis()->SetTickLength(gStyle->GetTickLength("X")/xfrac);
      // haxes->GetYaxis()->SetTickLength(gStyle->GetTickLength("Y")*xfrac);
      line = TLine(0,1,420,1);
      haxesr = new TH1F("haxesr","haxesr",1,0,420);
      haxesr->GetXaxis()->SetTickLength(0);
      haxesr->GetYaxis()->SetTickLength(gStyle->GetTickLength("Y")/(1.-xfrac));
      haxesr->GetYaxis()->SetRangeUser(0,1.5);
      haxesr->GetXaxis()->SetTitleSize(0);
      haxesr->GetXaxis()->SetLabelSize(0);
      liner = TLine(0,1,420,1);
   }
   haxes->GetYaxis()->SetRangeUser(0,1.5);
   haxes->GetYaxis()->SetTitle(ylabel);
   const char* xlabel = (xaxis=="pt") ? "p_{T} (GeV/c)" : "N_{part}";
   haxes->GetXaxis()->SetTitle(xlabel);
   haxes->Draw();
   line.Draw();
   if (xaxis=="cent") {
      padr->cd();
      haxesr->Draw();
      liner.Draw();
      padl->cd();
   }

   double xshift=0.;
   if (xaxis=="cent") xshift=0.05;
   TLegend *tleg = new TLegend(0.16+xshift,0.73,0.50,0.89);
   tleg->SetBorderSize(0);
   tleg->SetTextSize(0.03);

   // prepare for the printing of the result tables
   const char* xname = (xaxis=="cent") ? "Centrality" : "\\pt";
   gSystem->mkdir(Form("Output/%s/tex/", outputDir.c_str()), kTRUE); 
   char texname[2048]; sprintf(texname, "Output/%s/tex/result_%s.tex",outputDir.c_str(),xaxis.c_str());
   string yname("\\doubleratio");
   inittex(texname, xname, yname);

   int cnt=0;
   map<anabin, TGraphAsymmErrors*>::const_iterator it=theGraphs.begin();
   map<anabin, TGraphAsymmErrors*>::const_iterator it_syst=theGraphs_syst.begin();
   for (; it!=theGraphs.end(); it++) {
      anabin thebin = it->first;
      bool isMB = (thebin.centbin().low()<=0 && thebin.centbin().high()<=0);
      TGraphAsymmErrors* tg = it->second;
      TGraphAsymmErrors* tg_syst = it_syst->second;
      if (!tg || !tg_syst) continue;

      if (thebin.rapbin() == binF(0.,1.6)) {
         tg->SetMarkerStyle(kFullSquare);
         tg->SetMarkerColor(kRed);
         tg->SetLineColor(kRed);
         tg_syst->SetFillColorAlpha(kRed, 0.5);
      } else if (thebin.rapbin() == binF(1.6,2.4)) {
         tg->SetMarkerStyle(kFullCircle);
         tg->SetMarkerColor(kBlue);
         tg->SetLineColor(kBlue);
         tg_syst->SetFillColorAlpha(kBlue, 0.5);
      } else {
//.........这里部分代码省略.........
开发者ID:echapon,项目名称:HiCharm2015,代码行数:101,代码来源:plotResults.C


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