本文整理汇总了C++中TGaxis::SetTextColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TGaxis::SetTextColor方法的具体用法?C++ TGaxis::SetTextColor怎么用?C++ TGaxis::SetTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGaxis
的用法示例。
在下文中一共展示了TGaxis::SetTextColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anotherScale
ExtraAxis anotherScale (const TH1* refHist, double scale, int color, const char* title, double offset) {
ExtraAxis result;
double x0 = refHist->GetXaxis()->GetXmin();
double x1 = refHist->GetXaxis()->GetXmax();
double y0 = refHist->GetMinimum();
double y1 = refHist->GetMaximum();
// double y0 = refHist->GetYaxis()->GetXmin();
// double y1 = refHist->GetYaxis()->GetXmax();
double xoffset = exp (log(x0) - (log(x1) - log(x0))*offset);
TGaxis* axis = new TGaxis(xoffset, y0, xoffset, y1, y0*scale,y1*scale,510,"-GS");
axis->ImportAxisAttributes (refHist->GetXaxis());
axis->SetTitle(title);
axis->SetTextColor (color);
axis->SetLineColor (color);
axis->SetLineWidth (1);
axis->SetTextColor (color);
axis->SetLabelColor (color);
axis->SetLabelOffset (0.);
axis->SetTitleOffset (0.65);
axis->SetTickSize(0.015);
result.Add (axis);
TLine* line = new TLine (xoffset, y0, xoffset, y1);
line->SetLineColor (color);
line->SetLineWidth (2);
result.Add (line);
line = new TLine (x0, y0, xoffset, y0);
line->SetLineColor (kGray);
line->SetLineWidth (2);
result.Add (line);
line = new TLine (x0, y1, xoffset, y1);
line->SetLineColor (kGray);
line->SetLineWidth (2);
result.Add (line);
return result;
}
示例2: plotPair
//==========================================
//==========================================
void plotPair(TH1F *h1,TH1F *h0 ) {
h1->Draw();
// edit fonts/sizes
TAxis *ax =h1->GetYaxis();
float ss=ax->GetTitleSize();
//printf("ss=%f\n",ss);
ax->SetTitleSize(2*ss);
ax->SetTitleOffset(0.5);
ax =h1->GetXaxis();
ax->SetTitleSize(1.5*ss);
ax->SetLabelSize(1.5*ss);
ax->SetTitleOffset(0.7);
// edit fonts/sizes DONE
gPad->Update();
//scale hint1 to the pad coordinates
Float_t rightmax = 1.1*h0->GetMaximum();
Float_t scale = gPad->GetUymax()/rightmax;
h0->Scale(scale);
h0->Draw("same");
//draw an axis on the right side
TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"-R");
int col=h0->GetLineColor();
axis->SetLineColor(col);
axis->SetTextColor(col);
axis->SetLabelColor(col);
axis ->SetTitle("LCP yield");
axis->SetTitleSize(2*ss);
axis->SetTitleOffset(.5);
axis->Draw();
TPaveStats *st =( TPaveStats *)gPad->GetPrimitive("stats");
st->SetX1NDC(0.35);
st->SetX2NDC(0.5);
st->SetY1NDC(0.7);
st->SetY2NDC(1.);
}
示例3: 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;
}
示例4: 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;
}