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);
141 std::map<long int,long int> evcnts =
142 { {1300, 2866079091}, {1301, 2770144980}, {1302, 2658679173}, {1303, 2850295200}, {1304, 2866373874}, {1305, 2706157924}, {1306, 2801993946}, {1307, 2706466096},
143 {1320, 2930718917}, {1321, 2690367302}, {1322, 2674423426}, {1323, 2834563180}, {1324, 2786239006}, {1325, 2706374195}, {1326, 2770320696}, {1327, 2738620309}
154 evcnts[1300] += 2690752186;
155 evcnts[1320] += 2690419363;
156 evcnts[1307] += 2674554579;
157 evcnts[1327] += 2818616809;
159 std::map<long int,long int> mrgB =
160 { {1300, 17+12}, {1307, 4+1},
161 {1320, 11+14}, {1327, 1+1}
168 int bkgmode = sigmode+1000;
171 TFile *
f =
new TFile(fname);
172 TTree *
t = (TTree*)f->Get(
"ntp5");
174 TFile fana(
"ana_etac.root",
"UPDATE");
177 g[0] =
new TGraphErrors(8);
178 g[1] =
new TGraphErrors(8);
179 g[2] =
new TGraphErrors(8);
180 g[3] =
new TGraphErrors(8);
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.);
198 double emc_rmv[8] = { 0., 6., 23., 39., 56., 72., 89., 100.};
201 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]"};
204 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,800);
205 c1->Divide(2,2,0.0001,0.0001);
210 double Lint = 1220*5;
211 double fBR = 0.06*0.339*0.394;
213 double S_dat = sig_S * fBR * Lint;
214 double B_dat = sig_B * Lint;
216 cout <<
"S:B = "<<S_dat/B_dat<<
" mode_S="<<sigmode<<
" mode_B="<<bkgmode<<endl;
218 printf (
" i | S0 | B0 | S | B | fS | fB | S* | B* |\n");
219 printf (
"----+----------+------------+----------+--------+----------+-----------+---------+---------+\n");
220 for (
int i=0;
i<8;++
i)
223 long int B0 = evcnts[sigmode+
i+1000];
226 double fS = S_dat/S0;
227 double fB = B_dat/B0;
229 TString sigcut = Form(
"%s && mode==%d && xmct",
cut.Data(), sigmode+
i);
230 TString bkgcut = Form(
"%s && mode==%d",
cut.Data(), bkgmode+
i);
233 double S = (double)
cntEvt(t, sigcut);
234 double B = (double) (mrgB.find(sigmode+
i+1000) == mrgB.end() ?
cntEvt(t, bkgcut)+1 : mrgB[sigmode+
i+1000]);
238 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);
241 double SN = S*fS/(B*fB);
242 double dSN = SN*
sqrt(dS*dS/(S*S) + dB*dB/(B*B));
244 g[2]->SetPoint(
i, emc_rmv[
i], SN);
245 g[2]->SetPointError(i, 0, dSN);
248 double Z = S*fS/
sqrt(S*fS+B*fB);
249 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)) ;
251 g[3]->SetPoint(i, emc_rmv[i], Z);
252 g[3]->SetPointError(i, 0, dZ);
256 double deffS = effS*
sqrt( 1./S + 1./S0 );
258 g[0]->SetPoint(i, emc_rmv[i], effS*100.);
259 g[0]->SetPointError(i, 0, deffS*100.);
263 double deffB = effB*
sqrt( 1./B + 1./B0 );
265 g[1]->SetPoint(i, emc_rmv[i], effB*100.);
266 g[1]->SetPointError(i, 0, deffB*100.);
271 gStyle->SetOptFit(0);
272 gStyle->SetOptStat(0);
274 TString plotnam[4]={
"effs",
"effb",
"sn",
"sign"};
276 double hmaxy[4] = {20., 1e-5, 0.25, 7.};
278 for (
int i=0;
i<4;++
i)
281 gPad->SetTopMargin(0.10);
283 h[
i]->SetMaximum(hmaxy[i]);
285 g[
i]->Draw(
"P same");
287 f1->SetParameters(TMath::MaxElement(g[i]->GetN(), g[i]->GetY()),70, 10, TMath::MinElement(g[i]->GetN(), g[i]->GetY()));
290 f1->SetParameters(TMath::MaxElement(g[i]->GetN(), g[i]->GetY()),120, -10, TMath::MinElement(g[i]->GetN(), g[i]->GetY()));
291 f1->SetParLimits(1,110,200);
296 if (i>0) g[
i]->Fit(
"f1",
"q");
297 else g[
i]->Fit(
"f1",
"q",
"",0,95);
299 g[
i]->SetName(plotnam[i]+
"_"+((
TString)fname(5,7)));
303 fname.ReplaceAll(
".root",
"");
304 cut.ReplaceAll(
"&&",
"_AND_");
305 cut.ReplaceAll(
"||",
"_OR_");
306 cut.ReplaceAll(
"!",
"_NOT_");
307 cut.ReplaceAll(
">",
"_lg_");
308 cut.ReplaceAll(
"<",
"_sm_");
309 cut.ReplaceAll(
".",
"_");
311 c1->SaveAs(Form(
"fig/%s__%03d__%s.gif",fname.Data(), sigmode,
cut.Data()));
312 c1->SaveAs(Form(
"fig/%s__%03d__%s.C",fname.Data(), sigmode,
cut.Data()));
void analyse_etac1(TString fname="ntp5_etac1_A.root", TString cut="chi24c<50", int sigmode=300, TString tit="")
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)