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