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


C++ TGaxis::SetLabelSize方法代码示例

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


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

示例1: TGaxis

ReverseXAxis (TGraphAsymmErrors *g, double  size)
{
// Remove the current axis
   g->GetXaxis()->SetLabelOffset(999);
   g->GetXaxis()->SetTickLength(0);

//  Redraw the new axis 
   gPad->Update();

	g->GetYaxis()->SetTitle("Event Selection Efficiency");
   TGaxis *newaxis = new TGaxis(gPad->GetUxmax(),
                                gPad->GetUymin(),
                                gPad->GetUxmin(),
                                gPad->GetUymin(),
                                g->GetXaxis()->GetXmin(),
                                g->GetXaxis()->GetXmax(),
                                510,"-");
   newaxis->SetLabelOffset(-0.04);
   newaxis->SetTitle("Centrality");
   newaxis->SetTitleFont(42);
   newaxis->SetTitleSize(size);
   newaxis->SetLabelSize(size);
   newaxis->CenterTitle();
   newaxis->SetLabelFont(42);
   newaxis->Draw();


}
开发者ID:XuQiao,项目名称:HI,代码行数:28,代码来源:DrawEff_DS.C

示例2: drawLabels

void drawLabels(){
  TLatex l;
  l.SetTextSize(0.04);
  l.DrawLatex(500,50,"-z");
  l.DrawLatex(500,1430,"+z");
  l.DrawLatex(900,330,"TIB L1");
  l.DrawLatex(900,1000,"TIB L2");
  l.DrawLatex(1300,330,"TIB L3");
  l.DrawLatex(1300,1000,"TIB L4");
  l.DrawLatex(1700,330,"TOB L1");
  l.DrawLatex(1700,1000,"TOB L2");
  l.DrawLatex(2100,330,"TOB L3");
  l.DrawLatex(2100,1000,"TOB L4");
  l.DrawLatex(2500,330,"TOB L5");
  l.DrawLatex(2500,1000,"TOB L6");
  TArrow arx(2900,1190,2900,1350,0.01,"|>");
  l.DrawLatex(2915,1350,"x");
  TArrow ary(2900,1190,2790,1190,0.01,"|>");
  l.DrawLatex(2790,1210,"y");
  TArrow arz(2790,373,2790,672,0.01,"|>");
  l.DrawLatex(2820,667,"z");
  TArrow arphi(2790,511,2447,511,0.01,"|>");
  l.DrawLatex(2433,520,"#Phi");
  arx.SetLineWidth(3);
  ary.SetLineWidth(3);
  arz.SetLineWidth(3);
  arphi.SetLineWidth(3);
  arx.Draw();
  ary.Draw();
  arz.Draw();
  arphi.Draw();

  //FIXME : when tkmaps with taxis in color palette, introduce this
  TGaxis* axis = new TGaxis(3060,hmin,3060,hmax,0,100,510,"+L");
  axis->SetLabelSize(0.02);
  axis->Draw();

  canvas->Update();
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:39,代码来源:svgTopng.C

示例3: drawmat_DBD


//.........这里部分代码省略.........
     hmat[ihist] = new TH1F(hname[ihist],"",nbin,xmin,xmax);
     //// ensure proper errors
     // hmat[ihist]->Sumw2();
     hmat[ihist]->SetLineColor(color[ihist]);
     hmat[ihist]->SetLineWidth(3);
     hmat[ihist]->SetTitle(";#theta / degrees;X_{0}");
   }
   
   
  // read tree
  TFile* file = new TFile ( FILEN ) ;
  TTree* tree = (TTree *) file->Get("ntuple");
  if (!tree) {
    cout << "ERROR: Couldn't open tree ntuple on file: "<< FILEN << endl;
    return 1; 
  }
  
  tree->SetBranchAddress("itheta",  &itheta);
  tree->SetBranchAddress("nrecal",   &nrecal);
  tree->SetBranchAddress("nrset",   &nrset);
  tree->SetBranchAddress("nrtpc",   &nrtpc);
  tree->SetBranchAddress("nrtpc_i", &nrtpc_i);
  tree->SetBranchAddress("nrsit",   &nrsit);
  tree->SetBranchAddress("nrvxd",   &nrvxd);
  int entries = tree->GetEntries();
    cout << "tree has " << entries << " entries" << endl;
  
  // event loop
  for (int ievt = 0; ievt < entries; ++ievt) {

     tree->GetEntry(ievt);
     if (itheta < 4.45) continue;


     hmat[0]->Fill(-itheta,nrecal);
     hmat[1]->Fill(-itheta,nrset);
     hmat[2]->Fill(-itheta,nrtpc);
     if( itheta > 8. ) 
     hmat[3]->Fill(-itheta,nrtpc_i);

     hmat[4]->Fill(-itheta,nrsit);
     hmat[5]->Fill(-itheta,nrvxd);
     hmat[6]->Fill(-itheta,1);
  }
  
//   for (int ibin = 0; ibin < nbin+1; ++ibin) {
//     cout << "Bin " << ibin << " has " << hmat[4]->GetBinContent(ibin) << " entries" << endl;
//   }

  c1 = new TCanvas("c1","c1",600,600);
  

  bool first = true ;

#define _include_Ecal 0

#if _include_Ecal 
  for (int ihist = 0; ihist < nhist-1; ihist++) {
#else
  for (int ihist = 1; ihist < nhist-1; ihist++) {
#endif

    // average double counts 
    hmat[ihist]->Divide( hmat[nhist-1] );

    if( first ) { 

      hmat[ihist]->Draw( ""  );

      // --------- change axis labels from minus to plus --------
      c1->Update() ;
      TF1 *f1 = new TF1("f1","-x",0,90);
      hmat[ihist]->GetXaxis()->SetLabelOffset(99);
      Double_t x_min = c1->GetUxmin();
      Double_t x_max = c1->GetUxmax();
      Double_t y_min = c1->GetUymin();
      //std::cout << "x_min " << x_min << " x_max " << x_max << " y_min " << y_min << std::endl ;
      TGaxis *axis = new TGaxis( x_min, y_min, x_max, y_min, "f1", 5);    
      axis->SetLabelSize( 0.06 );
      axis->SetLabelFont( 42 ); 
      axis->Draw(); 
      // -----end: change axis labels from minus to plus --------

      first = false ;


    } else {
      hmat[ihist]->Draw( "same"  );
    }

    leg->AddEntry(hmat[ihist],htitle[ihist],"L");

  }
  leg->Draw();
  

  std::string pdfFile( std::string( FILEN ) + std::string( ".pdf" ) ) ;
  c1->Print( pdfFile.c_str() ) ;
  
}
开发者ID:iLCSoft,项目名称:GEAR,代码行数:101,代码来源:drawmat_DBD.C

示例4: arrangeCanvas


//.........这里部分代码省略.........
      ndiv = 505;
    } else if (myTitle.Contains("phi")){
      axmin = -TMath::Pi();
      axmax = TMath::Pi();
      ndiv = 510;
    } else  {
      std::cout<<"unrecongnized variable";
    }

    meanplots[i]->GetXaxis()->SetLabelOffset(999);
    meanplots[i]->GetXaxis()->SetTickLength(0);
    
    // Redraw the new axis 
    gPad->Update();
    TGaxis *newaxis =  new TGaxis(gPad->GetUxmin(),gPad->GetUymin(),
				  gPad->GetUxmax(),gPad->GetUymin(),
				  axmin,
				  axmax,
				  //meanplots[i]->GetXaxis()->GetXmin(),
				  //meanplots[i]->GetXaxis()->GetXmax(),
				  ndiv,"SDH");
    
    
    TGaxis *newaxisup =  new TGaxis(gPad->GetUxmin(),gPad->GetUymax(),
				    gPad->GetUxmax(),gPad->GetUymax(),
				    axmin,
				    axmax,
				    //meanplots[i]->GetXaxis()->GetXmin(),                                                                                                     
				    //meanplots[i]->GetXaxis()->GetXmax(),                                                                                                     
				    ndiv,"-SDH");
    
    newaxis->SetLabelOffset(0.02);
    newaxis->SetLabelFont(42);
    newaxis->SetLabelSize(.05);
    newaxis->Draw();

    newaxisup->SetLabelOffset(-0.02);
    newaxisup->SetLabelFont(42);
    newaxisup->SetLabelSize(0);
    newaxisup->Draw();
    
    if(i==0){
      //meanplots[i]->GetYaxis()->SetRangeUser(absmin-safeDelta/2.,absmax+safeDelta);
      std::cout<<"name is: "<< meanplots[i]->GetName() << " absmin:" <<absmin<<" absmax: "<<absmax<<" safeDelta: "<<safeDelta<<std::endl;
      TString theTitle = meanplots[i]->GetName();
      if( theTitle.Contains("Norm")){
	meanplots[i]->GetYaxis()->SetRangeUser(std::min(-0.48,absmin-safeDelta),std::max(0.48,absmax+safeDelta));
      } else {
	if(!onlyBias){
	  meanplots[i]->GetYaxis()->SetRangeUser(absmin-safeDelta,absmax+safeDelta);
	} else {
	  meanplots[i]->GetYaxis()->SetRangeUser(-theExtreme-(TMath::Abs(absmin)/10.),theExtreme+(TMath::Abs(absmax/10.)));
	}
	//meanplots[i]->GetYaxis()->SetRangeUser(-theExtreme,theExtreme);
      } 
      meanplots[i]->Draw("e1");

      if(onlyBias){
	Int_t nbins =  meanplots[i]->GetNbinsX();
	Double_t lowedge  = meanplots[i]->GetBinLowEdge(1);
	Double_t highedge = meanplots[i]->GetBinLowEdge(nbins+1);
	
	TH1F* hzero = DrawZero(meanplots[i],nbins,lowedge,highedge);
	hzero->Draw("PLsame");
      }
开发者ID:mmusich,项目名称:PVToolScripts,代码行数:66,代码来源:AutoFitResiduals_forApproval.C

示例5: draw_sigvsback


//.........这里部分代码省略.........
    
    legend->AddEntry(hist_sig, (sig_label+": "+to_string_with_precision(hist_sig->Integral())+" events").c_str());
    legend->AddEntry(hist_back, (back_label+": "+to_string_with_precision(hist_back->Integral())+" events").c_str());
    */

    legend->AddEntry(hist_sig, (sig_label).c_str());
    legend->AddEntry(hist_back, (back_label).c_str());

    canvas = new TCanvas(cname.c_str());   
    TPad * pad_base = new TPad();
    pad_base->Draw();
    pad_base->SetFillColor(0);
    double ymin_base = hist_sig->GetYaxis()->GetXmin();
    double ymax_base = hist_sig->GetYaxis()->GetXmax();
    double dy_base = (ymax_base-ymin_base)/0.8;
    double xmin_base = hist_sig->GetXaxis()->GetXmin();
    double xmax_base = hist_sig->GetXaxis()->GetXmax();
    double dx_base = (xmax_base-xmin_base)/0.8;
    pad_base->Range(xmin_base-0.1*dx_base,ymin_base-0.1*dy_base,xmax_base+0.1*dx_base,ymax_base+0.1*dy_base);
    pad_base->cd();
    hist_back->Draw();
    hist_sig->Draw("same");
    if(!significance && !efficiency) legend->Draw();

    //////    
    hist_sig->Scale(run_pot / signal_pot);
    hist_back->Scale(run_pot / background_pot);
    //////

    TGraph * graph_sig = nullptr;
    TPad * pad_sig = nullptr;
    if(significance) {
      graph_sig = getgraphsig(hist_sig, hist_back, forwards);
      canvas->cd();
      pad_sig = new TPad();
      pad_sig->SetFillStyle(4000);
      double ymin = graph_sig->GetYaxis()->GetXmin();
      double ymax = graph_sig->GetYaxis()->GetXmax();
      double dy = (ymax-ymin)/0.8;
      double xmax = 0;
      double ytemp = 0;
      graph_sig->GetPoint(graph_sig->GetN()-1, xmax, ytemp);
      pad_sig->Range(xmin_base-0.1*dx_base,ymin-0.1*dy,xmax_base+0.1*dx_base,ymax+0.1*dy);
      pad_sig->Draw();
      pad_sig->cd();
      graph_sig->Draw("samep");
      TGaxis * axis = new TGaxis(xmax_base,ymin,xmax_base,ymax,ymin,ymax, 510, "+L");
      axis->SetLabelColor(graph_sig->GetMarkerColor());
      axis->SetLabelSize(0.03);
      axis->Draw();
      legend->AddEntry(graph_sig, "Significance");
      if(!efficiency) legend->Draw();
    }

    TGraph * graph_eff = nullptr;
    TPad * pad_eff = nullptr;
    if(efficiency) {
      graph_eff = getgrapheff(hist_sig, forwards);
      canvas->cd();
      pad_eff = new TPad();
      pad_eff->SetFillStyle(4000);
      double ymin = graph_eff->GetYaxis()->GetXmin();
      double ymax = graph_eff->GetYaxis()->GetXmax();
      double dy = (ymax-ymin)/0.8;
      double xmax = 0;
      double ytemp = 0;
      graph_eff->GetPoint(graph_eff->GetN()-1, xmax, ytemp);
      pad_eff->Range(xmin_base-0.1*dx_base,ymin-0.1*dy,xmax_base+0.1*dx_base,ymax+0.1*dy);
      pad_eff->Draw();
      pad_eff->cd();
      graph_eff->Draw("samep");
      double axis_offset = 0;
      if(significance) axis_offset = 1./14*xmax;
      TGaxis * axis = new TGaxis(xmax_base+axis_offset,ymin,xmax_base+axis_offset,ymax,ymin,ymax, 510, "+L");   
      axis->SetLabelColor(graph_eff->GetMarkerColor());
      axis->SetLabelSize(0.03);
      axis->Draw();
      legend->AddEntry(graph_eff, "Efficiency");
      legend->Draw();
    }

    hist_sig->Scale(signal_pot / run_pot);
    hist_sig->Scale(1. / hist_sig->Integral());
    hist_back->Scale(background_pot / run_pot);
    hist_back->Scale(1. / hist_back->Integral()); 

    double const ymin_hist = 0;
    double ymax_hist = hist_sig->GetMaximum();
    if(hist_back->GetMaximum() > ymax_hist) ymax_hist = hist_back->GetMaximum();
    hist_back->GetYaxis()->SetRangeUser(ymin_hist, 1.1*ymax_hist);

    canvas->Write();
    delete canvas;
    delete hist_sig;
    delete hist_back;
    delete legend;
    if(graph_sig) delete graph_sig;
    if(graph_eff) delete graph_eff;

  }
开发者ID:rmurrells,项目名称:VertexBuilderTest,代码行数:101,代码来源:plot.cpp

示例6: ntuAnalyzer


//.........这里部分代码省略.........
  //book graphs and plots
  TGraphErrors* totRateVsCut = new TGraphErrors();
  totRateVsCut->SetMinimum(0);
  TGraphErrors* pureRateVsCut450 = new TGraphErrors();
  TGraphErrors* pureRateVsCut280 = new TGraphErrors();

  //loops
  int bin = 0;
  for (int cut = 350; cut < 500; cut=cut+10)
    {
      int mjjPassed = 0;
      int HT250Calo_Passed = 0;
      int excl410_passed = 0;
      int excl250_passed = 0;
      for (Long64_t jentry=0; jentry<nentries;++jentry) 
	{
	  tt->GetEntry(jentry);

	  if (hltAccept->at(HT250Calo) == 1)
	    ++HT250Calo_Passed;

	  //if (caloMjj > cut && !hltAccept->at(HT410PF))
	  if (caloMjj > cut && l1Accept->at(L1scenario) == 1 && hltAccept->at(HT410PF)==0)
	    ++excl410_passed;
	  if (caloMjj > cut && l1Accept->at(L1scenario)==1 && hltAccept->at(HT250Calo)==0)
	    ++excl250_passed;
	  if (caloMjj > cut && l1Accept->at(L1scenario)==1)
	    ++mjjPassed;

	  // if (hltAccept->at(HT250Calo) == 0 && mjj > cut)
	  //   std::cout << "ref trigger doesn't completely cover cut at " << cut << std::endl;
	}
      // float mjjTotalRate = (float)mjjPassed/(float)HT250Calo_Passed*HT250Calo_rate;
      // float mjjPureRate = (float)exclPassed/(float)HT250Calo_Passed*HT250Calo_rate;

      float sigmaMjjPassed = sqrt((float)mjjPassed);
      float sigmaNentries = sqrt((float)nentries);
      float sigmaExcl410_passed = sqrt((float)excl410_passed);
      float sigmaExcl250_passed = sqrt((float)excl250_passed);

      float mjjTotalRate = (float)mjjPassed/(float)nentries*PDRate;
      float mjjTotalRateE = PDRate*sqrt(pow((sigmaMjjPassed/nentries),2)+pow((sigmaNentries*mjjPassed/nentries/nentries),2));

      float mjj450_PureRate = (float)excl410_passed/(float)nentries*PDRate;
      float mjj450_PureRateE = PDRate*sqrt(pow((sigmaExcl410_passed/nentries),2)+pow((sigmaNentries*excl410_passed/nentries/nentries),2));
      
      float mjj280_PureRate = (float)excl250_passed/(float)nentries*PDRate;
      float mjj280_PureRateE = PDRate*sqrt(pow((sigmaExcl250_passed/nentries),2)+pow((sigmaNentries*excl250_passed/nentries/nentries),2));

      totRateVsCut->SetPoint(bin,cut,mjjTotalRate);
      totRateVsCut->SetPointError(bin,0.,mjjTotalRateE);

      pureRateVsCut450->SetPoint(bin,cut,mjj450_PureRate);
      pureRateVsCut450->SetPointError(bin,0.,mjj450_PureRateE);

      pureRateVsCut280->SetPoint(bin,cut,mjj280_PureRate);
      pureRateVsCut280->SetPointError(bin,0.,mjj280_PureRateE);

      ++bin;
    }

  //plotting and styling
  TLegend* leg = new TLegend(0.62, 0.78, 0.83, 0.89);
  leg->AddEntry(totRateVsCut,"total rate","P");
  leg->AddEntry(pureRateVsCut450,"pure rate wrt HT410PF","P");
  leg->AddEntry(pureRateVsCut280,"pure rate wrt HT250Calo","P");

  totRateVsCut->SetTitle("Rate Ref");

  totRateVsCut->GetXaxis()->SetTitle("Mjj cut threshold [GeV]");
  totRateVsCut->GetYaxis()->SetTitle("Rate @4E33 [Hz]");
  pureRateVsCut450->SetMarkerColor(kRed);
  pureRateVsCut450->SetLineColor(kRed);
  pureRateVsCut280->SetMarkerColor(kOrange+1);
  pureRateVsCut280->SetLineColor(kOrange+1);

  TCanvas* c4 = new TCanvas();
  c4->cd();
  totRateVsCut->Draw("AP");
  pureRateVsCut450->Draw("P,sames");
  pureRateVsCut280->Draw("P,sames");
  leg->Draw("sames");
  c4->Update();

  TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(), gPad->GetUymax(),
    			    (totRateVsCut->GetYaxis()->GetBinLowEdge(1))*lumiScaleFactor,
			    (totRateVsCut->GetYaxis()->GetBinLowEdge(totRateVsCut->GetYaxis()->GetNbins())+totRateVsCut->GetYaxis()->GetBinWidth(1))*lumiScaleFactor,510,"+L");

  c4->SetTicky(0);
  axis->SetLineColor(kRed);
  axis->SetLabelColor(kRed);
  axis->SetTextColor(kRed);
  axis->SetTitleOffset(1.3);
  axis->SetLabelSize(0.03);
  axis->SetTitle("Rate @1E34 [Hz]");
  axis->Draw();


  return 0;
}
开发者ID:deguio,项目名称:Analyzers,代码行数:101,代码来源:ntuAnalyzer.C

示例7: if


//.........这里部分代码省略.........
	else{
		g->SetLineWidth(2);
		g->SetLineStyle(s->getLineStyle());
    if ( last && arg->isQuickhack(25) ) g->SetLineWidth(3);
	}

	if ( plotPoints ){
		g->SetLineWidth(1);
		g->SetMarkerColor(color);
		g->SetMarkerStyle(8);
		g->SetMarkerSize(0.6);
		if(CLsType==1) {
			g->SetMarkerStyle(33);
			g->SetMarkerSize(1);
		}
		if(CLsType==2) {
			g->SetMarkerStyle(21);
		}
	}

	// build a histogram which holds the axes
	float min = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmin() : arg->scanrangeMin;
	float max = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmax() : arg->scanrangeMax;
	TH1F *haxes = new TH1F("haxes"+getUniqueRootName(), "", 100, min, max);
	haxes->SetStats(0);
	haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
	haxes->GetYaxis()->SetTitle("1-CL");
	haxes->GetXaxis()->SetLabelFont(font);
	haxes->GetYaxis()->SetLabelFont(font);
	haxes->GetXaxis()->SetTitleFont(font);
	haxes->GetYaxis()->SetTitleFont(font);
	haxes->GetXaxis()->SetTitleOffset(0.9);
	haxes->GetYaxis()->SetTitleOffset(0.85);
	haxes->GetXaxis()->SetLabelSize(labelsize);
	haxes->GetYaxis()->SetLabelSize(labelsize);
	haxes->GetXaxis()->SetTitleSize(titlesize);
	haxes->GetYaxis()->SetTitleSize(titlesize);
	int xndiv = arg->ndiv==-1 ? 407 : abs(arg->ndiv);
	bool optimizeNdiv = arg->ndiv<0 ? true : false;
	haxes->GetXaxis()->SetNdivisions(xndiv, optimizeNdiv);
	haxes->GetYaxis()->SetNdivisions(407, true);

  // plot y range
  float plotYMax;
  float plotYMin;
  if ( plotLegend && !arg->isQuickhack(22) ) {
    if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 10.; }
    else                { plotYMin = 0.0  ; plotYMax = 1.3; }
  }
  else {
    if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 1.0; }
    else                { plotYMin = 0.0  ; plotYMax = 1.0; }
  }
  // change if passed as option
	plotYMin = arg->plotymin > 0. ? arg->plotymin : plotYMin;
  plotYMax = arg->plotymax > 0. ? arg->plotymax : plotYMax;

  haxes->GetYaxis()->SetRangeUser( plotYMin, plotYMax );
	haxes->Draw("axissame");
	g->SetHistogram(haxes);

	TString drawOption = "";
	if ( plotPoints )   drawOption += " pe";
	else if ( filled )  drawOption += " F";
	else                drawOption += " L";
	if ( first )        drawOption += " A";
开发者ID:gammacombo,项目名称:gammacombo,代码行数:67,代码来源:OneMinusClPlot.cpp

示例8: rate


//.........这里部分代码省略.........
	    ++excl_mjjHltPassed;


	}
      float HTT240rate = (float)HTT240Passed/(float)nentries*PDRate;
      //std::cout << "HTT240rate = " << HTT240rate << std::endl;
      
      float sigmaNentries = sqrt((float)nentries);

      float sigmaMjjHltPassed = sqrt((float)mjjHltPassed);
      float excl_sigmaMjjHltPassed = sqrt((float)excl_mjjHltPassed);

      float sigmaMjjL1Passed = sqrt((float)mjjL1Passed);
      float excl_sigmaMjjL1Passed = sqrt((float)excl_mjjL1Passed);

      float mjjHltRate = (float)mjjHltPassed/(float)nentries*PDRate;
      float mjjHltRateE = PDRate*sqrt(pow((sigmaMjjHltPassed/nentries),2)+pow((sigmaNentries*mjjHltPassed/nentries/nentries),2));
      float excl_mjjHltRate = (float)excl_mjjHltPassed/(float)nentries*PDRate;
      float excl_mjjHltRateE = PDRate*sqrt(pow((excl_sigmaMjjHltPassed/nentries),2)+pow((sigmaNentries*excl_mjjHltPassed/nentries/nentries),2));

      float mjjL1Rate = (float)mjjL1Passed/(float)nentries*PDRate;
      float mjjL1RateE = PDRate*sqrt(pow((sigmaMjjL1Passed/nentries),2)+pow((sigmaNentries*mjjL1Passed/nentries/nentries),2));
      float excl_mjjL1Rate = (float)excl_mjjL1Passed/(float)nentries*PDRate;
      float excl_mjjL1RateE = PDRate*sqrt(pow((excl_sigmaMjjL1Passed/nentries),2)+pow((sigmaNentries*excl_mjjL1Passed/nentries/nentries),2));

      totHltRateVsCut->SetPoint(bin,cut,mjjHltRate);
      totHltRateVsCut->SetPointError(bin,0.,mjjHltRateE);
      pureHltRateVsCut->SetPoint(bin,cut,excl_mjjHltRate);
      pureHltRateVsCut->SetPointError(bin,0.,excl_mjjHltRateE);

      totL1RateVsCut->SetPoint(bin,cut,mjjL1Rate);
      totL1RateVsCut->SetPointError(bin,0.,mjjL1RateE);
      pureL1RateVsCut->SetPoint(bin,cut,excl_mjjL1Rate);
      pureL1RateVsCut->SetPointError(bin,0.,excl_mjjL1RateE);

      ++bin;
    }

  //plotting and styling
  TLegend* legHlt = new TLegend(0.62, 0.78, 0.83, 0.89);
  legHlt->AddEntry(totHltRateVsCut,"hlt total rate","P");
  legHlt->AddEntry(pureHltRateVsCut,"hlt pure rate wrt HT250","P");

  TLegend* legL1 = new TLegend(0.62, 0.78, 0.83, 0.89);
  legL1->AddEntry(totL1RateVsCut,"l1 total rate","P");
  legL1->AddEntry(pureL1RateVsCut,"l1 pure rate wrt HTT240","P");

  totHltRateVsCut->GetXaxis()->SetTitle("Mjj cut threshold [GeV]");
  totHltRateVsCut->GetYaxis()->SetTitle("Rate @7E33 [Hz]");
  totHltRateVsCut->SetMarkerColor(kRed);
  pureHltRateVsCut->SetMarkerColor(kOrange+1);

  totL1RateVsCut->GetXaxis()->SetTitle("Mjj cut threshold [GeV]");
  totL1RateVsCut->GetYaxis()->SetTitle("Rate @7E33 [Hz]");
  totL1RateVsCut->SetMarkerColor(kBlue);
  totL1RateVsCut->SetMarkerColor(kAzure);

  TCanvas* c4 = new TCanvas();
  c4->cd();
  totHltRateVsCut->Draw("AP");
  pureHltRateVsCut->Draw("P,sames");
  legHlt->Draw("sames");
  c4->Update();
  TGaxis *axisHlt = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(), gPad->GetUymax(),
    			    (totHltRateVsCut->GetYaxis()->GetBinLowEdge(1))*lumiScaleFactor,
			    (totHltRateVsCut->GetYaxis()->GetBinLowEdge(totHltRateVsCut->GetYaxis()->GetNbins())+totHltRateVsCut->GetYaxis()->GetBinWidth(1))*lumiScaleFactor,510,"+L");

  c4->SetTicky(0);
  axisHlt->SetLineColor(kRed);
  axisHlt->SetLabelColor(kRed);
  axisHlt->SetTextColor(kRed);
  axisHlt->SetTitleOffset(1.3);
  axisHlt->SetLabelSize(0.03);
  axisHlt->SetTitle("Rate @1E34 [Hz]");
  axisHlt->Draw();
  c4->Print("rates/hltRate.pdf","pdf");


  TCanvas* c5 = new TCanvas();
  c5->cd();
  totL1RateVsCut->Draw("AP");
  pureL1RateVsCut->Draw("P,sames");
  legL1->Draw("sames");
  c5->Update();
  TGaxis *axisL1 = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(), gPad->GetUymax(),
			      (totL1RateVsCut->GetYaxis()->GetBinLowEdge(1))*lumiScaleFactor,
			      (totL1RateVsCut->GetYaxis()->GetBinLowEdge(totL1RateVsCut->GetYaxis()->GetNbins())+totL1RateVsCut->GetYaxis()->GetBinWidth(1))*lumiScaleFactor,510,"+L");

  c5->SetTicky(0);
  axisL1->SetLineColor(kRed);
  axisL1->SetLabelColor(kRed);
  axisL1->SetTextColor(kRed);
  axisL1->SetTitleOffset(1.3);
  axisL1->SetLabelSize(0.03);
  axisL1->SetTitle("Rate @1E34 [Hz]");
  axisL1->Draw();
  c5->Print("rates/l1Rate.pdf","pdf");

  return 0;
}
开发者ID:deguio,项目名称:Analyzers,代码行数:101,代码来源:rate.C

示例9: PlotPotential2D


//.........这里部分代码省略.........
    // Text objects
    TPaveText **textLabel = new TPaveText*[2];

    C->cd(0);
    char pname[16];
    sprintf(pname,"pad_%i",1);
    pad[0] = (TPad*) gROOT->FindObject(pname);
    pad[0]->Draw();
    pad[0]->cd(); // <---------------------------------------------- Top Plot ---------
    if(opt.Contains("logz")) {
        pad[0]->SetLogz(1);
    } else {
        pad[0]->SetLogz(0);
    }
    pad[0]->SetFrameLineWidth(3);
    pad[0]->SetTickx(1);

    // Re-range:
    for(Int_t i=0; i<Nspecies; i++) {
        if(!hDen2D[i]) continue;
        hDen2D[i]->GetYaxis()->SetRangeUser(yMin -(factor-1)*yRange, yMax);
    }


    TH2F *hFrame = (TH2F*) gROOT->FindObject("hFrame1");
    if(hFrame) delete hFrame;
    hFrame = (TH2F*) hDen2D[0]->Clone("hFrame1");
    hFrame->Reset();

    hFrame->SetLabelFont(42,"xyz");
    hFrame->SetTitleFont(42,"xyz");

    hFrame->GetYaxis()->SetNdivisions(505);
    hFrame->GetYaxis()->SetLabelSize(0.085);
    hFrame->GetYaxis()->SetTitleSize(0.09);
    hFrame->GetYaxis()->SetTitleOffset(0.7);
    hFrame->GetYaxis()->SetTickLength(0.02);

    hFrame->GetXaxis()->SetLabelOffset(999.);
    hFrame->GetXaxis()->SetTitleOffset(999.);
    hFrame->GetXaxis()->SetTickLength(0.04);

    // Frame asymmetry:
    hFrame->Draw("col");

    // hDen2D[0]->GetZaxis()->SetNdivisions(505);

    // Injected electrons if any
    if(Nspecies>=3) {
        if(hDen2D[2]) {
            exHot->Draw();
            hDen2D[2]->Draw("colz same");
        }
    }

    // Plasma
    hDen2D[0]->GetZaxis()->SetTitleFont(42);
    exPlasma->Draw();
    hDen2D[0]->Draw("colz same");

    // Beam driver.
    if(hDen2D[1]) {
        //    hDen2D[1]->GetZaxis()->SetNdivisions(505);
        exElec->Draw();
        hDen2D[1]->Draw("colz same");
    }
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotPotential2D.C

示例10: ZinvEstimate


//.........这里部分代码省略.........
      legP->AddEntry(gr_estimated,"Estimated(from #gamma +Jets)","P");

    


     char TMgname1[100];
     TMultiGraph *TMg_1D[2];
     for(int k0=0;k0<2;k0++){
     sprintf(TMgname1,"TMg_1D%i",k0);
     TMg_1D[k0]=new TMultiGraph();
      }
     for(int j0=0;j0<2;j0++){
     TMg_1D[j0]->SetMinimum(0.01);
     TMg_1D[j0]->SetMaximum(2000);
      }
      
    TMg_1D[0]->SetTitle(" ;ith Bin ; Events ");

    TMg_1D[0]->Add(gr_mcPred);
    TMg_1D[0]->Add(gr_estimated);


    
    TMg_1D[0]->Draw("AP");
    TMg_1D[0]->GetXaxis()->SetLimits(0.5,18.5); 
   
    tpa->Draw();
    pCMS->Draw();
    legP->Draw();


   TGaxis *axis = new TGaxis( -5, 20, -5, 220, 20,220,510,"");
       axis->SetLabelFont(43); // Absolute font size in pixel (precision 3)
       axis->SetLabelSize(15);
       axis->Draw();



  cPredVsEstimated->cd();

      TPad *pad2 = new TPad("pad2", "pad2", 0, 0.05, 1, 0.3);
      pad2->SetTopMargin(0);
      pad2->SetBottomMargin(0.2);
      pad2->SetGridy(); // vertical grid
      pad2->Draw();
      pad2->cd();       // pad2 becomes the current pad


   TH1F *h3 = (TH1F*)h_NZinv18binC->Clone("h3");
   h3->SetLineColor(kBlack);
   h3->SetMinimum(-1);  // Define Y ..
   h3->SetMaximum(3); // .. range
   h3->Sumw2();
   h3->SetStats(0);      // No statistics on lower plot
   h3->Divide(ZinvEstimate);
   h3->SetMarkerStyle(21);
   h3->SetMarkerColor(1);
   h3->Draw("ep");       // Draw the r
   h3->GetXaxis()->SetTitle("ith Bin"); // Remove the ratio title

   // Y axis ratio plot settings
   h3->GetYaxis()->SetTitle("Pred/Est");
   h3->GetYaxis()->SetNdivisions(505);

   h3->GetYaxis()->SetTitleSize(20);
   h3->GetYaxis()->SetTitleFont(43);
开发者ID:bmahakud,项目名称:RA2bSUSY,代码行数:67,代码来源:ZinvEstimate.C

示例11: drawintlen_DBD


//.........这里部分代码省略.........
   //   int color[nhist] = {9,8,2,38,1};
   int color[nhist] = {8,2,38,1,9};
   TString option[nhist];

   option[0] = "same";
   option[1] = "same";
   option[2] = "";
   option[3] = "";
   option[4] = "";
      
   //  TLegend *leg = new TLegend (0.25, 0.6, 0.5, 0.85);
  TLegend *leg = new TLegend (0.25, 0.3, 0.6, 0.55);
  leg->SetFillStyle(0);
  
  // stuff for histograms
  TH1F* hmat[nhist];

  for (int ihist = 0; ihist < nhist; ihist++) {

    hmat[ihist] = new TH1F(hname[ihist],"",nbin,xmin,xmax);
    //// ensure proper errors
    // hmat[ihist]->Sumw2();
    hmat[ihist]->SetLineColor(color[ihist]);
    hmat[ihist]->SetLineWidth(3);
    hmat[ihist]->SetTitle(";#theta / degrees;Interaction Lengths");
  }
  
  
  // read tree
  TFile* file = new TFile ( FILEN ) ;
  TTree* tree = (TTree *) file->Get("ntuple");
  if (!tree) {
    cout << "ERROR: Couldn't open tree ntuple on file: "<< FILEN << endl;
    return 1; 
  }
  
  tree->SetBranchAddress("theta", &theta);
  tree->SetBranchAddress("thedeg",&thedeg);
  tree->SetBranchAddress("nlset", &nlset);
  tree->SetBranchAddress("nlecal", &nlecal);
  tree->SetBranchAddress("nlhcal", &nlhcal);
  tree->SetBranchAddress("nlcoil", &nlcoil);
  tree->SetBranchAddress("nlyoke", &nlyoke);
  int entries = tree->GetEntries();
    cout << "tree has " << entries << " entries" << endl;
  
  // event loop
  for (int ievt = 0; ievt < entries; ++ievt) {
     tree->GetEntry(ievt);

     //,     if (thedeg < 4.41) continue;  // ???

     hmat[0]->Fill(-thedeg,nlecal);
     hmat[1]->Fill(-thedeg,nlhcal);
     hmat[2]->Fill(-thedeg,nlcoil);
     hmat[3]->Fill(-thedeg,nlyoke);
     hmat[4]->Fill(-thedeg,1);
  }
  
  //   for (int ibin = 0; ibin < nbin+1; ++ibin) {
  //     cout << "Bin " << ibin << " has " << hmat[4]->GetBinContent(ibin) << " entries" << endl;
//   }
  
  c1 = new TCanvas("c1","c1",600,600);
  
  
  hmat[2]->GetYaxis()->SetRangeUser(0.,14.) ;

  //  for (int ihist = 0; ihist < nhist-2; ihist++) {
  for (int ihist = nhist-3 ; ihist >=0 ; --ihist) {
    // average double counts 
    hmat[ihist]->Divide( hmat[4] ) ;
    // draw 

    hmat[ihist]->Draw(option[ihist]);


    if( ihist ==  nhist-3 ){
      c1->Update() ;
      TF1 *f1 = new TF1("f1","-x",0,90);
      hmat[ihist]->GetXaxis()->SetLabelOffset(99);
      Double_t x_min = c1->GetUxmin();
      Double_t x_max = c1->GetUxmax();
      Double_t y_min = c1->GetUymin();
      //std::cout << "x_min " << x_min << " x_max " << x_max << " y_min " << y_min << std::endl ;
      TGaxis *axis = new TGaxis( x_min, y_min, x_max, y_min, "f1", 5);    
      axis->SetLabelSize( 0.06 );
      axis->SetLabelFont( 42 ); 
      axis->Draw(); 
    }

    leg->AddEntry(hmat[ihist],htitle[ihist],"L");
  }
  leg->Draw();
  

  std::string pdfFile( std::string( FILEN ) + std::string( ".pdf" ) ) ;
  c1->Print( pdfFile.c_str() ) ;
  
}
开发者ID:iLCSoft,项目名称:GEAR,代码行数:101,代码来源:drawintlen_DBD.C

示例12: PlotField1D


//.........这里部分代码省略.........
      if(yEMaxPos[i][j]>maxPhase)
	maxPhase = yEMaxPos[i][j];
      if(yEMaxPos[i][j]<minPhase)
	minPhase = yEMaxPos[i][j];
 
      if(yEMaxValue[i][j]>maxField)
	maxField = yEMaxValue[i][j];
      if(yEMaxValue[i][j]<minField)
	minField = yEMaxValue[i][j];
    }
  }

  Float_t margin = (maxPhase - minPhase)/10;
  gEMaxPos[0]->GetYaxis()->SetRangeUser(minPhase-margin,maxPhase+margin);
  gEMaxPos[0]->GetYaxis()->CenterTitle();
  gEMaxPos[0]->GetXaxis()->CenterTitle();
  gEMaxPos[0]->SetLineColor(phaseC);
  gEMaxPos[0]->SetMarkerColor(phaseC);
  gEMaxPos[0]->SetLineWidth(3);
  gEMaxPos[0]->SetMarkerStyle(20);
  gEMaxPos[0]->SetMarkerSize(1.4);
  gEMaxPos[0]->Draw("APC");

  if(Nfields>1) {
    gEMaxPos[1]->SetLineStyle(1);
    gEMaxPos[1]->SetLineColor(phaseC);
    gEMaxPos[1]->SetMarkerColor(phaseC);
    gEMaxPos[1]->SetLineWidth(1);
    gEMaxPos[1]->SetMarkerStyle(24);
    gEMaxPos[1]->SetMarkerSize(1.4);
    gEMaxPos[1]->Draw("PC");
  }

  // Emax value
  // New axis first:
  C->Update();  // Needed for the axis!

  margin = (maxField - minField)/10;
  if (margin==0) margin = 1; 
  Float_t rightmin = minField-margin;
  Float_t rightmax = maxField+margin;
  Float_t slope = (gPad->GetUymax() - gPad->GetUymin())/(rightmax-rightmin);
  TGaxis *axisEmax = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(),
				gPad->GetUymax(),rightmin,rightmax,505,"+L");
  axisEmax->SetLineWidth(1);
  axisEmax->SetLineColor(fieldC);
  axisEmax->SetLabelColor(fieldC);
  axisEmax->SetTitleColor(fieldC);
  if(opt.Contains("units") && n0) 
    axisEmax->SetTitle("E_{min} [GV/m]");
  else
    axisEmax->SetTitle("E_{min} [E_{0}]");
  axisEmax->CenterTitle();
  axisEmax->SetTitleSize(0.05);
  axisEmax->SetTitleOffset(1.2);
  axisEmax->SetLabelSize(0.05);
  axisEmax->SetLabelOffset(0.006);
  
  axisEmax->Draw();
  
  // Adjust the TGraph
  Double_t *x = gEMaxValue[0]->GetX();
  Double_t *y = gEMaxValue[0]->GetY();
  for(Int_t i=0;i<gEMaxValue[0]->GetN();i++) {
    gEMaxValue[0]->SetPoint(i,x[i],(y[i]-rightmin)*slope + gPad->GetUymin());
  }  
  gEMaxValue[0]->SetLineColor(fieldC);
  gEMaxValue[0]->SetMarkerColor(fieldC);
  gEMaxValue[0]->SetLineWidth(3);
  gEMaxValue[0]->SetMarkerStyle(20);
  gEMaxValue[0]->SetMarkerSize(1.4);
  gEMaxValue[0]->Draw("PC");

   if(Nfields>1) {
    x = gEMaxValue[1]->GetX();
    y = gEMaxValue[1]->GetY();
    for(Int_t i=0;i<gEMaxValue[1]->GetN();i++) {
      gEMaxValue[1]->SetPoint(i,x[i],(y[i]-rightmin)*slope + gPad->GetUymin());
    }  
    gEMaxValue[1]->SetLineColor(fieldC);
    gEMaxValue[1]->SetMarkerColor(fieldC);
    gEMaxValue[1]->SetLineWidth(1);
    gEMaxValue[1]->SetMarkerStyle(24);
    gEMaxValue[1]->SetMarkerSize(1.4);
    gEMaxValue[1]->Draw("PC");
  }

  // Emax value
  // New axis first:
  C->Update();  // Needed for the axis!

  C->cd();

  ifile->Close();
  
  // Print to a file
  PlasmaGlob::imgconv(C,fOutName,opt);
  // ---------------------------------------------------------
  
  }
开发者ID:delaossa,项目名称:ptools,代码行数:101,代码来源:PlotField1D.C


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