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


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

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


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

示例1: draw_variations_sta_pp

void draw_variations_sta_pp(int ieta, bool plotAll, bool statonly=false)
{
   // ieta = 0 (0-1.6), 1 (1.6-2.4)
   // plotAll: plot 100 variations for muid+trg if true, plot only +1/-1 sigma if false
   // statonly: false -> stat+syst variations, true -> stat only variations

   const char* statonly_str = statonly ? "_statonly" : "";

   double eta;
   double ptmin = 0;
   if (ieta==0) {ptmin = 2.1; eta=0.3;}
   else {ptmin = 1.5; eta=2.3;}
   TCanvas *c1 = new TCanvas();
   TH1F *haxes = new TH1F("haxes","haxes",10,0,20);
   haxes->GetYaxis()->SetRangeUser(0.8,1.5);
   haxes->GetXaxis()->SetTitle("p_{T}");
   haxes->GetYaxis()->SetTitle("Correction");
   haxes->Draw();

   TLegend *tleg = new TLegend(0.55,0.5,0.9,0.83);
   tleg->SetFillStyle(0);
   tleg->SetFillColor(0);
   tleg->SetBorderSize(0);
   tleg->SetTextSize(0.035);
   if (ieta==0) tleg->SetHeader("STA #eta^{#mu} #in [0.0, 0.9]");
   else if (ieta==1) tleg->SetHeader("STA #eta^{#mu} #in [0.9, 1.6]");
   else if (ieta==2) tleg->SetHeader("STA #eta^{#mu} #in [1.6, 2.1]");
   else tleg->SetHeader("STA #eta^{#mu} #in [2.1, 2.4]");

   int istart, istep;
   if (plotAll) {
      istart = 100; istep = -1;
   } else {
      istart = -2; istep = 1;
   }
   for (int i=istart; i*istep<=0; i += istep)
   {
      TF1 *func = new TF1(Form("var_%i",i),Form("tnp_weight%s_sta_pp(x,%f,%i)",statonly_str,eta,i),ptmin,20);
      if (i==0) func->SetLineColor(kRed);
      else func->SetLineColor(kBlack);
      func->Draw("same");

      if (i==0) {
         tleg->AddEntry(func,"nominal","l");
      } else if (abs(i)==1) {
         tleg->AddEntry(func,"variation","l");
      }
   }

   tleg->Draw();

   TLatex *lt1 = new TLatex(); lt1->SetNDC();
   lt1->SetTextSize(0.05);
   lt1->DrawLatex(0.55,0.86,"pp  #sqrt{s} = 2.76 TeV");
}
开发者ID:goni,项目名称:HIN-15-001,代码行数:55,代码来源:draw_variations.C

示例2: plotNDOM

//------------------------------------------//
// Plot nDOM with out any other reqs.
//------------------------------------------//
void plotNDOM(TTree* tree)
{

  // Plot the number of DOM's per event
  TString var = "DetectorResponseEvent_.totalNumberOfDom_";

  // Make canvas
  TCanvas* c  = makeCanvas("c");

  // Create histogram holders
  int nbins = 100;
  int min   = 0;
  int max   = 2000;
  TString xtitle = "nDOMs";
  TString ytitle = "Entries";
  TH1F* hist = makeFrame("hist",nbins,min,max,
			 xtitle,ytitle);

  // Make legend
  TLegend* leg = makeLegend(0.7,0.8,0.8,0.9);
  leg->SetHeader("Luminosity");

  // Draw
  tree->Draw((var+">>hist").Data(),"","hist");

  // Add to legend
  leg->AddEntry(hist, "All", "l");

  // Now draw the figures
  hist->Draw("hist");
  leg->Draw("same");

  c->SaveAs((savedir+"nDoms_total.png").Data());
}
开发者ID:mrelich,项目名称:SCAna,代码行数:37,代码来源:DefineFilter.C

示例3: checkNDOM

//------------------------------------------//
// Problem 2: There is a requirement that 
// at least 400 DOMs launch.  I want to look 
// at the average, and maybe also the average 
// for given event range.
//------------------------------------------//
void checkNDOM(TTree* tree)
{

  // Plot the number of DOM's per event
  TString var = "DetectorResponseEvent_.totalNumberOfDom_";

  // Make canvas
  TCanvas* c  = makeCanvas("c");

  // Make a vector of TCuts
  vector<TString> cuts;
  cuts.push_back("1");   // 1%
  cuts.push_back("3");   // 3%
  cuts.push_back("10");  // 10%
  cuts.push_back("30");  // 30%
  cuts.push_back("51");  // 51%
  cuts.push_back("100"); // 100%

  // Create histogram holders
  TH1F* hists[6];
  int nbins = 100;
  int min   = 0;
  int max   = 2000;
  TString xtitle = "nDOMs";
  TString ytitle = "Entries";
  
  // Make legend
  TLegend* leg = makeLegend(0.7,0.8,0.6,0.9);
  leg->SetHeader("Luminosity");

  // Loop and draw
  float maximum = -999;
  for(unsigned int i=0; i<cuts.size(); ++i){
    // get cut value
    TString cutval = cuts.at(i); 
    // create histogram
    hists[i] = makeFrame("hist_"+cutval,nbins,min,max,
			 xtitle,ytitle);

    // cut the TCut object from value
    TCut cut = lumiCut(cutval);

    // Draw and set att
    tree->Draw((var+">>hist_"+cutval).Data(),cut,"hist");
    setAtt(hists[i],xtitle,ytitle,m_colors[i],m_markers[i]);
    setMax(hists[i],maximum);

    // Add to legend
    leg->AddEntry(hists[i],(cutval+"%").Data(),"l");
  }

  // Now draw the figures
  hists[0]->SetMaximum(maximum*1.1);
  hists[0]->Draw("hist");
  for(unsigned int i=1; i<cuts.size(); ++i)
    hists[i]->Draw("samehist");
  leg->Draw("same");

  c->SaveAs((savedir+"nDoms_perLumi.png").Data());
}
开发者ID:mrelich,项目名称:SCAna,代码行数:66,代码来源:DefineFilter.C

示例4: makeNoEWSBLegend

TLegend* makeNoEWSBLegend(Double_t txtsz,Int_t tanBeta_){

  txtsz = txtsz;

  Double_t ypos_1 = 0.12;
  Double_t ypos_2 = 0.22;
  Double_t xpos_1 = 0.82;
  Double_t xpos_2 = 0.92;
  if(tanBeta_ == 40){
    xpos_1 = 0.10;
    xpos_2 = 0.20;
    ypos_1 = 0.85;
    ypos_2 = 0.95;

  }

  TLegend* legst = new TLegend(xpos_1,ypos_1,xpos_2,ypos_2);
  legst->SetHeader("No EWSB");
  legst->SetFillStyle(0);
  legst->SetBorderSize(0);
  legst->SetTextSize(0.03);
  legst->SetTextAngle(30);

  return legst;
}
开发者ID:hooberman,项目名称:UserCode,代码行数:25,代码来源:ExclusionPlot.C

示例5: plotSpectraMin

void plotSpectraMin() {

    vector<TH1F*> hists;

    for(int i = 0; i < fileNames.size(); i++) {
        hists.push_back(getHist(fileNames[i]));
    }

    TLegend * leg = new TLegend(0.60, 0.70, 0.88, 0.88);
    leg->SetHeader("LED Pulse Width");
    
    for(int i =0; i < hists.size(); i++) {
        hists[i]->SetLineColor(i+1);
        hists[i]->SetLineWidth(2);
        //hists[i]->Sumw2();
        hists[i]->Draw("SAME"); 
        leg->AddEntry(hists[i], (TString)leg_entries[i]);
        
    }

    hists[hists.size()-1]->SetLineColor(hists.size()+1);
    hists[hists.size()-1]->SetTitle("PMT Spectra with Varying LED Pulse Width");
    hists[hists.size()-1]->GetXaxis()->SetTitle("Integrated Charge / (pC)");
    hists[hists.size()-1]->GetYaxis()->SetTitle("Events");
    hists[hists.size()-1]->GetYaxis()->SetRangeUser(0.5, 20000);
    gStyle->SetOptStat(0);
    leg->Draw();

}
开发者ID:btcardwell,项目名称:milliqAnalysis,代码行数:29,代码来源:plotSpectraMin.cpp

示例6: npulsePlot

//------------------------------------------//
// Format amplitude plots
//------------------------------------------//
void npulsePlot(TFile* file, vector<TString> filters)
{

  // Specify the titles
  TString xtitle = "Number of Pulses";
  TString ytitle = "Entries";

  // Histogram name
  TString pname = "h_npulse";

  // Create canvas
  TCanvas* c = makeCanvas("c");
  
  // Make legend
  TLegend* leg = makeLegend(0.7,0.8,0.6,0.9);
  //TLegend* leg = makeLegend(0.7,0.8,0.8,0.9);

  // Loop and plot
  TH1* hist[6];
  float maximum = -999;
  for(unsigned int i=0; i<filters.size(); ++i){
    TString filter = filters.at(i);
    
    hist[i] = getHist(file,pname+"_"+filter,xtitle,ytitle,
		   m_colors[i], m_markers[i]);
    
    leg->AddEntry(hist[i],(filter+"%").Data(),"l");

    if( maximum < hist[i]->GetMaximum() )
      maximum = hist[i]->GetMaximum();

  }// end loop over filters
  /*
  for(unsigned int i=0; i<filters.size(); ++i){
    leg->Clear();
    leg->SetHeader("Filter");
    leg->AddEntry(hist[i],(filters.at(i)+"%").Data(),"l");
    hist[i]->Draw();
    leg->Draw("same");
    c->SaveAs((savedir+"npulse_filter"+filters.at(i)+".png").Data());
  }

  return;
  */

  // Set maximum correctly
  hist[0]->SetMaximum(1.1*maximum);
  hist[0]->Draw();
  for(unsigned int i=1; i<filters.size(); ++i){
    hist[i]->Draw("same");
  }

  // Draw legend
  leg->SetHeader("Filter");
  leg->Draw("same");
  
  c->SaveAs((savedir+"npulse_perLumi.png").Data());

}
开发者ID:mrelich,项目名称:SCAna,代码行数:62,代码来源:DefineFilter.C

示例7: TLegend

// construct the legend
TLegend *make_legend() { 
  leg_w = .2;
  leg_h = .15;
  leg_x = .67;
  leg_y = .71;
  TLegend *leg = new TLegend(leg_x, leg_y, leg_x+leg_w, leg_y+leg_h);
  leg->SetHeader("Legend"); 
  return leg;
}
开发者ID:jacobpierce1,项目名称:thermometer-analyzer,代码行数:10,代码来源:PlotData.cpp

示例8: plotRatioRaw

// ----------------------------------------------------------------------
void plotRatioRaw(string era = "2016BF") {
  gStyle->SetOptStat(0);

  if (era == "all") {
    plotRatioRaw("2011");
    plotRatioRaw("2012");
    plotRatioRaw("2016BF");
    plotRatioRaw("2016GH");
    return;
  }


  double eps(0.00001);
  TH1D *hresult = new TH1D("hresult", Form("%s", era.c_str()), 80, 0., 0.4);
  hresult->GetXaxis()->SetTitle("BDT > ");
  hresult->SetMarkerStyle(24); hresult->SetLineColor(kRed+2); hresult->SetMarkerColor(kRed+2);
  TH1D *hsresult = new TH1D("hsresult", Form("%s", era.c_str()), 80, 0.+eps, 0.4+eps);
  hsresult->SetMarkerStyle(25); hsresult->SetLineColor(kBlue);  hsresult->SetMarkerColor(kBlue);

  TH1D *hbdtcut = new TH1D("hbdtcut", Form("%s", era.c_str()), 80, 0., 0.4);
  hbdtcut->SetMarkerColor(kRed+2);  hbdtcut->SetMarkerStyle(20);
  TH1D *hsbdtcut = new TH1D("hsbdtcut", Form("%s", era.c_str()), 80, 0.+eps, 0.4+eps);
  hsbdtcut->SetMarkerColor(kBlue);  hsbdtcut->SetMarkerStyle(21);

  invertedMuonIDRaw(era, 0.15, hresult, hsresult);
  invertedMuonIDRaw(era, 0.20, hresult, hsresult);
  invertedMuonIDRaw(era, 0.25, hresult, hsresult);
  invertedMuonIDRaw(era, 0.30, hresult, hsresult);
  invertedMuonIDRaw(era, -99., hbdtcut, hsbdtcut);

  c0->Clear();
  double ymax(50.);
  double smax = hresult->GetMaximum();
  double dmax = hsresult->GetMaximum();
  double themax = (smax>dmax? smax: dmax);
  if (themax < 50.)  ymax = 50.;
  if (themax < 20.)  ymax = 30.;
  if (themax < 5.)  ymax = 10.;
  if (themax < 0.5) ymax = 1.0;
  hresult->SetMinimum(-ymax);
  hresult->SetMaximum(ymax);
  hresult->Draw();
  hsresult->Draw("same");
  hbdtcut->Draw("same");
  hsbdtcut->Draw("same");
  pl->DrawLine(0., 0., 0.4, 0.);

  TLegend *tle = new TLegend(0.25, 0.2, 0.50, 0.5);
  tle->SetFillStyle(0);
  tle->SetBorderSize(0);
  tle->SetHeader(era.c_str());
  tle->AddEntry(hresult, "yield at B0", "p");
  tle->AddEntry(hsresult, "yield at Bs", "p");
  tle->Draw();

  c0->SaveAs(Form("invertedMuonIDRaw-%s-result.pdf", era.c_str()));
}
开发者ID:Bmm4,项目名称:Bmm,代码行数:58,代码来源:invertedMuonID.C

示例9: draw_ratio

void draw_ratio(std::vector<TH1F*> h,
	  TString name, TString xTitle,
	  double xmin, double xmax,
	  TString legHeader = "", bool legRIGHT = true, bool legTOP = true,
	  bool logX = false, bool stat = false, int rebin = -1, int orbin = -1,
	  TString option = "", int nclus = 99) {  //double ymin_ratio, double ymax_ratio,
  TCanvas* can = new TCanvas(name+"_ratio",name+"_ratio",900,450);
  can->cd();

  double legxmin = (legRIGHT ? 0.55 : 0.18);
  double legxmax = legxmin+0.25;
  double legymin = (legTOP ? 0.70 : 0.15);
  double legymax = legymin+0.15;
  TLegend* leg = new TLegend(legxmin,legymin,legxmax,legymax);
  if (legHeader!="") leg->SetHeader(legHeader);
  leg->SetTextSize(0.04);
  leg->SetFillColor(0);
  leg->SetLineColor(0);

  TString options = (option=="" ? "pe" : option);

  if (rebin>0) h[h.size()-1]->Rebin(rebin); //to rebin benchmark before divide
  for (size_t i=0; i<h.size(); i++) {
    //if(h[i]->GetNbinsX() != orbin) cout << "WARNING: orbin for " << h[i]->GetName() << " are " << h[i]->GetNbinsX() << endl; //debug - shift of h[][] wrt clu[][]
    if (rebin>0 && i<(h.size()-1)) h[i]->Rebin(rebin);
    TH1F* ratio = (TH1F*)h[i]->Clone("ratio_"+name);
    ratio->Sumw2();
    ratio->Divide(h[h.size()-1]); //benchmark is at the end.

    if (logX) gPad->SetLogx();
    ratio->SetMarkerStyle(20+i);
    ratio->SetMarkerSize(1.0); //1.2
    ratio->GetXaxis()->SetRangeUser(xmin,xmax);
    ratio->SetMinimum(-0.1);
    ratio->SetMaximum(4);
    if (i==0){    //just for the first one
     ratio->GetXaxis()->SetLabelSize(0.05);
     ratio->GetXaxis()->SetTitle(xTitle);
     ratio->GetXaxis()->SetTitleOffset(1);
     ratio->GetXaxis()->SetTitleSize(0.06);
     ratio->GetYaxis()->SetTitle("ratio");
     ratio->GetYaxis()->SetTitleSize(0.06);
     ratio->GetYaxis()->SetTitleOffset(0.7);
     ratio->GetYaxis()->SetLabelSize(0.05);
    }
    string nam = "";
    nam = translate(clu[nclus][0].c_str());
    if(i==(h.size()-1)) leg->AddEntry(h[i],nam.c_str(),"l"); //to print only benchmark (first in the list)
    if (i==1) options = options + (stat ? "sames" : "same"); //once is enought
    ratio->Draw(options);
  }
  leg->Draw("same");
  drawPrivate(0.04);
  can->Update();
  can->SaveAs(Outfolder+name+"_ratio.png");
}
开发者ID:MDallOsso,项目名称:hh4bNores,代码行数:56,代码来源:plot_comp2S.C

示例10: plotMultiplicity

void plotMultiplicity(char target[6], char list[20], char ene[6], char part[4],
		      char dir[12]="histo", char g4ver[20]="G4.9.1.p01") {

  setStyle();
  gStyle->SetOptTitle(0);
  
  char name[1024], sym[10];
  if      (part=="pim") sprintf(sym, "#pi^{-}");
  else if (part=="pip") sprintf(sym, "#pi^{+}");
  else                  sprintf(sym, "p");

  std::vector<std::string> typeOld = typesOld();
  int energy = atoi(ene);
  
  char ofile[100];
  sprintf (ofile, "%s/histo_%s%s_%s_%sGeV.root", dir, target, list, part, ene);
  std::cout << "Input file " << ofile << "\n";
  TFile *fout = TFile::Open(ofile);
  fout->cd();

  char name[160], title[160], ctype[20], ytitle[20], cname[160];
  TH1I *hiMulti[20];
  for (unsigned int ii=0; ii<=(typeOld.size()); ii++) {
    if      (ii == 0) sprintf (ctype, "All Particles");
    else              sprintf (ctype, "%s", typeOld[ii-1].c_str());
    sprintf (name, "Multi%s%s%sGeV(%s)", target, list, ene, ctype);
    hiMulti[ii] = (TH1I*)fout->FindObjectAny(name);
    //    std::cout << ii << " (" << ctype << ") " << name << " " << hiMulti[ii] << "\n";
  }

  TCanvas *c[20];
  std::vector<std::string> types = types();
  for (unsigned int ii=0; ii<types.size(); ii++) {
    if      (ii == 0) sprintf (ctype, "All Particles");
    else              sprintf (ctype, "%s", types[ii-1].c_str());
    sprintf (cname, "Multiplicity (%s)", ctype);
    hiMulti[ii]->GetXaxis()->SetTitle(cname);
    hiMulti[ii]->SetMarkerStyle(mstyle[ii]);
    hiMulti[ii]->SetMarkerSize(msiz[ii]);
    hiMulti[ii]->SetMarkerColor(mcolor[ii]);
    hiMulti[ii]->SetLineColor(lcolor[ii]);
    hiMulti[ii]->SetLineStyle(lstyle[ii]);
    hiMulti[ii]->SetLineWidth(lwidth[ii]); 

    sprintf(cname, "c_%s%s_%s_%sGeV_Multiplicity(%s)", target, list, part, 
	    ene, ctype);
    c[ii] = new TCanvas(cname, cname, 800, 500);
    hiMulti[ii]->Draw();

    TLegend *leg = new TLegend(0.35, 0.80, 0.8, 0.87);
    char hdr[160];
    sprintf(hdr, "%s+%s at %s GeV (%s-%s)", sym, target, ene, g4ver, list);
    leg->SetHeader(hdr);  leg->SetFillColor(10); leg->SetMargin(0.45);
    leg->SetTextSize(.036); leg->Draw("same");
  }
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:56,代码来源:PlotMultiplicity.C

示例11: AnaEField

//------------------------------------//
// Main
//------------------------------------//
void AnaEField()
{

  // Make Canvas 
  TCanvas* can = makeCanvas("can");
  can->SetLogy();
  can->SetGridx();
  can->SetGridy();

  // Define the function here with parameters:
  // [0] = L
  // [1] = freq
  // [2] = k
  // [3] = n
  // [4] = sqrt(2pi) * mu * mu0
  TString func = "[4]*[0]*[1]*sin(x/57.2957)*exp(-pow([2]*[0],2)*pow(cos(x/57.2957)-1/[3],2)/2)";
  //TString func = "[4]*[1]*sin(x/57.2957)*exp(-pow([2]*[0],2)*pow(cos(x/57.2957)-1/[3],2)/2)";
  //TString func = "[4]*[0]*[1]*exp(-pow([2]*[0],2)*pow(cos(x/57.2957)-1/[3],2)/2)";

  // Now fix some of the variables:
  double freq = 1e9; //600e6; // Hz
  double c    = 3e8;   // m/s
  double n    = 1.3; //1.78;
  double k    = 2*TMath::Pi() * n * freq/c; // 1/m
  double Const= sqrt(2*TMath::Pi()) * 4 * TMath::Pi() * 1e-7 * 1;

  // Make a dummy histogram
  TH1F* h = makeHist("h",100,0,90,"Angle [deg]", "Field Strength",kBlack,0);
  h->Fill(1e10);
  h->SetMinimum(10);
  h->SetMaximum(3000);
  h->Draw();

  // Make two instances of the function
  TF1* f0 = new TF1("f0",func.Data(),0,90);
  setParam(f0,1.2,freq,k,n,Const,kBlack);

  TF1* f1 = new TF1("f1",func.Data(),0,90);
  setParam(f1,0.1,freq,k,n,Const,kBlue);
 
  // Draw
  f0->Draw("same");
  f1->Draw("same");
  
  // Add Legend
  TLegend* leg = makeLegend(0.15,0.3,0.7,0.9);
  leg->SetHeader("f = 600 MHz");
  leg->AddEntry(f0,"L = 1.2m","l");
  leg->AddEntry(f1,"L = 0.1m","l");
  leg->Draw("same");
  
  //can->SaveAs("../plots/quickAnalytic_600MHz.png");

}
开发者ID:mrelich,项目名称:Simulation,代码行数:57,代码来源:AnaEField.C

示例12: 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

示例13: TLegend

TLegend *createLegend(const string &text)
{
    TLegend *legend = new TLegend( .2, .7, .3, .8);
    if (!text.empty())
        legend->SetHeader(text.c_str());

    legend->SetMargin(0.12);
    legend->SetTextSize(0.06);
    legend->SetFillColor(10);
    legend->SetBorderSize(0);

    return legend;
}
开发者ID:PerilousApricot,项目名称:bsm_analyze,代码行数:13,代码来源:fig.C

示例14: DrawTProfile

void DrawTProfile(TFile** File, char** Histos_Name, std::vector<char*> legend, char* Title, char* Xlegend, char* Ylegend, double xmin, double xmax, double ymin, double ymax,  bool save, char* save_path)
{
   int Color[]    = {2,4,8,1,4,6,3,9,5};
   int Marker[]   = {21,22,23,20,20,3,2};
   int Style[]    = {1,5,7,9,10};

   int    N         = legend.size();
   TProfile** Histos    = new TProfile*[N];

   double HistoMax      = -1;
   int    HistoHeighest = -1;

   for(int i=0;i<N;i++){
        Histos[i] = File[i]->Get(Histos_Name[i]);
        Histos[i]->SetTitle();
        Histos[i]->SetStats(kFALSE);
        Histos[i]->GetXaxis()->SetTitle(Xlegend);
        Histos[i]->GetYaxis()->SetTitle(Ylegend);
        Histos[i]->GetYaxis()->SetTitleOffset(1.20);
        if(xmin!=xmax)Histos[i]->SetAxisRange(xmin,xmax,"X");
        if(ymin!=ymax)Histos[i]->SetAxisRange(ymin,ymax,"Y");
        Histos[i]->SetMarkerStyle(Marker[i]);
        Histos[i]->SetMarkerColor(Color[i]);
        Histos[i]->SetMarkerSize(1.5);
   }

   TLegend* leg;
//   leg = new TLegend(0.10,0.90,0.50,0.90-N*0.1);
   leg = new TLegend(0.90,0.90,0.55,0.90-N*0.1);
   leg->SetFillColor(0);
   if(strcmp(Title,"")!=0)leg->SetHeader(Title);

   Histos[0]->Draw("");
   for(int i=0;i<N;i++){
        Histos[i]->Draw("Same");
   }

   for(int i=0;i<N;i++){
      leg->AddEntry(Histos[i], legend[i] ,"P");
   }
   leg->Draw();


   if(save==1){
//        char path[255]; sprintf(path,"Pictures/PNG/%s.png",save_path);  c1->SaveAs(path);
//        char path[255]; sprintf(path,"Pictures/EPS/%s.eps",save_path);  c1->SaveAs(path);
//        char path[255]; sprintf(path,"Pictures/C/%s.C"  ,save_path);  c1->SaveAs(path);
           c1->SaveAs(save_path);

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

示例15: TLegend

TLegend *getLegend(double x1, double y1, double x2, double y2)
{
  TLegend *leg = new TLegend(x1,y1,x2,y2,NULL,"BRNDC");
  leg->SetHeader("");
  leg->SetBorderSize(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.06);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(10);
  leg->SetFillStyle(1001);
  return leg;
}
开发者ID:ilaflott,项目名称:RAA_5p02_code,代码行数:14,代码来源:JRsp.C


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