BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
aug14_track_eff_ptmom_count_barrel.cxx
Go to the documentation of this file.
1#include "TCut.h"
2#include "cut_pipijpsi.h"
3#include "TTree.h"
4#include "TGraph.h"
5#include "TCanvas.h"
6#include "TFile.h"
7#include "TH1.h"
8#include "TString.h"
9#include "TText.h"
10#include "TGraphErrors.h"
11#include <iostream>
12
13
14TCut m_cut_three_yes = "invjpsi>3.0 && invjpsi<3.2 && pipidang<0.98 && cmslepm<1.7 && cmslepp<1.7 && cmslepm>1.4 && cmslepp>1.4 && mompionm<0.5 && mompionp<0.5 && Npi0<1 && maxene<0.3 && epratio<0.9 && (((eveflag==1||eveflag==6) && missmass<0.25) || eveflag==4)";
15TCut m_cut_four_yes = "invjpsi>3.0 && invjpsi<3.2 && pipidang<0.98 && cmslepm<1.7 && cmslepp<1.7 && cmslepm>1.4 && cmslepp>1.4 && mompionm<0.5 && mompionp<0.5 && Npi0<1 && maxene<0.3 && epratio<0.9 && eveflag==4";
16
17TCut m_cut_three_no = "invjpsi>3.0 && invjpsi<3.2 && pipidang<0.98 && cmslepm<1.7 && cmslepp<1.7 && cmslepm>1.4 && cmslepp>1.4 && mompionm<0.5 && mompionp<0.5 && epratio<1.0 && (eveflag==1||eveflag==6 || eveflag==4)";
18TCut m_cut_four_no = "invjpsi>3.0 && invjpsi<3.2 && pipidang<0.98 && cmslepm<1.7 && cmslepp<1.7 && cmslepm>1.4 && cmslepp>1.4 && mompionm<0.5 && mompionp<0.5 && epratio<1.0 && eveflag==4";
19
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");
25
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;
32 }
33}
34
35//void aug14_track_eff_ptmom_count_barrel(TString file_fir_name="../../651_psip_pipijpsi_data_check.root", TString file_sec_name="../../651_psip_pipijpsi_dst_uu.root", TCut m_cut_run="", TCut m_cut_run="", TString tree_name="infmom", Int_t m_bins=7){
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){
37
38 gROOT->SetStyle("BES");
39 TFile *m_file = new TFile(file_fir_name);
40 TTree *m_tree = (TTree*)m_file->Get(tree_name);
41
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];
44 f_eff(m_tree, m_cut_three_yes, m_cut_four_yes, m_data_eff, m_data_err, m_xcen, m_xerr);
45
46 TFile *m_file2 = new TFile(file_sec_name);
47 TTree *m_tree2 = (TTree*)m_file2->Get(tree_name);
48 f_eff(m_tree2, m_cut_three_no, m_cut_four_no, m_mc_eff, m_mc_err, m_xcen, m_xerr);
49
50 // create the TGraphErrors and draw it
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);
59
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");
65 gr_data->Draw("AP");
66 gr_mc->Draw("P");
67 c1->Update();
68
69 TText m_text;
70 m_text.SetTextSize(0.08);
71 m_text.SetTextColor(2);
72 m_text.DrawTextNDC(0.5,0.4,"bg 2.4%");
73
74 m_text.SetTextColor(4);
75 m_text.DrawTextNDC(0.5,0.3,"bg 12%");
76
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");
80
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");
83}
84
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)
int m_bins(0)