54 gStyle->SetTitleOffset(1.4,
"X");
55 gStyle->SetTitleOffset(1.2,
"Y");
56 gStyle->SetLabelOffset(0.014,
"X");
57 gStyle->SetLabelOffset(0.010,
"Y");
58 gStyle->SetLabelFont(42,
"X");
59 gStyle->SetLabelFont(42,
"Y");
60 gStyle->SetTitleFont(42,
"X");
61 gStyle->SetTitleFont(42,
"Y");
62 gStyle->SetLabelSize(0.03,
"X");
63 gStyle->SetLabelSize(0.03,
"Y");
65 gStyle->SetTitleH(0.050);
66 gStyle->SetTitleW(0.95);
67 gStyle->SetTitleY(0.98);
68 gStyle->SetTitleFont(12,
"D");
69 gStyle->SetTitleColor(kBlue,
"D");
70 gStyle->SetTextFont(12);
71 gStyle->SetTitleFillColor(kWhite);
73 gStyle->SetNumberContours(256);
74 gStyle->SetCanvasColor(kWhite);
75 gStyle->SetStatBorderSize(1);
78 gStyle->SetStatX(0.878);
79 gStyle->SetStatY(0.918);
80 gStyle->SetStatW(0.200);
81 gStyle->SetStatH(0.160);
83 gStyle->SetStatColor(0);
86 gStyle->SetFrameBorderMode(0);
89 cout<<
"cwb_report_sim.C starts..."<<endl;
92 Color_t
colors[
NMDC_MAX] = { 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
93 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
94 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
95 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7 };
96 Style_t markers[
NMDC_MAX]= {20,21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,
97 21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20,
98 21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20,
99 21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20 };
134 imdc_name,imdc_fcentral,imdc_fbandwidth);
137 cout <<
"cwb_report_sim.C : Error - no injection types or bad format" << endl;
138 cout <<
"mdc injection file list : " <<
mdc_inj_file << endl;
139 cout <<
"format must be : mdc_set mdc_type mdc_name mdc_fcentral mdc_fbandwidth" << endl;
140 cout <<
"process terminated !!!" << endl;
145 imdc_flow[
i] = imdc_fcentral[
i]-imdc_fbandwidth[
i];
148 imdc_fhigh[
i] = imdc_fcentral[
i]+imdc_fbandwidth[
i];
154 for(
int j=0;
j<
ninj;
j++) imdc_index[imdc_type[
j]]=
j;
156 cout <<
j <<
" " << imdc_index[
j] << endl;
157 if(imdc_index[
j]>=ninj) {
159 cout <<
"cwb_report_sim.C : Error - mdc type must be < num max type inj = " << ninj << endl;
160 cout <<
"check mdc_type injection file list : " <<
mdc_inj_file << endl;
161 cout <<
"format : mdc_set mdc_type mdc_name mdc_fcentral mdc_fbandwidth" << endl;
162 cout <<
"process terminated !!!" << endl;
171 for(
int j=0;
j<
nset;
j++)
if(imdc_set[
i]==imdc_set_name[
j]) bnew=
false;
172 if(bnew) imdc_set_name[nset++]=imdc_set[
i];
174 cout <<
"nset : " << nset << endl;
177 for(
int j=0;
j<
ninj;
j++)
if(imdc_set[
j]==imdc_set_name[
i]) imdc_iset[
j]=
i;
181 for(
int j=0;
j<
nset;
j++)
if(imdc_set[
i]==imdc_set_name[
j]) imdc_tset[imdc_type[
i]]=
j;
185 cout <<
i <<
" " << imdc_name[
i] <<
" " << imdc_set[
i] <<
" " << imdc_iset[
i]
186 <<
" " << imdc_tset[
i] <<
" " << imdc_type[
i] <<
" " << imdc_index[
i] << endl;
191 if((pp_eff_vs_thr_mode!=
"DISABLED")&&(pp_eff_vs_thr_mode!=
"disabled")) {
195 if(pp_eff_vs_thr_eff.IsFloat()) pp_eff = pp_eff_vs_thr_eff.Atoi();
196 if(pp_eff<0) pp_eff=0;
197 if(pp_eff>100) pp_eff=100;
199 TChain
sim(
"waveburst");
208 if((pp_eff_vs_thr_mode!=
"AUTO")&&(pp_eff_vs_thr_mode!=
"auto")) {
209 sprintf(fname,
"%s",pp_eff_vs_thr_mode.Data());
211 FILE* fp = fopen(fname,
"r");
213 cout <<
"cwb_report_sim.C - Error opening file : " << fname << endl;
220 fscanf(fp,
"%s %d %f",xmdc_name, &xmdc_type, &xfactors);
221 cout <<
i <<
" " << xmdc_name <<
" "<< xmdc_type <<
" "<< xfactors << endl;
231 cout <<
"cwb_report_sim.C - missing factor for : " << imdc_name[
i] << endl << endl;
246 if((pp_eff_vs_thr_mode==
"AUTO")||(pp_eff_vs_thr_mode==
"auto")) {
253 sprintf(sim_cuts,
"%s && %s && %s",
ch2,fac_cuts,rho_cuts);
255 sprintf(mdc_cuts,
"type[0]==%d && %s",(
int)(imdc_type[
i]+1),fac_cuts);
256 sprintf(sim_cuts,
"%s && type[1]==%lu && %s && %s",
ch2,imdc_type[
i]+1,fac_cuts,rho_cuts);
260 mdc.Draw(
"Entry$",mdc_cuts,
"goff");
261 nmdc = mdc.GetSelectedRows();
262 sim.Draw(
"Entry$",sim_cuts,
"goff");
263 nsim = sim.GetSelectedRows();
264 double xeff = double(nsim)/double(nmdc);
265 if(
fabs(100*xeff-pp_eff)<
fabs(100*effXX-pp_eff)) {effXX=xeff;factorXX[
i]=
factors[
k];}
271 cout <<
i <<
"\tCompute efficiency vs threshold @ factor : " 272 << factorXX[
i] <<
"\tmdc : " << imdc_name[
i] << endl;
275 sprintf(fac_cuts,
"abs(factor-%f)<EPSILON*%f",factorXX[
i],factorXX[i]);
278 sprintf(mdc_cuts,
"type[0]==%d && %s",(
int)(imdc_type[i]+1),fac_cuts);
281 mdc.Draw(
"Entry$",mdc_cuts,
"goff");
282 nmdc = mdc.GetSelectedRows();
288 if(pp_eff_vs_thr_rho_min.IsFloat()) rho_min = pp_eff_vs_thr_rho_min.Atof();
291 sprintf(fname,
"%s/eff_%d_threshold_%s.txt",
netdir,pp_eff,imdc_name[i]);
292 cout << fname << endl;
295 if (!fout.good()) {cout <<
"Error Opening File : " << fname << endl;
exit(1);}
305 sprintf(sim_cuts,
"%s && type[1]==%lu && %s && rho[%d]>%f",
ch2,imdc_type[i]+1,fac_cuts,
pp_irho,rho);
308 sim.Draw(
"Entry$",sim_cuts,
"goff");
309 nsim = sim.GetSelectedRows();
310 double xeff = double(nsim)/double(nmdc);
313 fout << rho <<
" " << xeff << endl;
318 sprintf(fname,
"%s/eff_%d_threshold_factors.txt",
netdir,pp_eff);
319 cout << fname << endl;
320 FILE* fp = fopen(fname,
"w");
322 cout <<
"cwb_report_sim.C - Error opening file : " << fname << endl;
326 fprintf(fp,
"%s %d %g\n",imdc_name[
i], (
int)imdc_type[i], factorXX[i]);
331 pp_eff_vs_thr_quit.ToUpper();
332 if(pp_eff_vs_thr_quit==
"TRUE") {
333 cout <<
"efficiency " << pp_eff <<
" vs threshold terminated, exit" << endl;
344 for (
int iset=0;iset<
nset;iset++) {
346 TChain
sim(
"waveburst");
360 cout <<
"cwb_report_sim.C Error : Leaf " << veto_name
361 <<
" is not present in tree" << endl;
372 if(bifo) XDQF[nXDQF++]=
VDQF[
j];
382 ww.fChain->SetBranchAddress(veto_name,&VETO[
j]);
391 sup = log10(pp_factor2distance/
factors[0]);
394 TF1 *gfit=
new TF1(
"logNfit",
logNfit,pow(10.0,inf),pow(10.0,sup),5);
395 gfit->SetParameters((inf+sup)/2.,0.3,1.,1.);
396 gfit->SetParNames(
"hrss50",
"sigma",
"betam",
"betap");
397 gfit->FixParameter(4,pp_factor2distance);
398 gfit->SetParLimits(0,inf,sup);
403 gfit->SetParLimits(1,0.05,10.);
404 gfit->SetParLimits(2,0.05,3.);
406 gfit->SetParLimits(1,0.08,10.);
407 gfit->SetParLimits(2,0.00,3.);
409 gfit->SetParLimits(3,0.0,2.50);
412 TLegend *legend =
new TLegend(0.53,0.17,0.99,0.7,
"",
"brNDC");
413 legend->SetLineColor(1);
414 legend->SetTextSize(0.033);
415 legend->SetBorderSize(1);
416 legend->SetLineStyle(1);
417 legend->SetLineWidth(1);
418 legend->SetFillColor(0);
419 legend->SetFillStyle(1001);
423 double a,b,
vED,enrg[5];
436 int ntrg = sim.GetEntries();
437 int nmdc = mdc.GetEntries();
439 cout<<
" total injections: " << nmdc <<endl;
441 for(
int i=0; i<ninj+1; i++) {
442 if((i<ninj)&&(imdc_iset[i]!=iset))
continue;
446 hT[
i]->SetTitleOffset(1.3,
"Y");
447 hT[
i]->GetXaxis()->SetTitle(
"detected-injected time, sec");
448 hT[
i]->GetYaxis()->SetTitle(
"events");
449 sprintf(fname,
"%s",imdc_name[i]);
450 hT[
i]->SetTitle(fname);
453 hF[
i] =
new TH1F(fname,fname,512,imdc_flow[i],imdc_fhigh[i]);
454 hF[
i]->SetTitleOffset(1.3,
"Y");
455 if(i<ninj) hF[
i]->GetXaxis()->SetTitle(
"frequency, Hz");
456 else hF[
i]->GetXaxis()->SetTitle(
"detected-injected, Hz");
457 hF[
i]->GetYaxis()->SetTitle(
"events");
458 sprintf(fname,
"%s",imdc_name[i]);
459 hF[
i]->SetTitle(fname);
461 for(
int j=0; j<
nIFO; j++) {
462 sprintf(fname,
"%s_hrss_%d",IFO[j],i);
463 HH[
j][
i] =
new TH2F(fname,
"",500,-23.,-19.,500,-23.,-19.);
464 HH[
j][
i]->SetTitleOffset(1.7,
"Y");
465 HH[
j][
i]->SetTitleOffset(1.7,
"Y");
466 HH[
j][
i]->GetXaxis()->SetTitle(
"injected log10(hrss)");
467 HH[
j][
i]->GetYaxis()->SetTitle(
"detected log10(hrss)");
468 HH[
j][
i]->SetStats(kFALSE);
469 sprintf(fname,
"%s: %s",IFO[j],imdc_name[i]);
470 HH[
j][
i]->SetTitle(fname);
471 HH[
j][
i]->SetMarkerColor(2);
473 for(
int j=0; j<
nIFO; j++) {
474 sprintf(fname,
"%s_nre_%d",IFO[j],i);
475 NRE[
j][
i] =
new TH2F(fname,
"",500,0.,7.,500,-3,1.);
476 NRE[
j][
i]->SetTitleOffset(1.7,
"Y");
477 NRE[
j][
i]->SetTitleOffset(1.7,
"Y");
478 NRE[
j][
i]->GetXaxis()->SetTitle(
"injected log10(snr^{2})");
479 NRE[
j][
i]->GetYaxis()->SetTitle(
"log10(normalized residual energy)");
480 NRE[
j][
i]->SetStats(kFALSE);
481 sprintf(fname,
"%s: %s",IFO[j],imdc_name[i]);
482 NRE[
j][
i]->SetTitle(fname);
483 NRE[
j][
i]->SetMarkerColor(2);
487 TH1F* hcor =
new TH1F(
"hcor",
"",100,0,1.);
488 hcor->SetTitleOffset(1.3,
"Y");
489 hcor->GetXaxis()->SetTitle(
"network correlation (ecor)");
490 hcor->GetYaxis()->SetTitle(
"events");
491 hcor->SetStats(kFALSE);
493 TH1F* hcc =
new TH1F(
"hcc",
"",100,0,1.);
494 hcc->SetTitleOffset(1.3,
"Y");
495 hcc->GetXaxis()->SetTitle(
"network correlation");
496 hcc->GetYaxis()->SetTitle(
"events");
497 hcc->SetStats(kFALSE);
499 TH1F* hrho =
new TH1F(
"hrho",
"",500,0,10.);
500 hrho->SetTitleOffset(1.3,
"Y");
501 hrho->GetXaxis()->SetTitle(
"log10(#rho^2)");
502 hrho->GetYaxis()->SetTitle(
"events");
504 TH1F* eSNR =
new TH1F(
"eSNR",
"",500,0,10.);
505 eSNR->SetTitleOffset(1.3,
"Y");
506 eSNR->GetXaxis()->SetTitle(
"log10(SNR/det)");
507 eSNR->GetYaxis()->SetTitle(
"events");
508 eSNR->SetStats(kFALSE);
510 TH2F*
rhocc =
new TH2F(
"rhocc",
"",100,0.,1.,500,0,10.);
511 rhocc->SetTitleOffset(1.3,
"Y");
512 rhocc->GetXaxis()->SetTitle(
"network correlation");
513 rhocc->GetYaxis()->SetTitle(
"log10(rho^2)");
514 rhocc->SetStats(kFALSE);
516 TH2F* skyc =
new TH2F(
"skyc",
"",180,-180,180.,90,-90.,90.);
517 skyc->SetTitleOffset(1.3,
"Y");
518 skyc->GetXaxis()->SetTitle(
"#Delta#phi, deg.");
519 skyc->GetYaxis()->SetTitle(
"#Delta#theta, deg.");
520 skyc->SetStats(kFALSE);
522 TH1F*
hpf =
new TH1F(
"hpf",
"",100,0.,1.);
523 hpf->SetTitleOffset(1.3,
"Y");
525 hpf->GetXaxis()->SetTitle(
"penalty factor");
526 hpf->GetYaxis()->SetTitle(
"events");
528 TH1F*
hvED =
new TH1F(
"hvED",
"",200,0,2.);
529 hvED->SetTitleOffset(1.3,
"Y");
531 hvED->GetXaxis()->SetTitle(
"hvED consistency");
532 hvED->GetYaxis()->SetTitle(
"events");
534 TH2F*
pf_cc =
new TH2F(
"pf_cc",
"",100,0.,1.,100,0,1.);
535 pf_cc->SetTitleOffset(1.3,
"Y");
536 pf_cc->GetXaxis()->SetTitle(
"network correlation");
537 pf_cc->GetYaxis()->SetTitle(
"penalty");
538 pf_cc->SetMarkerStyle(20);
539 pf_cc->SetMarkerColor(1);
540 pf_cc->SetMarkerSize(0.8);
541 pf_cc->SetStats(kFALSE);
543 TH2F*
pf_vED =
new TH2F(
"pf_vED",
"",100,0.,1.,100,0,1.);
544 pf_vED->SetTitleOffset(1.3,
"Y");
545 pf_vED->GetXaxis()->SetTitle(
"H1H2 consistency");
546 pf_vED->GetYaxis()->SetTitle(
"penalty");
547 pf_vED->SetMarkerStyle(20);
548 pf_vED->SetMarkerColor(1);
549 pf_vED->SetMarkerSize(0.8);
550 pf_vED->SetStats(kFALSE);
556 for(
int i=0; i<
nIFO; i++) {
558 sprintf(fname,
"ifoT%s",IFO[i]);
559 ifoT[
i] =
new TH1F(fname,
"",250,-0.05,0.05);
560 ifoT[
i]->SetTitleOffset(1.3,
"Y");
561 ifoT[
i]->GetXaxis()->SetTitle(
"detected-injected time, sec");
562 ifoT[
i]->GetYaxis()->SetTitle(
"events");
563 ifoT[
i]->SetTitle(IFO[i]);
565 sprintf(fname,
"hrs1%s",IFO[i]);
566 hrs1[
i] =
new TH2F(fname,
"",500,-23.,-19.,500,-23.,-19.);
567 hrs1[
i]->SetTitleOffset(1.3,
"Y");
568 hrs1[
i]->GetXaxis()->SetTitle(
"detected");
569 hrs1[
i]->GetYaxis()->SetTitle(
"injected");
570 hrs1[
i]->SetStats(kFALSE);
571 hrs1[
i]->SetTitle(IFO[i]);
572 hrs1[
i]->SetMarkerColor(2);
574 sprintf(fname,
"hrs2%s",IFO[i]);
575 hrs2[
i] =
new TH2F(fname,
"",500,-23.,-19.,500,-23.,-19.);
576 hrs2[
i]->SetTitleOffset(1.3,
"Y");
577 hrs2[
i]->SetMarkerColor(2);
578 hrs2[
i]->SetStats(kFALSE);
590 for(
int i=0; i<
nmdc; i++) {
595 if(imdc_tset[mm.type-1] != iset)
continue;
596 indx = imdc_index[mm.type-1];
598 if(mm.strain<hrss_min[indx])
if(mm.strain>0) hrss_min[indx]=mm.strain;
599 if(mm.strain>hrss_max[indx]) hrss_max[indx]=mm.strain;
604 if(hrss_min[i]==1e20)
continue;
605 if(hrss_max[i]==0)
continue;
606 vhrss[
i][0]=hrss_min[
i];
607 vhrss[
i][nhrss]=hrss_max[
i];
608 double fhrss=exp(
log(vhrss[i][nhrss]/vhrss[i][0])/nhrss);
609 for(
int j=1;j<=nhrss;j++) vhrss[i][j]=fhrss*vhrss[i][j-1];
610 for(
int j=0;j<nhrss;j++) sMDC[i][j]=(vhrss[i][j+1]+vhrss[i][j])/2.;
612 for(
int j=0;j<nhrss;j++)
for(
int k=0; k<
NMDC_MAX; k++) {nMDC[
k].
append(1.);}
616 for(
int i=0; i<
nmdc; i++) {
622 if(imdc_tset[mm.type-1] != iset)
continue;
623 indx = imdc_index[mm.type-1];
628 for(
int j=0; j<
n; j++) {
631 if(pp_factor2distance) {
632 if(
fabs(sMDC[0].data[j]-mm.factor)<
EPSILON*mm.factor) {
633 save =
false; nMDC[indx].
data[
j]+=1.; j=
n;
636 if(
fabs(sMDC[0].data[j]-mm.strain)<0.1*mm.strain) {
637 save =
false; nMDC[indx].
data[
j]+=1.; j=
n;
642 if(
fabs(sMDC[0].data[j]-mm.factor)<
EPSILON*mm.factor) {
643 save =
false; nMDC[indx].
data[
j]+=1.; j=
n;
648 if(mm.strain>vhrss[indx][j] && mm.strain<=vhrss[indx][j+1]) {
649 nMDC[indx].
data[
j]+=1.;
650 mhrss[indx][
j].
append(mm.strain);
660 if(pp_factor2distance) {
678 cout <<
"cwb_report_sim.C Error : number of detected strains " << sMDC[0].
size()
679 <<
" is greater of nfactor declared in the user_parameters.C : " <<
nfactor << endl;
687 if(sMDC[k].
size()==0) {
delete [] mhrss[
k];
continue;}
689 for(
int i=0;i<nhrss;i++) {
691 int* hrss_index =
new int[
K];
692 if(K>0) TMath::Sort(K,mhrss[k][i].data,hrss_index,kFALSE);
694 if(K>0) sMDC[
k][
i] = mhrss[
k][
i].
data[hrss_index[K/2]];
695 delete [] hrss_index;
719 if(sMDC[k].
size()==0)
continue;
720 mdc_index[
k] =
new int[sMDC[
k].
size()];
721 TMath::Sort((
int)sMDC[k].
size(),sMDC[k].data,mdc_index[k],kFALSE);
732 cout<<
"total events: " << ntrg << endl;
736 bool ifar_exists=
false;
737 TIter
next(
ww.fChain->GetListOfBranches());
738 while ((branch=(TBranch*)
next())) {
739 if(
TString(
"ifar").CompareTo(branch->GetName())==0) ifar_exists=
true;
742 if (ifar_exists)
ww.fChain->SetBranchAddress(
"ifar",&ifar);
745 for(
int i=0; i<
ntrg; i++) {
748 if(
ww.type[1]<1)
continue;
751 if(imdc_tset[
ww.type[1]-1] != iset)
continue;
756 for(
int j=0;j<
nXDQF;j++) {
757 if((XDQF[j].
cat==
CWB_CAT2)&&(!VETO[j])) bveto=
true;
763 vED =
ww.neted[0]/
ww.ecor;
767 if (
T_ifar>0)
if(ifar_exists) {
if(ifar <
T_ifar)
continue;}
771 for(
int j=0;j<
nFCUT;j++) {
783 indx = imdc_index[
ww.type[1]-1];
786 null = nill = etot = 0.;
787 for(
int j=0; j<
nIFO; j++) {
795 for(
int j=0; j<
nIFO; j++) {
796 if(a2or > etot-enrg[j]) a2or = etot-enrg[
j];
800 acor = sqrt(
ww.ECOR/nIFO);
808 rhocc->Fill(xcor,log10(rho*rho));
809 pf_cc->Fill(xcor,
ww.penalty);
811 if(xcor<
T_cor)
continue;
813 pf_vED->Fill(vED,
ww.penalty);
814 hvED->Fill(
fabs(vED));
815 hpf->Fill(
ww.penalty);
817 if(
ww.netcc[3] <
T_scc)
continue;
818 if(
ww.penalty <
T_pen)
continue;
822 if(rho >
T_cut) save=
true;
825 hrho->Fill(log10(rho*rho));
826 eSNR->Fill(log10(
ww.likelihood/nIFO));
828 a =
ww.phi[0]-
ww.phi[1];
829 if(a> 180) a = 360-
a;
830 if(a< -180) a = -360-
a;
831 b =
ww.theta[0]-
ww.theta[1];
833 if(b< -90) b = -180-b;
836 for(
int j=0; j<
nIFO; j++) {
838 HH[
j][indx]->Fill(log10(
ww.hrss[j+nIFO]),log10(
ratio_hrss*
ww.hrss[j]));
840 double nre =
ww.iSNR[
j] ? (
ww.iSNR[
j]+
ww.oSNR[
j]-2*
ww.ioSNR[
j])/
ww.iSNR[j] : 10;
842 NRE[
j][
ninj]->Fill(log10(
ww.iSNR[j]),log10(nre));
843 NRE[
j][indx]->Fill(log10(
ww.iSNR[j]),log10(nre));
845 ifoT[
j]->Fill(
ww.time[j]-
ww.time[j+nIFO]);
848 hT[indx]->Fill(
ww.time[0]-
ww.time[nIFO]);
850 hT[
ninj]->Fill(
ww.time[0]-
ww.time[nIFO]);
851 hF[
ninj]->Fill(
float(
ww.
frequency[0]-(imdc_flow[indx]+imdc_fhigh[indx])/2));
855 for(
int j=0; j<
n; j++) {
858 if(pp_factor2distance) {
860 nTRG[indx].
data[
j]+=1.; j=
n;
863 if(
fabs(sMDC[0].data[j]-
ww.strain[1])<0.1*
ww.strain[1]) {
864 nTRG[indx].
data[
j]+=1.; j=
n;
870 nTRG[indx].
data[
j]+=1.; j=
n;
875 if(
ww.strain[1]>vhrss[indx][j] &&
ww.strain[1]<=vhrss[indx][j+1]) {
876 nTRG[indx].
data[
j]+=1.; j=
n;
884 for(
int k=0; k<
NMDC_MAX; k++)
for(
int i=0;i<sMDC[
k].size();i++) sMDC[k].data[i] = pp_factor2distance/sMDC[k].data[i];
888 cout <<
"INJ HRSS NUMBER: " << n << endl;
892 for(
int i=0; i<
ninj; i++) {
893 if(imdc_iset[i]!=iset)
continue;
895 in = fopen(f_file,
"w");
896 if(in==NULL) {cout <<
"cwb_report_sim : Error opening file " << f_file << endl;
exit(1);}
897 for(
int k=0; k<
n; k++){
898 int j=mdc_index[
i][
k];
899 if(nMDC[i].data[j] <= 0.)
continue;
902 sqrt(eff[i].data[j]*(1-eff[i].data[j])/nMDC[i].data[j]);
903 fprintf(in,
"%e %i %i %.3f\n", sMDC[i].data[j], (
int)nTRG[i].data[j], (
int)nMDC[i].data[j], eff[i].data[j]);
908 TCanvas *
c1 =
new TCanvas(
"c",
"C",0,0,800,800);
909 c1->SetBorderMode(0);
911 c1->SetBorderSize(2);
915 c1->SetLeftMargin(0.137039);
916 c1->SetRightMargin(0.117039);
917 c1->SetTopMargin(0.0772727);
918 c1->SetBottomMargin(0.143939);
919 c1->ToggleEventStatus();
921 for(
int i=0; i<
ninj; i++) {
922 if(imdc_iset[i]!=iset)
continue;
924 fprintf(evt_all,
"%2d %s ", i,imdc_name[i]);
932 fprintf(evt_all,
"%3.2f %3.2f ", hF[i]->GetMean(), hF[i]->GetRMS());
934 c1->Update(); c1->SaveAs(fname);
939 fprintf(evt_all,
"%3.6f %3.6f ", hT[i]->GetMean(), hT[i]->GetRMS());
940 c1->Update(); c1->SaveAs(fname);
944 for(
int j=0;j<
nIFO;j++){
946 HH[
j][
i]->Draw(
"HIST");
947 sprintf(fname,
"%s/hrss_%s_%s.gif",
netdir,IFO[j],imdc_name[i]);
948 c1->Update(); c1->SaveAs(fname);
952 sprintf(fname,
"%s/nre_%s_%s.gif",
netdir,IFO[j],imdc_name[i]);
953 c1->Update(); c1->SaveAs(fname);
963 sprintf(fname,
"%s/netcor_%s.gif",
netdir,imdc_set_name[iset].Data());
964 c1->Update(); c1->SaveAs(fname);
971 sprintf(fname,
"%s/cc_%s.gif",
netdir,imdc_set_name[iset].Data());
972 c1->Update(); c1->SaveAs(fname);
978 sprintf(fname,
"%s/rho_%s.gif",
netdir,imdc_set_name[iset].Data());
979 c1->Update(); c1->SaveAs(fname);
983 sprintf(fname,
"%s/penalty_%s.gif",
netdir,imdc_set_name[iset].Data());
984 c1->Update(); c1->SaveAs(fname);
988 sprintf(fname,
"%s/average_snr_%s.gif",
netdir,imdc_set_name[iset].Data());
989 c1->Update(); c1->SaveAs(fname);
995 sprintf(fname,
"%s/rho_cc_%s.gif",
netdir,imdc_set_name[iset].Data());
996 c1->Update(); c1->SaveAs(fname);
1000 pf_cc->Draw(
"colz");
1001 sprintf(fname,
"%s/penalty_cc_%s.gif",
netdir,imdc_set_name[iset].Data());
1002 c1->Update(); c1->SaveAs(fname);
1007 sprintf(fname,
"%s/coordinate_%s.gif",
netdir,imdc_set_name[iset].Data());
1008 c1->Update(); c1->SaveAs(fname);
1009 c1->SetLogz(kFALSE);
1013 pf_vED->Draw(
"colz");
1014 sprintf(fname,
"%s/penalty_vED_%s.gif",
netdir,imdc_set_name[iset].Data());
1015 c1->Update(); c1->SaveAs(fname);
1016 c1->SetLogz(kFALSE);
1021 sprintf(fname,
"%s/vED_%s.gif",
netdir,imdc_set_name[iset].Data());
1022 c1->Update(); c1->SaveAs(fname);
1023 c1->SetLogy(kFALSE);
1027 c1 =
new TCanvas(
"c",
"C",0,0,1000,800);
1028 c1->SetBorderMode(0);
1029 c1->SetFillColor(0);
1030 c1->SetBorderSize(2);
1031 c1->SetLogx(kFALSE);
1034 c1->SetRightMargin(0.0517039);
1035 c1->SetTopMargin(0.0772727);
1036 c1->SetBottomMargin(0.143939);
1037 c1->ToggleEventStatus();
1039 double chi2, hrss50,
sigma, betam, betap, hrssEr;
1043 sprintf(fname,
"%s/fit_parameters_%s.txt",
netdir,imdc_set_name[iset].Data());
1044 in = fopen(fname,
"w");
1047 for(
int i=0; i<
ninj; i++)
if(imdc_iset[i]==iset) iset_size++;
1048 double hleg = 0.18+iset_size*0.06;
1050 if(pp_show_eff_fit_curve) legend =
new TLegend(0.45,0.18,0.99,hleg,NULL,
"brNDC");
1051 else legend =
new TLegend(0.55,0.18,0.99,hleg,NULL,
"brNDC");
1053 for(
int i=0; i<
ninj; i++) {
1054 if(imdc_iset[i]!=iset)
continue;
1058 EFF[
i]=
new TGraphErrors(n,sMDC[i].data,eff[i].data,e00[i].data,err[i].data);
1059 if(
simulation==1 && pp_factor2distance) EFF[
i]->GetXaxis()->SetTitle(
"distance (Kpc)");
1060 else if(
simulation==2) EFF[
i]->GetXaxis()->SetTitle(
"snr");
1061 else EFF[
i]->GetXaxis()->SetTitle(
"hrss, #frac{strain}{#sqrt{Hz}}");
1062 EFF[
i]->GetYaxis()->SetTitle(
"Efficiency ");
1063 EFF[
i]->GetXaxis()->SetTitleOffset(1.7);
1064 EFF[
i]->GetXaxis()->SetLabelSize(0.04);
1065 EFF[
i]->GetYaxis()->SetTitleOffset(1.3);
1066 EFF[
i]->GetYaxis()->SetRangeUser(0,1);
1067 EFF[
i]->GetYaxis()->SetLabelSize(0.04);
1071 gfit->SetLineColor(colors[i]);
1076 gfit->SetNpx(100000);
1077 if(pp_show_eff_fit_curve) EFF[
i]->Fit(
"logNfit");
else EFF[
i]->Fit(
"logNfit",
"N");
1078 chi2=gfit->GetChisquare();
1079 hrss50=pow(10.,gfit->GetParameter(0));
1080 hrssEr=(pow(10.,gfit->GetParError(0))-1.)*hrss50;
1081 sigma=gfit->GetParameter(1);
1082 betam=gfit->GetParameter(2);
1083 betap=gfit->GetParameter(3);
1085 printf(
"%d %s %E %E +- %E %E %E %E\n",
1086 i,imdc_name[i],chi2,hrss50,hrssEr,sigma,betam,betap);
1087 fprintf(in,
"%2d %9.3E %9.3E +- %9.3E %9.3E %9.3E %9.3E %s\n",
1088 i,chi2,hrss50,hrssEr,sigma,betam,betap,imdc_name[i]);
1089 fprintf(in_all,
"%2d %9.3E %9.3E +- %9.3E %9.3E %9.3E %9.3E %s\n",
1090 i,chi2,hrss50,hrssEr,sigma,betam,betap,imdc_name[i]);
1092 sprintf(fname,
"%s, hrss50=%5.2E", imdc_name[i],hrss50);
1093 EFF[
i]->SetTitle(fname);
1095 gfit->SetLineColor(colors[i]);
1096 EFF[
i]->SetLineColor(colors[i]);
1097 EFF[
i]->SetMarkerStyle(markers[i]);
1098 EFF[
i]->SetMarkerColor(colors[i]);
1099 EFF[
i]->SetMarkerSize(2);
1101 legend->SetBorderSize(1);
1102 legend->SetTextAlign(22);
1103 legend->SetTextFont(12);
1104 legend->SetLineColor(1);
1105 legend->SetLineStyle(1);
1106 legend->SetLineWidth(1);
1107 legend->SetFillColor(0);
1108 legend->SetFillStyle(1001);
1109 legend->SetTextSize(0.04);
1110 legend->SetLineColor(kBlack);
1111 legend->SetFillColor(kWhite);
1113 if(pp_show_eff_fit_curve)
sprintf(fname,
"%s, %5.2E",imdc_name[i], hrss50);
1114 else sprintf(fname,
"%s",imdc_name[i]);
1115 legend->AddEntry(EFF[i], fname,
"lp");
1116 if(pp_show_eff_fit_curve) EFF[
i]->Draw(
"AP");
else EFF[
i]->Draw(
"APL");
1119 c1->SetLogx(kFALSE);
1125 sprintf(fname,
"%s/eff_%s.eps",
netdir,imdc_set_name[iset].Data());
1126 sprintf(gname,
"%s/eff_%s.gif",
netdir,imdc_set_name[iset].Data());
1127 TPostScript epsfile(fname,113);
1130 if(
simulation==2) c1->SetLogx(kFALSE);
else c1->SetLogx();
1131 c1->SetLogy(kFALSE);
1135 TMultiGraph*
mg=
new TMultiGraph();
1136 sprintf(ptitle,
"%s rho=%3.2f, cc=%3.2f",imdc_set_name[iset].Data(),
T_cut,
T_cor);
1137 mg->SetTitle(ptitle);
1138 double xmin=1.79769e+308;
1140 for(
int i=0;i<
ninj;i++) {
1141 if(imdc_iset[i]!=iset)
continue;
1143 if(sMDC[i].data[mdc_index[i][0]]<xmin) xmin=sMDC[
i].data[mdc_index[
i][0]];
1144 if(sMDC[i].data[mdc_index[i][sMDC[i].
size()-1]]>xmax) xmax=sMDC[
i].data[mdc_index[
i][sMDC[
i].size()-1]];
1146 if(pp_show_eff_fit_curve) mg->Draw(
"AP");
else mg->Draw(
"APL");
1147 if(
simulation==1 && pp_factor2distance) mg->GetHistogram()->GetXaxis()->SetTitle(
"distance (Kpc)");
1148 else if(
simulation==2) mg->GetHistogram()->GetXaxis()->SetTitle(
"snr");
1149 else mg->GetHistogram()->GetXaxis()->SetTitle(
"hrss, #frac{strain}{#sqrt{Hz}}");
1150 mg->GetHistogram()->GetYaxis()->SetTitle(
"Efficiency ");
1151 mg->GetHistogram()->GetXaxis()->SetTitleOffset(1.7);
1152 mg->GetHistogram()->GetXaxis()->SetLabelSize(0.04);
1153 mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);
1154 mg->GetHistogram()->GetXaxis()->SetRangeUser(xmin,xmax);
1155 mg->GetHistogram()->GetYaxis()->SetRangeUser(0,1);
1156 mg->GetHistogram()->GetYaxis()->SetLabelSize(0.04);
1157 legend->Draw(
"SAME");
1158 c1->Update(); epsfile.Close();
1160 sprintf(cmd,
"convert %s %s",fname,gname);cout<<cmd<<endl;
1164 for (
int i=0;i<ninj+1;i++) {
1165 if((i<ninj)&&(imdc_iset[i]!=iset))
continue;
1166 for(
int j=0;j<
nIFO;j++)
if(HH[j][i])
delete HH[
j][
i];
1167 for(
int j=0;j<
nIFO;j++)
if(NRE[j][i])
delete NRE[
j][
i];
1168 if(hT[i])
delete hT[
i];
1169 if(hF[i])
delete hF[
i];
1183 for (
int j=0;j<
nIFO;j++) {
1191 if(sMDC[k].
size()==0)
continue;
1192 delete [] mdc_index[
k];
1195 for(
int i=0;i<
NMDC_MAX;i++)
if(EFF[i]) {
delete EFF[
i];EFF[
i]=NULL;}
size_t append(const wavearray< DataType_t > &)
void Export(TString fname="")
wavearray< double > a(hp.size())
void Import(TString umacro="")
size_t imdc_iset[NMDC_MAX]
fprintf(stdout,"start=%f duration=%f rate=%f\, x.start(), x.size()/x.rate(), x.rate())
virtual size_t size() const
size_t imdc_index[NMDC_MAX]
printf("total live time: non-zero lags = %10.1f \, liveTot)
TIter next(twave->GetListOfBranches())
char imdc_name[NMDC_MAX][128]
sprintf(fname,"%s/eff_%d_threshold_factors.txt", netdir, pp_eff)
double fabs(const Complex &x)
TString pp_eff_vs_thr_quit
strcpy(RunLabel, RUN_LABEL)
size_t imdc_type[NMDC_MAX]
detectorParams detParms[4]
virtual void resize(unsigned int)
double imdc_fcentral[NMDC_MAX]
char imdc_set[NMDC_MAX][128]
void SetSingleDetectorMode()
double imdc_fbandwidth[NMDC_MAX]