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);
102 std::map<long int,long int> evcnts =
103 { {1000,859179654}, {1001,1}, {1002,1}, {1003,1}, {1004,508041001}, {1005,1}, {1006,1}, {1007,456811794},
104 {1020,478549190}, {1021,1}, {1022,1}, {1023,1}, {1024,537555935}, {1025,1}, {1026,1}, {1027,840537554}
113 int bkgmode = sigmode+1000;
116 TFile *
f =
new TFile(fname);
117 TTree *
t = (TTree*)f->Get(
"ntp1");
119 TFile fana(
"anaPhi.root",
"UPDATE");
122 g[0] =
new TGraphErrors(3);
123 g[1] =
new TGraphErrors(3);
124 g[2] =
new TGraphErrors(3);
125 g[3] =
new TGraphErrors(3);
130 confgraph(g[3],
"background efficiency");
132 TF1 *
f1=
new TF1(
"f1",
"pol0",0,100.);
133 f1->SetParLimits(2,15,100);
142 double emc_rmv[8] = { 0., 6., 23., 39., 56., 72., 89., 100.};
145 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]"};
148 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,800);
149 c1->Divide(2,2,0.0001,0.0001);
154 double Lint = 788*0.5;
155 double fBR = 0.489*0.489;
157 double S_dat = sig_S * fBR * Lint;
158 double B_dat = sig_B * Lint;
160 cout <<
"S:B = "<<S_dat/B_dat<<
" mode_S="<<sigmode<<
" mode_B="<<bkgmode<<endl;
162 int idxx[3] = {0, 4, 7};
169 long int B0 = evcnts[sigmode+i+1000];
171 cout <<
"S0 = "<<S0<<
" B0 = "<<B0<<endl;
173 double fS = S_dat/S0;
174 double fB = B_dat/B0;
176 TString sigcut = Form(
"%s && mode==%d",
cut.Data(), sigmode+
i);
177 TString bkgcut = Form(
"%s && mode==%d",
cut.Data(), bkgmode+
i);
180 double S = (double)
cntEvt(t, sigcut);
181 double B = (double)
cntEvt(t, bkgcut);
185 cout <<i<<
": S="<<S<<
" B="<<B<<
" --> S*"<<fS<<
"="<<S*fS<<
" B*"<<fB<<
"="<<B*fB<<endl;
187 double SN = S*fS/(B*fB);
188 double dSN = SN*
sqrt(dS*dS/(S*S) + dB*dB/(B*B));
190 g[2]->SetPoint(
jj, emc_rmv[i], SN);
191 g[2]->SetPointError(
jj, 0, dSN);
194 double Z = S*fS/
sqrt(S*fS+B*fB);
195 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)) ;
197 g[3]->SetPoint(
jj, emc_rmv[i], Z);
198 g[3]->SetPointError(
jj, 0, dZ);
202 double deffS = effS*
sqrt( 1./S + 1./S0 );
204 g[0]->SetPoint(
jj, emc_rmv[i], effS*100.);
205 g[0]->SetPointError(
jj, 0, deffS*100.);
209 double deffB = effB*
sqrt( 1./B + 1./B0 );
211 g[1]->SetPoint(
jj, emc_rmv[i], effB*100.);
212 g[1]->SetPointError(
jj, 0, deffB*100.);
217 gStyle->SetOptFit(0);
218 gStyle->SetOptStat(0);
220 TString plotnam[4]={
"effs",
"effb",
"sn",
"sign"};
222 for (
int i=0;
i<4;++
i)
225 gPad->SetTopMargin(0.10);
228 g[
i]->Draw(
"P same");
230 f1->SetParameters(TMath::MaxElement(g[i]->GetN(), g[i]->GetY()),70, 10, TMath::MinElement(g[i]->GetN(), g[i]->GetY()));
233 f1->SetParameters(TMath::MaxElement(g[i]->GetN(), g[i]->GetY()),120, -10, TMath::MinElement(g[i]->GetN(), g[i]->GetY()));
234 f1->SetParLimits(1,110,200);
241 g[
i]->SetName(plotnam[i]+
"_"+((
TString)fname(6,5)));
245 fname.ReplaceAll(
".root",
"");
246 cut.ReplaceAll(
"&&",
"_AND_");
247 cut.ReplaceAll(
"||",
"_OR_");
248 cut.ReplaceAll(
"!",
"_NOT_");
249 cut.ReplaceAll(
">",
"_lg_");
250 cut.ReplaceAll(
"<",
"_sm_");
251 cut.ReplaceAll(
".",
"_");
253 c1->SaveAs(Form(
"fig/%s__%03d__%s.gif",fname.Data(), sigmode,
cut.Data()));
254 c1->SaveAs(Form(
"fig/%s__%03d__%s.C",fname.Data(), sigmode,
cut.Data()));
void analyse_phi_base(TString fname="ntp1_2phi_A.root", TString cut="abs(f4cxd0m+f4cxd1m-2.15)<0.15&&abs(f4cxd0m-1.02)<0.012&&abs(f4cxd1m-1.02)<0.012&chi24c<50", int sigmode=0, TString tit="")
friend F32vec4 sqrt(const F32vec4 &a)
void confgraph(TGraph *g, TString tit, int col=1, int marker=20)
long int cntEvt(TTree *t1, TString cut, TString var="ev")
TH1F * createHistoGraph(TGraph *g, TString tit="", double xmin=0, double xmax=0)