BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Validation/SingleAlg/SingleAlg-00-01-00/share/eff.cxx
Go to the documentation of this file.
1{
2gStyle->SetFrameFillColor(0);
3gStyle->SetCanvasColor(0);
4gStyle->SetFillColor(0);
5
6gStyle->SetPadTickX(1);
7gStyle->SetPadTickY(1);
8
9gStyle->SetTitleXOffset(1.);
10gStyle->SetTitleYOffset(1.);
11
12gStyle->SetTitleXSize(0.06);
13gStyle->SetTitleYSize(0.06);
14
15gStyle->SetLabelSize(0.055,"x");
16gStyle->SetLabelSize(0.055,"y");
17gStyle->SetMarkerSize(1.8);
18gStyle->SetLineWidth(2.5);
19// gStyle->SetPadBorderMode(0);
20
21// gStyle->SetPadBorderMode(0);
22
23
24gStyle->SetPadLeftMargin(0.15);
25gStyle->SetPadTopMargin(0.1);
26gStyle->SetPadBottomMargin(0.15);
27
28//Double_t x[10]={.05,.15,.25,.35,.45,.55,.65,.75,.85,.95};
29//Double_t errx[20]={0.025,0.025,0.025,0.025,0.025,0.025,0.025,0.025,0.05,0.05,0.05,0.05,0.05,0.05,0.025,0.025,0.025,0.025,0.025,0.025};
30Double_t errx[20]={0};
31//Double_t errx[10]={0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05};
32 Double_t x[20]={0.025,0.075,0.125,0.175,0.225,0.275,0.325,0.375,0.425,0.475,0.525,0.575,0.625,0.675,0.725,0.775,0.825,0.875,0.925,0.975};
33
34Double_t eventNo=5000.;
35Char_t cut[200];
36
37Int_t kal_single[20];
38Int_t mc_single[20];
39Double_t eff_single[20];
40Double_t err_single[20];
41
42
43Int_t kal_single2[20];
44Int_t mc_single2[20];
45Double_t eff_single2[20];
46Double_t err_single2[20];
47
48Int_t kal_single3[20];
49Int_t mc_single3[20];
50Double_t eff_single3[20];
51Double_t err_single3[20];
52
53
54////////////////////////////// 1 /////////////////////////////////////////////////////////
55//TFile f("../test.root");
56TFile f("all10.root");
57//TFile f("/ihepbatch/besd22/jixb/yuanwl/single/MC/p651p.root");
58for (Int_t j=1; j<18; j++){
59 sprintf(cut,"(runinfo_ngood==0||runinfo_ngood==1)&&kal_n>=0.+%d*0.05&&kal_n<0.05+%d*0.05&&costheta_n>-0.7&&costheta_n<0.7",j,j);
60 runinfo->Draw("kal_n",cut);
61 mc_single[j]=htemp->GetEntries();
62
63 sprintf(cut,"runinfo_ngood==1&&kal_n>=0.+%d*0.05&&kal_n<0.05+%d*0.05&&costheta_n>-0.7&&costheta_n<0.7",j,j);
64 runinfo->Draw("kal_n",cut);
65 kal_single[j]=htemp->GetEntries();
66
67}
68
69
70
71
72////////////////////////////// 2 /////////////////////////////////////////////////////////
73TFile f("all09.root");
74//TFile f("../single_proton_gold0.3mm.root");
75for (Int_t j=1; j<18; j++){
76sprintf(cut,"(runinfo_ngood==0||runinfo_ngood==1)&&kal_n>=0.+%d*0.05&&kal_n<0.05+%d*0.05&&costheta_n>-0.7&&costheta_n<0.7",j,j);
77 runinfo->Draw("kal_n",cut);
78 mc_single2[j]=htemp->GetEntries();
79 sprintf(cut,"runinfo_ngood==1&&kal_n>=0.+%d*0.05&&kal_n<0.05+%d*0.05&&costheta_n>-0.7&&costheta_n<0.7",j,j);
80 runinfo->Draw("kal_n",cut);
81 kal_single2[j]=htemp->GetEntries();
82}
83
84
85
86
87////////////////////////////// 3 /////////////////////////////////////////////////////////
88TFile f("all09.root");
89for (Int_t j=1; j<18; j++){
90
91sprintf(cut,"(runinfo_ngood==0||runinfo_ngood==1)&&kal_n>=0.+%d*0.05&&kal_n<0.05+%d*0.05&&costheta_n>-0.7&&costheta_n<0.7",j,j);
92 runinfo->Draw("kal_n",cut);
93 mc_single3[j]=htemp->GetEntries();
94 sprintf(cut,"runinfo_ngood==1&&kal_n>=0.+%d*0.05&&kal_n<0.05+%d*0.05&&costheta_n>-0.7&&costheta_n<0.7",j,j);
95 runinfo->Draw("kal_n",cut);
96 kal_single3[j]=htemp->GetEntries();
97}
98
99
100
101for (Int_t i=1;i<18;i++){
102 cout<<mc_single[i]<<endl;
103 eff_single[i]=kal_single[i]*.1/(mc_single[i]*.1);
104 err_single[i]=sqrt(eff_single[i]*(1.-eff_single[i])/mc_single[i]);
105
106
107 eff_single2[i]=kal_single2[i]*.1/(mc_single2[i]*.1);
108 err_single2[i]=sqrt(eff_single2[i]*(1.-eff_single2[i])/mc_single2[i]);
109
110
111 eff_single3[i]=kal_single3[i]*.1/(mc_single3[i]*.1);
112 err_single3[i]=sqrt(eff_single3[i]*(1.-eff_single3[i])/mc_single3[i]);
113
114}
115 cout<<"............"<<endl;
116
117
118TGraph *gr1 = new TGraphErrors(18,x,eff_single,errx,err_single);
119TGraph *gr2 = new TGraphErrors(18,x,eff_single2,errx,err_single2);
120TGraph *gr3 = new TGraphErrors(18,x,eff_single3,errx,err_single3);
121
122
123
124TCanvas *c1 = new TCanvas ("c1","p",100,10,600,400);
125TMultiGraph *mg = new TMultiGraph();
126
127
128//c1->SetGrid();
129
130//mg->SetTitle("p");
131
132
133gr1->SetLineColor(2);
134gr2->SetLineColor(3);
135gr3->SetLineColor(4);
136
137
138
139gr1->SetMarkerColor(2);
140gr2->SetMarkerColor(3);
141gr3->SetMarkerColor(4);
142
143
144gr1->SetMarkerStyle(20);
145gr2->SetMarkerStyle(22);
146gr3->SetMarkerStyle(23);
147
148
149// gr1->SetMarkerSize(1);
150// gr2->SetMarkerSize(1.2);
151// gr3->SetMarkerSize(1);
152// gr4->SetMarkerSize(1.1);
153
154
155mg->Add(gr1);
156mg->Add(gr2);
157//mg->Add(gr3);
158
159
160
161mg->Draw("AP");
162mg->GetYaxis()->SetRangeUser(0.8,1.02);
163mg->GetXaxis()->SetRangeUser(0.05,1.05);
164mg->GetXaxis()->SetTitle("Transvers Momentum/GeV");
165mg->GetYaxis()->SetTitle("Tracking Efficiency");
166
167
168TPaveText *text = new TPaveText(0.98,0.62,0.78,0.67,"tr");
169
170text->AddText("Boss 6.5.1");
171text->SetTextColor(2);
172text->SetBorderSize(0);
173
174//text->Draw();
175
176
177
178TLegend *legend=new TLegend(0.55,0.45,0.75,0.65);
179
180legend->AddEntry(gr1,"1T tsf+pat","p");
181legend->AddEntry(gr2,"0.9T tsf+pat","p");
182//legend->AddEntry(gr3,"proton_Paraffin0.93","p");
183
184
185legend->SetBorderSize(0);
186legend->Draw();
187//c1->Print("p_eff_651.eps");
188
189
190
191
192}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
TFile f("all10.root")