139 std::map<long int,long int> evcnts =
140 { {1300, 2690752186}, {1301, 2914674237}, {1302, 2786406995}, {1303, 2738298947}, {1304, 2818739807}, {1305, 2866193988}, {1306, 2706488227}, {1307, 2801957793}, {1308, 2690419363},
141 {1320, 2674554579}, {1321, 2754101731}, {1322, 2754649841}, {1323, 2738459876}, {1324,2834829596 }, {1325, 2770416159}, {1326, 2802568964}, {1327, 2786802048}, {1328, 2818616809}
153 evcnts[1300] += 2866079091;
154 evcnts[1320] += 2706466096;
155 evcnts[1308] += 2930718917;
156 evcnts[1328] += 2738620309;
158 std::map<long int,long int> mrgB =
159 { {1300, 17+12}, {1308, 4+1},
160 {1320, 11+14}, {1328, 1+1}
166 int bkgmode = sigmode+1000;
169 TFile *
f =
new TFile(fname);
170 TTree *
t = (TTree*)f->Get(
"ntp5");
172 TFile fana(
"ana_etac_slc.root",
"UPDATE");
177 g[0] =
new TGraphErrors(Nred);
178 g[1] =
new TGraphErrors(Nred);
179 g[2] =
new TGraphErrors(Nred);
180 g[3] =
new TGraphErrors(Nred);
185 confgraph(g[3],
"background efficiency");
187 TF1 *
f1=
new TF1(
"f1",
"0.5*[0]*(1.0-TMath::Erf((x-[1])/[2]))+[3]",0,100.);
196 double emc_rmv[9] = { 0., 12.5, 25., 37.5, 50., 62.5, 75., 87.5, 100. };
199 TString lab[4] = {
";EMC missing [%];signal efficiency (#phi) [%]",
";EMC missing (#phi) [%];background efficiency [%]",
";EMC missing (#phi) [%];S/B",
";EMC missing (#phi) [%];significance [#sigma]"};
202 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,800);
203 c1->Divide(2,2,0.0001,0.0001);
208 double Lint = 1220*5;
209 double fBR = 0.06*0.339*0.394;
211 double S_dat = sig_S * fBR * Lint;
212 double B_dat = sig_B * Lint;
214 cout <<
"S:B = "<<S_dat/B_dat<<
" mode_S="<<sigmode<<
" mode_B="<<bkgmode<<endl;
216 printf (
" i | S0 | B0 | S | B | fS | fB | S* | B* |\n");
217 printf (
"----+----------+------------+----------+--------+----------+-----------+---------+---------+\n");
218 for (
int i=0;
i<Nred;++
i)
221 long int B0 =evcnts[sigmode+
i+1000];
225 double fS = S_dat/S0;
226 double fB = B_dat/B0;
228 TString sigcut = Form(
"%s && mode==%d && xmct",
cut.Data(), sigmode+
i);
229 TString bkgcut = Form(
"%s && mode==%d",
cut.Data(), bkgmode+
i);
232 double S = (double)
cntEvt(t, sigcut);
233 double B = (double) (mrgB.find(sigmode+
i+1000) == mrgB.end() ?
cntEvt(t, bkgcut)+1 : mrgB[sigmode+
i+1000]);
235 (double)
cntEvt(t, bkgcut)+1;
239 printf(
"%2d | %6ld | %6.3f G | %6d | %4d | %6.4f | %6.4f | %5.0f | %5.0f |\n",
i, S0, (
double)B0/1e9, (
int)S, (
int)B, fS, fB, S*fS, B*fB);
242 double SN = S*fS/(B*fB);
243 double dSN = SN*
sqrt(dS*dS/(S*S) + dB*dB/(B*B));
245 g[2]->SetPoint(
i, emc_rmv[
i], SN);
246 g[2]->SetPointError(i, 0, dSN);
249 double Z = S*fS/
sqrt(S*fS+B*fB);
250 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)) ;
252 g[3]->SetPoint(i, emc_rmv[i], Z);
253 g[3]->SetPointError(i, 0, dZ);
257 double deffS = effS*
sqrt( 1./S + 1./S0 );
259 g[0]->SetPoint(i, emc_rmv[i], effS*100.);
260 g[0]->SetPointError(i, 0, deffS*100.);
264 double deffB = effB*
sqrt( 1./B + 1./B0 );
266 g[1]->SetPoint(i, emc_rmv[i], effB*100.);
267 g[1]->SetPointError(i, 0, deffB*100.);
272 gStyle->SetOptFit(0);
273 gStyle->SetOptStat(0);
275 TString plotnam[4]={
"effs",
"effb",
"sn",
"sign"};
277 for (
int i=0;i<4;++
i)
280 gPad->SetTopMargin(0.10);
283 g[
i]->Draw(
"P same");
285 f1->SetParameters(TMath::MaxElement(g[i]->GetN(), g[i]->GetY()),70, 10, TMath::MinElement(g[i]->GetN(), g[i]->GetY()));
286 f1->SetParLimits(2,50,200);
300 g[
i]->SetName(plotnam[i]+
"_"+((
TString)fname(9,7)));
304 fname.ReplaceAll(
".root",
"");
305 cut.ReplaceAll(
"&&",
"_AND_");
306 cut.ReplaceAll(
"||",
"_OR_");
307 cut.ReplaceAll(
"!",
"_NOT_");
308 cut.ReplaceAll(
">",
"_lg_");
309 cut.ReplaceAll(
"<",
"_sm_");
310 cut.ReplaceAll(
".",
"_");
312 c1->SaveAs(Form(
"fig/%s__%03d__%s.gif",fname.Data(), sigmode,
cut.Data()));
313 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)