134 std::map<long int,long int> evcnts =
135 { {1100, 29996980207}, {1101, 27740885200}, {1102, 26471309572}, {1103, 27745096509}, {1104, 27497769591}, {1105, 28645444363}, {1106, 25532064241}, {1107, 24338865274}, {1108, 20568203496},
136 {1120, 24341219982}, {1121, 27009017984}, {1122, 26881191552 }, {1123, 25119567078}, {1124, 25082906031}, {1125, 25163739980}, {1126, 24914199407}, {1127, 20942409620}, {1128, 20772725573},
138 {1200, 20255703739}, {1201, 7446866207}, {1202, 7970194795}, {1203, 7520702389}, {1204, 7965350396}, {1205, 9310510861}, {1206, 8972578036}, {1207, 9197632458}, {1208, 8676693188},
139 {1220, 7519725318}, {1221, 8595694989}, {1222, 8751031806}, {1223, 9421220844}, {1224, 8935730839}, {1225, 9084618361}, {1226, 8896609302}, {1227, 9235338848}, {1228, 8900632658}
147 int bkgmode = sigmode+1000;
150 TFile *
f =
new TFile(fname);
151 TTree *
t = (TTree*)f->Get(
"ntp1");
153 TFile fana(
"anaJ_slc.root",
"UPDATE");
158 g[0] =
new TGraphErrors(Nred);
159 g[1] =
new TGraphErrors(Nred);
160 g[2] =
new TGraphErrors(Nred);
161 g[3] =
new TGraphErrors(Nred);
166 confgraph(g[3],
"background efficiency");
170 f1[0]=
new TF1(
"f0",
"0.5*[0]*(1.0-TMath::Erf((x-[1])/[2]))+[3]",0,100.);
171 f1[0]->SetParameters(10,70, 10, 5);
173 f1[1]=
new TF1(
"f1",
"0.5*[0]*(1.0-TMath::Erf((x-[1])/[2]))+[3]",0,100.);
178 f1[1]->SetParameters(1e-4, 50, -65, 6e-5);
179 f1[1]->SetParLimits(1,20,200);
180 f1[1]->SetParLimits(2,20,200);
186 f1[2]=
new TF1(
"f2",
"expo(0)+pol1(2)",0,100.);
187 f1[2]->SetParameters(-0.5,-0.01,1,1);
189 f1[3]=
new TF1(
"f3",
"expo(0)+[2]",0,100.);
190 f1[3]->SetParameters(1.2,-0.02,1.6);
202 double emc_rmv[9] = { 0., 12.5, 25., 37.5, 50., 62.5, 75., 87.5, 100. };
205 TString lab[4] = {
";EMC missing [%];signal efficiency (#phi) [%]",
";EMC missing (#phi) [%];background efficiency [%]",
";EMC missing (#phi) [%];S/B",
";EMC missing (#phi) [%];significance [#sigma]"};
208 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,800);
209 c1->Divide(2,2,0.0001,0.0001);
214 double Lint = 1170*2;
215 double fBR = 0.05*0.06;
217 double S_dat = sig_S * fBR * Lint;
218 double B_dat = sig_B * Lint;
220 cout <<
"S:B = "<<S_dat/B_dat<<
" mode_S="<<sigmode<<
" mode_B="<<bkgmode<<endl;
222 printf (
" i | S0 | B0 | S | B | fS | fB | S* | B* |\n");
223 printf (
"----+----------+------------+----------+---------+----------+-----------+---------+----------+\n");
224 for (
int i=0;
i<Nred;++
i)
227 long int B0 = evcnts[sigmode+
i+1000];
231 double fS = S_dat/S0;
232 double fB = B_dat/B0;
234 TString sigcut = Form(
"%s && mode==%d",
cut.Data(), sigmode+
i);
235 TString bkgcut = Form(
"%s && mode==%d",
cut.Data(), bkgmode+
i);
238 double S = (double)
cntEvt(t, sigcut);
239 double B = (double)
cntEvt(t, bkgcut);
244 printf(
"%2d | %6ld | %6.3f G | %6d | %5d | %6.4f | %7.4f | %5.0f | %6.0f |\n",
i, S0, (
double)B0/1e9, (
int)S, (
int)B, fS, fB, S*fS, B*fB);
247 double SN = S*fS/(B*fB);
248 double dSN = SN*
sqrt(dS*dS/(S*S) + dB*dB/(B*B));
250 g[2]->SetPoint(
i, emc_rmv[
i], SN);
251 g[2]->SetPointError(i, 0, dSN);
254 double Z = S*fS/
sqrt(S*fS+B*fB);
255 double dZ = 0.5 *
sqrt( ((fS*fS*S+2*fB*fS*B)*(fS*fS*S+2*fB*fS*B)*S + fS*fS*fB*fB*S*S*B)/pow(fS*S+fB*B,3)) ;
257 g[3]->SetPoint(i, emc_rmv[i], Z);
258 g[3]->SetPointError(i, 0, dZ);
262 double deffS = effS*
sqrt( 1./S + 1./S0 );
264 g[0]->SetPoint(i, emc_rmv[i], effS*100.);
265 g[0]->SetPointError(i, 0, deffS*100.);
269 double deffB = effB*
sqrt( 1./B + 1./B0 );
271 g[1]->SetPoint(i, emc_rmv[i], effB*100.);
272 g[1]->SetPointError(i, 0, deffB*100.);
277 gStyle->SetOptFit(0);
278 gStyle->SetOptStat(0);
280 TString plotnam[4]={
"effs",
"effb",
"sn",
"sign"};
282 for (
int i=0;i<4;++
i)
287 g[
i]->Draw(
"P same");
296 g[
i]->Fit(Form(
"f%d",i),
"q");
298 g[
i]->SetName(plotnam[i]+
"_"+((
TString)fname(9,5)));
302 fname.ReplaceAll(
".root",
"");
303 cut.ReplaceAll(
"&&",
"_AND_");
304 cut.ReplaceAll(
"||",
"_OR_");
305 cut.ReplaceAll(
"!",
"_NOT_");
306 cut.ReplaceAll(
">",
"_lg_");
307 cut.ReplaceAll(
"<",
"_sm_");
308 cut.ReplaceAll(
".",
"_");
310 c1->SaveAs(Form(
"fig/%s__%03d__%s.gif",fname.Data(), sigmode,
cut.Data()));
311 c1->SaveAs(Form(
"fig/%s__%03d__%s.C",fname.Data(), sigmode,
cut.Data()));
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
friend F32vec4 sqrt(const F32vec4 &a)
long int cntEvt(TTree *t1, TString cut, TString var="ev")
TH1F * createHistoGraph(TGraph *g, TString tit="", double xmin=0, double xmax=0)
void confgraph(TGraph *g, TString tit, int col=1, int marker=20)