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


C++ TLegend::SetTextAlign方法代码示例

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


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

示例1: DrawTLegend

//------------------------------------------------------------------------------
// DrawTLegend
//------------------------------------------------------------------------------
TLegend* DrawTLegend(Float_t x1,
		     Float_t y1,
		     TH1*    hist,
		     TString label,
		     TString option,
		     Float_t tsize,
		     Float_t xoffset,
		     Float_t yoffset)
{
  TLegend* legend = new TLegend(x1,
				y1,
				x1 + xoffset,
				y1 + yoffset);
  
  legend->SetBorderSize(    0);
  legend->SetFillColor (    0);
  legend->SetTextAlign (   12);
  legend->SetTextFont  (   42);
  legend->SetTextSize  (tsize);

  legend->AddEntry(hist, label.Data(), option.Data());
  legend->Draw();

  return legend;
}
开发者ID:piedraj,项目名称:usercode,代码行数:28,代码来源:drawFigure7.C

示例2: setLegend

void DrawTree::setLegend(float xmin, float ymin, float xsize, float ysize,char* header) {
    _legend = new TLegend(xmin,ymin,xmin+xsize,ymin+ysize);
    _legend->SetTextAlign(12);
    _legend->SetTextColor(1);
    _legend->SetTextSize(0.03);
    _legend->SetFillStyle(0);
    _legend->SetFillColor(0);
    _legend->SetBorderSize(0);

    _legend->SetHeader(header);

}
开发者ID:nsahoo,项目名称:cmssw-1,代码行数:12,代码来源:DrawTree.C

示例3: DrawLegend

void BasePlot::DrawLegend(Float_t x1, Float_t y1, TH1F*   hist, TString label, TString option) {
    TLegend* legend = new TLegend(x1, y1, x1 + _xoffset, y1 + _yoffset);

    legend->SetBorderSize(     0);
    legend->SetFillColor (     0);
    legend->SetTextAlign (    12);
    legend->SetTextFont  (_labelFont);
    legend->SetTextSize  (_legendTextSize);

    legend->AddEntry(hist, label.Data(), option.Data());

    legend->Draw();
}
开发者ID:HuguesBrun,项目名称:WWAnalysis,代码行数:13,代码来源:BasePlot.C

示例4: make_1D_Plot

void make_1D_Plot(T *hist, configuration *myconfig){
  TCanvas *c1 = new TCanvas("c1","C1",10,10,1280,960);
  gPad->SetTopMargin(0.08);
  gPad->SetRightMargin(0.04);
  gPad->SetLeftMargin(0.12);
  gPad->SetBottomMargin(0.14);
  gPad->SetTickx();
  gPad->SetTicky();
  //gPad->SetLogy();
  //hist->GetYaxis()->SetTitleOffset(0.8);
  hist->SetLineWidth(2);
  if(static_cast<TString>(hist->GetName()).Contains("_IP")){
    hist->SetLineColor(kBlack);
    hist->SetMarkerColor(kBlack);
  }
  else hist->SetLineColor(kBlue+2);
  hist->GetXaxis()->SetLabelSize(0.05);
  hist->GetYaxis()->SetLabelSize(0.05);
  hist->GetXaxis()->SetTitleSize(0.05);
  hist->GetYaxis()->SetTitleSize(0.05);
  hist->GetYaxis()->SetRangeUser(0,1.2*hist->GetMaximum());
  if(static_cast<TString>(hist->GetName()).Contains("_IP"))hist->Draw("e1p");
  else hist->Draw("hist");

  TPaveText *blank_box = new TPaveText(1.001-gPad->GetRightMargin(),gPad->GetBottomMargin(),1.0,gPad->GetBottomMargin()+0.05,"BRNDC");
  blank_box->SetBorderSize(0);blank_box->SetFillColor(kWhite);blank_box->SetTextAlign(12);blank_box->SetFillStyle(1001);
  blank_box->AddText(" ");
  blank_box->Draw();
  hist->Draw("axis same");

  if(static_cast<TString>(hist->GetName()).Contains("_IP")){
    TLegend *leg;
    leg = new TLegend(0.5,0.12+gPad->GetBottomMargin(),0.97-gPad->GetRightMargin(),0.17+gPad->GetBottomMargin());
    leg->SetBorderSize(0);leg->SetFillColor(kWhite);leg->SetFillStyle(1001);leg->SetTextAlign(12);leg->SetTextSize(0.05);leg->SetTextFont(42);
    temp = "#Xi_{c}^{+}+n negative Tracks";
    if(myconfig->get_particle().Contains("Xic0"))temp = "#Xi_{c}^{0} + n positive Tracks";
    if(myconfig->get_particle().Contains("Omega"))temp = "#Omega_{c}^{0} + n positive Tracks^{+}";
    leg->AddEntry(hist,temp,"lp");
    leg->Draw();
  }

  temp = myconfig->get_dumpdir()+"/Plots/";
  if(!gSystem->OpenDirectory(temp))gSystem->mkdir(temp);

  temp += static_cast<TString>(hist->GetName()) + "_" + myconfig->get_current_cs() + ".pdf";
  if(!myconfig->is_debug()) c1->SaveAs(temp);
  delete c1;
  return;
}
开发者ID:marianstahl,项目名称:SL_b2Xch,代码行数:49,代码来源:SimpleCuts.cpp

示例5: TLegend

TLegend *GetLegendBaselines(TGraphAsymmErrors *gpp,Int_t identifier){
  TLegend * legend = new TLegend(0.27,0.39,0.55,0.47);//pad 0
  //  TLegend * legend = new TLegend(0.40,0.45,0.85,0.55);//pad 1
  // TLegend * legend = new TLegend(0.40,0.6,0.85,0.67);
  // TLegend * legend = new TLegend(0.40,0.64,0.85,0.72);
  //  TLegend * legend = new TLegend(0.011/gPad->GetWNDC()+gPad->GetLeftMargin(),0.22/gPad->GetHNDC()+gPad->GetBottomMargin(),0.27/gPad->GetWNDC()+gPad->GetLeftMargin(),0.28/gPad->GetHNDC()+gPad->GetBottomMargin());
  legend->SetFillColor(0);
  legend->SetFillStyle(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(43);
  legend->SetTextAlign(12);
  // legend->SetTextSize(0.055/(gPad->GetHNDC())*scaleHeightPads);
  legend->SetTextSize(22*innerPadHeight/referencePadHeight*resizeTextFactor);// settings for font 42: 0.07/(gPad->GetHNDC())*scaleHeight
 
  legend->AddEntry(gpp,"baseline-subtraction uncertainty","f");
  legend->SetName(Form("LegendBaselineUncPPandpPb_%d",identifier));
  return legend;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:18,代码来源:DoComparison_ppVsMCallPanelsNew.C

示例6: Legend

void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4)
{

TLegend *leg = new TLegend(0.45,0.88,1.,1.0); 
leg->SetTextAlign(32);
leg->SetTextColor(1);
leg->SetTextSize(0.020);

char  label[128];
sprintf(label,"perfect alignment;      mean = %1.3f, RMS = %1.3f",convert(histo1->GetMean()),convert(histo1->GetRMS()));
leg->AddEntry(histoname1, label, "l");
sprintf(label,"SurveyLASCosmics alignment; mean = %1.3f, RMS = %1.3f",convert(histo2->GetMean()),convert(histo2->GetRMS()));
leg->AddEntry(histoname2, label, "l");
sprintf(label,"10 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo3->GetMean()),convert(histo3->GetRMS()));
leg->AddEntry(histoname3, label, "l");
sprintf(label,"100 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo4->GetMean()),convert(histo4->GetRMS()));
leg->AddEntry(histoname4, label, "l");
leg->Draw();

}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:20,代码来源:pullz0.C

示例7: DrawLegend

//------------------------------------------------------------------------------
// DrawLegend
//------------------------------------------------------------------------------
void DrawLegend(Float_t x1,
		Float_t y1,
		TH1F*   hist,
		TString label,
		TString option)
{
  TLegend* legend = new TLegend(x1,
				y1,
				x1 + 0.22,
				y1 + 0.05);

  legend->SetBorderSize(    0);
  legend->SetFillColor (    0);
  legend->SetTextAlign (   12);
  legend->SetTextFont  (   42);
  legend->SetTextSize  (0.045);

  legend->AddEntry (hist, label.Data(), option.Data());
  //  legend->AddEntry (hist, label.Data());
  legend->Draw();
}
开发者ID:ltikvica,项目名称:WZanalysis,代码行数:24,代码来源:drawFigure4a.C

示例8: plot

void plot(){

TFile* f1 = TFile::Open("prunedmass_cv.root");
TFile* f2 = TFile::Open("prunedmass_up.root");
TFile* f3 = TFile::Open("prunedmass_down.root");

TH1F* cv = (TH1F*)f1->Get("AK8jetPrunedMass");
TH1F* up = (TH1F*)f2->Get("AK8jetPrunedMass");
TH1F* down = (TH1F*)f3->Get("AK8jetPrunedMass");

TLegend* l = new TLegend(0.6645729,0.701049,0.8743719,0.8706294,"","NDC");
l->SetLineWidth(2);
l->SetBorderSize(0);
l->SetFillColor(0);
l->SetFillStyle(0);
l->SetTextFont(42);
l->SetTextSize(0.035);
l->SetTextAlign(12);

cv->SetLineColor(kRed);
cv->SetLineWidth(2);
up->SetLineColor(kBlack);
up->SetFillColor(kBlack);
up->SetFillStyle(3018);
down->SetLineColor(kBlue);
down->SetFillColor(kBlue);

l->AddEntry(cv,"central value","L");
l->AddEntry(up,"scale up","F");
l->AddEntry(down,"scale down","F");

down->Draw("HIST");
cv->Draw("HISTsame");
up->Draw("HISTsame");
l->Draw();

}
开发者ID:jngadiub,项目名称:ExoDiBosonAnalysis,代码行数:37,代码来源:plot.C

示例9: DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_gammaD_Sorted_cT_XY_lab


//.........这里部分代码省略.........
   
   TH1F *h_gammaD_2_cT_XY_lab67 = new TH1F("h_gammaD_2_cT_XY_lab67","h_gammaD_2_cT_XY_lab",5,0,50);
   h_gammaD_2_cT_XY_lab67->SetBinContent(1,0.05508168);
   h_gammaD_2_cT_XY_lab67->SetBinContent(2,0.02481173);
   h_gammaD_2_cT_XY_lab67->SetBinContent(3,0.01176736);
   h_gammaD_2_cT_XY_lab67->SetBinContent(4,0.00563072);
   h_gammaD_2_cT_XY_lab67->SetBinContent(5,0.002708513);
   h_gammaD_2_cT_XY_lab67->SetBinContent(6,0.002983999);
   h_gammaD_2_cT_XY_lab67->SetEntries(79999);

   ci = TColor::GetColor("#ff0000");
   h_gammaD_2_cT_XY_lab67->SetLineColor(ci);
   h_gammaD_2_cT_XY_lab67->SetLineWidth(2);
   h_gammaD_2_cT_XY_lab67->SetMarkerStyle(20);
   h_gammaD_2_cT_XY_lab67->GetXaxis()->SetLabelFont(42);
   h_gammaD_2_cT_XY_lab67->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_2_cT_XY_lab67->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_2_cT_XY_lab67->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_2_cT_XY_lab67->GetXaxis()->SetTitleFont(42);
   h_gammaD_2_cT_XY_lab67->GetYaxis()->SetLabelFont(42);
   h_gammaD_2_cT_XY_lab67->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_2_cT_XY_lab67->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_2_cT_XY_lab67->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_2_cT_XY_lab67->GetYaxis()->SetTitleFont(42);
   h_gammaD_2_cT_XY_lab67->GetZaxis()->SetLabelFont(42);
   h_gammaD_2_cT_XY_lab67->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_2_cT_XY_lab67->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_2_cT_XY_lab67->GetZaxis()->SetTitleFont(42);
   h_gammaD_2_cT_XY_lab67->Draw("same");
   
   TLegend *leg = new TLegend(0.46,0.6744444,0.6955556,0.7644444,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_gammaD_1_cT_XY_lab","1st dark photon (leading p_{T})","L");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_gammaD_2_cT_XY_lab","2nd dark photon","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 10 mm}}","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextAlign(22);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","CMS Simulation (LHE) 14 TeV","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   cnv->Modified();
   cnv->cd();
   cnv->SetSelected(cnv);
}
开发者ID:tahuang1991,项目名称:MuJetAnalysis,代码行数:101,代码来源:DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_gammaD_Sorted_cT_XY_lab.C

示例10: DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_gammaD_Sorted_cT_Z_lab


//.........这里部分代码省略.........
   
   TH1F *h_gammaD_2_cT_Z_lab70 = new TH1F("h_gammaD_2_cT_Z_lab70","h_gammaD_2_cT_Z_lab",5,0,50);
   h_gammaD_2_cT_Z_lab70->SetBinContent(1,0.04590486);
   h_gammaD_2_cT_Z_lab70->SetBinContent(2,0.02475454);
   h_gammaD_2_cT_Z_lab70->SetBinContent(3,0.01457528);
   h_gammaD_2_cT_Z_lab70->SetBinContent(4,0.008818965);
   h_gammaD_2_cT_Z_lab70->SetBinContent(5,0.005946348);
   h_gammaD_2_cT_Z_lab70->SetBinContent(6,0.02668493);
   h_gammaD_2_cT_Z_lab70->SetEntries(79999);

   ci = TColor::GetColor("#ff0000");
   h_gammaD_2_cT_Z_lab70->SetLineColor(ci);
   h_gammaD_2_cT_Z_lab70->SetLineWidth(2);
   h_gammaD_2_cT_Z_lab70->SetMarkerStyle(20);
   h_gammaD_2_cT_Z_lab70->GetXaxis()->SetLabelFont(42);
   h_gammaD_2_cT_Z_lab70->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_2_cT_Z_lab70->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_2_cT_Z_lab70->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_2_cT_Z_lab70->GetXaxis()->SetTitleFont(42);
   h_gammaD_2_cT_Z_lab70->GetYaxis()->SetLabelFont(42);
   h_gammaD_2_cT_Z_lab70->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_2_cT_Z_lab70->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_2_cT_Z_lab70->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_2_cT_Z_lab70->GetYaxis()->SetTitleFont(42);
   h_gammaD_2_cT_Z_lab70->GetZaxis()->SetLabelFont(42);
   h_gammaD_2_cT_Z_lab70->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_2_cT_Z_lab70->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_2_cT_Z_lab70->GetZaxis()->SetTitleFont(42);
   h_gammaD_2_cT_Z_lab70->Draw("same");
   
   TLegend *leg = new TLegend(0.46,0.6744444,0.6955556,0.7644444,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_gammaD_1_cT_Z_lab","1st dark photon (leading p_{T})","L");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_gammaD_2_cT_Z_lab","2nd dark photon","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 10 mm}}","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextAlign(22);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","CMS Simulation (LHE) 14 TeV","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   cnv->Modified();
   cnv->cd();
   cnv->SetSelected(cnv);
}
开发者ID:tahuang1991,项目名称:MuJetAnalysis,代码行数:101,代码来源:DarkSusy_mH_125_mGammaD_2000_cT_10_LHE_gammaD_Sorted_cT_Z_lab.C

示例11: DarkSusy_mH_125_mGammaD_2000_cT_0_LHE_gammaD_M

void DarkSusy_mH_125_mGammaD_2000_cT_0_LHE_gammaD_M()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:19:47 2015) by ROOT version6.02/05
    TCanvas *cnv = new TCanvas("cnv", "cnv",1,1,904,904);
    gStyle->SetOptFit(1);
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);
    cnv->SetHighLightColor(2);
    cnv->Range(-1.526695,-0.2275,1.571513,1.5225);
    cnv->SetFillColor(0);
    cnv->SetBorderMode(0);
    cnv->SetBorderSize(2);
    cnv->SetLogx();
    cnv->SetTickx(1);
    cnv->SetTicky(1);
    cnv->SetLeftMargin(0.17);
    cnv->SetRightMargin(0.03);
    cnv->SetTopMargin(0.07);
    cnv->SetBottomMargin(0.13);
    cnv->SetFrameFillStyle(0);
    cnv->SetFrameBorderMode(0);
    cnv->SetFrameFillStyle(0);
    cnv->SetFrameBorderMode(0);

    TH1F *h_gammaD_1_M_dummy86 = new TH1F("h_gammaD_1_M_dummy86","h_gammaD_1_M_dummy",303,0.1,30.1);
    h_gammaD_1_M_dummy86->SetMaximum(1.4);
    h_gammaD_1_M_dummy86->SetLineStyle(0);
    h_gammaD_1_M_dummy86->SetMarkerStyle(20);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitle("Mass of #gamma_{D} [GeV]");
    h_gammaD_1_M_dummy86->GetXaxis()->SetLabelFont(42);
    h_gammaD_1_M_dummy86->GetXaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitleSize(0.06);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitleOffset(0.95);
    h_gammaD_1_M_dummy86->GetXaxis()->SetTitleFont(42);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitle("Fraction of events / 0.1 GeV");
    h_gammaD_1_M_dummy86->GetYaxis()->SetLabelFont(42);
    h_gammaD_1_M_dummy86->GetYaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitleSize(0.06);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitleOffset(1.35);
    h_gammaD_1_M_dummy86->GetYaxis()->SetTitleFont(42);
    h_gammaD_1_M_dummy86->GetZaxis()->SetLabelFont(42);
    h_gammaD_1_M_dummy86->GetZaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M_dummy86->GetZaxis()->SetTitleSize(0.06);
    h_gammaD_1_M_dummy86->GetZaxis()->SetTitleFont(42);
    h_gammaD_1_M_dummy86->Draw("");

    TH1F *h_gammaD_1_M87 = new TH1F("h_gammaD_1_M87","h_gammaD_1_M",303,0.1,30.1);
    h_gammaD_1_M87->SetBinContent(201,1);
    h_gammaD_1_M87->SetBinError(201,0.002500016);
    h_gammaD_1_M87->SetEntries(159998);
    h_gammaD_1_M87->SetDirectory(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#0000ff");
    h_gammaD_1_M87->SetLineColor(ci);
    h_gammaD_1_M87->SetLineWidth(2);
    h_gammaD_1_M87->SetMarkerStyle(20);
    h_gammaD_1_M87->GetXaxis()->SetLabelFont(42);
    h_gammaD_1_M87->GetXaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M87->GetXaxis()->SetTitleSize(0.06);
    h_gammaD_1_M87->GetXaxis()->SetTitleOffset(0.95);
    h_gammaD_1_M87->GetXaxis()->SetTitleFont(42);
    h_gammaD_1_M87->GetYaxis()->SetLabelFont(42);
    h_gammaD_1_M87->GetYaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M87->GetYaxis()->SetTitleSize(0.06);
    h_gammaD_1_M87->GetYaxis()->SetTitleOffset(1.3);
    h_gammaD_1_M87->GetYaxis()->SetTitleFont(42);
    h_gammaD_1_M87->GetZaxis()->SetLabelFont(42);
    h_gammaD_1_M87->GetZaxis()->SetLabelOffset(0.007);
    h_gammaD_1_M87->GetZaxis()->SetTitleSize(0.06);
    h_gammaD_1_M87->GetZaxis()->SetTitleFont(42);
    h_gammaD_1_M87->Draw("SAMEHIST");

    TLegend *leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextSize(0.02777778);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    TLegendEntry *entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 0 mm}}","h");
    entry->SetLineColor(1);
    entry->SetLineStyle(1);
    entry->SetLineWidth(1);
    entry->SetMarkerColor(1);
    entry->SetMarkerStyle(21);
    entry->SetMarkerSize(1);
    entry->SetTextFont(42);
    leg->Draw();

    leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextAlign(22);
    leg->SetTextSize(0.045);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
//.........这里部分代码省略.........
开发者ID:tahuang1991,项目名称:MuJetAnalysis,代码行数:101,代码来源:DarkSusy_mH_125_mGammaD_2000_cT_0_LHE_gammaD_M.C

示例12: DarkSusy_mH_125_mGammaD_2000_cT_1000_LHE_dimuon_m1_vs_m2

void DarkSusy_mH_125_mGammaD_2000_cT_1000_LHE_dimuon_m1_vs_m2()
{
//=========Macro generated from canvas: cnv/cnv
//=========  (Sun May 24 15:19:04 2015) by ROOT version6.02/05
   TCanvas *cnv = new TCanvas("cnv", "cnv",1,1,904,904);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   cnv->SetHighLightColor(2);
   cnv->Range(-10.36674,-7.877387,51.86701,54.35636);
   cnv->SetFillColor(0);
   cnv->SetBorderMode(0);
   cnv->SetBorderSize(2);
   cnv->SetTickx(1);
   cnv->SetTicky(1);
   cnv->SetLeftMargin(0.17);
   cnv->SetRightMargin(0.03);
   cnv->SetTopMargin(0.07);
   cnv->SetBottomMargin(0.13);
   cnv->SetFrameFillStyle(0);
   cnv->SetFrameBorderMode(0);
   cnv->SetFrameFillStyle(0);
   cnv->SetFrameBorderMode(0);
   
   TH2F *h_m1_vs_m2113 = new TH2F("h_m1_vs_m2113","h_m1_vs_m2",500,0.213,50,100,0.213,50);
   h_m1_vs_m2113->SetBinContent(20279,79998);
   h_m1_vs_m2113->SetBinContent(20280,1);
   h_m1_vs_m2113->SetEntries(79999);
   h_m1_vs_m2113->SetLineStyle(0);
   h_m1_vs_m2113->SetMarkerStyle(20);
   h_m1_vs_m2113->GetXaxis()->SetTitle("m_{2#mu#mu} [GeV]");
   h_m1_vs_m2113->GetXaxis()->SetLabelFont(42);
   h_m1_vs_m2113->GetXaxis()->SetLabelOffset(0.007);
   h_m1_vs_m2113->GetXaxis()->SetTitleSize(0.06);
   h_m1_vs_m2113->GetXaxis()->SetTitleOffset(0.95);
   h_m1_vs_m2113->GetXaxis()->SetTitleFont(42);
   h_m1_vs_m2113->GetYaxis()->SetTitle("m_{1#mu#mu} [GeV]");
   h_m1_vs_m2113->GetYaxis()->SetLabelFont(42);
   h_m1_vs_m2113->GetYaxis()->SetLabelOffset(0.007);
   h_m1_vs_m2113->GetYaxis()->SetTitleSize(0.06);
   h_m1_vs_m2113->GetYaxis()->SetTitleOffset(1.3);
   h_m1_vs_m2113->GetYaxis()->SetTitleFont(42);
   h_m1_vs_m2113->GetZaxis()->SetLabelFont(42);
   h_m1_vs_m2113->GetZaxis()->SetLabelOffset(0.007);
   h_m1_vs_m2113->GetZaxis()->SetTitleSize(0.06);
   h_m1_vs_m2113->GetZaxis()->SetTitleFont(42);
   h_m1_vs_m2113->Draw("");
   
   TLegend *leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 1000 mm}}","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextAlign(22);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","CMS Simulation (LHE) 14 TeV","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   cnv->Modified();
   cnv->cd();
   cnv->SetSelected(cnv);
}
开发者ID:tahuang1991,项目名称:MuJetAnalysis,代码行数:88,代码来源:DarkSusy_mH_125_mGammaD_2000_cT_1000_LHE_dimuon_m1_vs_m2.C

示例13: drawOneComparison

void drawOneComparison(vector<TH1F*> histos, vector<TString> descr, TString xaxislabel, const char *filename, TPaveText *t=0) {
  
  if(histos.size()!=descr.size()) {
    cout << "description not complete!" << endl;
    return;
  }

  vector<int> colors;
  colors.push_back(kRed+1);
  colors.push_back(kAzure-6);
  colors.push_back(kTeal+3);
  colors.push_back(kBlue+3);

  gStyle->SetOptStat(0);
  gStyle->SetOptFit(0);

  TCanvas *c1 = new TCanvas("c1", "c1", 600, 600);
  c1->SetGridx();
  c1->SetGridy();  
  TLegend* legend = new TLegend(0.20, 0.20, 0.43, 0.36);
  legend->SetBorderSize(   0);
  legend->SetFillColor (   0);
  legend->SetTextAlign (  12);
  legend->SetTextFont  (  42);
  legend->SetTextSize  (0.05);

  for(int i=0;i<(int)histos.size();++i) {
    
    histos[i]->SetMinimum(0.5);
    histos[i]->SetMaximum(1.1);
    histos[i]->SetMarkerSize(2);
    histos[i]->SetMarkerStyle(20);
    histos[i]->SetMarkerColor(colors[i]);
    histos[i]->SetLineColor(colors[i]);
    histos[i]->SetTitle("");
    if(TString(histos[i]->GetName()).Contains("PU")) {
      histos[i]->SetMaximum(1.1);
      histos[i]->Fit("pol1","","same",1,35);
      histos[i]->GetFunction("pol1")->SetLineColor(colors[i]);
    }
    histos[i]->GetXaxis()->SetTitle(xaxislabel);
    histos[i]->GetYaxis()->SetTitle("efficiency");
    histos[i]->GetYaxis()->SetTitleOffset(1.5);

    legend->AddEntry(histos[i],descr[i]);

    if(i==0) { 
      histos[i]->Draw("pe1");
      for(int bin=1;bin<=histos[i]->GetNbinsX();bin++) {
	//cout << "bin i = " << bin << ": " <<  histos[i]->GetBinContent(bin) << " +/- " << histos[i]->GetBinError(bin) << endl;
	//	cout << "m35_fakeRate[" << bin << "] = " << histos[i]->GetBinContent(bin) << ";" << endl;
      }
      for(int bin=1;bin<=histos[i]->GetNbinsX();bin++) {
	//	cout << "m35_fakeRate_err[" << bin << "] = " << histos[i]->GetBinError(bin) << ";" << endl;
      }
    }
    else histos[i]->Draw("same pe1");
  }
  legend->Draw();
  if(t) t->Draw();

  TString basename(filename);
  c1->SaveAs(basename+TString(".png"));
  c1->SaveAs(basename+TString(".pdf"));

}
开发者ID:emanueledimarco,项目名称:EGamma-DataTree,代码行数:66,代码来源:drawEff.C

示例14: PlotRakeBunch


//.........这里部分代码省略.........
  // textCharge->Draw();
  textMom->Draw();
   
  gPad->RedrawAxis(); 

  // Bottom plot -----------------------------------------

  C->cd();

  pad[0]->Draw();
  pad[0]->cd();

  hFrame[0]->GetYaxis()->SetRangeUser(0.0,1.1*yMax);
  hFrame[0]->Draw();
    

  hX1->SetLineWidth(2);
  hX1->SetFillStyle(1001);
  hX1->SetFillColor(PlasmaGlob::elecFill);
  // hX1->SetLineColor(kBlue);
  hX1->Draw("FL same");
  //hX1->Draw("C");

  TLine lZmean2(xmean,0.0,xmean,1.1*yMax);
  lZmean2.SetLineColor(kGray+2);
  lZmean2.SetLineStyle(2);
  lZmean2.Draw();

  Int_t markerSize = 1.2; 
  Int_t lineWidth  = 2.0;   

  gYrms->SetMarkerStyle(20);
  gYrms->SetLineStyle(1);
  gYrms->SetMarkerColor(kGray+1);
  gYrms->SetMarkerSize(markerSize); 
  gYrms->SetLineColor(kGray+1);
  gYrms->SetLineWidth(lineWidth);
  gYrms->Draw("PL");
  
  // hP2X2sl[0]->Draw("colz");
  gemit->SetMarkerStyle(20);
  //  gemit->SetMarkerColor(kMagenta-2);
  gemit->SetMarkerColor(kGray+2);
  gemit->SetMarkerSize(markerSize);
  gemit->SetLineWidth(lineWidth);
  gemit->SetLineColor(kGray+2);
  gemit->Draw("PL");

  gErms->SetMarkerStyle(20);
  gErms->SetMarkerSize(markerSize);
  gErms->SetMarkerColor(kOrange+10);
  gErms->SetLineColor(kOrange+10);
  gErms->SetLineWidth(lineWidth);
  gErms->Draw("PL");


  TLegend *Leg;
  if(!sim.Contains("DR")) 
    Leg=new TLegend(0.55,0.60,1 - gPad->GetRightMargin() - 0.02,0.95);
  else
    Leg=new TLegend(gPad->GetLeftMargin() + 0.02, 1.0-gPad->GetTopMargin()-0.20,
		    gPad->GetLeftMargin() + 0.30, 1.0-gPad->GetTopMargin()-0.02);
  
  
  PlasmaGlob::SetPaveStyle(Leg);
  Leg->SetTextAlign(12);
  Leg->SetTextColor(kGray+3);
  Leg->SetTextFont(42);
  Leg->SetLineColor(1);
  Leg->SetBorderSize(0);
  Leg->SetFillColor(0);
  Leg->SetFillStyle(1001);
  Leg->SetFillStyle(0); // Hollow
 
  Leg->AddEntry(hX1  ,"Current [kA]","L");
  //  Leg->AddEntry(gErms,"Energy spread (GeV)","PL");
  Leg->AddEntry(gErms,"Energy spread [%]","PL");
  Leg->AddEntry(gemit,"Emittance [#mum]","PL");
  Leg->AddEntry(gYrms,"Bunch width [#mum]","PL");
 
  Leg->Draw();

  gPad->RedrawAxis(); 

  gPad->Update();
  

  // Print to file --------------------------------------
  
  C->cd();
  
  // Print to a file
  // Output file
  TString fOutName = Form("./%s/Plots/RakeBunch/RakeBunch",sim.Data());
  fOutName += Form("-%s_%i",sim.Data(),time);

  PlasmaGlob::imgconv(C,fOutName,opt);
  // ---------------------------------------------------------
  
}
开发者ID:delaossa,项目名称:ptools,代码行数:101,代码来源:PlotRakeBunch.130712.C

示例15: DarkSusy_mH_125_mGammaD_2000_cT_100_LHE_gammaD_Phi


//.........这里部分代码省略.........
   h_gammaD_2_Phi82->SetBinError(66,0.0004574101);
   h_gammaD_2_Phi82->SetBinError(67,0.0004486146);
   h_gammaD_2_Phi82->SetBinError(68,0.000442124);
   h_gammaD_2_Phi82->SetBinError(69,0.0004414166);
   h_gammaD_2_Phi82->SetBinError(70,0.0004380409);
   h_gammaD_2_Phi82->SetBinError(71,0.0004713736);
   h_gammaD_2_Phi82->SetBinError(72,0.000295279);
   h_gammaD_2_Phi82->SetEntries(79999);
   h_gammaD_2_Phi82->SetDirectory(0);

   ci = TColor::GetColor("#ff0000");
   h_gammaD_2_Phi82->SetLineColor(ci);
   h_gammaD_2_Phi82->SetLineWidth(2);
   h_gammaD_2_Phi82->SetMarkerStyle(20);
   h_gammaD_2_Phi82->GetXaxis()->SetLabelFont(42);
   h_gammaD_2_Phi82->GetXaxis()->SetLabelOffset(0.007);
   h_gammaD_2_Phi82->GetXaxis()->SetTitleSize(0.06);
   h_gammaD_2_Phi82->GetXaxis()->SetTitleOffset(0.95);
   h_gammaD_2_Phi82->GetXaxis()->SetTitleFont(42);
   h_gammaD_2_Phi82->GetYaxis()->SetLabelFont(42);
   h_gammaD_2_Phi82->GetYaxis()->SetLabelOffset(0.007);
   h_gammaD_2_Phi82->GetYaxis()->SetTitleSize(0.06);
   h_gammaD_2_Phi82->GetYaxis()->SetTitleOffset(1.3);
   h_gammaD_2_Phi82->GetYaxis()->SetTitleFont(42);
   h_gammaD_2_Phi82->GetZaxis()->SetLabelFont(42);
   h_gammaD_2_Phi82->GetZaxis()->SetLabelOffset(0.007);
   h_gammaD_2_Phi82->GetZaxis()->SetTitleSize(0.06);
   h_gammaD_2_Phi82->GetZaxis()->SetTitleFont(42);
   h_gammaD_2_Phi82->Draw("SAMEHIST");
   
   TLegend *leg = new TLegend(0.46,0.6744444,0.6955556,0.7644444,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_gammaD_1_Phi","1st dark photon (leading p_{T})","L");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_gammaD_2_Phi","2nd dark photon","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.02777778);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","#splitline{pp #rightarrow h #rightarrow 2n_{1} #rightarrow 2n_{D} + 2 #gamma_{D} #rightarrow 2n_{D} + 4#mu}{#splitline{m_{h} = 125 GeV, m_{n_{1}} = 50 GeV, m_{n_{D}} = 1 GeV}{m_{#gamma_{D}} = 20 GeV, c#tau_{#gamma_{D}} = 100 mm}}","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.17,0.935,0.97,1,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextAlign(22);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("NULL","CMS Simulation (LHE) 14 TeV","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   cnv->Modified();
   cnv->cd();
   cnv->SetSelected(cnv);
}
开发者ID:tahuang1991,项目名称:MuJetAnalysis,代码行数:101,代码来源:DarkSusy_mH_125_mGammaD_2000_cT_100_LHE_gammaD_Phi.C


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