本文整理汇总了C++中TLatex::SetTextAlign方法的典型用法代码示例。如果您正苦于以下问题:C++ TLatex::SetTextAlign方法的具体用法?C++ TLatex::SetTextAlign怎么用?C++ TLatex::SetTextAlign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLatex
的用法示例。
在下文中一共展示了TLatex::SetTextAlign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmsPrel
void cmsPrel(double intLumi=-1, bool wide = false, long int sqrtS = 7) {
TLatex *latex = new TLatex();
latex->SetNDC();
latex->SetTextSize(0.045);
double wideLeftOffset = 0.19; //for JMEStyle, was 0.15 by default;
latex->SetTextAlign(31); // align right
latex->DrawLatex(wide ? 0.98 : 0.95, 0.96, ((TString)"#sqrt{s} = "+ sqrtS)+ " TeV");
if (intLumi > 0.) {
latex->SetTextAlign(11); // align left
//latex->DrawLatex(wideLeftOffset,0.96,Form("CMS preliminary, %.2g nb^{-1}",intLumi));
latex->DrawLatex(wide ? 0.06 : wideLeftOffset, 0.96,
// Form(" ",intLumi));
// Form("CMS, %.2g pb^{-1}",intLumi));
//was Form("CMS preliminary, %.2g pb^{-1}",intLumi));
Form("CMS preliminary, %.2g fb^{-1}",intLumi));
}
else if (intLumi==0) { // simulation
latex->SetTextAlign(11); // align left
latex->DrawLatex(wide ? 0.06 : wideLeftOffset, 0.96, "CMS simulation (Su12 QCD)");
}
else {
latex->SetTextAlign(11); // align left
// latex->DrawLatex(wideLeftOffset,0.96,"CMS preliminary");
latex->DrawLatex(wide ? 0.06 : wideLeftOffset,0.96,"CMS work in progress");
}
} // cmsPrel
示例2: TCanvas
TCanvas *subsupscript()
{
TCanvas *S = new TCanvas("script","Subscripts and Superscripts",400,250);
TLatex Tl;
Tl.SetTextSize(0.09);
Tl.SetTextAlign(12);
TLatex Tt;
Tt.SetTextSize(0.09);
Tt.SetTextFont(82);
Tt.SetTextAlign(12);
// Draw First Column
float y, x1, x2;
float step = 0.3;
y = 0.80; x1 = 0.02; x2 = x1+0.3;
Tl.DrawLatex(x2, y, "x^{2y}") ; Tt.DrawText(x1, y, "x^{2y}");
y -= step ; Tl.DrawLatex(x2, y, "x_{2y}") ; Tt.DrawText(x1, y, "x_{2y}");
y -= step ; Tl.DrawLatex(x2, y, "x^{y^{2}}") ; Tt.DrawText(x1, y, "x^{y^{2}}");
// Draw Second Column
y = 0.80; x1 = 0.52; x2 = x1+0.3;
Tl.DrawLatex(x2, y, "x^{y_{1}}") ; Tt.DrawText(x1, y, "x^{y_{1}}");
y -= step ; Tl.DrawLatex(x2, y, "x^{y}_{1}") ; Tt.DrawText(x1, y, "x^{y}_{1}");
y -= step ; Tl.DrawLatex(x2, y, "x_{1}^{y}") ; Tt.DrawText(x1, y, "x_{1}^{y}");
return S;
}
示例3: loglikdistrib
void loglikdistrib(Int_t ntrials = 10000, Bool_t print = kFALSE)
{
// compute distribution of log likelihood value
TH1D * hmc = gStack[gPadNr][gOrder[gPadNr][0]];
TH1D * hdata = gStack[gPadNr][gMaxProcess-1];
Int_t nbins = hmc->GetNbinsX();
Double_t loglik = loglikelihood(hmc, hdata, 1, nbins);
TH1D * htest = new TH1D(*hdata);
TH1D * lldistrib = new TH1D("lldistrib", "log(Likelihood) distribution",
1000, loglik-200, loglik+200);
setopt(lldistrib);
for (Int_t n = 0; n < ntrials; n++) {
// generate poisson around theorie
for (Int_t i = 1; i <= nbins; i++) {
htest->SetBinContent(i, gRandom->Poisson(hmc->GetBinContent(i)));
}
lldistrib->Fill(loglikelihood(hmc, htest, 1, nbins));
}
TCanvas * llcanvas = new TCanvas("llcanvas", "Log(Likelihood) distribution",
40, 40, 800, 600);
setopt(llcanvas);
lldistrib->SetFillColor(kYellow);
lldistrib->Draw();
lldistrib->GetYaxis()->SetTitle("Anzahl Ereignisse");
lldistrib->GetXaxis()->SetTitle("-ln L");
// autozoom
Int_t lowbin = 1;
while (lldistrib->GetBinContent(lowbin) == 0)
lowbin++;
Int_t highbin = lldistrib->GetNbinsX();
while (lldistrib->GetBinContent(highbin) == 0)
highbin--;
lldistrib->SetAxisRange(lldistrib->GetBinLowEdge(lowbin),
lldistrib->GetBinLowEdge(highbin));
TH1D * hworse = (TH1D *) lldistrib->Clone();
for (Int_t nbin = 1; nbin < 501; nbin++) {
hworse->SetBinContent(nbin, 0);
}
hworse->SetFillColor(95);
hworse->Draw("same");
Double_t pvalue = lldistrib->Integral(501,1000) / lldistrib->Integral();
TLatex * tex = new TLatex(0.18, 0.96, Form("-ln L_{obs} = %5.2f", loglik));
tex->SetNDC();
tex->SetTextAlign(13);
tex->Draw();
tex = new TLatex(0.18, 0.86, Form("CL_{obs} = %.3f", pvalue));
tex->SetNDC();
tex->SetTextAlign(13);
tex->Draw();
TLine * l = new TLine(loglik, 0, loglik, lldistrib->GetMaximum());
l->SetLineWidth(3);
l->SetLineColor(kBlue);
l->Draw();
llcanvas->Modified();
llcanvas->Update();
if (print)
llcanvas->Print("lldistrib.pdf");
cd(gPadNr+1);
}
示例4: 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);
}
示例5: TPTiming
void TPTiming ()
{
TAxis * ax = TPMatchEmul2D->GetZaxis() ;
ax->SetRangeUser(-1,6) ;
TCanvas* canv = new TCanvas("canv", "canv") ;
canv->SetLogz(0) ;
gStyle->SetOptStat(10) ;
int color[10]= {1,10,3,4,5,6,7,8,9,2} ;
gStyle->SetPalette(7, color) ;
TPMatchEmul2D->GetXaxis()->SetTitle("Phi index");
TPMatchEmul2D->GetYaxis()->SetTitle("Eta index");
TPMatchEmul2D->Draw("colz") ;
TH2I * label = new TH2I("label", "",72, 1, 73, 38, -19, 19) ;
label->SetMarkerSize(0.6);
label->SetBit(kCanDelete);
for (int x=3 ; x<73 ; x+=4) {
for (int y=21; y<=37; y++) {
int towernb = 4*(y-21)+1 ;
label->SetBinContent(x-1, y, towernb) ; //EB+
label->SetBinContent(x, 40-y, towernb) ; //EB-
}
}
label->Draw("same text") ;
TLatex txt;
txt.SetTextSize(0.02);
TLine line;
line.SetLineColor(1) ;
line.SetLineStyle(1) ;
line.SetLineWidth(1) ;
TAxis* xAxis = TPMatchEmul2D->GetXaxis();
TAxis* yAxis = TPMatchEmul2D->GetYaxis();
// draw SM borders and numbers
float sm ;
for (int i=0; i<36 ; i++ ) {
if (i<18) {
sm = 4*i+3 ;
line.DrawLine(sm, 1, sm, 18) ;
txt.SetTextAlign(32);
txt.DrawText(sm-1+0.3, -17.7, Form("-%d",i+1));
}
else {
sm = 4*(i-18)+3 ;
line.DrawLine(sm, 0, sm, -17) ;
txt.SetTextAlign(12);
txt.DrawText(sm-2+0.3, 18.5, Form("+%d",i-17));
}
}
line.DrawLine(1, 0, 73, 0) ;
line.DrawLine(1, -17, 73, -17) ;
line.DrawLine(1, 1, 73, 1) ;
line.DrawLine(1, 18, 73, 18) ;
}
示例6: cmsPrelim
////CMS Preliminary label and luminosity + any aditional inline title
void cmsPrelim(const char * label)
{
TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.04);
latex.SetTextAlign(31); // align right
latex.DrawLatex(0.90,0.96,"CMS 2012, #sqrt{s} = 8 TeV");
latex.SetTextAlign(11); // align left
latex.DrawLatex(0.18,0.96, label );
}
示例7: topTitle
void topTitle(const char *title)
{
TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.06);
latex.SetTextAlign(31); // align right
latex.DrawLatex(0.90,0.92, title);
latex.SetTextAlign(11); // align left
latex.DrawLatex(0.18,0.92,"Preliminary");
}
示例8: cmsPrelim
////CMS Preliminary label and luminosity
void cmsPrelim()
{
TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.04);
latex.SetTextAlign(31); // align right
latex.DrawLatex(0.90,0.96,"#sqrt{s} = 8 TeV");
latex.SetTextAlign(11); // align left
latex.DrawLatex(0.18,0.96,"CMS Preliminary 2012");
}
示例9: spectra_mw
void spectra_mw(const char *prefix = "pt/PhiNsigma_KTPCnsig30_STD2010_00_DEFAULT_00")
{
TGraphErrors *g = ReadMWGraph(Form("%s/mass", prefix), 1);
g->Draw("ACP");
TLatex latex;
latex.SetTextFont(42);
latex.SetTextAlign(12);
latex.SetTextSize(0.03);
latex.SetTextColor(kBlue+1);
latex.DrawLatex(1.2, 1.01877, "MC generated");
latex.SetTextColor(kGreen+1);
latex.DrawLatex(1.2, 1.01877-0.00015, "MC reconstructed");
latex.SetTextColor(kRed+1);
latex.DrawLatex(1.2, 1.01877-2*0.000155, "Real data (uncorrected)");
latex.SetTextColor(kBlack);
latex.DrawLatex(1.2, 1.01877-3*0.00016, "Real data (corrected)");
gPad->Print(Form("%s.pdf", g->GetName()));
gPad->Clear();
gPad->SetLogy(0);
TGraphErrors *g = ReadMWGraph(Form("%s/mass", prefix), 3);
g->Draw("AP");
latex.SetTextAlign(22);
latex.SetTextSize(0.04);
latex.SetTextColor(kBlack);
latex.DrawLatex(2.0, 1.0207, "pp @ #sqrt{s} = 2.76 TeV");
latex.DrawLatex(2.0, 1.0205, "TPC 3.0 #sigma");
latex.DrawLatex(2.0, 1.0202, "#phi #rightarrow K^{ +} K^{ -}");
latex.SetTextSize(0.035);
latex.DrawLatex(1.7, 1.0182, "uncertainties: stat. (bars) & syst. (boxes)");
gPad->Print(Form("%s.pdf", g->GetName()));
gPad->Clear();
TGraphErrors *g = ReadMWGraph(Form("%s/width", prefix), 2);
g->Draw("AP");
TLatex latex;
latex.SetTextAlign(22);
latex.SetTextSize(0.04);
latex.SetTextColor(kBlack);
latex.DrawLatex(1.7, 0.0090, "pp @ #sqrt{s} = 2.76 TeV");
latex.DrawLatex(1.7, 0.0085, "TPC 3.0 #sigma");
latex.DrawLatex(1.7, 0.0077, "#phi #rightarrow K^{ +} K^{ -}");
latex.SetTextSize(0.035);
latex.DrawLatex(1.7, 0.0007, "uncertainties: stat. (bars) & syst. (boxes)");
gPad->Print(Form("%s.pdf", g->GetName()));
// gPad->Clear();
// gPad->SetLogy();
// TGraphErrors *g = ReadPtGraphSys("pt/out.txt");
// if (!g) return;
// g->Draw("AP");
// gPad->Print(Form("%s.pdf", g->GetName()));
}
示例10: setTitles
// ----------------------------------------------------------------------
void styles::setTitles(TH1 *h, TString xTitle, TString yTitle, TString Left, TString Right) {
if (0==h) {
cout << " Histogram not defined" << endl;
} else {
h->SetXTitle(xTitle); h->SetYTitle(yTitle);
TLatex label; label.SetNDC(kTRUE);
label.SetTextSize(0.06);
label.SetTextAlign(11);
label.DrawLatex(PadLeftMargin,1-PadTopMargin+0.02,Left);
label.SetTextAlign(31);
label.DrawLatex(1-PadRightMargin,1-PadTopMargin+0.02,Right);
}
}
示例11: cmsPrelim
void cmsPrelim( double intLumi ){ TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.04);
latex.SetTextAlign(31); // align right
latex.DrawLatex(0.9,0.96,Form("%.1f fb^{-1}, #sqrt{s} = 8 TeV",intLumi/1000));
// if (intLumi > 0.) {
// latex.SetTextAlign(31); // align right
// latex.DrawLatex(0.9,0.9,Form("#int #font[12]{L} dt = %.1f fb^{-1}",intLumi));
// }
latex.SetTextAlign(11); // align left
latex.DrawLatex(0.25,0.96,"CMS preliminary");
}
示例12: cmsPrelim
////CMS Preliminary label and lumu - Thanks to Kalanand
void Histograms::cmsPrelim()
{
TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.03);
latex.SetTextAlign(31); // align right
latex.DrawLatex(0.90,0.96,"#sqrt{s} = 8 TeV, 2.0E34 cm^{-2}s^{-1}");
latex.SetTextAlign(11); // align left
latex.DrawLatex(0.18,0.96,"CMS preliminary 2012");
}
示例13: DrawTitlePage
//____________________________________________________________________
void DrawTitlePage(const TCollection* c)
{
fBody->cd();
Double_t y = .7;
TLatex* ltx = new TLatex(.5, y, "AOD #rightarrow P(#it{N}_{ch} )");
ltx->SetTextSize(0.07);
ltx->SetTextFont(62);
ltx->SetTextAlign(22);
ltx->SetNDC();
ltx->Draw();
Bool_t mc = GetObject(c, "mcVertex", false) != 0;
if (mc) {
y -= 0.05;
TLatex* sub = new TLatex(.5, y, "(Simulation input)");
sub->SetTextSize(0.04);
sub->SetTextFont(42);
sub->SetTextAlign(22);
sub->SetNDC();
sub->Draw();
}
Double_t save = fParName->GetTextSize();
fParName->SetTextSize(0.03);
fParVal->SetTextSize(0.03);
y = .6;
UShort_t sys;
UShort_t sNN;
ULong_t trig;
Double_t minIpZ;
Double_t maxIpZ;
GetParameter(c, "sys", sys);
GetParameter(c, "sNN", sNN);
GetParameter(c, "trigger", trig);
GetParameter(c, "minIpZ", minIpZ);
GetParameter(c, "maxIpZ", maxIpZ);
TString tT; TriggerString(trig, tT); DrawParameter(y, "Trigger", tT);
TString tS; SysString(sys, tS); DrawParameter(y, "System", tS);
TString tE; SNNString(sNN, tE); DrawParameter(y, "#sqrt{s_{NN}}", tE);
DrawParameter(y, "IP_{z} range", Form("%+5.2fcm - %+5.2fcm",
minIpZ, maxIpZ));
PrintCanvas("Title page");
fParName->SetTextSize(save);
fParVal->SetTextSize(save);
}
示例14: cmspre
void cmspre()
{
TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.05);
latex.SetTextAlign(31); // align right
latex.DrawLatex(0.85,0.93,"#sqrt{s} = 8 TeV");
latex.SetTextAlign(31); // align right
latex.DrawLatex(0.65,0.93,Form("#scale[0.5]{#lower[-0.15]{#it{#int}}}#it{L} dt = %0.1f#kern[0.2]{fb}^{-1}", 19.3));
latex.SetTextAlign(11); // align left
// latex.DrawLatex(0.15,0.93,"CMS, #sqrt{s} = 7 TeV");//preliminary 2011");
latex.DrawLatex(0.15,0.93,"CMS Preliminary");
}
示例15: 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();
}