本文整理汇总了C++中TAxis::GetLabelSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TAxis::GetLabelSize方法的具体用法?C++ TAxis::GetLabelSize怎么用?C++ TAxis::GetLabelSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAxis
的用法示例。
在下文中一共展示了TAxis::GetLabelSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: residual_error
/*
double residual_error( double error_data, double pdf )
{
double chi2 = 0.;
if ( pdf > 0 )
chi2 += 2. * ( pdf - error_data );
if ( error_data > 0 && pdf > 0 )
chi2=(error_data/pdf);
//chi2 += 2. * error_data * log( error_data / error_pdf );
// return ( ( error_data >= pdf ) ? sqrt( chi2 ) : -sqrt( chi2 ) );
// return ( ( error_data >= pdf ) ? chi2 : chi2 );
return ( chi2 );
}
*/
TH1D* residualHist( const RooHist* rhist, const RooCurve* curve )
{
double r = 0.2;
double sr = 1. / r;
// Grab info from the histogram.
int n = rhist->GetN();
double* x = rhist->GetX();
double* y = rhist->GetY();
//rhist->Sumw2();
// double e;
// Create residual histogram.
double xMin = x[ 0 ];
double xMax = x[ n - 1 ];
TH1D* residuals_temp = new TH1D( "r", "", n, xMin, xMax );
double datum = 0.;
double pdf = 0.;
double error_data = 0.;
// Fill the histogram.
if ( curve )
for ( int bin = 0; bin < n; bin++ )
{
datum = y[ bin ];
pdf = curve->Eval( x[ bin ] );
error_data = rhist->GetErrorY(bin);
// error_pdf = curve->Eval( x[ bin ] );
residuals_temp->SetBinContent( bin + 1, residual( datum, pdf ) );
// residuals_temp->SetBinError ( bin + 1, residual_error( error_data, pdf ) );
residuals_temp->SetBinError ( bin + 1, error_data / pdf );
}
residuals_temp->SetMinimum ( -2. );
residuals_temp->SetMaximum ( 2. );
residuals_temp->SetStats ( false );
residuals_temp->SetMarkerStyle( 8 );
residuals_temp->SetMarkerSize ( .8 );
TAxis* xAxis = residuals_temp->GetXaxis();
xAxis->SetTickLength ( sr * xAxis->GetTickLength() );
xAxis->SetLabelSize ( sr * xAxis->GetLabelSize() );
xAxis->SetTitleSize ( sr * xAxis->GetTitleSize() );
xAxis->SetLabelOffset( sr * xAxis->GetLabelOffset() );
TAxis* yAxis = residuals_temp->GetYaxis();
//yAxis->SetNdivisions ( 500 );
//yAxis->SetLabelSize ( 10*sr * yAxis->GetLabelSize() );
yAxis->SetLabelSize ( 2.5 * yAxis->GetLabelSize() );
yAxis->SetTitle(" (DATA - FIT) / FIT");
yAxis->SetTitleSize ( 0.09 );
yAxis->SetTitleOffset( 0.35 );
return residuals_temp;
}
示例2: DrawOne
THStack* DrawOne(TVirtualPad* p,
Double_t yr,
Bool_t top,
TDirectory* dir,
const char* name)
{
p->cd();
p->SetFillColor(0);
p->SetFillStyle(0);
p->SetLineColor(0);
p->SetRightMargin(0.01);
p->SetLeftMargin(0.12);
p->SetGridx();
if (top) p->SetBottomMargin(0.001);
else p->SetBottomMargin(0.2);
if (top) p->SetTopMargin(0.02);
else p->SetTopMargin(0.0001);
THStack* s = static_cast<THStack*>(dir->Get(name));
s->Draw("nostack");
Double_t sc = (top ? 1-yr : yr);
TAxis* ya = s->GetHistogram()->GetYaxis();
ya->SetLabelSize(1/sc*ya->GetLabelSize());
ya->SetTitleSize(1/sc*ya->GetTitleSize());
ya->SetTitleOffset(sc*(ya->GetTitleOffset()+.5));
ya->SetTitleFont(42);
ya->SetLabelFont(42);
TAxis* xa = s->GetHistogram()->GetXaxis();
xa->SetLabelSize(!top ? 1/yr*xa->GetLabelSize() : 0);
xa->SetTitleSize(!top ? 1/yr*xa->GetTitleSize() : 0);
xa->SetTitleOffset(yr*(xa->GetTitleOffset()+2));
xa->SetTitleFont(42);
xa->SetLabelFont(42);
p->Modified();
p->Update();
p->cd();
return s;
}
示例3: main
//.........这里部分代码省略.........
plotGrabBaseName = "h_METX_vs_nVtx_noPhiCorr";
TCanvas * c_Var;
TH2F * DataComp, * MCComp;
TH1F * DataMean, * MCMean;
TF1 * f1_resp_Lin = new TF1("fb_Lin","[0] + x*[1]",FitLowRange, FitHighRange);
TFitResultPtr fitres_Lin;
vector<TH1F *> * DataVec, * MCVec;
for (int iChan = 0; iChan < 7; ++iChan) {
subSampName = subSampVec->at(grabChan[iChan]).histNameSuffix;
plotGrabName = plotGrabBaseName;
plotSystGrabName = plotGrabName;
plotGrabName += subSampName;
dataHistTH1Vec = new vector<TH1 *>;
mcHistTH1Vec = new vector<TH1 *>;
mcHistSystTH1Vec = new vector<TH1 *>;
DataVec = new vector<TH1F *>;
MCVec = new vector<TH1F *>;
HistogramVecGrabberCentValGrab(inputFiles, true, dataHistTH1Vec, nVtxBackScaleVec, plotGrabName, subSampName, useDDEstimate, TTBarSF, scaleLumi);
HistogramVecGrabberCentValGrab(inputFiles, false, mcHistTH1Vec, nVtxBackScaleVec, plotGrabName, subSampName, useDDEstimate, TTBarSF, scaleLumi);
DataComp = HistogramAdderDataTwoDee(dataHistTH1Vec);
MCComp = HistogramAdderDataTwoDee(mcHistTH1Vec);
VectorDistMakerMean(DataMean, DataVec, DataComp, plotGrabName+TString("_mean"), plotGrabName + TString("_Vec"));
VectorDistMakerMean(MCMean, DataVec, MCComp, plotGrabName+TString("_MC_mean"), plotGrabName + TString("_MC_Vec"));
HistMainAttSet(DataMean, 0, 0, kBlue, DataMean->GetLineWidth(), kBlue, 20, DataMean->GetMarkerSize());
HistMainAttSet(MCMean, 0, 0, kRed, MCMean->GetLineWidth(), kRed, 24, MCMean->GetMarkerSize());
canvName = canvNameBase;
canvName += canvNameAdd[iChan];
canvName += canvSuffixSaveName;
c_Var = new TCanvas(canvName, canvName, 0, 0, 700, 700);
DataMean->Draw();
MCMean->Draw("same");
XAxis = DataMean->GetXaxis();
YAxis = DataMean->GetYaxis();
HistAxisAttSet(YAxis, "<E_{x}^{miss}> [GeV/c]", YAxis->GetTitleSize(), YAxis->GetTitleOffset(), YAxis->GetLabelSize(), YAxis->GetLabelOffset(), -30.0, 30.0);
leg= new TLegend(0.2,0.65,0.60,0.85);
f1_resp_Lin->SetLineColor(kBlue);
f1_resp_Lin->SetLineWidth(2);
f1_resp_Lin->SetLineStyle(1);
fitres_Lin = DataMean->Fit(f1_resp_Lin,FitOption,"axis same",FitLowRange, FitHighRange);
c_0d = fitres_Lin->Parameter(0);
c_1d = fitres_Lin->Parameter(1);
sprintf(buf,"data A+B+C+D c_{0} = %0.2f #pm %0.2f",fitres_Lin->Parameter(0),fitres_Lin->ParError(0));
leg->AddEntry(DataMean,buf,"p");
sprintf(buf,"data A+B+C+D c_{1} = %0.2f #pm %0.2f",fitres_Lin->Parameter(1),fitres_Lin->ParError(1));
leg->AddEntry(DataMean,buf,"p");
f1_resp_Lin->SetLineStyle(2);
f1_resp_Lin->SetLineColor(kRed);
fitres_Lin = MCMean->Fit(f1_resp_Lin,FitOption,"axis same",FitLowRange, FitHighRange);
c_0mc = fitres_Lin->Parameter(0);
c_1mc = fitres_Lin->Parameter(1);
sprintf(buf,"sim A+B+C+D c_{0} = %0.2f #pm %0.2f",fitres_Lin->Parameter(0),fitres_Lin->ParError(0));
leg->AddEntry(MCMean,buf,"p");
sprintf(buf,"sim A+B+C+D c_{1} = %0.2f #pm %0.2f",fitres_Lin->Parameter(1),fitres_Lin->ParError(1));
leg->AddEntry(MCMean,buf,"p");
leg->Draw("same");
c_Var->SaveAs(canvName + TString(".pdf"));
if (makeRootCopy) {
c_Var->SaveAs(canvName + TString(".root"));
}
cout << "{c_0 X data, c_1 X data, c_0 X MC, c_1 X MC} is: {" << c_0d << ", " << c_1d << ", " << c_0mc << ", " << c_1mc << "}" << endl;
}
canvNameBase = "h_METY_vs_nVtx_noPhiCorr";
plotGrabBaseName = "h_METY_vs_nVtx_noPhiCorr";
for (int iChan = 0; iChan < 7; ++iChan) {