8 TBranch *br = t1->GetBranch(var);
15 TEventList *el=(TEventList*)gROOT->FindObject(
"el");
17 t1->SetBranchStatus(
"*",0);
18 t1->SetBranchStatus(var,1);
21 bool isint=tit.EndsWith(
"/I");
24 t1->SetBranchAddress(var,&ibev);
26 t1->SetBranchAddress(var,&fbev);
29 int lev = -1, cev=-1,
cnt=0;
30 for (
int i=0;
i<el->GetN();++
i)
32 t1->GetEvent(el->GetEntry(
i));
34 cev = isint ? ibev : fbev;
40 t1->SetBranchStatus(
"*",1);
49 g->GetHistogram()->SetTitle(tit);
50 g->GetHistogram()->SetMinimum(0);
52 g->SetMarkerColor(
col);
53 g->SetMarkerStyle(marker);
63 if (tit==
"") tit=g->GetTitle();
65 double ymax = TMath::MaxElement(g->GetN(), g->GetY());
66 double dymax = g->GetErrorY(TMath::LocMax(g->GetN(), g->GetEY()));
70 xmin = TMath::MinElement(g->GetN(), g->GetX());
71 xmax = TMath::MaxElement(g->GetN(), g->GetX());
75 h->GetXaxis()->SetLabelSize(0.05);
76 h->GetXaxis()->SetTitleSize(0.05);
77 h->GetYaxis()->SetLabelSize(0.05);
78 h->GetYaxis()->SetTitleSize(0.05);
79 h->GetYaxis()->SetTitleOffset(1.4);
81 h->SetMaximum((ymax+dymax)*1.05);
130 std::map<long int,long int> evcnts =
131 { {1100,24342651889}, {1101,23723523588}, {1102,21921465124}, {1103,21192161015}, {1104,20899111775}, {1105,21264224163}, {1106,21918977223}, {1107,20327238649},
132 {1120,21266925718}, {1121,21721036293}, {1122,21144322234}, {1123,20364376890}, {1124,20899648526}, {1125,21667979271}, {1126,22088200372}, {1127,21308984620},
134 {1200,8821819045}, {1201,9010185209}, {1202,7969422935}, {1203,8081829652}, {1204,7707163073}, {1205,7482700194}, {1206,7781565342}, {1207,7967077007},
135 {1220,8229011119}, {1221,7705315505}, {1222,8043282415}, {1223,7780855820}, {1224,8230265044}, {1225,8005672265}, {1226,7407676699}, {1227,7932457375}
142 int bkgmode = sigmode+1000;
145 TFile *
f =
new TFile(fname);
146 TTree *
t = (TTree*)f->Get(
"ntp1");
148 TFile fana(
"anaJ.root",
"UPDATE");
151 g[0] =
new TGraphErrors(8);
152 g[1] =
new TGraphErrors(8);
153 g[2] =
new TGraphErrors(8);
154 g[3] =
new TGraphErrors(8);
159 confgraph(g[3],
"background efficiency");
161 TF1 *
f1=
new TF1(
"f1",
"0.5*[0]*(1.0-TMath::Erf((x-[1])/[2]))+[3]",0,100.);
162 f1->SetParLimits(2,15,100);
171 double emc_rmv[8] = { 0., 6., 23., 39., 56., 72., 89., 100.};
174 TString lab[4] = {
";EMC missing (polar #theta) [%];signal efficiency [%]",
";EMC missing (polar #theta) [%];background efficiency [%]",
";EMC missing (polar #theta) [%];S/B",
";EMC missing (polar #theta) [%];significance [#sigma]"};
177 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,800);
178 c1->Divide(2,2,0.0001,0.0001);
183 double Lint = 1170*2;
184 double fBR = 0.05*0.06;
186 double S_dat = sig_S * fBR * Lint;
187 double B_dat = sig_B * Lint;
189 cout <<
"S:B = "<<S_dat/B_dat<<
" mode_S="<<sigmode<<
" mode_B="<<bkgmode<<endl;
191 printf (
" i | S0 | B0 | S | B | fS | fB | S* | B* |\n");
192 printf (
"----+----------+------------+----------+---------+----------+------------+---------+---------+\n");
193 for (
int i=0;
i<8;++
i)
196 long int B0 = evcnts[sigmode+
i+1000];
200 double fS = S_dat/S0;
201 double fB = B_dat/B0;
203 TString sigcut = Form(
"%s && mode==%d",
cut.Data(), sigmode+
i);
204 TString bkgcut = Form(
"%s && mode==%d",
cut.Data(), bkgmode+
i);
207 double S = (double)
cntEvt(t, sigcut);
208 double B = (double)
cntEvt(t, bkgcut);
212 printf(
"%2d | %6ld | %6.3f G | %6d | %5d | %6.4f | %7.4f | %5.0f | %5.0f |\n",
i, S0, (
double)B0/1e9, (
int)S, (
int)B, fS, fB, S*fS, B*fB);
215 double SN = S*fS/(B*fB);
216 double dSN = SN*
sqrt(dS*dS/(S*S) + dB*dB/(B*B));
218 g[2]->SetPoint(
i, emc_rmv[
i], SN);
219 g[2]->SetPointError(i, 0, dSN);
222 double Z = S*fS/
sqrt(S*fS+B*fB);
223 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)) ;
225 g[3]->SetPoint(i, emc_rmv[i], Z);
226 g[3]->SetPointError(i, 0, dZ);
230 double deffS = effS*
sqrt( 1./S + 1./S0 );
232 g[0]->SetPoint(i, emc_rmv[i], effS*100.);
233 g[0]->SetPointError(i, 0, deffS*100.);
237 double deffB = effB*
sqrt( 1./B + 1./B0 );
239 g[1]->SetPoint(i, emc_rmv[i], effB*100.);
240 g[1]->SetPointError(i, 0, deffB*100.);
245 gStyle->SetOptFit(0);
246 gStyle->SetOptStat(0);
248 TString plotnam[4]={
"effs",
"effb",
"sn",
"sign"};
250 for (
int i=0;
i<4;++
i)
255 g[
i]->Draw(
"P same");
257 f1->SetParameters(TMath::MaxElement(g[i]->GetN(), g[i]->GetY()),70, 10, TMath::MinElement(g[i]->GetN(), g[i]->GetY()));
260 f1->SetParameters(TMath::MaxElement(g[i]->GetN(), g[i]->GetY()),120, -10, TMath::MinElement(g[i]->GetN(), g[i]->GetY()));
261 f1->SetParLimits(1,110,200);
268 g[
i]->SetName(plotnam[i]+
"_"+((
TString)fname(5,5)));
272 fname.ReplaceAll(
".root",
"");
273 cut.ReplaceAll(
"&&",
"_AND_");
274 cut.ReplaceAll(
"||",
"_OR_");
275 cut.ReplaceAll(
"!",
"_NOT_");
276 cut.ReplaceAll(
">",
"_lg_");
277 cut.ReplaceAll(
"<",
"_sm_");
278 cut.ReplaceAll(
".",
"_");
280 c1->SaveAs(Form(
"fig/%s__%03d__%s.gif",fname.Data(), sigmode,
cut.Data()));
281 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)
void analyse_J(TString fname="ntp1_Jee_A.root", TString cut="xd0d0pide>0.5&&xd0d1pide>0.5&&chi24c<50", int sigmode=100, TString tit="")
void confgraph(TGraph *g, TString tit, int col=1, int marker=20)
TH1F * createHistoGraph(TGraph *g, TString tit="", double xmin=0, double xmax=0)
long int cntEvt(TTree *t1, TString cut, TString var="ev")