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


C++ TLatex::SetTextAngle方法代码示例

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


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

示例1: drawLabels

void drawLabels(){

  // "Hadron Gas"
  TLatex *xHad1 = new TLatex(0.11, 0.13, "Hadron");
  TLatex *xHad2 = new TLatex(0.15, 0.085, "Gas");
  xHad1->SetTextSize(0.04);
  xHad2->SetTextSize(0.04);
  if(iColor)xHad1->SetTextColor(4);
  if(iColor)xHad2->SetTextColor(4);
  xHad1->Draw();
  xHad2->Draw();

  //"Quark Gloun Plasma"
  TLatex *xQGP1 = new TLatex(0.55, 0.8, "Quark Gluon");
  TLatex *xQGP2 = new TLatex(0.62, 0.755, "Plasma");
  xQGP1->SetTextSize(0.04);
  xQGP2->SetTextSize(0.04);
  if(iColor)xQGP1->SetTextColor(4);
  if(iColor)xQGP2->SetTextColor(4);
  xQGP1->Draw();
  xQGP2->Draw();

  //"Early Universe"
  TArrow *aUniv = new TArrow(.025, 0.95,.025, 0.45,0.03,"|>");
  aUniv->SetLineWidth(2);
  if(iColor)aUniv->SetLineColor(2);
  if(iColor)aUniv->SetFillColor(2);
  aUniv->Draw();
  TLatex *xUniv = new TLatex(0.075, 0.58, "Early Universe");
  xUniv->SetTextSize(0.04);
  xUniv->SetTextAngle(90);
  if(iColor)xUniv->SetTextColor(2);
  xUniv->Draw();
  
  //"Neutron Stars"
  TArrow *aNeut = new TArrow(.65, .05 ,.99, 0.075,0.03,"|>");
  aNeut->SetLineWidth(2);
  if(iColor)aNeut->SetLineColor(8);
  if(iColor)aNeut->SetFillColor(8);
  aNeut->Draw();
  TLatex *xNeut = new TLatex(0.735, 0.08, "Neutron Stars");
  xNeut->SetTextSize(0.04);
  xNeut->SetTextAngle(5);
  if(iColor)xNeut->SetTextColor(8);
  xNeut->Draw();

  //"Critical Point"
  TLatex *xCrit1 = new TLatex(0.2, 0.585, "Critical");
  TLatex *xCrit2 = new TLatex(0.225, 0.54, "Point");
  xCrit1->SetTextSize(0.04);
  xCrit2->SetTextSize(0.04);
  xCrit1->Draw();
  xCrit2->Draw();
}
开发者ID:skymeson,项目名称:root_macros,代码行数:54,代码来源:phaseDiagram.C

示例2: PlotTLHisto

void PlotTLHisto(TH1F* histo)
{
  histo->SetStats(kFALSE);

  //   Int_t cullay[13]={0,9,15,18,22,24,27,30,32,36,39,45,54};
  Int_t cullay[13]={-27,-18,-12,-9,-5,-3,0,3,5,9,12,18,27};
     TString modname[12]={"TEC-","TOB-","TID-","TIB-","PBwd","PBar-",
                        "PBar+","PFwd","TIB+","TID+","TOB+","TEC+"};

   histo->Draw("");
   gPad->Update();
   Float_t ymax=gPad->GetUymax();
   Float_t ymin=gPad->GetUymin();
   for(Int_t k=0;k<12;k++){
     TLine *lin= new TLine(cullay[k],ymin,cullay[k],ymax);
    lin->SetLineWidth(1);
     lin->SetLineStyle(3);
     lin->SetLineColor(4);
     if (k>0) lin->Draw();

     TLatex t;
     t.SetTextSize(0.04);
     t.SetTextAngle(90);
     Float_t tpos=cullay[k]+0.75*(cullay[k+1]-cullay[k]);
     t.DrawLatex(tpos,ymin+0.025*(ymax-ymin),modname[k]);
   }

}
开发者ID:covarell,项目名称:usercode,代码行数:28,代码来源:AlignmentLayers.C

示例3: xyplot

void xyplot()
{
   TCanvas *c = new TCanvas("c","XY plot",200,10,700,500);

   // Remove the frame
   c->SetFillColor(kWhite);
   c->SetFrameLineColor(kWhite);
   c->SetFrameBorderMode(0);

   // Define and draw a curve the frame
   const Int_t n = 4;
   Double_t x[n] = {-1, -3, -9, 3};
   Double_t y[n] = {-1000,  900,  300, 300};
   gr = new TGraph(n,x,y);
   gr->SetTitle("XY plot");
   gr->SetMinimum(-1080);
   gr->SetMaximum(1080);
   gr->SetLineColor(kRed);
   gr->Draw("AC*");

   // Remove the frame's axis
   gr->GetHistogram()->GetYaxis()->SetTickLength(0);
   gr->GetHistogram()->GetXaxis()->SetTickLength(0);
   gr->GetHistogram()->GetYaxis()->SetLabelSize(0);
   gr->GetHistogram()->GetXaxis()->SetLabelSize(0);
   gr->GetHistogram()->GetXaxis()->SetAxisColor(0);
   gr->GetHistogram()->GetYaxis()->SetAxisColor(0);

   gPad->Update();

   // Draw orthogonal axis system centered at (0,0).
   // Draw the Y axis. Note the 4th label is erased with SetLabelAttributes
   TGaxis *yaxis = new TGaxis(0, gPad->GetUymin(),
                              0, gPad->GetUymax(),
                              gPad->GetUymin(),gPad->GetUymax(),6,"+LN");
   yaxis->ChangeLabel(4,-1,0.);
   yaxis->Draw();

   // Draw the Y-axis title.
   TLatex *ytitle = new TLatex(-0.5,gPad->GetUymax(),"Y axis");
   ytitle->Draw();
   ytitle->SetTextSize(0.03);
   ytitle->SetTextAngle(90.);
   ytitle->SetTextAlign(31);

   // Draw the X axis
   TGaxis *xaxis = new TGaxis(gPad->GetUxmin(), 0,
                              gPad->GetUxmax(), 0,
                              gPad->GetUxmin(),gPad->GetUxmax(),510,"+L");
   xaxis->Draw();

   // Draw the X axis title.
   TLatex *xtitle = new TLatex(gPad->GetUxmax(),-200.,"X axis");
   xtitle->Draw();
   xtitle->SetTextAlign(31);
   xtitle->SetTextSize(0.03);
}
开发者ID:Y--,项目名称:root,代码行数:57,代码来源:xyplot.C

示例4: PlotPoints

void PlotPoints(){
	GetAllMasses();
  TCanvas *c1 = new TCanvas("c1","MassPlot",200,10,700,500);
  c1 -> DrawFrame(0, 0, 850, 600);
	TGraph *MassPlot = new TGraph(StopMass.size(), (float*) &StopMass[0], (float*) &NeutralinoMass[0]);
  MassPlot->SetMarkerStyle(20);
  MassPlot->SetMarkerSize(1.1);
  MassPlot->SetMarkerColor(2);
  MassPlot->Draw("P");
  TLatex Title = TLatex(); Title.DrawLatexNDC(.40, .94, "Mass Points");
  TLatex Xaxis = TLatex(); Xaxis.DrawLatexNDC(0.65, 0.03, "Stop Mass [GeV]");
  TLatex Yaxis = TLatex(); Yaxis.SetTextAngle(90); Yaxis.DrawLatexNDC(0.03, 0.31, "Neutralino Mass [GeV]");
  c1 -> Print(outputdir + "MassPoints.pdf", "pdf");
  c1 -> Print(outputdir + "MassPoints.png", "png");
}
开发者ID:GonzalezFJR,项目名称:TOP13TeV,代码行数:15,代码来源:getT2ttInfo.C

示例5: drawCanvas

void drawCanvas()
{
  cPhase = new TCanvas("cPhase","cPhase",0,0,500,500);
  cPhase->SetLeftMargin(0.2);
  cPhase->SetBottomMargin(0.2);
  
  cPhase->Range(-0.2,-0.2,1.1,1.1);
  TLatex *latex = new TLatex(1.0,-0.1,"#mu_{B}");
  latex->SetTextAlign(31);
  latex->Draw();
  latex = new TLatex(-0.1,1.0,"T");
  latex->SetTextAlign(31);
  latex->SetTextAngle(90);
  latex->Draw();
}
开发者ID:skymeson,项目名称:root_macros,代码行数:15,代码来源:phaseDiagram.C

示例6: transparency

void transparency()
{
   TCanvas *c1 = new TCanvas("c1", "c1",224,330,700,527);
   c1->Range(-0.125,-0.125,1.125,1.125);

   TLatex *tex = new TLatex(0.06303724,0.0194223,"This text is opaque and this line is transparent");
   tex->SetLineWidth(2);
   tex->Draw();

   TArrow *arrow = new TArrow(0.5555158,0.07171314,0.8939828,0.6195219,0.05,"|>");
   arrow->SetLineWidth(4);
   arrow->SetAngle(30);
   arrow->Draw();

   // Draw a transparent graph.
   Double_t x[10] = {
   0.5232808, 0.8724928, 0.9280086, 0.7059456, 0.7399714,
   0.4659742, 0.8241404, 0.4838825, 0.7936963, 0.743553};
   Double_t y[10] = {
   0.7290837, 0.9631474, 0.4775896, 0.6494024, 0.3555777,
   0.622012, 0.7938247, 0.9482072, 0.3904382, 0.2410359};
   TGraph *graph = new TGraph(10,x,y);
   graph->SetLineColorAlpha(46, 0.1);
   graph->SetLineWidth(7);
   graph->Draw("l");

   // Draw an ellipse with opaque colors.
   TEllipse *ellipse = new TEllipse(0.1740688,0.8352632,0.1518625,0.1010526,0,360,0);
   ellipse->SetFillColor(30);
   ellipse->SetLineColor(51);
   ellipse->SetLineWidth(3);
   ellipse->Draw();

   // Draw an ellipse with transparent colors, above the previous one.
   ellipse = new TEllipse(0.2985315,0.7092105,0.1566977,0.1868421,0,360,0);
   ellipse->SetFillColorAlpha(9, 0.571);
   ellipse->SetLineColorAlpha(8, 0.464);
   ellipse->SetLineWidth(3);
   ellipse->Draw();

   // Draw a transparent blue text.
   tex = new TLatex(0.04871059,0.1837649,"This text is transparent");
   tex->SetTextColorAlpha(9, 0.476);
   tex->SetTextSize(0.125);
   tex->SetTextAngle(26.0);
   tex->Draw();
}
开发者ID:Y--,项目名称:root,代码行数:47,代码来源:transparency.C

示例7: drawP1D

void drawP1D(){
    
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);
    
    text.SetNDC(1);
    text.SetTextFont(43);
    text.SetTextSize(16);
    text1.SetNDC(1);
    text1.SetTextFont(43);
    text1.SetTextSize(18);
    text2.SetNDC(1);
    text2.SetTextFont(43);
    text2.SetTextSize(20);
    txt.SetNDC(1);//internal symbol
    txt.SetTextFont(43);
    txt.SetTextSize(21);
    txt.SetTextColor(16);
    txt.SetTextAngle(40);
    lab1.SetNDC(1);
    lab2.SetNDC(1);
    lab3.SetNDC(1);
    lab4.SetNDC(1);
    lab1.SetTextSize(17);
    lab2.SetTextSize(16);
    lab3.SetTextSize(16);
    lab4.SetTextSize(15);
    
    lab1.SetTextFont(73);
    lab2.SetTextFont(43);
    lab3.SetTextFont(43);
    lab4.SetTextFont(43);
    line.SetLineStyle(3);
    
   
    readin(0);
    readin(1);
    
    for (int ipt=0; ipt<1; ipt++) {
        int ic = 0;
        drawplot(ipt, ic);
      //  drawcorr(ipt, ic);
    }

    
}
开发者ID:phuo,项目名称:vncorrelation,代码行数:46,代码来源:drawP1D.C

示例8: DrawCMSLogoTest

    void DrawCMSLogoTest(TPad* pad, TString cmsText, TString extraText, int iPosX,
		   float relPosX, float relPosY, float relExtraDY) {
    TVirtualPad *pad_backup = gPad;
    pad->cd();
    float cmsTextFont = 61;  // default is helvetic-bold

    bool writeExtraText = extraText.Length() > 0;
    float extraTextFont = 52;  // default is helvetica-italics

    // text sizes and text offsets with respect to the top frame
    // in unit of the top margin size
    TString lumiText;
    float lumiTextOffset = 0.2;
    float cmsTextSize = 0.8;
    float lumiTextSize = 0.6;
    // float cmsTextOffset    = 0.1;  // only used in outOfFrame version

    // ratio of "CMS" and extra text size
    float extraOverCmsTextSize = 0.76;

    //!!MAKE CHOICE CONFIGURABLE
    TString lumi_13TeV = "20.1 fb^{-1}";
    TString lumi_8TeV = "18.9-19.7 fb^{-1}";
    TString lumi_7TeV = "0-4.9 fb^{-1}";

    lumiText +=lumi_8TeV;
    lumiText +=" (8 TeV) + ";
    lumiText +=lumi_7TeV;
    lumiText +=" (7 TeV)";



    bool outOfFrame = false;
    if (iPosX / 10 == 0) {
      outOfFrame = true;
    }
    int alignY_ = 3;
    int alignX_ = 2;
    if (iPosX / 10 == 0) alignX_ = 1;
    if (iPosX == 0) alignX_ = 1;
    if (iPosX == 0) alignY_ = 1;
    if (iPosX / 10 == 1) alignX_ = 1;
    if (iPosX / 10 == 2) alignX_ = 2;
    if (iPosX / 10 == 3) alignX_ = 3;
    if (iPosX == 0) relPosX = 0.14;
    int align_ = 10 * alignX_ + alignY_;

    float l = pad->GetLeftMargin();
    float t = pad->GetTopMargin();
    float r = pad->GetRightMargin();
    float b = pad->GetBottomMargin();

    TLatex latex;
    latex.SetNDC();
    latex.SetTextAngle(0);
    latex.SetTextColor(kBlack);

    float extraTextSize = extraOverCmsTextSize * cmsTextSize;
    float pad_ratio = (static_cast<float>(pad->GetWh()) * pad->GetAbsHNDC()) /
      (static_cast<float>(pad->GetWw()) * pad->GetAbsWNDC());
    if (pad_ratio < 1.) pad_ratio = 1.;

    latex.SetTextFont(42);
    latex.SetTextAlign(31); 
    latex.SetTextSize(lumiTextSize*t*pad_ratio);    
    latex.DrawLatex(1-r,1-t+lumiTextOffset*t,lumiText);

    if (outOfFrame) {
      latex.SetTextFont(cmsTextFont);
      latex.SetTextAlign(11);
      latex.SetTextSize(cmsTextSize * t * pad_ratio);
      latex.DrawLatex(l, 1 - t + lumiTextOffset * t, cmsText);
    }


    float posX_ = 0;
    if (iPosX % 10 <= 1) {
      posX_ = l + relPosX * (1 - l - r);
    } else if (iPosX % 10 == 2) {
      posX_ = l + 0.5 * (1 - l - r);
    } else if (iPosX % 10 == 3) {
      posX_ = 1 - r - relPosX * (1 - l - r);
    }
    float posY_ = 1 - t - relPosY * (1 - t - b);
    if (!outOfFrame) {
      latex.SetTextFont(cmsTextFont);
      latex.SetTextSize(cmsTextSize * t * pad_ratio);
      latex.SetTextAlign(align_);
      latex.DrawLatex(posX_, posY_, cmsText);
      if (writeExtraText) {
	latex.SetTextFont(extraTextFont);
	latex.SetTextAlign(align_);
	latex.SetTextSize(extraTextSize * t * pad_ratio);
	latex.DrawLatex(posX_, posY_ - relExtraDY * cmsTextSize * t, extraText);
      }
    } else if (writeExtraText) {
      if (iPosX == 0) {
	posX_ = l + relPosX * (1 - l - r);
	posY_ = 1 - t + lumiTextOffset * t;
      }
//.........这里部分代码省略.........
开发者ID:ajgilbert,项目名称:ICHiggsTauTau,代码行数:101,代码来源:Plot1DScan.cpp

示例9: DMplot


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


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


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

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

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

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


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

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


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

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

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

示例10: getMCcorrectionfactors


//.........这里部分代码省略.........
  leg0->AddEntry(SFljets, "7 TeV e/#mu+jets  (TOP-11-013)"   , "P");
  leg0->AddEntry(SFdilep, "7 TeV ee/e#mu/#mu#mu (TOP-11-013)", "P");
  leg0->AddEntry(SFljets8,"8 TeV e/#mu+jets  (TOP-12-028)"   , "P");
  leg0->AddEntry(SFdilep8,"8 TeV ee/e#mu/#mu#mu (TOP-12-028)", "P");
  if(!sepLeg) leg0->Draw("same");
  leg1->AddEntry( function7, fitEntry7, "L");
  if(plotsepfit) leg1->AddEntry( functiondilep7, fitEntrydilep7, "L");
  if(plotsepfit) leg1->AddEntry( functionljets7, fitEntryljets7, "L");
  leg1->AddEntry( function8, fitEntry8, "L");
  if(plotsepfit) leg1->AddEntry( functiondilep8, fitEntrydilep8, "L");
  if(plotsepfit) leg1->AddEntry( functionljets8, fitEntryljets8, "L");
  if(!sepLeg) leg1->Draw("same");
  // Draw cms label
  TPaveText *label = new TPaveText();
  label -> SetX1NDC(gStyle->GetPadLeftMargin());
  label -> SetY1NDC(1.0-gStyle->GetPadTopMargin());
  label -> SetX2NDC(1.0-gStyle->GetPadRightMargin());
  label -> SetY2NDC(1.0);
  label -> SetTextFont(42);
  TString CMSlab="";
  if(!PHD) CMSlab+="CMS Preliminary, ";  
  CMSlab+="5.0/19.7 fb^{-1} at #sqrt{s} = 7/8 TeV";
  label -> AddText(CMSlab);
  label->SetFillStyle(0);
  label->SetBorderSize(0);
  label->SetTextSize(0.04);
  label->SetTextAlign(32);
  label-> Draw("same");
  // BCC label
  double positionX=xmax+0.045*xmax*(gStyle->GetCanvasDefW()/600.);
  double positionY=0.5;
  TLatex *bcclabel = new TLatex(positionX,positionY, " (horizontal BCC wrt. NNLO^{approx}, arXiv:1205.3453)");
  bcclabel->SetTextAlign(11);
  bcclabel->SetTextAngle(90);
  bcclabel->SetTextSize(0.035);
  bcclabel->Draw("same");
  if(grey) plotCanvas_[0]->SetGrayscale();
  //saving
  plotCanvas_[0]->Print("diffXSecFromSignal/plots/combined/2012/xSec/dataVsMadgraph7and8TeV.eps");
  plotCanvas_[0]->Print("diffXSecFromSignal/plots/combined/2012/xSec/dataVsMadgraph7and8TeV.png");

  // ---
  // ERROR band plot
  // ---
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle("data/MC top Pt errorband");
  // drawing
  dummy->GetYaxis()->SetTitle("(Data / Simulation) SF (#sqrt{s}=8 TeV)");
  dummy->GetYaxis()->SetRangeUser(0.35, 1.65);
  dummy->SetFillColor(10);
  dummy->SetLineColor(10);
  dummy->Draw("axis");
  // extract parameters
  double a=function8->GetParameter(0);
  double b=function8->GetParameter(1);
  // turning point
  double min=0;
  double max=500;
  double TP=-a/b;
  // get functions for high, low and central
  TF1* centralErr=new TF1("centralErr",def,min, max);
  centralErr->SetParameter(0, a);
  centralErr->SetParameter(1, b);
  TF1* upErr=new TF1("upErr",def,min, max);
  upErr->SetParameter(0, 2*a);
开发者ID:kovalch,项目名称:TopAnalysis,代码行数:67,代码来源:getMCcorrectionfactors.C

示例11: in_tot


//.........这里部分代码省略.........
        out += histDenom->Integral(xminbin, xmaxbin, yminbin, ymaxbin);

        //cout<<"("<<pt[ipt]<<","<<eta[ieta]<<") "<<in<<"/"<<out<<endl;
        //cout<<"("<<(pt[ipt]+pt[ipt+1])/2<<","<<(eta[ieta]+eta[ieta+1])/2<<") "<<in<<"/"<<out<<endl;
        hFakeRateNum   ->Fill( (pt[ipt]+pt[ipt+1])/2, (eta[ieta]+eta[ieta+1])/2, in);
        hFakeRateAll->Fill( (pt[ipt]+pt[ipt+1])/2, (eta[ieta]+eta[ieta+1])/2, out);

      }
    }

  }

  if(hFakeRateNum){
    //TGraphAsymmErrors* hFakeRateEff = new TGraphAsymmErrors(hFakeRateNum->GetArray(), hFakeRateAll->GetArray(), "");
    //TGraphAsymmErrors* hFakeRateEff = new TGraphAsymmErrors(hFakeRateNum, hFakeRateAll, "");
    TH2F* hFakeRate = (TH2F*) hFakeRateNum->Clone("hFakeRate");
    //hFakeRate->Divide(hFakeRateAll);
    //hFakeRate->Scale(100.); //make is a percent
    TCanvas c1;
    c1.SetLogx(1);


    //gStyle->SetTextFont(132);
    //gStyle->SetTextSize(1.2);
    hFakeRate->SetMarkerSize(3);
    //gStyle->SetPaintTextFormat("3.0f m");
    gStyle->SetPaintTextFormat("4.0f");
    hFakeRate->Draw("colz");

    TLatex latexLabel;
    latexLabel.SetNDC();
    latexLabel.SetTextSize(0.04);
    latexLabel.SetTextFont(42);
    latexLabel.SetTextAngle(90);
    latexLabel.SetTextAlign(22);
    for(int ybin = 1; ybin<= hFakeRate->GetYaxis()->GetNbins(); ++ybin){
      int nx = hFakeRate->GetXaxis()->GetNbins();
      TGraphAsymmErrors* gFakeRatePt = new TGraphAsymmErrors(nx);
      gFakeRatePt->SetMaximum(1.1);
      gFakeRatePt->SetMinimum(0.);
      gFakeRatePt->SetTitle((title + ";p_{T} (GeV);Rate").c_str());
      for(int xbin = nx; xbin >= 1; --xbin){
        float xcen = hFakeRate->GetXaxis()->GetBinCenter(xbin);
        float ycen = hFakeRate->GetYaxis()->GetBinCenter(ybin);
        
        double xpos, ypos;
        GetNDC(c1, xcen, ycen, xpos, ypos);
        int bin = hFakeRate->GetBin(xbin, ybin);
        float pass = hFakeRateNum->GetBinContent(bin);
        float tot  = hFakeRateAll->GetBinContent(bin);
        float mean    = tot>0 ? pass / tot : 0.;
        float errUp   = TEfficiency::ClopperPearson(tot, pass, 0.68, true) - mean;//hFakeRateEff->GetErrorYhigh(bin-1);
        float errDown = mean - TEfficiency::ClopperPearson(tot, pass, 0.68, false);//hFakeRateEff->GetErrorYlow(bin-1);
        errDown = max(errDown, (float) 0.);
        hFakeRate->SetBinContent(bin, mean);
        //hFakeRate->SetBinError(bin, err);
        float err = (errUp + errDown)/2;
        printf("if(pt > %.0f) return Value(%.4f, %.4f); //pt %3.0f eta %.1f, bin %2i, (mean, err)= (%.4f, %.4f) (%.2f / %.2f) +%.4f -%.4f\n", 
               hFakeRate->GetXaxis()->GetBinLowEdge(xbin), mean, err, 
               hFakeRate->GetXaxis()->GetBinLowEdge(xbin), hFakeRate->GetYaxis()->GetBinLowEdge(ybin), bin, mean, err, pass, tot, errUp, errDown);
        if(xbin != 1) latexLabel.DrawLatex(xpos, ypos, Form("%.0f^{+%.0f}_{-%.0f}%% (%.0f/%.0f)(%.f-%.f)GeV",mean*100, errUp*100, errDown*100, pass, tot, pt[xbin-1],pt[xbin]));
        

        gFakeRatePt->SetPoint      (xbin-1, xcen, mean);
        gFakeRatePt->SetPointEYhigh(xbin-1, errUp);
        gFakeRatePt->SetPointEYlow (xbin-1, errDown);
开发者ID:cfantasia,项目名称:CMGWPrimeGroup,代码行数:67,代码来源:CalcFakeRate.C

示例12: CheckDataFakes


//.........这里部分代码省略.........
  for(unsigned int j= 0 ; j < jetpt.size() ; j++){
    TH1F* h_mc_presel= (TH1F*)fmc->Get("Presel_fakeparam_"+jetpt.at(j));
    TH1F* h_np_presel= (TH1F*)fnp->Get("Presel_fakeparam_"+jetpt.at(j));
    TH1F* h_cf_presel= (TH1F*)fcf->Get("Presel_fakeparam_"+jetpt.at(j));
    
    if(j == 0){
      h_mc_presel->SetLineColor(kOrange);
    }
    if(j ==1){
      h_mc_presel->SetFillColor(870);
    }
    if(j == 2){
      h_mc_presel->SetFillColor(391);
    }
    if(j==3){
      h_mc_presel->SetFillColor(kBlue-2);
    }
    
    for(unsigned int i=1; i < h_mc_presel->GetNbinsX()+1 ; i++){
      float binerror = sqrt( (h_mc_presel->GetBinError(i)*h_mc_presel->GetBinError(i)) + ((h_mc_presel->GetBinContent(i)*0.2)*(h_mc_presel->GetBinContent(i)*0.2)));
      h_mc_presel->SetBinError(i , binerror);
    }
    for(unsigned int i=1 ;i < h_cf_presel->GetNbinsX()+1 ; i++){
      float binerror = sqrt( (h_cf_presel->GetBinError(i)*h_cf_presel->GetBinError(i)) + ((h_cf_presel->GetBinContent(i)*0.2)*(h_cf_presel->GetBinContent(i)*0.2)));
      h_cf_presel->SetBinError(i , binerror);
    }
    for(unsigned int i=1 ;i < h_np_presel->GetNbinsX()+1 ; i++){
      float binerror = sqrt( (h_np_presel->GetBinError(i)*h_np_presel->GetBinError(i)) + ((h_np_presel->GetBinContent(i)*0.4)*(h_np_presel->GetBinContent(i)*0.4)));
      h_np_presel->SetBinError(i , binerror);
    }
    
    h_mc_presel->Add(h_np_presel);
    h_mc_presel->Add(h_cf_presel);
    
    double jx[9], jxerr[9];
    double jy[9], jyerr[9];
    for(unsigned int i=0 ;i < h_mc_presel->GetNbinsX() ; i++){
      jx[i] = i + 0.4 + (0.1*float(j));
      jy[i] = h_mc_presel->GetBinContent(i+1);
      jyerr[i] =  h_mc_presel->GetBinError(i+1);
      jxerr[i] = 0.;
    }
    
    
    TGraphAsymmErrors * g = new TGraphAsymmErrors(9, jx, jy, jxerr, jxerr, jyerr, jyerr);

    if(j ==0){
      g->SetLineColor(kOrange);
      g->SetMarkerColor(kOrange);
      g->SetMarkerStyle(21.);
    }
    if(j ==1){
      g->SetLineColor(870);
      g->SetMarkerColor(870);
      g->SetMarkerStyle(22.);
    }
    if(j ==2){
      g->SetLineColor(kCyan);
      g->SetMarkerColor(kCyan);
      g->SetMarkerStyle(23.);
    }
    if(j ==3){
      g->SetLineColor(kBlue-2);
      g->SetMarkerColor(kBlue-2);
      g->SetMarkerStyle(23.);
    }
   
    g->SetLineWidth(2.);
    g->SetMarkerSize(2.);

    g->Draw( "9sameP" );
    

    legendH->AddEntry(g , "Awayjet pt > " + jetpt.at(j) , "lp");
  }
  legendH->Draw();
  
  CMS_lumi( c1, 2, 11 );
  c1->Update();
  c1->RedrawAxis();

  TLatex latex;
  latex.SetNDC();
  latex.SetTextAngle(0);
  latex.SetTextColor(kBlack);

  latex.SetTextFont(42);
  //  latex.SetTextAlign(31);
  float t = c1->GetTopMargin();
  latex.SetTextSize(lumiTextSize*t);

  TString label = "#bf{Preselection}";
  TString label2 = "#bf{2 Electrons + 2 Jets; Zveto }"; 
  float l = c1->GetLeftMargin()+0.05;
  latex.DrawLatex(l, 0.75 ,label);
  latex.DrawLatex(l, 0.7 ,label2);

  c1->SaveAs(("/home/jalmond/WebPlots/PreApproval/DataFakes/Preselection_looseregion1.pdf"));
    
}
开发者ID:gbyu,项目名称:LQanalyzer,代码行数:101,代码来源:CheckDataFakes.C

示例13: drawclosureffgamma


//.........这里部分代码省略.........
    }
    else if(icent==1)
    {
      // leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],"#eta cone sub","");
      leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],"trk p_{T}>1 GeV, R < 0.3","");
      leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],Form("%d>#gamma p_{T}>%d GeV",phoetmin,phoetmax),"");
    }
    else if(icent==2)
    {
      leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],"0.3 < |#eta^{jet}| < 1.6","");
      leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],"p_{T}^{jet} > 40 GeV","");
    }
    else
    {
      leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],"Pythia+Hydjet","");
      leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],"","");
    }
    leg_ff_pbpbsub[icent]->AddEntry(clone_hgammaffxi_pbpbmc_[icent],Form("%s",cents[icent].data()),"");
    leg_ff_pbpbsub[icent]->Draw();
    // c1_subpbpb[icent]->SaveAs("pbpbmc_gen_pbpbmc_etaconesubtracted_45_gamma_100.png");
    // Eta cone subtracted FF pbpbmc_gen and pbpbmc

  }
  call->cd(1);

  TH2D * axis_dummy = new TH2D("axis_dummy","",1,0.01,4.99,1,0,yaxismax);
  gStyle->SetFrameLineColor(0);
  axis_dummy->UseCurrentStyle();
  axis_dummy->Draw("FB BB A");

  TLatex * ldndxi = new TLatex(0.4,0.5,"dN/d#xi");
  ldndxi->SetTextSize(ldndxi->GetTextSize()*1.2);
  ldndxi->SetNDC();
  ldndxi->SetTextAngle(90);

  TLatex * laxis[yaxismax];
  for (int ilatex = 0; ilatex < yaxismax; ilatex++) {
    laxis[ilatex] = new TLatex(3.,ilatex-0.1,Form("%d",ilatex));
    laxis[ilatex]->SetTextSize(laxis[ilatex]->GetTextSize()*1.2);
    laxis[ilatex]->Draw();
  }
  ldndxi->Draw();

  TCanvas * callratio = new TCanvas("callratio","",1600,500);
  makeMultiPanelCanvas(callratio,6,1,0.02,0.0,-6,0.2,0.04);
  for (int icent = 0; icent < 5; icent++) {
    callratio->cd(icent+2);
    clone2_hgammaffxi_pbpbmc_gen_[icent] = (TH2D*) clone_hgammaffxi_pbpbmc_gen_[icent]->Clone(Form("clone2_hgammaffxi_pbpbmc_gen_%d_%d",centmins[icent],centmaxs[icent]));
    clone2_hgammaffxi_pbpbmc_[icent] = (TH2D*) clone_hgammaffxi_pbpbmc_[icent]->Clone(Form("clone2_hgammaffxi_pbpbmc_%d_%d",centmins[icent],centmaxs[icent]));
    clone2_hgammaffxi_pbpbmc_gen_[icent]->Divide(clone2_hgammaffxi_pbpbmc_[icent]);

    dummy2_pbpbsub[icent] = new TH2D(Form("dummy2_pbpbsub_%d_%d",centmins[icent],centmaxs[icent]),";#xi;dN/d#xi",1,0.01,4.99,1,0,yaxismax2);
    dummy2_pbpbsub[icent]->GetXaxis()->SetTitleOffset(0.8);
    dummy2_pbpbsub[icent]->GetXaxis()->CenterTitle();
    dummy2_pbpbsub[icent]->GetYaxis()->CenterTitle();
    dummy2_pbpbsub[icent]->GetXaxis()->SetTitleSize(dummy2_pbpbsub[icent]->GetXaxis()->GetTitleSize()*1.4);
    dummy2_pbpbsub[icent]->Draw();
    // clone2_hgammaffxi_pbpbmc_gen_[icent]->SetMarkerColor(kViolet);
    clone2_hgammaffxi_pbpbmc_gen_[icent]->SetMarkerColor(kBlack);
    clone2_hgammaffxi_pbpbmc_gen_[icent]->Draw("same");
    TLine * lone = new TLine(0,1,5,1);
    lone->SetLineStyle(9);
    lone->Draw();

    if(icent==0)
    {
开发者ID:velicanu,项目名称:gammajettrack,代码行数:67,代码来源:drawclosureffgamma.C

示例14: example_plot


//.........这里部分代码省略.........
    TLatex latex;
				
    int n_ = 2;

    float x1_l = 0.92;
    float y1_l = 0.60;

    float dx_l = 0.30;
    float dy_l = 0.18;
    float x0_l = x1_l-dx_l;
    float y0_l = y1_l-dy_l;

    TPad* legend = new TPad("legend_0","legend_0",x0_l,y0_l,x1_l, y1_l );
    //    legend->SetFillColor( kGray );
    legend->Draw();
    legend->cd();
		
    float ar_l = dy_l/dx_l;
		
    float x_l[1];
    float ex_l[1];
    float y_l[1];
    float ey_l[1];
		
    //    float gap_ = 0.09/ar_l;
    float gap_ = 1./(n_+1);
		
    float bwx_ = 0.12;
    float bwy_ = gap_/1.5;
		
    x_l[0] = 1.2*bwx_;
    //    y_l[0] = 1-(1-0.10)/ar_l;
    y_l[0] = 1-gap_;
    ex_l[0] = 0;
    ey_l[0] = 0.04/ar_l;
		
    TGraph* gr_l = new TGraphErrors(1, x_l, y_l, ex_l, ey_l );
		
    gStyle->SetEndErrorSize(0);
    gr_l->SetMarkerSize(0.9);
    gr_l->Draw("0P");
		
    latex.SetTextFont(42);
    latex.SetTextAngle(0);
    latex.SetTextColor(kBlack);    
    latex.SetTextSize(0.25);    
    latex.SetTextAlign(12); 
		
    TLine line_;
    TBox  box_;
    float xx_ = x_l[0];
    float yy_ = y_l[0];
    latex.DrawLatex(xx_+1.*bwx_,yy_,"Data");
		
    yy_ -= gap_;
    box_.SetLineStyle( kSolid );
    box_.SetLineWidth( 1 );
    //		box_.SetLineColor( kBlack );
    box_.SetLineColor( histLineColor );
    box_.SetFillColor( histFillColor );
    box_.DrawBox( xx_-bwx_/2, yy_-bwy_/2, xx_+bwx_/2, yy_+bwy_/2 );
    box_.SetFillStyle(0);
    box_.DrawBox( xx_-bwx_/2, yy_-bwy_/2, xx_+bwx_/2, yy_+bwy_/2 );
    latex.DrawLatex(xx_+1.*bwx_,yy_,"Z #rightarrow e^{+}e^{-} (MC)");

    canv->cd();
  }

  {
    // Observed data
    TFile file_("histo.root","READ");

    TH1F *data = static_cast<TH1F*>(file_.Get("data")->Clone());
    data->SetDirectory(0);
    data->SetMarkerStyle(20);
    data->SetMarkerSize(markerSize);

    TH1F *MC   = static_cast<TH1F*>(file_.Get("MC")->Clone());
    MC->SetDirectory(0);
    MC->SetLineColor(histLineColor);
    MC->SetFillColor(histFillColor);

    MC->Draw("histsame");
    data->Draw("esamex0");

    file_.Close();
  }

  // writing the lumi information and the CMS "logo"
  CMS_lumi( canv, iPeriod, iPos );

  canv->Update();
  canv->RedrawAxis();
  canv->GetFrame()->Draw();

  canv->Print(canvName+".pdf",".pdf");
  canv->Print(canvName+".png",".png");

  return canv;
}
开发者ID:jking79,项目名称:hep_analysis,代码行数:101,代码来源:myMacro.C

示例15: plotTree


//.........这里部分代码省略.........
		} else {
			 pad1_x1 = 0.01; 
			 pad1_x2 = 0.59; 
			 pad1_y1 = 0.56; 
			 pad1_y2 = 0.98; 
		}
		
		TPad pad1("t1","",pad1_x1,pad1_y1,pad1_x2,pad1_y2);
		TPad pad1a("t1a","",0.01,0.045,0.59,0.522);
		TPad pad2("t2","",0.59,0.04,0.98,0.62);
		TPad pad3("t3","",0.55,0.64,0.96,0.95);

		pad1.SetNumber(1); pad2.SetNumber(2); pad3.SetNumber(3); pad1a.SetNumber(4);

		if ( isFitted ) {pad1a.Draw();pad2.Draw();pad3.Draw();}

		pad1.Draw();
		pad2.SetGrid(true);


		TLatex *titletext = new TLatex();titletext->SetNDC();

		if ( isFitted ){
			c->cd(4); 
			tree_->Draw(Form("%s:%s_In>>%s_%s_2d",name,name,name,tree_->GetName()),""); 
			//TH2D *h2d_corr = (TH2D*)gROOT->FindObject(Form("%s_2d",name));
			//h2d_corr->SetMarkerColor(4);
			//h2d_corr->SetTitle("");
			//h2d_corr->GetXaxis()->SetTitle(Form("%s_In",name));
			//h2d_corr->GetYaxis()->SetTitle(Form("%s",name));
			titletext->SetTextAlign(11);
			titletext->SetTextSize(0.05);
			titletext->DrawLatex(0.05,0.02,Form("%s_In",name));
			titletext->SetTextAngle(90);
			titletext->DrawLatex(0.04,0.06,Form("%s",name));
			titletext->SetTextAngle(0);
		}

		
		c->cd(1); bH->Draw(); bHf->Draw("same");
		TLegend *legend = new TLegend(0.6,0.8,0.9,0.89);
		legend->SetFillColor(0);
		legend->AddEntry(bH,"All Toys","L");
		legend->AddEntry(bHf,selectString.c_str(),"L");
		legend->Draw();

		if (doPull && plotLH) {
			c->cd(2); gr->Draw("ALP");
		}

		if (fitPull){
			c->cd(3);
			double gap;
			TLatex *tlatex = new TLatex(); tlatex->SetNDC(); 
			if (fitPullf) {tlatex->SetTextSize(0.09); gap=0.12;}
			else  {tlatex->SetTextSize(0.11);gap=0.14;}

			tlatex->SetTextColor(4);
			tlatex->DrawLatex(0.11,0.80,Form("Mean    : %.3f #pm %.3f",bH->GetFunction("gaus")->GetParameter(1),bH->GetFunction("gaus")->GetParError(1)));
			tlatex->DrawLatex(0.11,0.80-gap,Form("Sigma   : %.3f #pm %.3f",bH->GetFunction("gaus")->GetParameter(2),bH->GetFunction("gaus")->GetParError(2)));

			if (fitPullf){ 
				tlatex->SetTextColor(2);
				tlatex->DrawLatex(0.11,0.60,Form("Mean    : %.3f #pm %.3f",bHf->GetFunction("gaus")->GetParameter(1),bHf->GetFunction("gaus")->GetParError(1)));
				tlatex->DrawLatex(0.11,0.60-gap,Form("Sigma   : %.3f #pm %.3f",bHf->GetFunction("gaus")->GetParameter(2),bHf->GetFunction("gaus")->GetParError(2)));
			}
开发者ID:VecbosApp,项目名称:HiggsAnalysisTools,代码行数:67,代码来源:plotParametersFromToys.C


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