20void f_eff(TTree *m_tree, TCut &cut_all, TCut &cut_four, Double_t *m_eff, Double_t *m_err, Double_t *m_xcen, Double_t *m_xerr){
21 TH1F *hpionm =
new TH1F(
"hpionm",
"hpionm",7,0.05,0.4);
22 TH1F *hfourm =
new TH1F(
"hfourm",
"hfourm",7,0.05,0.4);
23 m_tree->Draw(
"tppionratiom*mompionm>>hpionm",cut_all+
"fabs(costhe[1])<0.7");
24 m_tree->Draw(
"tppionratiom*mompionm>>hfourm",cut_four+
"fabs(costhe[1])<0.7");
26 for(Int_t i=1; i<8; i++){
27 m_eff[i-1] = hpionm->GetBinContent(i) ? hfourm->GetBinContent(i)/hpionm->GetBinContent(i) : 0;
28 m_err[i-1] = m_eff[i-1]*(hpionm->GetBinContent(i)) ? sqrt((m_eff[i-1])*(1-m_eff[i-1])/((hpionm->GetBinContent(i)))) : 0 ;
29 m_xcen[i-1] = hfourm->GetBinCenter(i);
30 m_xerr[i-1] = hfourm->GetBinWidth(i)/2;
31 cout <<
"pt mom: " << 0.05+(i-1)*(0.4-0.05)/7 <<
" eff: " <<m_eff[i-1] <<
" err: " << m_err[i-1] << endl;
36void aug14_track_eff_ptmom_count_barrel(TString file_fir_name=
"../../651_pipijpsi_inclusive.root", TString file_sec_name=
"../../651_pipijpsi_inclusive.root", TCut m_cut_run=
"", TCut m_cut_run=
"", TString tree_name=
"infmom", Int_t
m_bins=7){
38 gROOT->SetStyle(
"BES");
39 TFile *m_file =
new TFile(file_fir_name);
40 TTree *m_tree = (TTree*)m_file->Get(tree_name);
42 Double_t m_data_eff[7], m_data_err[7], m_mc_eff[7], m_mc_err[7];
43 Double_t m_xcen[7], m_xerr[7];
46 TFile *m_file2 =
new TFile(file_sec_name);
47 TTree *m_tree2 = (TTree*)m_file2->Get(tree_name);
51 TCanvas *c1 =
new TCanvas(
"c1",
"c1",10,10,800,643);
52 TGraphErrors *gr_data =
new TGraphErrors(
m_bins, m_xcen, m_data_eff, m_xerr, m_data_err);
53 gr_data->SetTitle(
"Tracking effciency of #pi^{-}");
54 gr_data->GetXaxis()->SetTitle(
"transverse momentum (GeV)");
55 gr_data->GetYaxis()->SetTitle(
"efficiency");
56 gr_data->GetYaxis()->SetRangeUser(0.65,1.0);
57 gr_data->SetMarkerColor(2);
58 gr_data->SetMarkerStyle(20);
60 TGraphErrors *gr_mc =
new TGraphErrors(
m_bins, m_xcen, m_mc_eff, m_xerr, m_mc_err);
61 gr_mc->SetMarkerColor(4);
62 gr_mc->SetMarkerStyle(21);
63 gr_mc->GetXaxis()->SetTitle(
"transverse momentum (GeV)");
64 gr_mc->GetYaxis()->SetTitle(
"efficiency");
70 m_text.SetTextSize(0.08);
71 m_text.SetTextColor(2);
72 m_text.DrawTextNDC(0.5,0.4,
"bg 2.4%");
74 m_text.SetTextColor(4);
75 m_text.DrawTextNDC(0.5,0.3,
"bg 12%");
77 m_text.SetTextColor(1);
78 m_text.DrawTextNDC(0.5,0.2,
"651, Barrel");
79 m_text.DrawTextNDC(0.5,0.5,
"Inclusive MC");
81 c1->Print(
"figs/nov30_track_eff_ptmom_count_barrel_651_bg_study.eps");
82 c1->Print(
"figs/nov30_track_eff_ptmom_count_barrel_651_bg_study.pdf");
void f_eff(TTree *m_tree, TCut &cut_all, TCut &cut_four, Double_t *m_eff, Double_t *m_err, Double_t *m_xcen, Double_t *m_xerr)
void aug14_track_eff_ptmom_count_barrel(TString file_fir_name="../../651_pipijpsi_inclusive.root", TString file_sec_name="../../651_pipijpsi_inclusive.root", TCut m_cut_run="", TCut m_cut_run="", TString tree_name="infmom", Int_t m_bins=7)