当前位置: 首页>>代码示例>>C++>>正文


C++ TAxis::GetTickLength方法代码示例

本文整理汇总了C++中TAxis::GetTickLength方法的典型用法代码示例。如果您正苦于以下问题:C++ TAxis::GetTickLength方法的具体用法?C++ TAxis::GetTickLength怎么用?C++ TAxis::GetTickLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TAxis的用法示例。


在下文中一共展示了TAxis::GetTickLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:cardaci,项目名称:T2TopPlusPhoton,代码行数:76,代码来源:RooFitMacro.C

示例2: plot_Comb


//.........这里部分代码省略.........
        //Note: it is already pre-divided by the bin width
        rshape_data->SetBinContent(i+1,data->GetBinContent(i+1)/peak);
        rshape_data->SetBinError(i+1,sqrt(pow(data->GetBinError(i+1)/peak,2)+pow(peak_err*rshape_data->GetBinContent(i+1),2)));
    }
    if (IS_RSHAPE && !IS_7TEV) data = rshape_data;

    TGraphAsymmErrors* gdata = new TGraphAsymmErrors(nbin-1);
    for( size_t ii=0; ii<nbin; ii++ )
    {
        double x_ = fake_par[ii];
        double y_ = data->GetBinContent(ii+1);
        double exl_ = fake_par[ii]-mass_xbin[ii];
        double exh_ = mass_xbin[ii+1]-fake_par[ii];
        double eyl_ = data->GetBinError(ii+1);
        double eyh_ = eyl_;
        gdata->SetPoint(ii,x_,y_);
        gdata->SetPointError(ii,exl_,exh_,eyl_,eyh_);
    }

//FIXME need ratio plots
    TCanvas *c1 = new TCanvas("CrossSect1D","CrossSect1D",600,600);
    c1->Draw();
    c1->cd();
    TPad *p1 = new TPad("p1", "",0.0,0.25,1.0,0.98,0,0,0);
    p1->Draw();
    p1->cd();
    //p1->SetTickx(kFALSE);

    //TAxis *xaxis = h_theory4->GetXaxis();
    //xaxis->SetMoreLogLabels();
    //xaxis->SetNoExponent();

    TAxis *axis = h_theory4->GetYaxis();
    axis->SetTickLength(axis->GetTickLength()/1.35);
    //axis->SetNdivisions(506);


    p1->SetRightMargin(0.055);
    p1->SetBottomMargin(0.01);
    p1->SetTopMargin(0.1);
    p1->SetLogy();
    p1->SetLogx();
    h_theory4->GetXaxis()->SetMoreLogLabels();
    if (IS_RSHAPE) h_theory4->GetYaxis()->SetTitle("1/#sigma_{Z}d#sigma/dm [GeV^{-1}]");
    else h_theory4->GetYaxis()->SetTitle("d#sigma/dm [pb/GeV]");
    h_theory4->GetXaxis()->SetTitle("m_{#mu#mu} [GeV]");
    h_theory4->SetLineColor(kBlue);
    h_theory4->SetLineWidth(0.1);
    h_theory4->SetMarkerSize(0);
    //h_theory4->SetMaximum(h_theory4->GetMaximum()*100.);
    h_theory4->GetYaxis()->SetRangeUser(h_theory4->GetMinimum()/10.,h_theory4->GetMaximum()*10.);
    h_theory4->SetMinimum(1.5*10E-9);
    h_theory4->Draw("L");

    TH1D* h_theory4_clone = (TH1D*)h_theory4->Clone();
    h_theory4_clone->SetLineWidth(1.5);
    //h_theory4_clone->GetXaxis()->SetRangeUser(40,180);
    h_theory4_clone->Draw("Lsame");
    h_theory4_band->SetLineColor(kBlue);
    h_theory4_band->SetLineWidth(3);
    h_theory4_band->SetMarkerSize(0);
    h_theory4_band->SetFillColor(kBlue);
    h_theory4_band->Draw("E3same");
    //data->Draw("Psame");

    gdata->SetMarkerStyle(20);
开发者ID:andjuo,项目名称:DrellYanAnalysis,代码行数:67,代码来源:plot_Comb.C


注:本文中的TAxis::GetTickLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。