本文整理汇总了C++中TLatex::DrawTextNDC方法的典型用法代码示例。如果您正苦于以下问题:C++ TLatex::DrawTextNDC方法的具体用法?C++ TLatex::DrawTextNDC怎么用?C++ TLatex::DrawTextNDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLatex
的用法示例。
在下文中一共展示了TLatex::DrawTextNDC方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: danss_calc_ratio
//.........这里部分代码省略.........
hSum[8]->Add(h[24]);
hSum[8]->Add(h[27]);
hSum[8]->Add(h[30]);
hSum[9]->Add(h[21]);
hSum[9]->Add(h[23]);
hSum[9]->Add(h[26]);
hSum[9]->Add(h[29]);
hRatio[5]->Divide(hSum[9], hSum[8]);
// DecemberJanuary (34 + 37 + 40) / (32 + 35 + 38 + 41)
hSum[10]->Add(h[32]);
hSum[10]->Add(h[35]);
hSum[10]->Add(h[38]);
hSum[10]->Add(h[41]);
hSum[11]->Add(h[34]);
hSum[11]->Add(h[37]);
hSum[11]->Add(h[40]);
hRatio[6]->Divide(hSum[11], hSum[10]);
cv->Divide(2, 1);
pd = cv->cd(1);
pd->Divide(1, 2);
pd->cd(1);
hSum[0]->SetTitle("Up - Middle - Down;MeV;mHz");
hSum[0]->SetLineColor(kRed);
hSum[2]->SetLineColor(kGreen);
hSum[1]->SetLineColor(kBlue);
for (i=0; i<4; i++) hSum[i]->SetLineWidth(2);
hSum[0]->Draw();
hSum[2]->Draw("same");
hSum[1]->Draw("same");
val = hSum[0]->IntegralAndError(1, 35, err);
sprintf(str, "Up = %5.2f+-%4.2f", val, err);
txt->SetTextColor(kRed);
txt->DrawTextNDC(0.4, 0.85, str);
val = hSum[2]->IntegralAndError(1, 35, err);
sprintf(str, "Mid = %5.2f+-%4.2f", val, err);
txt->SetTextColor(kGreen);
txt->DrawTextNDC(0.4, 0.8, str);
val = hSum[1]->IntegralAndError(1, 35, err);
sprintf(str, "Down = %5.2f+-%4.2f", val, err);
txt->SetTextColor(kBlue);
txt->DrawTextNDC(0.4, 0.75, str);
pd->cd(2);
hSum[3]->SetTitle("Average of all positions;MeV;mHz");
hSum[3]->SetLineColor(kBlack);
hSum[3]->Draw();
val = hSum[3]->IntegralAndError(1, 35, err);
sprintf(str, "Avr = %5.2f+-%4.2f", val, err);
txt->SetTextColor(kBlack);
txt->DrawTextNDC(0.4, 0.8, str);
pd = cv->cd(2);
pd->Divide(1, 4);
pd->cd(1);
hRatio[0]->SetTitle("Down/Up all by all;MeV;");
hRatio[0]->SetLineColor(kBlack);
hRatio[0]->SetLineWidth(2);
hRatio[0]->SetMinimum(0.5);
hRatio[0]->SetMaximum(1.0);
hRatio[0]->Fit("pol0", "", "", 1, 7);
pd->cd(2);
hRatio[2]->SetTitle("Down/Up pair by pair;MeV;");
hRatio[2]->SetLineColor(kBlack);
hRatio[2]->SetLineWidth(2);
示例2: PlotPubHisto
//.........这里部分代码省略.........
// if there are too many points (>80), keep the marker size smaller
if(h0->GetNbinsX()>=50) h0->SetMarkerSize(1);
//if(h0->GetNbinsX()>=100) h0->SetMarkerSize(1);
h0->SetLineWidth(3);
h0->SetMarkerStyle(8);
h0->SetMarkerColor(1);
h0->Draw("E1,SAME");
// Print some comparison:
//ostringstream basefactor;
//basefactor << "Files." << nbkg+3 << "." << "Factor";
//TString timesfactor(basefactor.str().c_str());
//Double_t nprod = params->GetValue(timesfactor,1.000);
//printf("Data Yield = %5.2f ; SumBkg = %5.2f ; SumBkg+Sig = %5.2f ; Data-SumBkg diff = %5.2f%% \n",
// h0->Integral(),hbkg2->Integral,(hbkg2->Integral()+(signalhistos[0]->Integral()/nprod),
// (h0->Integral()-hbkg2->Integral)*100./h0->Integral()));
//
// Print D0 and lumi:
//
TText *t1 = new TText();
t1->SetTextFont(62);
t1->SetTextColor(1);
t1->SetNDC();
t1->SetTextAlign(12);
t1->SetTextSize(textSize);
TString prelim="D\328 Preliminary";
if(oFileName.EndsWith(".eps")) {
prelim="D\349 Preliminary L=3.7 fb^-1#";
}
else if(oFileName.EndsWith(".gif")) {
prelim="D\328 Preliminary L=3.7 fb^-1#";
}
t1->DrawTextNDC(0.13,0.965,prelim.Data());
// a counter of how much text we have added from the top
int nAddTextLines=0;
// any additional text?
for(int iText=1;iText<20;iText++) {
ostringstream baseTextName;
baseTextName << "Histo.AddText." << iText;
TString bTextName(baseTextName.str().c_str());
if(params->Defined(bTextName)) {
// we are adding a line of text
TLatex *t2 = new TLatex();
t2->SetTextFont(62);
t2->SetTextColor(13);
t2->SetTextAlign(32);
t2->SetNDC();
t2->SetTextSize(textSize);
TString addText(params->GetValue(bTextName,"."));
float x0=0.94;
float y0=0.96-(nAddTextLines)*0.05;
// check if the user specified an alternative location for the text
if(params->Defined(bTextName+".X0")) x0=params->GetValue(bTextName+".X0",0.94);
if(params->Defined(bTextName+".Y0")) y0=params->GetValue(bTextName+".Y0",0.8);
if(params->Defined(bTextName+".TextSize")) t2->SetTextSize(params->GetValue(bTextName+".TextSize",textSize));
// and increment the counter keeping track of how much we added,
// but only if the user didn't move the label around.
if(!params->Defined(bTextName+".X0")) nAddTextLines++;
printf("AddText %4.2f %4.2f %s\n",x0,y0,addText.Data());
t2->DrawLatex(x0,y0,addText.Data());