本文整理汇总了C++中TLatex::SetTextColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TLatex::SetTextColor方法的具体用法?C++ TLatex::SetTextColor怎么用?C++ TLatex::SetTextColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLatex
的用法示例。
在下文中一共展示了TLatex::SetTextColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compnclusts
void compnclusts(Int_t run)
{
TFile* f = new TFile(Form("hodtest_%d.root",run));
cout << "hcana root file " << Form("hodtest_%d.root",run) << endl;
TH1F* h = nclust;
TFile* f1 = new TFile(Form("%d_hbk.root",run));
cout << "Engine root file " << Form("%d_hbk.root",run) << endl;
TH1F* h1;
switch (run) {
case 50017 :
// h1 = h212; //A+
break;
default :
h1 = h412; //hnclusters
}
TCanvas *c1 = new TCanvas("c1", "Shower Cluster Map", 1000, 667);
gPad->SetLogy();
h1->SetFillColor(kGreen);
h1->SetLineColor(kGreen);
h1->SetFillStyle(1111);
h1->Draw();
h->SetFillColor(kBlue);
h->SetLineWidth(2);
h->SetFillStyle(0);
h->Draw("same");
TLatex l;
l.SetTextSize(0.04);
Float_t maxy = h1->GetBinContent(h1->GetMaximumBin());
Float_t xmin = h1->GetXaxis()->GetXmin();
Float_t xmax = h1->GetXaxis()->GetXmax();
Float_t xt = xmin + 0.67*(xmax-xmin);
l.SetTextColor(kGreen);
l.DrawLatex(xt,0.095*maxy,"Engine");
l.SetTextColor(kBlue);
l.DrawLatex(xt,0.045*maxy,"hcana");
// Difference between the histograms.
TCanvas *c2 = new TCanvas("c2", "Cluster differences", 1000, 667);
TH1F* dif = h->Clone();
dif->Add(h,h1,1.,-1.);
dif->SetTitle("Difference");
dif->SetFillColor(kRed);
dif->SetLineColor(kRed);
dif->SetLineWidth(1);
dif->SetFillStyle(1111);
dif->Draw();
}
示例2: comparecfback
void comparecfback(TString file1, TString file2, TString histname1, TString histname2, TString histname3,TString sys) {
TFile* ifile1_ = new TFile(Form("%s",file1.Data()), "read");
TFile* ifile2_ = new TFile(Form("%s",file2.Data()), "read");
TH1D* hist1;
TH1D* hist2;
TH1D* hist3;
// if ( (strcmp(sys,"V0LL") == 0) || (strcmp(sys,"V0ALAL") == 0) || (strcmp(sys,"V0LAL") == 0) ) {
// hist1 = (TH1D*)ifile1_->Get(Form("Numcqinv%stpcM%d%s",sys,mult,kT));
// hist2 = (TH1D*)ifile2_->Get(Form("Numcqinv%stpcM%d%s",sys,mult,kT));
// }
// else {
hist1 = (TH1D*)ifile1_->Get(Form("%s",histname1.Data()));
hist2 = (TH1D*)ifile2_->Get(Form("%s",histname2.Data()));
hist3 = (TH1D*)ifile2_->Get(Form("%s",histname3.Data()));
// }
TCanvas *myCan = new TCanvas("asd","asd");
myCan->Draw();
myCan->cd();
hist1->SetMarkerColor(kBlack);
hist2->SetMarkerColor(kRed);
hist3->SetMarkerColor(kBlue);
hist1->SetMarkerStyle(20);
hist2->SetMarkerStyle(20);
hist3->SetMarkerStyle(20);
hist1->SetMarkerSize(1.6);
hist2->SetMarkerSize(1.6);
hist3->SetMarkerSize(1.6);
hist1->SetTitle("");
hist1->GetXaxis()->SetRangeUser(0.,1.0);
hist2->GetXaxis()->SetRangeUser(0.,1.0);
hist3->GetXaxis()->SetRangeUser(0.,1.0);
gStyle->SetOptStat(0);
//hist1->Scale(1./1.026);//1.026, 1.05
hist1->SetMaximum(1.015);
hist1->SetMinimum(0.9425);
hist1->GetXaxis()->SetTitleSize(0.05);
hist1->GetYaxis()->SetTitleSize(0.05);
hist1->Draw("p");
hist2->Draw("psame");
hist3->Draw("psame");
TLatex Tl;
Tl.SetTextAlign(23);
Tl.SetTextSize(0.08);
Tl.SetTextColor(kBlack);
Tl.DrawLatex(0.5,0.995,"p#bar{p}");
Tl.SetTextColor(kRed);
Tl.DrawLatex(0.5,0.980,"p#bar{#Lambda}");
Tl.SetTextColor(kBlue);
Tl.DrawLatex(0.5,0.965,"#bar{p}#Lambda");
myCan->SaveAs(Form("comp%s.eps",sys.Data()));
}
示例3: 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();
}
示例4: ATLASLabelOld
void ATLASLabelOld(Double_t x,Double_t y,bool Preliminary,Color_t color)
{
TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize);
l.SetNDC();
l.SetTextFont(72);
l.SetTextColor(color);
l.DrawLatex(x,y,"ATLAS");
if (Preliminary) {
TLatex p;
p.SetNDC();
p.SetTextFont(42);
p.SetTextColor(color);
p.DrawLatex(x+0.115,y,"Preliminary");
}
}
示例5: ATLASLumi
void ATLASLumi(Double_t x,Double_t y, float datlum, int energy=7)
{
// add the Atlas Lumi and centre of mass
//float datlum=8.2;
// if (!fIsPseudoData) {
// TString tit="#sqrt{s} = 7 TeV, #int L dt=";
TString tit;
if(energy == 7) tit +="#sqrt{s} = 7 TeV";
if(energy == 8) tit +="#sqrt{s} = 8 TeV";
if(energy == 13) tit +="#sqrt{s} = 13 TeV";
tit +=Form(", %.1f",datlum);
tit +=" fb^{-1}";
//
float fTextScaleFactor=0.8;
TLatex l; //l.SetTextAlign(12);
l.SetNDC();
//l.SetTextFont(42);// standard
l.SetTextFont(72); // italics
float siz=l.GetTextSize();
l.SetTextSize(siz*fTextScaleFactor);
//l.SetTextSize(siz*0.7); // set the size here
l.SetTextColor(1);
l.DrawLatex(x,y,tit);
}
示例6: ellipises
void ellipises(){
TEllipse *e1 = new TEllipse(0.66, 0.66, 0.025, 0.2, 0., 360., 0.);
e1->SetLineWidth(2);
e1->SetFillStyle(3003);
e1->SetFillColor(1);
if(iColor)e1->SetFillColor(kBlue);
if(iColor)e1->SetLineColor(kBlue);
e1->SetNoEdges();
e1->Draw();
TEllipse *e2 = new TEllipse(0.33, 0.33, 0.025, 0.2, 0., 360., 180.);
e2->SetLineWidth(2);
e2->SetFillStyle(3003);
e2->SetFillColor(1);
if(iColor)e2->SetFillColor(kRed);
if(iColor)e2->SetLineColor(kRed);
e2->SetNoEdges();
e2->Draw();
TBox *b1 = new TBox(0.3, 0.6, 0.7, 0.4);
b1->SetFillColor(0);
b1->SetLineColor(0);
b1->Draw();
TEllipse *e3 = new TEllipse(0.5, 0.5, 0.1, 0.066, 0., 360., 0.);
e3->SetLineWidth(2);
if(iColor)e3->SetFillColor(kRed+2);
if(iColor)e3->SetLineColor(kRed+2);
e3->Draw();
TLatex *xFire = new TLatex(0.445, 0.49, "Fireball");
if(iColor)xFire->SetTextColor(0);
xFire->SetTextSize(0.04);
xFire->Draw();
TLatex *xA1 = new TLatex(0.72, 0.665, "Nucleus");
xA1->SetTextSize(0.04);
if(iColor)xA1->SetTextColor(kBlue);
xA1->Draw();
TLatex *xA2 = new TLatex(0.77, 0.625, "A");
xA2->SetTextSize(0.04);
if(iColor)xA2->SetTextColor(kBlue);
xA2->Draw();
TLatex *xB1 = new TLatex(0.13, 0.37, "Nucleus");
xB1->SetTextSize(0.04);
if(iColor)xB1->SetTextColor(kRed);
xB1->Draw();
TLatex *xB2 = new TLatex(0.18, 0.33, "B");
xB2->SetTextSize(0.04);
if(iColor)xB2->SetTextColor(kRed);
xB2->Draw();
TLatex *xSide = new TLatex(0.45, 0.95, "#bf{Side View}");
xSide->SetTextSize(0.04);
xSide->Draw();
}
示例7: decorate
void decorate(TCanvas *can,TH2D &h, bool addLHC=true){
TLatex * tex = new TLatex();
tex->SetNDC();
tex->SetTextFont(42);
tex->SetLineWidth(2);
tex->SetTextSize(0.03);
tex->DrawLatex(0.32,0.93,"4.9 fb^{-1} (7 TeV) + 19.7 fb^{-1} (8 TeV) + 2.3 fb^{-1} (13 TeV)");
tex->SetTextFont(42);
tex->SetTextSize(0.06);
//if (!addLHC){
// tex->SetTextSize(0.04);
// tex->SetTextColor(kWhite);
// if (isPrelim) tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}");
// else tex->DrawLatex(0.155, 0.85, "#bf{CMS}");
//} else {
if (isPrelim) {
tex->SetTextSize(0.04);
tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}");
}
else tex->DrawLatex(0.14, 0.93, "#bf{CMS}");
//}
TGraph *SM = new TGraph();
SM->SetPoint(0,1,1);
SM->SetMarkerColor(kOrange);
SM->SetMarkerStyle(33);
SM->SetMarkerSize(4);
SM->Draw("Psame");
TLegend *leg;
if (addLHC) {
if (isPrelim) leg = new TLegend(0.14,0.56,0.4,0.83);
else leg = new TLegend(0.14,0.62,0.4,0.89);
}
else leg = new TLegend(0.52,0.84,0.78,0.89);
leg->SetTextSize(0.042);
leg->SetFillStyle(0);
leg->SetTextColor(kWhite);
leg->SetBorderSize(0);
TGraph *gr = new TGraph(); gr->SetLineWidth(2); gr->SetMarkerStyle(34); gr->SetLineColor(kWhite); gr->SetMarkerColor(kWhite);
TGraph *gr2 = new TGraph(); gr2->SetLineWidth(2); gr2->SetLineColor(kWhite); gr2->SetLineStyle(2);
gr->SetMarkerSize(2);
if (addLHC){
leg->AddEntry(SM,"SM production","P");
leg->AddEntry(gr,"LHC best fit","P");
leg->AddEntry(gr, "68% CL","L");
leg->AddEntry(gr2,"95% CL","L");
leg->Draw();
} else {
TLatex *lat = new TLatex();
lat->SetTextSize(0.04);
lat->SetTextColor(kWhite);
lat->DrawLatex(1.05,1.05,"SM production");
}
can->SetTicky();
can->SetTickx();
can->RedrawAxis();
}
示例8: ATLAS_LABEL
void ATLAS_LABEL(Double_t x,Double_t y,Color_t color, std::string extra)
{
TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize);
l.SetNDC();
l.SetTextFont(72);
l.SetTextColor(color);
l.DrawLatex(x,y, ("ATLAS " + extra ).c_str());
}
示例9: mySmallText
void mySmallText(Double_t x,Double_t y,Color_t color,char *text) {
Double_t tsize=0.044;
TLatex l;
l.SetTextSize(tsize);
l.SetNDC();
l.SetTextColor(color);
l.DrawLatex(x,y,text);
}
示例10: myText
void drawPlots::myText(Double_t x,Double_t y,Color_t color,char *text) {
TLatex l; //l.SetTextAlign(12);
// l.SetTextSize(size);
l.SetNDC();
l.SetTextColor(color);
l.DrawLatex(x,y,text);
}
示例11: ATLAS_LABEL
// *************************************** //
// draw the ATLAS label //
// *************************************** //
void drawPlots::ATLAS_LABEL(Double_t x,Double_t y,Color_t color)
{
TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize);
l.SetNDC();
l.SetTextFont(72);
l.SetTextColor(color);
l.DrawLatex(x,y,"ATLAS");
}
示例12: myText
void myText(Double_t x,Double_t y,Color_t color, const char *text) {
//Double_t tsize=0.05;
TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize);
l.SetNDC();
l.SetTextColor(color);
l.DrawLatex(x,y,text);
}
示例13: NewLatex
TLatex* NewLatex()
{
TLatex *latex = new TLatex;
latex->SetNDC(kTRUE);
latex->SetTextSize(0.06);
latex->SetTextColor(kRed);
return latex;
}
示例14: comphh
void comphh(Int_t run, TH1F* h1, TH1F* h2)
{
TFile* f = new TFile(Form("hodtest_%d.root",run));
cout << "hcana root file " << Form("hodtest_%d.root",run) << endl;
TCanvas *c1 = new TCanvas("c1", "h1 vs h2", 1000, 667);
// gPad->SetLogy();
h1->SetFillColor(kGreen);
h1->SetLineColor(kGreen);
h1->Draw();
h2->SetLineColor(kBlue);
h2->SetFillStyle(0);
h2->SetLineWidth(2);
h2->Draw("same");
TLatex l;
l.SetTextSize(0.04);
Float_t maxy = h1->GetBinContent(h1->GetMaximumBin());
Float_t xmin = h1->GetXaxis()->GetXmin();
Float_t xmax = h1->GetXaxis()->GetXmax();
Float_t xt = xmin + 0.75*(xmax-xmin);
l.SetTextColor(kGreen);
l.DrawLatex(xt,0.65*maxy,"h1");
l.SetTextColor(kBlue);
l.DrawLatex(xt,0.75*maxy,"h2");
// Difference between the histograms.
TCanvas *c2 = new TCanvas("c2", "Epr differences", 1000, 667);
TH1F* dif = h2->Clone();
dif->Add(h2,h1,1.,-1.);
dif->SetTitle("Difference");
dif->SetFillColor(kRed);
dif->SetLineColor(kRed);
dif->SetLineWidth(1);
dif->SetFillStyle(1111);
dif->Draw();
}
示例15: AddLabel
TLatex* AddLabel(const char*txt,float x,float y,int color,float size)
{
TLatex* lt = new TLatex(x,y,txt);
lt->SetNDC();
lt->SetTextColor(color);
lt->SetTextSize(size);
lt->Draw();
return lt;
}