BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Single_pideff.cxx
Go to the documentation of this file.
1void Single_pideff(char *filename="Single_pid.root")
2{
3TFile *f = new TFile(filename);
4TTree *pid_kal = (TTree*)f->Get("pid_kal");
5
6Double_t kal_p;
7Double_t prob_pion;
8Double_t prob_kaon;
9Double_t prob_proton;
10
11pid_kal->SetBranchAddress("kal_p",&kal_p);
12pid_kal->SetBranchAddress("prob_pion",&prob_pion);
13pid_kal->SetBranchAddress("prob_kaon",&prob_kaon);
14pid_kal->SetBranchAddress("prob_proton",&prob_proton);
15
16
17Int_t nevent = pid_kal->GetEntries();
18
19Double_t x[10]={.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0};
20Double_t ex[10]={0};
21
22Int_t kal[10]={0};
23
24Int_t pid1[10]={0};
25Int_t pid2[10]={0};
26Int_t pid3[10]={0};
27Int_t pid4[10]={0};
28Int_t pid5[10]={0};
29Int_t pid6[10]={0};
30Int_t pid7[10]={0};
31Int_t pid8[10]={0};
32
33Double_t eff1[10]={0};
34Double_t eff2[10]={0};
35Double_t eff3[10]={0};
36Double_t eff4[10]={0};
37Double_t eff5[10]={0};
38Double_t eff6[10]={0};
39Double_t eff7[10]={0};
40Double_t eff8[10]={0};
41
42Double_t err1[10]={0};
43Double_t err2[10]={0};
44Double_t err3[10]={0};
45Double_t err4[10]={0};
46Double_t err5[10]={0};
47Double_t err6[10]={0};
48Double_t err7[10]={0};
49Double_t err8[10]={0};
50
51
52for (Int_t i=0; i<nevent; i++){
53 pid_kal->GetEntry(i);
54
55 for(Int_t j=0; j<10; j++){
56 if(kal_p>0.05+0.1*j&&kal_p<0.15+0.1*j){
57 kal[j]++;
58 if(prob_pion>0) pid1[j]++;
59 if(prob_pion>0.001) pid2[j]++;
60 if(prob_pion>prob_kaon) pid3[j]++;
61 if(prob_pion>prob_kaon&&prob_pion>prob_proton) pid4[j]++;
62 if(prob_pion>0&&prob_pion>prob_kaon) pid5[j]++;
63 if(prob_pion>0&&prob_pion>prob_kaon&&prob_pion>prob_proton) pid6[j]++;
64 if(prob_pion>0.001&&prob_pion>prob_kaon) pid7[j]++;
65 if(prob_pion>0.001&&prob_pion>prob_kaon&&prob_pion>prob_proton) pid8[j]++;
66 }
67 }
68}
69
70
71for(Int_t i=0;i<10;i++){
72 eff1[i]=(pid1[i]*.1)/(kal[i]*.1);
73 err1[i]=sqrt(eff1[i]*(1-eff1[i])/kal[i]);
74
75 eff2[i]=(pid2[i]*.1)/(kal[i]*.1);
76 err2[i]=sqrt(eff2[i]*(1-eff2[i])/kal[i]);
77
78 eff3[i]=(pid3[i]*.1)/(kal[i]*.1);
79 err3[i]=sqrt(eff3[i]*(1-eff3[i])/kal[i]);
80
81 eff4[i]=(pid4[i]*.1)/(kal[i]*.1);
82 err4[i]=sqrt(eff4[i]*(1-eff4[i])/kal[i]);
83
84 eff5[i]=(pid5[i]*.1)/(kal[i]*.1);
85 err5[i]=sqrt(eff5[i]*(1-eff5[i])/kal[i]);
86
87 eff6[i]=(pid6[i]*.1)/(kal[i]*.1);
88 err6[i]=sqrt(eff6[i]*(1-eff6[i])/kal[i]);
89
90 eff7[i]=(pid7[i]*.1)/(kal[i]*.1);
91 err7[i]=sqrt(eff7[i]*(1-eff7[i])/kal[i]);
92
93 eff8[i]=(pid8[i]*.1)/(kal[i]*.1);
94 err8[i]=sqrt(eff8[i]*(1-eff8[i])/kal[i]);
95}
96
97
98TGraph *gr1 = new TGraphErrors(10,x,eff1,ex,err1);
99TGraph *gr2 = new TGraphErrors(10,x,eff2,ex,err2);
100TGraph *gr3 = new TGraphErrors(10,x,eff3,ex,err3);
101TGraph *gr4 = new TGraphErrors(10,x,eff4,ex,err4);
102TGraph *gr5 = new TGraphErrors(10,x,eff5,ex,err5);
103TGraph *gr6 = new TGraphErrors(10,x,eff6,ex,err6);
104TGraph *gr7 = new TGraphErrors(10,x,eff7,ex,err7);
105TGraph *gr8 = new TGraphErrors(10,x,eff8,ex,err8);
106
107TCanvas *c1 = new TCanvas ("c1","pion_eff_pid",100,10,600,400);
108TMultiGraph *mg = new TMultiGraph();
109
110
111c1->SetGrid();
112
113mg->SetTitle("pion_eff_pid");
114
115//gr1->SetLineColor(2);
116gr2->SetLineColor(1);
117//gr3->SetLineColor(4);
118gr4->SetLineColor(2);
119//gr5->SetLineColor(6);
120//gr6->SetLineColor(3);
121//gr7->SetLineColor(8);
122gr8->SetLineColor(3);
123
124
125//mg->Add(gr1);
126mg->Add(gr2);
127//mg->Add(gr3);
128mg->Add(gr4);
129//mg->Add(gr5);
130//mg->Add(gr6);
131//mg->Add(gr7);
132mg->Add(gr8);
133
134
135
136mg->Draw("ALP");
137mg->GetYaxis()->SetRangeUser(0.9,1.0);
138mg->GetXaxis()->SetTitle("Pt/GeV");
139mg->GetYaxis()->SetTitle("Eff");
140
141TLegend *legend=new TLegend(0.55,0.15,0.85,0.35);
142//legend->AddEntry(gr1,"prob(\\pi)>0","l");
143legend->AddEntry(gr2,"prob(\\pi)>0.001","l");
144//legend->AddEntry(gr3,"prob(\\pi)>prob(K)","l");
145legend->AddEntry(gr4,"prob(\\pi)>prob(K)&&prob(\\pi)>prob(p)","l");
146//legend->AddEntry(gr5,"prob(\\pi)>0&&prob(\\pi)>prob(K)","l");
147//legend->AddEntry(gr6,"prob(\\pi)>0&&prob(\\pi)>prob(K)&&prob(\\pi)>prob(p)","l");
148//legend->AddEntry(gr7,"prob(\\pi)>0.001&&prob(\\pi)>prob(K)","l");
149legend->AddEntry(gr8,"prob(\\pi)>0.001&&prob(\\pi)>prob(K)&&prob(\\pi)>prob(p)","l");
150
151
152legend->Draw();
153
154}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
Double_t x[10]
void Single_pideff(char *filename="Single_pid.root")