Пример #1
0
int main(int argc, char const *argv[])
{

  latex();

  return 0;
}
Пример #2
0
void InsetPreview::preparePreview(DocIterator const & pos) const  
{
	TexRow texrow;
	odocstringstream str;  
	otexstream os(str, texrow);
	OutputParams runparams(&pos.buffer()->params().encoding());
	latex(os, runparams);
	docstring const snippet = str.str();
	preview_->addPreview(snippet, *pos.buffer());  
}
Пример #3
0
double Legend::Height(std::vector<std::string> const& entries, std::string const& title) const
{
    INFO(entries.size(), title);
    auto height = boost::accumulate(entries, 0., [](double height, std::string const & entry) {
        TLatex latex(0, 0, entry.c_str());
        SetText(latex);
        INFO(entry, latex.GetYsize());
        return height + latex.GetYsize();
    });
    INFO(height);
    height += (entries.size() - 1) * EntrySeparation();
    height /= columns_; // TODO must be more sofisticated
    INFO(height);
    if (title.empty()) return height;
    TLatex latex(0, 0, title.c_str());
    SetText(latex);
    height += latex.GetYsize();
    height += EntrySeparation();
    return height;
}
Пример #4
0
// print the yields
void CreateYieldTable 
(
    const std::string& label, 
    const std::string& hist_name = "h_reco_full_yield",
    const std::string& output_file = "", 
    bool print_latex = false
)
{
    // map of samples and yields
    const dy::YieldVector yields = dy::GetYieldVector(label, hist_name);
    const dy::Yield bkgd_pred    = dy::GetBackgroundPred(label, hist_name);
    const dy::Yield dy_pred      = yields[dy::Sample::dyll] + bkgd_pred;
    const dy::Yield dy_eemm      = yields[dy::Sample::dyll] - yields[dy::Sample::dytt];

    std::string table;
    if (print_latex)
    {
        string latex("\\begin{table}[ht!]\n"                            );
        latex.append("\\begin{center}\n"                                );
        latex.append("\\begin{tabular}{l|cccc} \\hline\\hline\n"        );
        latex.append("source & $ee$ & $\\mu\\mu$ & $\\ell\\ell $ \\\\\n");
        latex.append("\\hline\n"                                                        );
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::dyll                                      , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("$Z\\gamma\\ \\rightarrow ee/\\mu\\mu\\ (no\\ \\tau)$", dy_eemm  ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::dytt                                      , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::wjets                                     , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::ttdil                                     , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::ttslq                                     , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::tthad                                     , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::qcdmu15                                   , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::ww2l2nu                                   , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::wz2l2q                                    , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::wz3lnu                                    , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::zz2l2nu                                   , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::zz2l2q                                    , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::zz4l                                      , yields   ).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("Background Prediction"                               , bkgd_pred).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("MC Prediction"                                       , dy_pred  ).c_str()));
        latex.append("\\hline\\hline\n");
        latex.append(Form("%s \\\\\n", GetLatex(dy::Sample::data, yields, /*data=*/true).c_str()));
        latex.append("\\hline\\hline\n"                      );
        latex.append("\\end{tabular}\n"                      );
        latex.append("\\caption{Drell-Yan Exercise Yields}\n");
        latex.append("\\end{center}\n"                       );
        latex.append("\\end{table}"                          );

        // print it
        table = latex; 
    }
    else
    {
        // make the table
        CTable t_yields;
        t_yields.useTitle();
        t_yields.setTitle("yields for Drell-Yan Exercise");
        t_yields.setTable()
        (                                                                                "ee",                                   "mm",                                  "ll")
        (dy::GetSampleInfo(dy::Sample::dyll    ).name  , yields[dy::Sample::dyll    ].ee.pm("4.1") , yields[dy::Sample::dyll    ].mm.pm("4.1") , yields[dy::Sample::dyll    ].ll.pm("4.1"))
        ("dyll (no tau --> e/mu)"                      ,                      dy_eemm.ee.pm("4.1") ,                      dy_eemm.mm.pm("4.1") ,                      dy_eemm.ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::dytt    ).name  , yields[dy::Sample::dytt    ].ee.pm("4.1") , yields[dy::Sample::dytt    ].mm.pm("4.1") , yields[dy::Sample::dytt    ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::wjets   ).name  , yields[dy::Sample::wjets   ].ee.pm("4.1") , yields[dy::Sample::wjets   ].mm.pm("4.1") , yields[dy::Sample::wjets   ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::ttdil   ).name  , yields[dy::Sample::ttdil   ].ee.pm("4.1") , yields[dy::Sample::ttdil   ].mm.pm("4.1") , yields[dy::Sample::ttdil   ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::ttslq   ).name  , yields[dy::Sample::ttslq   ].ee.pm("4.1") , yields[dy::Sample::ttslq   ].mm.pm("4.1") , yields[dy::Sample::ttslq   ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::tthad   ).name  , yields[dy::Sample::tthad   ].ee.pm("4.1") , yields[dy::Sample::tthad   ].mm.pm("4.1") , yields[dy::Sample::tthad   ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::qcdmu15 ).name  , yields[dy::Sample::qcdmu15 ].ee.pm("4.1") , yields[dy::Sample::qcdmu15 ].mm.pm("4.1") , yields[dy::Sample::qcdmu15 ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::ww2l2nu ).name  , yields[dy::Sample::ww2l2nu ].ee.pm("4.1") , yields[dy::Sample::ww2l2nu ].mm.pm("4.1") , yields[dy::Sample::ww2l2nu ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::wz2l2q  ).name  , yields[dy::Sample::wz2l2q  ].ee.pm("4.1") , yields[dy::Sample::wz2l2q  ].mm.pm("4.1") , yields[dy::Sample::wz2l2q  ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::wz3lnu  ).name  , yields[dy::Sample::wz3lnu  ].ee.pm("4.1") , yields[dy::Sample::wz3lnu  ].mm.pm("4.1") , yields[dy::Sample::wz3lnu  ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::zz2l2nu ).name  , yields[dy::Sample::zz2l2nu ].ee.pm("4.1") , yields[dy::Sample::zz2l2nu ].mm.pm("4.1") , yields[dy::Sample::zz2l2nu ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::zz2l2q  ).name  , yields[dy::Sample::zz2l2q  ].ee.pm("4.1") , yields[dy::Sample::zz2l2q  ].mm.pm("4.1") , yields[dy::Sample::zz2l2q  ].ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::zz4l    ).name  , yields[dy::Sample::zz4l    ].ee.pm("4.1") , yields[dy::Sample::zz4l    ].mm.pm("4.1") , yields[dy::Sample::zz4l    ].ll.pm("4.1"))
        ("Background Pred"                             ,                    bkgd_pred.ee.pm("4.1") ,                    bkgd_pred.mm.pm("4.1") ,                    bkgd_pred.ll.pm("4.1"))
        ("MC Pred"                                     ,                      dy_pred.ee.pm("4.1") ,                      dy_pred.mm.pm("4.1") ,                      dy_pred.ll.pm("4.1"))
        (dy::GetSampleInfo(dy::Sample::data    ).name  , yields[dy::Sample::data    ].ee.pm("4.0") , yields[dy::Sample::data    ].mm.pm("4.0") , yields[dy::Sample::data    ].ll.pm("4.0"))
        ;

        // print it
        std::ostringstream os;
        os << t_yields;
        table = os.str();
    }

    // output
    if (output_file.empty())
    {
        std::cout << table << std::endl;
    }
    else
    {
        std::ofstream fout(output_file);
        fout << table << std::endl;
    }
}
Пример #5
0
void plCalcEfficX(int charge = 0, char* iPath="/star/u/stevens4/wAnalysis/efficXsec/outEmb/gainUp2/"){ 

  char* sign;
  if(charge==0) sign="+";
  else if(charge==1) sign="-";
  
  char* core0; //these have no vertex reweighting
  if(charge == 1) core0="Wminus";
  else if(charge == 0) core0="Wplus";

  ofstream latex(Form("./%s.txt",core0));

  //gStyle->SetOptFit(1);
  //gStyle->SetOptStat(0);
  gStyle->SetPalette(1);

  //load file
  TString fullInpName=iPath;  fullInpName+=core0; 
  fullInpName+=".wana.hist.root";
  fd=new TFile(fullInpName);
  if(!fd->IsOpen()) {
    printf("ERROR: input histo file not found, quit\n",fullInpName.Data());
    return;
  } else {
    printf("Opened: %s\n",fullInpName.Data());
  }
  
  //use rebin 1 for effic # calc, but rebin N for plot
  int etrebin=4;
  int etaRebin=50;
  int zRebin=4;
  int phiModuleRebin=6;
  int phiRebin=1;
  int zdcRebin=5;

  //get total efficiency and error
  float etplot[5]={1.0,1.0,1.0,1.0,1.0};
  float etplotErr[5]={1.0,1.0,1.0,1.0,0.0};
  float zdcplot[5]={2.0,2.0,2.0,2.0,2.0};
  float zdcplotErr[5]={1.0,1.0,1.0,1.0,0.0};

  //trigger efficiency
  TH1F *hTrigET=doEfficiency(fd,"MCeleETall","MCeleETtrig",Form("W%s trigger efficiency",sign),etrebin,etplot[0],etplotErr[0]);
  TH1F *hTrigEta=doEfficiency(fd,"MCeleEtaAll","MCeleEtaTrig",Form("W%s trigger efficiency",sign),etaRebin,0);
  TH1F *hTrigDetEta=doEfficiency(fd,"MCeleDetEtaAll","MCeleDetEtaTrig",Form("W%s trigger efficiency",sign),etaRebin,0);
  TH1F *hTrigZvert=doEfficiency(fd,"MCeleZvertAll","MCeleZvertTrig",Form("W%s trigger efficiency",sign),zRebin,0);
  TH1F *hTrigPhi=doEfficiency(fd,"MCelePhiModulePairAll","MCelePhiModulePairTrig",Form("W%s trigger efficiency",sign),phiModuleRebin,0); 
  TH1F *hTrigZDC=doEfficiency(fd,"MCeleZdcAll","MCeleZdcTrig",Form("W%s trigger efficiency",sign),zdcRebin,zdcplot[0],zdcplotErr[0]);
  //vertex efficiency
  TH1F *hVertET=doEfficiency(fd,"MCeleETtrig","MCeleETvert",Form("W%s vertex efficiency",sign),etrebin,etplot[1],etplotErr[1]);
  TH1F *hVertEta=doEfficiency(fd,"MCeleEtaTrig","MCeleEtaVert",Form("W%s vertex efficiency",sign),etaRebin,0);
  TH1F *hVertZvert=doEfficiency(fd,"MCeleZvertTrig","MCeleZvertVert",Form("W%s vertex efficiency",sign),zRebin,0);
  TH1F *hVertPhi=doEfficiency(fd,"MCelePhiTrig","MCelePhiVert",Form("W%s vertex efficiency",sign),phiRebin,0);
  TH1F *hVertZDC=doEfficiency(fd,"MCeleZdcTrig","MCeleZdcVert",Form("W%s vertex efficiency",sign),zdcRebin,zdcplot[1],zdcplotErr[1]);
  //tracking efficiency
  TH1F *hTrackET=doEfficiency(fd,"MCeleETvert","MCeleETTrack",Form("W%s tracking efficiency",sign),etrebin,etplot[2],etplotErr[2]);
  TH1F *hTrackEta=doEfficiency(fd,"MCeleEtaVert","MCeleEtaTrack",Form("W%s tracking efficiency",sign),etaRebin,0);
  TH1F *hTrackZvert=doEfficiency(fd,"MCeleZvertVert","MCeleZvertTrack",Form("W%s tracking efficiency",sign),zRebin,0);
  TH1F *hTrackPhi=doEfficiency(fd,"MCelePhiVert","MCelePhiTrack",Form("W%s tracking efficiency",sign),phiRebin,0);
  TH1F *hTrackZDC=doEfficiency(fd,"MCeleZdcVert","MCeleZdcTrack",Form("W%s tracking efficiency",sign),zdcRebin,zdcplot[2],zdcplotErr[2]);
  //algo efficiency
  TH1F *hRecoET=doEfficiency(fd,"MCeleETTrack","MCeleETreco",Form("W%s algo efficiency",sign),etrebin,etplot[3],etplotErr[3]);
  TH1F *hRecoEta=doEfficiency(fd,"MCeleEtaTrack","MCeleEtaReco",Form("W%s algo efficiency",sign),etaRebin,0);
  TH1F *hRecoZvert=doEfficiency(fd,"MCeleZvertTrack","MCeleZvertReco",Form("W%s algo efficiency",sign),zRebin,0);
  TH1F *hRecoPhi=doEfficiency(fd,"MCelePhiTrack","MCelePhiReco",Form("W%s algo efficiency",sign),phiRebin,0);
  TH1F *hRecoZDC=doEfficiency(fd,"MCeleZdcTrack","MCeleZdcReco",Form("W%s algo efficiency",sign),zdcRebin,zdcplot[3],zdcplotErr[3]);

  //total efficiency for overall stat uncertainty
  TH1F *hTotET=doEfficiency(fd,"MCeleETall","MCeleETreco",Form("W%s total efficiency",sign),etrebin,etplot[4],etplotErr[4]);
  TH1F *hTotZDC=doEfficiency(fd,"MCeleZdcAll","MCeleZdcReco",Form("W%s total efficiency",sign),zdcRebin,zdcplot[4],zdcplotErr[4]);
  float totEffic=etplot[0]*etplot[1]*etplot[2]*etplot[3];
  //cout<<totEffic<<endl;
  cout<<"Total Efficiency = "<<etplot[4]<<" $\\pm$ "<<etplotErr[4]<<endl;  
  //spreadsheet<<"Track Effic = "<<etplot[2]<<" +/- "<<etplotErr[2]<<endl;

  spreadsheet<<"W"<<sign<<" Total Efficiency"<<endl;
  for(int j=0; j<6; j++){
    spreadsheet<<25+j*4<<","<<29+j*4<<","<<Form("%.4f",hTotET->GetBinContent(7+j))<<","<<Form("%.4f",hTotET->GetBinError(7+j))<<endl;
  }

  //set axis range for ET plot
  int etAxisMin=0; int etAxisMax=70;

  //***************  Algo Efficiency plots ***************//
  cA=new TCanvas(Form("W%s algo effic",sign),"algo effic",800,600);
  cA->Divide(2,2);
  cA->cd(1);
  hRecoET->Draw(); 
  hRecoET->SetAxisRange(etAxisMin,etAxisMax);
  cA->cd(2);
  hRecoEta->Draw();
  cA->cd(3);
  hRecoZvert->Draw();
  cA->cd(4);
  hRecoZDC->Draw();
  //hRecoPhi->Draw();
  cA->Print(Form("plots/W%salgoEffic.eps",sign));
  cA->Print(Form("plots/W%salgoEffic.png",sign));

  //algo efficiency numbers
  spreadsheet<<"W"<<sign<<" Algo Efficiency"<<endl;
  latex<<"W"<<sign<<" Algo Efficiency"<<endl;
  for(int j=0; j<6; j++){
    //semi-latex format
    if(j<6) latex<<25+j*4<<"$<E_T<$"<<29+j*4<<" & "<<Form("%.4f",hRecoET->GetBinContent(7+j))<<" $\\pm$ "<<Form("%.4f",hRecoET->GetBinError(7+j))<<" $\\pm$  &  \\\\"<<endl;
    
    //for spreadsheet
    spreadsheet<<25+j*4<<","<<29+j*4<<","<<Form("%.4f",hRecoET->GetBinContent(7+j))<<","<<Form("%.4f",hRecoET->GetBinError(7+j))<<endl;
  }

  //***************  Tracking Efficiency plots ***********//
  cT=new TCanvas(Form("W%s track effic",sign),"track effic",800,600);
  cT->Divide(2,2);
  cT->cd(1);
  hTrackET->Draw(); 
  hTrackET->SetAxisRange(etAxisMin,etAxisMax);
  cT->cd(2);
  hTrackEta->Draw();
  cT->cd(3);
  //hTrackZvert->Draw();
  hTrackZDC->SetMinimum(0.6); 
  hTrackZDC->Draw();
  cT->cd(4);
  hTrackPhi->Draw();
  cT->Print(Form("plots/W%strackEffic.eps",sign));
  cT->Print(Form("plots/W%strackEffic.png",sign));

  //***************  Vertex Efficiency plots *************//
  //Draw trigger efficiency 
  cV=new TCanvas(Form("W%s vertex effic",sign),"vertex effic",800,600);
  cV->Divide(2,2);
  cV->cd(1);
  hVertET->Draw(); 
  hVertET->SetAxisRange(etAxisMin,etAxisMax);
  cV->cd(2);
  hVertEta->Draw();
  cV->cd(3);
  hVertZvert->Draw();
  cV->cd(4);
  hVertZDC->SetMinimum(0.6);
  hVertZDC->Draw();
  cV->Print(Form("plots/W%svertEffic.eps",sign));
  cV->Print(Form("plots/W%svertEffic.png",sign));

  //***************  Trigger Efficiency plots ************//
  //draw trigger efficiency to show why W- isn't const w/ ET
  c2D=new TCanvas(Form("W%s trigger effic ET bins",sign),"trigger effic ET bins",700,500);
  j1=(TH2F*)fd->Get("MCeleEta_ptPreTrig"); //j1->Rebin2D(2,5);
  TH1D* h25[10];
  c2D->Divide(2,2);
  spreadsheet<<"W"<<sign<<" Trigger Efficiency"<<endl;
  latex<<"W"<<sign<<" Trigger Efficiency"<<endl;
  for(int j=0; j<6; j++){
    h25[j] = j1->ProjectionX(Form("pt%d_%d",25+j*4,29+j*4),26+j*4,29+j*4);
    h25[j]->SetTitle(Form("Lepton detector #eta (from Geant): PT=[%d,%d]",25+j*4,29+j*4));
    h25[j]->Rebin(2); 
    
    //count frac. of events with |eta|<1 and effic for each bin
    float accepted = h25[j]->Integral(26,125);
    float total = h25[j]->Integral();
    //cout<<"ET=["<<25+j*4<<","<<29+j*4<<"] efficiency = "<<hTrigET->GetBinContent(7+j)<<" ; fraction with |eta| < 1 : "<<accepted<<" "<<total<<endl;

    //semi-latex format
    if(j<6) latex<<25+j*4<<"$<E_T<$"<<29+j*4<<" & "<<Form("%.4f",hTrigET->GetBinContent(7+j))<<" $\\pm$ "<<Form("%.4f",hTrigET->GetBinError(7+j))<<" $\\pm$  &  & "<<Form("%.4f",accepted/total)<<" &  \\\\"<<endl;
    spreadsheet<<25+j*4<<","<<29+j*4<<","<<Form("%.4f",hTrigET->GetBinContent(7+j))<<","<<Form("%.4f",hTrigET->GetBinError(7+j))<<endl;

    //add lines for detector cutoff at eta=1
    h25[j]->Rebin(5);
    Lx=h25[j]->GetListOfFunctions();
    int max=h25[j]->GetMaximum();
    ln1=new TLine(-1,0,-1,max);
    ln2=new TLine(1,0,1,max);
    ln1->SetLineWidth(2); ln2->SetLineWidth(2);
    ln1->SetLineColor(kRed); ln1->SetLineStyle(2);
    ln2->SetLineColor(kRed); ln2->SetLineStyle(2);
    Lx->Add(ln1); Lx->Add(ln2);
    if(j<4){ //only plot first four ET bins
      c2D->cd(j+1);
      h25[j]->Draw("h");
    }
  }
  c2D->Print(Form("plots/W%strigEfficNonConst.eps",sign));
  c2D->Print(Form("plots/W%strigEfficNonConst.png",sign));
  
  //Draw trigger efficiency 
  c=new TCanvas(Form("W%s trigger effic",sign),"trigger effic",800,600);
  c->Divide(2,2);
  c->cd(1);
  hTrigET->Draw(); 
  hTrigET->SetAxisRange(etAxisMin,etAxisMax);
  c->cd(2);
  hTrigEta->Draw();
  c->cd(3);
  hTrigDetEta->Draw();
  c->cd(4);
  hTrigPhi->Draw();
  c->Print(Form("plots/W%strigEffic.eps",sign));
  c->Print(Form("plots/W%strigEffic.png",sign));
  

  //other efficiency related histos
  TH2F * g0=(TH2F * )fd->Get("muBdist1");  assert(g0);
  TH2F * g1=(TH2F * )fd->Get("muBclET24R_ET");  assert(g1);
  TH2F * g2=(TH2F * )fd->Get("muBclEjetE2D_ET");  assert(g2);
  TH2F * g3=(TH2F * )fd->Get("musPtBalance_clust");  assert(g3);
  cAlgo2=new TCanvas(Form("W%s algo effic 2 ",sign),"algo effic 2",800,600);
  cAlgo2->Divide(2,2);
  cAlgo2->cd(1);
  g0->Draw("colz");
  g0->GetXaxis()->SetRange(0,70);
  cAlgo2->cd(2);
  g1->Draw("colz");
  g1->GetXaxis()->SetRange(0,70);
  cAlgo2->cd(3);
  g2->Draw("colz");
  g2->GetXaxis()->SetRange(0,70);
  cAlgo2->cd(4);
  g3->Draw("colz");
  g3->GetXaxis()->SetRange(0,70);
  cAlgo2->Print(Form("plots/W%salgoEffic2.eps",sign));
  cAlgo2->Print(Form("plots/W%salgoEffic2.png",sign));

  //cout<<g2->GetYaxis()->FindBin(0.88)<<endl;
  //cout<<g2->Integral(26,30,0,1000)<<" "<<g2->Integral(26,30,1,g2->GetYaxis()->FindBin(0.88))<<endl;
  //cout<<g2->Integral(26,1000,1,1000)<<" "<<g2->Integral(26,1000,1,g2->GetYaxis()->FindBin(0.88))<<endl;

  return;
}
Пример #6
0
// print the yields
void CreateCrossSectionTable 
(
    const std::string& label, 
    const std::string& hist_name = "h_reco_full_yield",
    const std::string& output_file = "", 
    bool print_latex = false
)
{
    const double lumi = 0.082; // fb^-1

    // map of samples and yields
    const dy::YieldVector yields = dy::GetYieldVector(label, hist_name);
    const dy::Yield y_data       = yields[dy::Sample::data];
    const dy::Yield y_bk_pred    = dy::GetBackgroundPred(label, hist_name);
    const dy::Yield y_dy_pred    = yields[dy::Sample::dyll];
    const dy::Yield y_mc_pred    = y_dy_pred + y_bk_pred;
    const dy::Yield y_den_acc    = dy::GetYieldFromLabel(dy::Sample::dyll, label, "h_acc_gen_den");
    const dy::Yield y_num_acc    = dy::GetYieldFromLabel(dy::Sample::dyll, label, "h_acc_rec_num");
    const dy::Yield y_acc        = dy::GetYieldFromLabel(dy::Sample::dyll, label, "h_acc_rec");
    const dy::Yield y_nsig       = y_data - y_bk_pred; 

    // xsec = (Nobs - Nbkg)/(lumi * acc)
    dy::Yield xsec = y_nsig/(lumi * y_acc); 
    xsec = xsec * (1e-6); // fb --> nb


    std::string result;
    if (print_latex)
    {
        string latex("\\begin{table}[ht!]\n"                    ); 
        latex.append("\\begin{center}\n"                        ); 
        latex.append("\\begin{tabular}{l|ccc} \\hline\\hline\n" ); 
        latex.append("source & $ee$ & $\\mu\\mu$ \\\\\n"        ); 
        latex.append("\\hline\n"                                ); 
        latex.append(Form("%s \\\\\n", GetLatex("$N_{obs}$" ,    y_data).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("$N_{mc}$"  , y_mc_pred).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("$N_{dyll}$", y_dy_pred).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("$N_{bkgd}$", y_bk_pred).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("$N_{sig}$" ,    y_nsig).c_str()));
        latex.append(Form("%s \\\\\n", GetLatex("Acc"       ,     y_acc).c_str()));
        latex.append("\\hline\\hline\n");
        latex.append(Form("%s \\\\\n", GetLatex("Sigma (nb)", xsec).c_str()));
        latex.append("\\hline\\hline\n"                              ); 
        latex.append("\\end{tabular}\n"                              ); 
        latex.append("\\caption{Drell-Yan Exercise Cross-Section}\n" ); 
        latex.append("\\end{center}\n"                               ); 
        latex.append("\\end{table}"                                  ); 
        result = latex;
    }
    else
    {
        // make the table
        CTable t_yields;
        t_yields.useTitle();
        t_yields.setTitle("Cross-Sectoin for Drell-Yan Exercise");
        t_yields.setTable()
        (                                  "ee",                    "mm") 
        ("N_obs"       ,    y_data.ee.pm("4.0"),     y_data.mm.pm("4.0")) 
        ("N_mc"        , y_mc_pred.ee.pm("4.1"),  y_mc_pred.mm.pm("4.1")) 
        ("N_dyll"      , y_dy_pred.ee.pm("4.1"),  y_dy_pred.mm.pm("4.1")) 
        ("N_bkgd"      , y_bk_pred.ee.pm("4.1"),  y_bk_pred.mm.pm("4.1")) 
        ("N_sig"       ,    y_nsig.ee.pm("4.1"),     y_nsig.mm.pm("4.1")) 
        ("Num Acc"     , y_num_acc.ee.pm("4.3"),  y_num_acc.mm.pm("4.3")) 
        ("Den Acc"     , y_den_acc.ee.pm("4.3"),  y_den_acc.mm.pm("4.3")) 
        ("Acc"         ,     y_acc.ee.pm("4.3"),      y_acc.mm.pm("4.3")) 
        ("Sigma (nb)"  ,      xsec.ee.pm("4.3"),       xsec.mm.pm("4.3")) 
        ;

        // print it
        std::ostringstream os;
        os << t_yields;
        result = os.str();
    }

    // output
    if (output_file.empty())
    {
        std::cout << result << std::endl;
    }
    else
    {
        std::ofstream fout(output_file);
        fout << result << std::endl;
    }
}