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


C++ TAxis::SetNdivisions方法代码示例

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


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

示例1: SetAxis

//------------------------------------------------------------------------------
// SetAxis
//------------------------------------------------------------------------------
void SetAxis(TH1*    hist,
	     TString xtitle,
	     TString ytitle,
	     Float_t size,
	     Float_t offset)
{
  TAxis* xaxis = (TAxis*)hist->GetXaxis();
  TAxis* yaxis = (TAxis*)hist->GetYaxis();

  xaxis->SetLabelFont(42);
  yaxis->SetLabelFont(42);
  xaxis->SetTitleFont(42);
  yaxis->SetTitleFont(42);

  xaxis->SetLabelOffset(0.025);
  yaxis->SetLabelOffset(0.025);
  xaxis->SetTitleOffset(1.4);
  yaxis->SetTitleOffset(offset);

  xaxis->SetLabelSize(size);
  yaxis->SetLabelSize(size);
  xaxis->SetTitleSize(size);
  yaxis->SetTitleSize(size);

  xaxis->SetTitle(xtitle);
  yaxis->SetTitle(ytitle);

  xaxis->SetNdivisions(505);
  yaxis->SetNdivisions(505);

  yaxis->CenterTitle();

  gPad->GetFrame()->DrawClone();
  gPad->RedrawAxis();
}
开发者ID:d4space,项目名称:HWWSE,代码行数:38,代码来源:drawDistributions.C

示例2: showGraph

void showGraph(double canvasSizeX, double canvasSizeY,
	       TGraph* graph, 
	       bool useLogScaleX, double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
	       bool useLogScaleY, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
	       const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2); 
  canvas->SetTopMargin(0.05);
  canvas->SetLeftMargin(0.19);
  canvas->SetBottomMargin(0.19);
  canvas->SetRightMargin(0.05);
  canvas->SetLogx(useLogScaleX);
  canvas->SetLogy(useLogScaleY);

  TH1* dummyHistogram = new TH1D("dummyHistogram", "dummyHistogram", 10, xMin, xMax);
  dummyHistogram->SetTitle("");
  dummyHistogram->SetStats(false);
  dummyHistogram->SetMinimum(yMin);
  dummyHistogram->SetMaximum(yMax);
  dummyHistogram->Draw("axis");

  TAxis* xAxis = dummyHistogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(xAxisOffset);
  xAxis->SetTitleSize(0.065);
  xAxis->SetLabelSize(0.055);
  xAxis->SetLabelOffset(0.01);
  xAxis->SetTickLength(0.055);
  xAxis->SetNdivisions(505);

  TAxis* yAxis = dummyHistogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleOffset(yAxisOffset);
  yAxis->SetTitleSize(0.070);
  yAxis->SetLabelSize(0.055);
  yAxis->SetLabelOffset(0.01);
  yAxis->SetTickLength(0.055);
  yAxis->SetNdivisions(505);

  graph->SetMarkerColor(1);
  graph->SetLineColor(1);
  graph->Draw("p");

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( useLogScaleY ) outputFileName_plot.append("_log");
  else outputFileName_plot.append("_linear");
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  //canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  //canvas->Print(std::string(outputFileName_plot).append(".root").data());
  
  delete dummyHistogram;
  delete canvas;  
}
开发者ID:veelken,项目名称:SVfitMEM_paper,代码行数:58,代码来源:makeSVfitMEM_xSectionPlot.C

示例3: showHistograms

void showHistograms(double canvasSizeX, double canvasSizeY,
		    TH1* histogram, 
		    double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
		    bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
		    const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);
  canvas->SetLeftMargin(0.15);
  canvas->SetBottomMargin(0.15);
  canvas->SetLogy(useLogScale);

  histogram->SetTitle("");
  histogram->SetStats(true);
  histogram->SetMinimum(yMin);
  histogram->SetMaximum(yMax);
  histogram->SetLineColor(1);
  histogram->SetLineWidth(2);
  histogram->SetMarkerColor(1);
  histogram->SetMarkerStyle(20);
  histogram->SetMarkerSize(1.5);
  histogram->Draw("hist");

  TAxis* xAxis = histogram->GetXaxis();
  xAxis->SetRangeUser(xMin, xMax);
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleSize(0.060);
  xAxis->SetTitleOffset(xAxisOffset);
  xAxis->SetLabelSize(0.050);
  xAxis->SetNdivisions(505);

  TAxis* yAxis = histogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleSize(0.060);
  yAxis->SetTitleOffset(yAxisOffset);
  yAxis->SetLabelSize(0.050);
  yAxis->SetNdivisions(505);

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( useLogScale ) outputFileName_plot.append("_log");
  else outputFileName_plot.append("_linear");
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  //canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  //canvas->Print(std::string(outputFileName_plot).append(".root").data());
  
  delete canvas;  
}
开发者ID:veelken,项目名称:SVfitMEM,代码行数:51,代码来源:makeTFNormalizationPlots.C

示例4: setHist

void LEPStyle::setHist()
{
  _hist = new TH1F( "bidon", "bidon", 100, _xmin, _xmax );
  
  _ax = _hist->GetXaxis();
  _ay = _hist->GetYaxis();

  _ax->SetTitle(_title);
  _ax->SetNdivisions(_ndivx);

  if( _logX )
    {
      _ax->SetMoreLogLabels();
    }

  _ax->SetLabelSize(_scale*0.060);
  //  _ax->SetLabelOffset(_scale*0.007);
  _ax->SetTitleSize(_scale*0.070);
  _ax->SetTitleOffset(0.9);
  _ax->CenterTitle( _centerTitle );

  _ay->SetNdivisions(0);

}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例5: SetAxisLabels

void SetAxisLabels(TH1& hist, char* xtitle, char* ytitle="",
		   double xoffset=1.1, double yoffset=1.4) {

  TAxis* x = hist.GetXaxis();
  TAxis* y = hist.GetYaxis();
  x->SetTitle(xtitle);
  x->SetTitleSize(0.06);
  x->SetLabelSize(0.05);
  x->SetTitleOffset(xoffset);
  x->SetNdivisions(505);
  y->SetTitle(ytitle);
  y->SetTitleSize(0.06);
  y->SetLabelSize(0.05);
  y->SetTitleOffset(yoffset);
  y->SetNoExponent();
  hist.SetLineWidth(2);
  hist.SetMarkerStyle(20);

  std::stringstream str;
  str << "Events / " << (int) lumi << " pb^{-1}   ";
  std::string  defYtitle = str.str();
  if(ytitle=="") y->SetTitle( defYtitle.c_str() );
}
开发者ID:ajaykumar649,项目名称:scripts,代码行数:23,代码来源:plotSpectrum.C

示例6: drawBeamSpotPdfs

void drawBeamSpotPdfs (TDirectory* directory, const char* coord,
			const char* fname)
{
  TH3* obsHisto = directory->Get("PVobs");
  TH3* estHisto = directory->Get("PVest");
  if ( obsHisto==0 || estHisto==0 )  return;
  
  std::string fullName("PV");
  fullName += coord;
  if ( fname )  fullName += fname;
  else  fullName += directory->GetName();
  TCanvas* c = new TCanvas(fullName.c_str(),fullName.c_str());
  c->SetLogy(true);
  TH1* obsHisto1D = obsHisto->Project3D(coord);
  TH1* estHisto1D = estHisto->Project3D(coord);
  TAxis* xaxis = obsHisto1D->GetXaxis();
  string atitle("Primary vertex ");
  atitle += coord;
  atitle += " [cm]";
  xaxis->SetTitle(atitle.c_str());
  if ( c->GetLogy() )  obsHisto1D->SetMinimum(0.5);
  obsHisto1D->SetMarkerStyle(21);
//   obsHisto1D->SetLineColor(2);
//   obsHisto1D->SetMarkerColor(2);
  obsHisto1D->Draw("E0");
  estHisto1D->SetLineColor(2);
  estHisto1D->SetLineWidth(2);
  estHisto1D->Draw("hist same c");

  if ( strcmp(coord,"x") || strcmp(coord,"y") )  xaxis->SetNdivisions(508);

  string epsName = fullName + ".eps";
  c->SaveAs(epsName.c_str());
  string pngName = fullName + ".png";
  c->SaveAs(pngName.c_str());
  
}
开发者ID:wa01,项目名称:usercode,代码行数:37,代码来源:drawBeamSpotPdfs.C

示例7: makePlot


//.........这里部分代码省略.........
  histogramSVfitMEMkEq0->SetMarkerColor(colors[2]);
  histogramSVfitMEMkEq0->SetMarkerStyle(markerStyles[2]);
  histogramSVfitMEMkEq0->SetMarkerSize(markerSizes[2]);
  // CV: fix pathological bins at high mass for which dN/dm increases
  int numBins = histogramSVfitMEMkEq0->GetNbinsX();
  for ( int idxBin = 1; idxBin <= numBins; ++idxBin ) {
    double binCenter = histogramSVfitMEMkEq0->GetBinCenter(idxBin);
    if ( (channel == "#tau_{h}#tau_{h}" && massPoint == 500 && binCenter > 1500.) ||
	 (channel == "#tau_{h}#tau_{h}" && massPoint == 800 && binCenter > 2000.) ||
	 (channel == "#mu#tau_{h}"      && massPoint == 500 && binCenter > 1500.) ||
	 (channel == "#mu#tau_{h}"      && massPoint == 800 && binCenter > 2500.) ) {
      histogramSVfitMEMkEq0->SetBinContent(idxBin, 0.);
    }
  }

  histogramSVfitMEMkNeq0->SetFillColor(0);
  histogramSVfitMEMkNeq0->SetFillStyle(0);
  histogramSVfitMEMkNeq0->SetLineColor(colors[3]);
  histogramSVfitMEMkNeq0->SetLineStyle(lineStyles[3]);
  histogramSVfitMEMkNeq0->SetLineWidth(lineWidths[3]);
  histogramSVfitMEMkNeq0->SetMarkerColor(colors[3]);
  histogramSVfitMEMkNeq0->SetMarkerStyle(markerStyles[3]);
  histogramSVfitMEMkNeq0->SetMarkerSize(markerSizes[3]);

  TAxis* xAxis = histogramCA->GetXaxis();
  xAxis->SetTitle("m_{#tau#tau} [GeV]");
  xAxis->SetTitleOffset(1.15);
  xAxis->SetTitleSize(0.070);
  xAxis->SetTitleFont(42);
  xAxis->SetLabelOffset(0.010);
  xAxis->SetLabelSize(0.055);
  xAxis->SetLabelFont(42);
  xAxis->SetTickLength(0.040);
  xAxis->SetNdivisions(510);

  //double xMin = 20.;
  //double xMax = xAxis->GetXmax();
  //xAxis->SetRangeUser(xMin, xMax);

  TAxis* yAxis = histogramCA->GetYaxis();
  yAxis->SetTitle("dN/dm_{#tau#tau} [1/GeV]");
  yAxis->SetTitleOffset(1.20);
  yAxis->SetTitleSize(0.070);
  yAxis->SetTitleFont(42);
  yAxis->SetLabelOffset(0.010);
  yAxis->SetLabelSize(0.055);
  yAxis->SetLabelFont(42);
  yAxis->SetTickLength(0.040);  
  yAxis->SetNdivisions(505);

  double massPoint_double = 0.;
  if ( massPoint == 90 ) massPoint_double = 91.2;
  else massPoint_double = massPoint;
  double dLog = (TMath::Log(5.*massPoint_double) - TMath::Log(50.))/25.; // xMin = 50, xMax = 5*massPoint, numBins = 25
  double binWidth = TMath::Exp(TMath::Log(massPoint_double) + 0.5*dLog) - TMath::Exp(TMath::Log(massPoint_double) - 0.5*dLog);
  double sf_binWidth = 1./binWidth;
  std::cout << "massPoint = " << massPoint << ": sf_binWidth = " << sf_binWidth << std::endl;

  histogramCA->SetTitle("");
  histogramCA->SetStats(false);
  histogramCA->SetMaximum(sf_binWidth*0.79);
  histogramCA->SetMinimum(sf_binWidth*1.1e-4);
  histogramCA->Draw("hist");
  histogramSVfit->Draw("histsame");
  //histogramSVfitMEMkEq0->Draw("histsame");
  histogramSVfitMEMkEq0->Draw("epsame");
开发者ID:veelken,项目名称:SVfitMEM_paper,代码行数:67,代码来源:makeSVfitMEM_massPlots1_fromBetty.C

示例8: drawFigure7

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure7
//
//    parameter = "dg0"
//    parameter = "lam0"
//    parameter = "dk0"
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure7(TString parameter = "dk0")
{
  gInterpreter->ExecuteMacro("WZPaperStyle.C");

  gSystem->mkdir("pdf", kTRUE);
  gSystem->mkdir("png", kTRUE);


  // Individual settings
  //----------------------------------------------------------------------------
  if (parameter.Contains("dg0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#lambda";
      xmin   = -0.5;
      xmax   =  0.5;
      ymin   = -0.039;
      ymax   =  0.053;
    }
  else if (parameter.Contains("lam0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#Deltag^{Z}_{1}";
      xmin   = -0.53;
      xmax   =  0.53;
      ymin   = -0.05;
      ymax   =  0.09;
    }
  else if (parameter.Contains("dk0"))
    {
      xtitle = "#Deltag^{Z}_{1}";
      ytitle = "#lambda";
      xmin   = -0.059;
      xmax   =  0.059;
      ymin   = -0.037;
      ymax   =  0.052;
    }


  // Read the input file
  //----------------------------------------------------------------------------
  TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read");

  TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68");
  TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95");
  TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99");
  TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95");
  TGraph* bestFit     = (TGraph*)file->Get("bestFit");

  bestFit->SetMarkerSize(1.5);
  bestFit->SetMarkerStyle(34);

  TGraph* g_large = new TGraph(2);

  g_large->SetPoint(0, -1.0, 1.0);
  g_large->SetPoint(1,  1.0, 1.0);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas("canvas", "canvas");

  TMultiGraph* mg = new TMultiGraph();

  mg->Add(cont_exp_68);
  mg->Add(cont_exp_95);
  mg->Add(cont_exp_99);
  mg->Add(cont_obs_95);
  mg->Add(bestFit, "p");
  mg->Add(g_large);

  mg->Draw("ac");

  mg->SetMinimum(ymin);
  mg->SetMaximum(ymax);


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = mg->GetXaxis();
  TAxis* yaxis = mg->GetYaxis();
  
  xaxis->SetLabelFont  (    42);
  xaxis->SetLabelOffset(  0.01);
  xaxis->SetLabelSize  (  0.05);
  xaxis->SetNdivisions (   505);
  xaxis->SetTitle      (xtitle);
  xaxis->SetTitleFont  (    42);
  xaxis->SetTitleOffset(   1.2);
  xaxis->SetTitleSize  (  0.05);

//.........这里部分代码省略.........
开发者ID:piedraj,项目名称:usercode,代码行数:101,代码来源:drawFigure7.C

示例9: makeTable


//.........这里部分代码省略.........
//   g1->GetYaxis()->SetRangeUser(0.5, 1.05);


  h0->SetMarkerStyle(20);
  h1->SetMarkerStyle(20);
  ScaleTo10pb( *h0 );
  ScaleTo10pb( *h1 );

//   TH1F* h01 = (TH1F*) myhistos->Get("fit_eff_Et");
//   TH1F* h11 = (TH1F*) myhistos->Get("fit_eff_Eta");
//   h01->SetMarkerColor(4);
//   h01->SetLineColor(4);
//   h11->SetMarkerColor(4);
//   h11->SetLineColor(4);
//   ScaleTo10pb( *h01 );
//   ScaleTo10pb( *h11 );

  TH1F* h02 = (TH1F*) myhistos->Get("truth_eff_EtDet");
  TH1F* h12 = (TH1F*) myhistos->Get("truth_eff_EtaDet");
  h02->SetMarkerColor(2);
  h02->SetLineColor(2);
  h02->SetMarkerStyle(24);
  h12->SetMarkerColor(2);
  h12->SetLineColor(2);
  h12->SetMarkerStyle(24);
  ScaleTo10pb( *h02 );
  ScaleTo10pb( *h12 );

  TAxis* xaxis = h0->GetXaxis();
  TAxis* yaxis = h0->GetYaxis();
  xaxis->SetTitle("E_{T} (GeV)");
  xaxis->SetTitleSize(0.04);
  xaxis->SetTitleOffset(1.3);
  xaxis->SetNdivisions(505);
  yaxis->SetTitle("Efficiency  ");
  yaxis->SetTitleSize(0.04);
  yaxis->SetTitleOffset(1.6);
  h0->SetMinimum(0.5);
  h0->SetMaximum(1.1);


  TAxis* xaxis = h1->GetXaxis();
  TAxis* yaxis = h1->GetYaxis();
  xaxis->SetTitle("#eta");
  xaxis->SetTitleSize(0.04);
  xaxis->SetTitleOffset(1.3);
  xaxis->SetNdivisions(505);
  yaxis->SetTitle("Efficiency  ");
  yaxis->SetTitleSize(0.04);
  yaxis->SetTitleOffset(1.6);
  h1->SetMinimum(0.5);
  h1->SetMaximum(1.1);

  TAxis* xaxis = h2->GetXaxis();
  TAxis* yaxis = h2->GetYaxis();
  xaxis->SetTitle("E_{T} (GeV)");
  xaxis->SetTitleSize(0.04);
  xaxis->SetTitleOffset(1.3);
  xaxis->SetNdivisions(505);
  yaxis->SetTitle("#eta ");
  yaxis->SetTitleSize(0.04);
  yaxis->SetTitleOffset(1.7);


  double l1 = 0.2, l2 =0.3;
  double p1 = 0.5;
开发者ID:kalanand,项目名称:UserCode,代码行数:67,代码来源:compareEleEffPlots.C

示例10: ratio

/*
 * Main Function
 */
void ratio() {

  gStyle->SetFrameLineWidth(1); 
                                
  //Number of Measurements
  const int NUM = 2;
  
  //Measurements and uncertainties
  // mean, -stat, +stat, -syst, +syst  
  double m[NUM][5] = {
    0.98, 0.10, 0.10, 0.14, 0.14,
    //1.33, 0.32, 0.32, 0.22, 0.22
    1.26, 0.37, 0.37, 0.46, 0.46
  };
  
  //Theory and uncertainties
  // mean, -uncert, +uncert
  double t[NUM][3] = {
    1.0, 0.114, 0.114,
    1.0, 0.111, 0.111
  };

  // label text, sub-label text
  // Note: TString does not work, b/c one cannot pass an array of TStrings
  // as an argument to a function
  char label[NUM][2][100] = {
    "Z#gamma#gamma", "",
    //"W#gamma#gamma", ""
    "W#gamma#gamma (#mu)", ""
  };

  // format: 
  // # color, bgColor, fontSytle, linewidth, markerStyle 
  int aux[NUM][5] = {
    1,  10, 42, 2, 20,
    1,  10, 42, 2, 20
  };

  // determning the x size of the plot
  double lowX = LOW_X;
  double uppX = UPP_X;

  
  TH2F* lft = new TH2F("lft", "", 50, lowX, uppX, 1, 0.0, 1.0);

  // height = NUM*unitHeight + 2*spacers + 1*bottomMargin + 0.5*topMargin
  const double unitHeight = 50.0; // even number
  const double height = (double(NUM)+2.0)*unitHeight+100.0+30.0;
  // how much to step each time to cover the vertical range of the histo in
  // exactly NUM+2 steps
  const double vstep  = unitHeight/(height-100.0-30.0);
  const double width = 800.0;

  printf("Canvas: width=%d, height=%d\n",
	 TMath::Nint(width), TMath::Nint(height));
  printf("Y-step = %6.4f\n", vstep);

  
  // Set canvas and margins
  TCanvas* canvas = new TCanvas("canvas", "canvas", 200, 0,
				TMath::Nint(width), TMath::Nint(height));
  
  canvas->SetFillColor(10);
  canvas->SetRightMargin(20.0/width);
  canvas->SetLeftMargin(20.0/width);
  canvas->SetBottomMargin(56.0/height);
  canvas->SetTopMargin(30.0/height);
  canvas->Draw();
  canvas->cd();

  //printf("TopMargin   : %6.4f\n", canvas->GetTopMargin());
  //printf("BottomMargin: %6.4f\n", canvas->GetBottomMargin());

  TAxis* xaxis = lft->GetXaxis();
  TAxis* yaxis = lft->GetYaxis();
  xaxis->CenterTitle(kTRUE);  
  xaxis->SetTitleSize(0.07);  
  xaxis->SetTitleFont(62);    
  xaxis->SetTitleOffset(1.1); 
  xaxis->SetNdivisions(6,5,0);
    
  xaxis->SetLabelOffset(0.01);
  xaxis->SetLabelSize(0.05);
  xaxis->SetLabelFont(42);
  yaxis->SetLabelSize(0.0);
  yaxis->SetNdivisions(-1);

  lft->SetXTitle("Cross Section Ratio  #sigma_{Exp} / #sigma_{Theory}");
  lft->SetYTitle("");
  lft->SetStats(kFALSE);
  lft->SetTitle("");
  lft->Draw();

    
  // Draw Theory Bands
  for (int i=0; i!=NUM; ++i) {
    drawTheory(i, t[i][0], t[i][1], t[i][2], vstep);
//.........这里部分代码省略.........
开发者ID:cranelli,项目名称:WGamGam,代码行数:101,代码来源:ratio.C

示例11: draw


//.........这里部分代码省略.........
  TGraph* tg2 = new TGraph(n, x[0], x[2]);
  TGraph* tg3 = new TGraph(n, x[0], x[3]);
  TGraph* tg4 = new TGraph(n, x[0], x[4]);
  TGraph* tg5 = new TGraph(n, x[0], x[5]);
  TGraph* tg6 = new TGraph(n, x[0], x[6]);
  TGraph* tg7 = new TGraph(n, x[0], x[7]);
  TGraph* tg8 = new TGraph(n, x[0], x[8]);
  TGraph* tg9 = new TGraph(n, x[0], x[9]);
  TGraph* tg10 = new TGraph(n, x[0], x[10]);
  TGraph* tg11 = new TGraph(n, x[0], x[11]);
  TGraph* tg12 = new TGraph(n, x[0], x[12]);
  TGraph* tg13 = new TGraph(n, x[0], x[13]);
  TGraph* tg14 = new TGraph(n, x[0], x[14]);
  TGraph* tg15 = new TGraph(n, x[0], x[15]);

  TAxis* xa = axhist->GetXaxis();
  TAxis* ya = axhist->GetYaxis();

  xa->SetTitleOffset(1.2);    //  factor multiplies default offset
  ya->SetTitleOffset(1.1);

  xa->SetLabelOffset(0.005);
  ya->SetLabelOffset(0.005);

  xa->SetTickLength(0.015);  // default  = 0.03
  ya->SetTickLength(0.015);  // default  = 0.03

  xa->SetTitleSize(0.05);
  ya->SetTitleSize(0.05);

  //  gPad->SetLogx(1);
  //  xa->SetLimits(90., 700.);

  xa->SetNdivisions(-5); // negative value should force number of divisions?
  ya->SetNdivisions(-4);

  xa->SetLabelSize(0.05);
  ya->SetLabelSize(0.05);

  // Draw axes and then add stuff

  // kDot=1, kPlus, kStar, kCircle=4, kMultiply=5,
  // kFullDotSmall=6, kFullDotMedium=7, kFullDotLarge=8,
  // kFullCircle=20, kFullSquare=21, kFullTriangleUp=22,
  // kFullTriangleDown=23, kOpenCircle=24, kOpenSquare=25,
  // kOpenTriangleUp=26, kOpenDiamond=27, kOpenCross=28,
  // kFullStar=29, kOpenStar=30

  axhist->Draw();

  tg1->SetLineColor(kRed);
  tg1->SetLineWidth(2);
  tg1->SetLineStyle(2);
  tg1->SetMarkerColor(kRed);
  tg1->SetMarkerSize(0.8);
  tg1->SetMarkerStyle(20);
  tg1->Draw("L,same");              // or P for points

  tg2->SetLineColor(kRed);
  tg2->SetLineWidth(2);
  tg2->SetLineStyle(2);
  tg2->SetMarkerColor(kRed);
  tg2->SetMarkerSize(0.8);
  tg2->SetMarkerStyle(20);
  tg2->Draw("L,same");              // or P for points
开发者ID:cranmer,项目名称:fast-asimov-utils,代码行数:66,代码来源:draw_medsig_s5_rel_bi.C

示例12: plot_ZJetBalance

void plot_ZJetBalance( int index, std::string JetResponseFilename, 
		       Float_t genMean[], Float_t genSigma[], 
		       Float_t recoMean[], Float_t recoSigma[]) {


  ////////////// Defining the L3JetCorrector ///////////////////////
  double p[6];
  p[0] = 10.0;          
  p[1] = 800.0;         

  // // with MEAN response
//   p[2] = 0.953124;
//   p[3] = 4.87151;
//   p[4] = 2.83723;  
//   p[5] = 2.91468;


  // // with MPV response
//   p[2] = 0.978755;
//   p[3] = 2.1759;
//   p[4] = 2.25031;  
//   p[5] = 0.0;


  // // with TruncMEAN 2 sigma response
//   p[2] = 1.00299;
//   p[3] = 3.83695;
//   p[4] = 2.87351;  
//   p[5] = 1.6071;


  // // with TruncMEAN 1.5 sigma response
  p[2] = 1.00299;
  p[3] = 3.83695;
  p[4] = 2.87351;  
  p[5] = 1.6071;


  // // with TruncMEAN 1.5 sigma iterative 3 times
//   p[2] = 1.16793;
//   p[3] = 8.8575;
//   p[4] = 5.01816;  
//   p[5] = 5.03132;


  // // with TruncMEAN 1.5 sigma iterative n times
//   p[2] = 1.23392;
//   p[3] = 9.33578;
//   p[4] = 5.60468;  
//   p[5] = 5.52937;


  // // with TruncMEAN 1 sigma response
//   p[2] = 0.690152;
//   p[3] = 2.97111;
//   p[4] = 1.70586;  
//   p[5] = 0.72181;


  // // with MPV: when p[5] is allowed to go negative       
//   p[2] = 0.893141;
//   p[3] = 0.00355417;
//   p[4] = 0.0123656;  
//   p[5] = -1.00176;


  // // from dijet MC truth      
//   p[2] = 0.996998;
//   p[3] = 4.39412;
//   p[4] = 2.96134;  
//   p[5] = 1.69966;


   if(storeResponsHistogramsInRootFile == true) {
     TFile respHistFile(JetResponseFilename.c_str(),"RECREATE");
  }

  TH1F* responseHistGen[nZPtBins];
  TH1F* responseHistReco[nZPtBins];
  TH1F* genJetpt[nZPtBins];
  TH1F* recoZpt[nZPtBins];
  TH1F* caloJetpt[nZPtBins];
  TH1F* Zpt[nZPtBins];

  for(int i=0; i<nZPtBins; i++) {

    responseHistGen[i] = new TH1F(TString("responseHistGen_")+ptBin[i],
				  "",40, 0.0, 2.0);
    TAxis* responseHistGenx = responseHistGen[i]->GetXaxis();
    TAxis* responseHistGeny = responseHistGen[i]->GetYaxis();
    responseHistGenx->SetTitle("p_{T}^{jet} / p_{T}^{Z}   ");
    responseHistGeny->SetTitle("Events / 0.05");
    responseHistGeny->SetTitleOffset(1.4);   
    responseHistGenx->SetNdivisions(505);
    responseHistGeny->SetNdivisions(505);

    responseHistReco[i] = new TH1F(TString("responseHistReco_")+ptBin[i],
				   "",40,0.0,2.0);
    responseHistReco[i]->SetLineColor(2);
    responseHistReco[i]->SetMarkerColor(2);    
//.........这里部分代码省略.........
开发者ID:ajaykumar649,项目名称:scripts,代码行数:101,代码来源:plot_ZJetBalance.C

示例13: makePlot


//.........这里部分代码省略.........
  histogramDYJets->SetLineColor(lineColors[0]);
  histogramDYJets->SetLineStyle(lineStyles[0]);
  histogramDYJets->SetLineWidth(lineWidths[0]);

  histogramHiggs125->SetFillColor(fillColors[1]);
  histogramHiggs125->SetFillStyle(fillStyles[1]);
  histogramHiggs125->SetLineColor(lineColors[1]);
  histogramHiggs125->SetLineStyle(lineStyles[1]);
  histogramHiggs125->SetLineWidth(lineWidths[1]);

  histogramHiggs200->SetFillColor(fillColors[2]);
  histogramHiggs200->SetFillStyle(fillStyles[2]);
  histogramHiggs200->SetLineColor(lineColors[2]);
  histogramHiggs200->SetLineStyle(lineStyles[2]);
  histogramHiggs200->SetLineWidth(lineWidths[2]);

  histogramHiggs300->SetFillColor(fillColors[3]);
  histogramHiggs300->SetFillStyle(fillStyles[3]);
  histogramHiggs300->SetLineColor(lineColors[3]);
  histogramHiggs300->SetLineStyle(lineStyles[3]);
  histogramHiggs300->SetLineWidth(lineWidths[3]);

  TAxis* xAxis = histogramHiggs300->GetXaxis();
  if ( histogram == "mVis"    ) xAxis->SetRangeUser(0,350);
  else xAxis->SetRangeUser(0,450);
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.00);
  xAxis->SetTitleSize(0.070);
  xAxis->SetTitleFont(42);
  xAxis->SetLabelOffset(0.010);
  xAxis->SetLabelSize(0.050);
  xAxis->SetLabelFont(42);
  xAxis->SetTickLength(0.040);
  xAxis->SetNdivisions(505);

  //double xMin = 20.;
  //double xMax = xAxis->GetXmax();
  //xAxis->SetRangeUser(xMin, xMax);

  TAxis* yAxis = histogramHiggs300->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleOffset(1.20);
  yAxis->SetTitleSize(0.070);
  yAxis->SetTitleFont(42);
  yAxis->SetLabelOffset(0.010);
  yAxis->SetLabelSize(0.055);
  yAxis->SetLabelFont(42);
  yAxis->SetTickLength(0.040);  
  yAxis->SetNdivisions(505);

  histogramHiggs300->SetTitle("");
  histogramHiggs300->SetStats(false);
  histogramHiggs300->SetMaximum(1.2*histogramDYJets->GetMaximum());
  histogramHiggs300->SetMinimum(0.);
  histogramHiggs300->Draw("hist");
  histogramHiggs200->Draw("histsame");
  histogramHiggs125->Draw("histsame");
  histogramDYJets->Draw("histsame");
  histogramHiggs300->Draw("axissame");

  TLegend* legend_new = new TLegend(0.50, 0.62, 0.87, 0.92, NULL, "brNDC");
  legend_new->SetFillColor(10);
  legend_new->SetFillStyle(0);
  legend_new->SetBorderSize(0);
  legend_new->SetTextFont(42);
  legend_new->SetTextSize(0.055);
开发者ID:veelken,项目名称:SVfitPerformanceStudies,代码行数:67,代码来源:makeSVfitMEM_massPlots_from13.C

示例14: DrawZPeak


//.........这里部分代码省略.........
  allmc->SetFillStyle  (3345);
  allmc->SetLineColor  (kWhite);
  allmc->SetLineWidth  (0);
  allmc->SetMarkerColor(kOrange-2);
  allmc->SetMarkerSize (0);

  THStack* hs = new THStack();

  if (energy.Contains("8TeV"))
    {
      WV->SetFillColor(kRed+1);  // kAzure
      WV->SetLineColor(kRed+1);  // kAzure

      VVV->SetFillColor(kRed+1);  // kBlack
      VVV->SetLineColor(kRed+1);  // kBlack

      hs->Add(VVV);
      hs->Add(WV);
    }

  hs->Add(Zgamma);
  hs->Add(ZZ);
  hs->Add(fakes);
  hs->Add(WZ);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas(energy, energy);

  data->Draw("ep");


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = data->GetXaxis();
  TAxis* yaxis = data->GetYaxis();
  
  xaxis->SetLabelFont  (  42);
  xaxis->SetLabelOffset(0.01);
  xaxis->SetLabelSize  (0.05);
  xaxis->SetNdivisions ( 505);
  xaxis->SetTitleFont  (  42);
  xaxis->SetTitleOffset( 1.3);
  xaxis->SetTitleSize  (0.05);

  yaxis->SetLabelFont  (  42);
  yaxis->SetLabelOffset(0.01);
  yaxis->SetLabelSize  (0.05);
  yaxis->SetNdivisions ( 505);
  yaxis->SetTitleFont  (  42);
  yaxis->SetTitleOffset( 1.6);
  yaxis->SetTitleSize  (0.05);

  xaxis->SetRangeUser(68, 112);
  xaxis->SetTitle("m_{#font[12]{ll}} (GeV)");
  yaxis->SetTitle(Form("Events /  %.0f GeV", data->GetBinWidth(0)));


  // Adjust scale
  //----------------------------------------------------------------------------
  Float_t theMax   = GetMaximumIncludingErrors(data);
  Float_t theMaxMC = GetMaximumIncludingErrors(allmc);

  if (theMaxMC > theMax) theMax = theMaxMC;

  data->SetMaximum(1.15 * theMax);


  // Legend
  //----------------------------------------------------------------------------
  Double_t x0 = 0.635;
  Double_t y0 = 0.770;

  DrawTLegend(x0, y0 + 2.*(_yoffset+0.001), data,  " Data",               "ep");
  DrawTLegend(x0, y0 + 1.*(_yoffset+0.001), WZ,    " WZ",                 "f");
  DrawTLegend(x0, y0,                       fakes, " Non-prompt leptons", "f");
  DrawTLegend(x0, y0 - 1.*(_yoffset+0.001), ZZ,    " MC background",      "f");
  DrawTLegend(x0, y0 - 2.*(_yoffset+0.001), allmc, " stat. #oplus syst.", "f");


  // Finish it
  //----------------------------------------------------------------------------
  data->SetTitle("");

  DrawTLatex(_cmsTextFont,   0.215, 0.880, 0.055, 13, "CMS");
  //  DrawTLatex(_extraTextFont, 0.215, 0.826, 0.030, 13, "Preliminary");
  DrawTLatex(_lumiTextFont,  0.940, 0.940, 0.040, 31, _lumiText);

  hs   ->Draw("hist,same");
  allmc->Draw("e2,same");
  data ->Draw("ep,same");

  canvas->GetFrame()->DrawClone();
  canvas->RedrawAxis();
  canvas->Update();
  
  canvas->SaveAs("pdf/" + name + energy + ".pdf");
  canvas->SaveAs("png/" + name + energy + ".png");
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例15: plot3


//.........这里部分代码省略.........

               if(MZ < Mmin) { Mmin = MZ; cout << MZ << "\t" << sqrt(fitsph) << endl;}
            }
         }
      }

      cout << "(" << file << ") " << "MZmin: " << MZmin << endl;
      cout << "(" << file << ") " << "MWmin: " << MWmin << endl;
   }
 
// CREATE PLOTS /////////////////////////////////////////////////////////

   NPplot->SetLineStyle(2);
   NPplot->SetMarkerStyle(20);
   NPplot->SetMarkerSize(0.4);
   SMplot->SetMarkerStyle(20);
   SMplot->SetMarkerSize(0.4);
   
   if(strpltmd.compare("cos") == 0) {xMin = 0.0; yMin = 0.0; yMax = 1.0;}
   if(strpltmd.compare("sin") == 0) {yMin = 0.0; yMax = 1.0;}
   if(strpltmd.compare("mmp") == 0) {xMin = 0.0; xMax = 5.8/1.1; yMin = 0.0; yMax = 5;}

   TH1F* frame = MyC->DrawFrame(0.9*xMin,0.9*yMin,1.1*xMax,1.0*yMax);
   frame->SetTitle(plottitle.c_str());

   TAxis *xaxis = frame->GetXaxis();
   TAxis *yaxis = frame->GetYaxis();   
   xaxis->SetTitle(xtitle.c_str());
   xaxis->CenterTitle();
   xaxis->SetTitleOffset(1.);
   xaxis->SetDecimals();
   xaxis->SetLabelSize(0.03);
   xaxis->SetLabelOffset(0.01);
   yaxis->SetNdivisions(505);
   yaxis->SetTitle(ytitle.c_str());
   yaxis->CenterTitle();
   yaxis->SetTitleOffset(1.2);
   yaxis->SetDecimals();
   yaxis->SetLabelSize(0.03);
   yaxis->SetLabelOffset(0.01);

   TLegend *mmleg = new TLegend(mmlegxmin,mmlegymin,mmlegxmax,mmlegymax);
   mmleg->AddEntry(NPplot,NPleg.c_str(),"l");
   mmleg->AddEntry(SMplot,SMleg.c_str(),"l"); 
   mmleg->SetTextSize(0.025);
   mmleg->SetFillStyle(0);

   if( (strfile.compare("uu-d") != 0) && (strfile.compare("nu-d") != 0) ) {

      for(tphStep=0; tphStep<tphSteps; tphStep++){NPmrk[tphStep]->Draw(); SMmrk[tphStep]->Draw();}

   }

   Float_t xdummy[1] = {0.0}, ydummy[1] = {0.0};

   TGraph *circle = new TGraph(1,xdummy,ydummy);
   circle->SetMarkerStyle(24);
   circle->SetMarkerColor(kGreen+1);
   circle->SetMarkerSize(0.8); 
   
   TGraph *square = new TGraph(1,xdummy,ydummy);
   square->SetMarkerStyle(25);
   square->SetMarkerColor(kCyan+1);
   square->SetMarkerSize(0.8); 

   TGraph *triangle = new TGraph(1,xdummy,ydummy);
开发者ID:jxi24,项目名称:GAPP,代码行数:67,代码来源:plot3.C


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