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


C++ TGraph::GetLineColor方法代码示例

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


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

示例1: tit

  /** 
   * Create ratios to other data 
   * 
   * @param ib      Bin number  
   * @param res     Result
   * @param alice   ALICE result if any
   * @param cms     CMS result if any
   * @param all     Stack to add ratio to 
   */
  void Ratio2Stack(Int_t ib, TH1* res, TGraph* alice, TGraph* cms, THStack* all)
  {
    if (!all || !res || !(alice || cms)) return;

    Int_t        off  = 5*ib;
    TGraph*      gs[] = { (alice ? alice : cms), (alice ? cms : 0), 0 };
    TGraph**     pg   = gs;
    while (*pg) { 
      TGraph*     g = *pg;
      const char* n = (g == alice ? "ALICE" : "CMS");

      TH1*    r = static_cast<TH1*>(res->Clone(Form("ratio%s", n)));
      TString tit(r->GetTitle());
      tit.ReplaceAll("Corrected", Form("Ratio to %s", n));
      r->SetTitle(tit);
      r->SetMarkerColor(g->GetMarkerColor());
      r->SetLineColor(g->GetLineColor());

      TObject* tst = r->FindObject("legend");
      if (tst) r->GetListOfFunctions()->Remove(tst);

      for (Int_t i = 1; i <= r->GetNbinsX(); i++) {
	Double_t c = r->GetBinContent(i);
	Double_t e = r->GetBinError(i);
	Double_t o = g->Eval(r->GetBinCenter(i));
	if (o < 1e-12) { 
	  r->SetBinContent(i, 0);
	  r->SetBinError(i, 0);
	  continue;
	}
	r->SetBinContent(i, (c - o) / o + off);
	r->SetBinError(i, e / o);
      }
      all->Add(r);
      pg++;
    }
    TLegend* leg = StackLegend(all);
    if (!leg) return;
      
    TString   txt      = res->GetTitle();
    txt.ReplaceAll("Corrected P(#it{N}_{ch}) in ", "");
    if      (ib == 0) txt.Append(" "); // (#times1)");
    // else if (ib == 1) txt.Append(" (#times10)");
    else              txt.Append(Form(" (+%d)", off));

    TObject* dummy = 0;
    TLegendEntry* e = leg->AddEntry(dummy, txt, "p");
    e->SetMarkerStyle(res->GetMarkerStyle());
    e->SetMarkerSize(res->GetMarkerSize());
    e->SetMarkerColor(kBlack);
    e->SetFillColor(0);
    e->SetFillStyle(0);
    e->SetLineColor(kBlack);
  }
开发者ID:ktf,项目名称:AliPhysics,代码行数:63,代码来源:UnfoldMultDists.C

示例2: integrated_lumi

void integrated_lumi(Bool_t goodOnly=0){
  nGoodRuns+= nGoodRuns15f;
  nGoodRuns+= nGoodRuns15h;
  nGoodRuns+= nGoodRuns15i;
  nGoodRuns+= nGoodRuns15j;
  nGoodRuns+= nGoodRuns15l;
  Int_t j=0;
  for (Int_t i=0;i<nGoodRuns15f;i++) goodRuns[j++]=goodRuns15f[i];
  for (Int_t i=0;i<nGoodRuns15h;i++) goodRuns[j++]=goodRuns15h[i];
//  for (Int_t i=0;i<nGoodRuns15i_badIR;i++) goodRuns[j++]=goodRuns15i_badIR[i];
//  for (Int_t i=0;i<nGoodRuns15i_badSPD;i++) goodRuns[j++]=goodRuns15i_badSPD[i];
  for (Int_t i=0;i<nGoodRuns15i;i++) goodRuns[j++]=goodRuns15i[i];
  for (Int_t i=0;i<nGoodRuns15j;i++) goodRuns[j++]=goodRuns15j[i];
  for (Int_t i=0;i<nGoodRuns15l;i++) goodRuns[j++]=goodRuns15l[i];


  gStyle->SetPadTopMargin(0.01);
  gStyle->SetPadRightMargin(0.01);
  gStyle->SetPadBottomMargin(0.06);
  gStyle->SetPadLeftMargin(0.13);
  TGaxis::SetMaxDigits(3);
  
  gStyle->SetOptTitle(1);
  gStyle->SetTitleOffset(1.6,"Y");
  gStyle->SetOptStat(0);
  TLatex* latex = new TLatex();
  latex->SetTextSize(0.05);
  latex->SetTextFont(42);
  latex->SetTextAlign(11);
  latex->SetNDC();
  
  t = new TChain("trending");
  t->AddFile("trending.root");
  classes = new TObjArray();
  partition = new TObjString();
  lhcState = new TObjString();
  lhcPeriod = new TObjString();
  activeDetectors = new TObjString();
  
  t->SetBranchAddress("run",&run);
  t->SetBranchAddress("fill",&fill);
  t->SetBranchAddress("classes",&classes);
  t->SetBranchAddress("class_l2a",&class_l2a);
  t->SetBranchAddress("class_lumi",&class_lumi);
  t->SetBranchAddress("timeStart",&timeStart);
  t->SetBranchAddress("timeEnd",&timeEnd);
  t->SetBranchAddress("partition",&partition);
  t->SetBranchAddress("lhcState",&lhcState);
  t->SetBranchAddress("lhcPeriod",&lhcPeriod);
  t->SetBranchAddress("activeDetectors",&activeDetectors);
  TGraph* gINT = GetStat("CINT7-B-NOPF-CENT",1,goodOnly);
  TGraph* gMUL = GetStat("CMUL7-B-NOPF-MUFAST",1,goodOnly);
  TGraph* gV0M = GetStat("CVHMV0M-B-NOPF-CENTNOTRD",1,goodOnly);
  TGraph* gSH2 = GetStat("CVHMSH2-B-NOPF-CENTNOTRD",1,goodOnly);
  TGraph* gStatINT = GetStat("CINT7-B-NOPF-CENT",0,goodOnly);
  TGraph* gStatV0M = GetStat("CVHMV0M-B-NOPF-CENTNOTRD",0,goodOnly);
  TGraph* gStatSH2 = GetStat("CVHMSH2-B-NOPF-CENTNOTRD",0,goodOnly);
  TGraph* gStatEMC = GetStat("CEMC7-B-NOPF-CENTNOTRD",0,goodOnly,"PHYSICS_2");
  TGraph* gStatDMC = GetStat("CDMC7-B-NOPF-CENTNOTRD",0,goodOnly,"PHYSICS_2");
  gMUL->SetLineColor(kBlack);
  gINT->SetLineColor(kBlue);
  gV0M->SetLineColor(kMagenta);
  gSH2->SetLineColor(kRed);
  gStatV0M->SetLineColor(kMagenta);
  gStatSH2->SetLineColor(kRed);
  gStatEMC->SetLineColor(kGray);
  gStatDMC->SetLineColor(kGreen-2);

  TCanvas* c1 = new TCanvas("c1","",800,700);
  Double_t xminLumi   = gMUL->GetXaxis()->GetXmin();
  Double_t xmaxLumi   = gMUL->GetXaxis()->GetXmax();
  Double_t ymaxLumi   = gMUL->GetYaxis()->GetXmax()*1.1;
  TH1F* f1 = gPad->DrawFrame(xminLumi,0,xmaxLumi,ymaxLumi);
  SetFrame(f1);
  f1->GetYaxis()->SetTitle("Integrated luminosity, pb^{-1}");
  f1->GetXaxis()->SetTimeDisplay(1);
  f1->GetXaxis()->SetTimeFormat("%d %b");
  Double_t y = 0.94;
  latex->DrawLatex(0.18,0.94,"ALICE Performance, pp #sqrt{s} = 13 TeV");
  latex->SetTextColor(gINT->GetLineColor());
  latex->DrawLatex(0.18,y-=0.07,Form("MB triggers: L = %.3f pb^{-1}",gINT->GetY()[gINT->GetN()-1]));
  latex->SetTextColor(gV0M->GetLineColor());
  latex->DrawLatex(0.18,y-=0.07,Form("V0 HM triggers:  L = %.3f pb^{-1}",gV0M->GetY()[gV0M->GetN()-1]));
  latex->SetTextColor(gSH2->GetLineColor());
  latex->DrawLatex(0.18,y-=0.07,Form("SPD HM triggers: L = %.3f pb^{-1}",gSH2->GetY()[gSH2->GetN()-1]));
  latex->SetTextColor(gMUL->GetLineColor());
  latex->DrawLatex(0.18,y-=0.07,Form("Dimuon triggers: L = %.3f pb^{-1}",gMUL->GetY()[gMUL->GetN()-1]));
  gMUL->Draw();
  gINT->Draw();
  gV0M->Draw();
  gSH2->Draw();
  gPad->Print("lumi_dimuon_triggers.png");

  TCanvas* c2 = new TCanvas("c2","",800,700);
  Double_t xminEvents = gStatINT->GetXaxis()->GetXmin();
  Double_t xmaxEvents = gStatINT->GetXaxis()->GetXmax();
  Double_t ymaxEvents = gStatINT->GetYaxis()->GetXmax()*1.1;

  TH1F* f2 = gPad->DrawFrame(xminEvents,0,xmaxEvents,ymaxEvents);
  SetFrame(f2);
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:integrated_lumi.C

示例3: DMplot


//.........这里部分代码省略.........
    h_scalar_min->GetXaxis()->SetTitleOffset(1.03);
    h_scalar_min->GetXaxis()->SetTitle("DM mass [GeV]");
    h_scalar_min->GetYaxis()->SetTitle("DM-nucleon cross section [cm^{2}]");
    h_scalar_lat->SetLineColor(4);
    h_scalar_lat->SetLineStyle(1);
    h_scalar_lat->SetLineWidth(3);
    h_scalar_max->SetLineColor(4);
    h_scalar_max->SetLineStyle(2);
    h_scalar_max->SetLineWidth(3);


    h_fermion_min->SetLineColor(kRed);
    h_fermion_min->SetLineStyle(2);
    h_fermion_min->SetLineWidth(3);
    h_fermion_lat->SetLineColor(kRed);
    h_fermion_lat->SetLineStyle(1);
    h_fermion_lat->SetLineWidth(3);
    h_fermion_max->SetLineColor(kRed);
    h_fermion_max->SetLineStyle(2);
    h_fermion_max->SetLineWidth(3);


    //h_scalar_lat->SetFillStyle(3005);
    //h_scalar_lat->SetLineWidth(-402);

    h_scalar_min->Draw("AL");
    h_scalar_lat->Draw("L");
    h_scalar_max->Draw("L");

    h_fermion_min->Draw("L");
    h_fermion_lat->Draw("L");
    h_fermion_max->Draw("L");
    z12016->Draw("L");
    //z12015->Draw("L");
    //CRESST2->Draw("C");
    SCDMS->Draw("C");
    PANDAX->Draw("C");

    //leg2->Draw();
    TLatex *lat = new TLatex(); lat->SetTextSize(0.025);
    lat->SetTextFont(42);
    lat->SetTextColor(kGreen+2);
    lat->SetTextAngle(15);
    //lat->DrawLatex(130,z1->Eval(130)*1.5,"LUX #it{Phys. Rev. Lett.} #bf{116} (2016)");


    //lat->DrawLatex(130,z12015->Eval(130)*1.5,"LUX (2015)");
    lat->DrawLatex(130,z12016->Eval(130)*0.5,"LUX (2013+2014-16)");
    
    lat->SetTextColor(SCDMS->GetLineColor());
    lat->SetTextAngle(344);
    //lat->SetFillColor(kWhite);
    lat->DrawLatex(5,SCDMS->Eval(5)*1.5,"CDMSlite (2015)");
    
    lat->SetTextColor(kBlue);
    lat->SetTextAngle(330);
    lat->DrawLatex(13,h_scalar_lat->Eval(13)*1.5,"Scalar DM");

    lat->SetTextColor(kRed);
    lat->SetTextAngle(4);
    lat->DrawLatex(5,h_fermion_lat->Eval(5)*1.5,"Fermion DM");


    lat->SetTextColor(kMagenta+2);
    lat->SetTextAngle(15);
    lat->DrawLatex(130,PANDAX->Eval(130)*1.25,"PandaX-II (2016)");

	TLatex * tex = new TLatex();
	tex->SetNDC();
	tex->SetTextFont(42);
	tex->SetLineWidth(2);
	tex->SetTextSize(0.04);
	tex->SetTextAlign(31);
	tex->DrawLatex(0.93,0.78,"4.9 fb^{-1} (7 TeV) + 19.7 fb^{-1} (8 TeV)");
	tex->DrawLatex(0.93,0.74,"+ 2.3 fb^{-1} (13 TeV)");
	//tex->SetTextAlign(11);
  	tex->SetTextFont(42);
	tex->SetTextSize(0.06);
        TLegend *legBOX; 
	if (isPrelim)	{
   		legBOX = new TLegend(0.16,0.83,0.38,0.89);
		legBOX->SetFillColor(kWhite);
		legBOX->SetLineWidth(0);
		legBOX->Draw();
		tex->DrawLatex(0.17, 0.84, "#bf{CMS} #it{Preliminary}");
	} else {
   		legBOX = new TLegend(0.16,0.83,0.28,0.89);
		legBOX->SetFillColor(kWhite);
		legBOX->SetLineWidth(0);
		//legBOX->Draw();
		tex->DrawLatex(0.93, 0.84, "#bf{CMS}");
	}
  tex->SetTextSize(0.045);
  tex->DrawLatex(0.93,0.68,Form("B(H #rightarrow inv.) < %.2f",BRinv));
  tex->DrawLatex(0.93,0.5,"90% CL limits");
  canv->SetTicky(1);
  canv->SetTickx(1);
  canv->SaveAs("limitsDM.pdf"); 

}
开发者ID:nucleosynthesis,项目名称:work-tools,代码行数:101,代码来源:DMplot.C


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