14 std::vector<TString>
ifo;
59 void PlotChirp(EBBH* ebbh,
int mch_order,
double& tmerger,
double& xmin,
double& xmax, EColor color);
99 #define CHI2_THR -4.5 // if negative the chirp pixels are tagged with pix->likelihood=0 after the selection 100 #define TMERGER_CUT 0.01 155 if(gtype<-16 || gtype>16) {cout <<
"Error, gtype parameter value not allowed : [-1:11]" << endl;
exit(1);}
156 if(ifroot==
"") {cout <<
"Error, input root file name not defined" << endl;
exit(1);}
158 gPLOT = gtype<0 ? true :
false;
161 if(
gPLOT) gROOT->SetBatch(
true);
165 TString fDir = gSystem->DirName(ifroot);
168 if(fName.Contains(
"*")) {
170 fTag.ReplaceAll(
"*",
"");
172 if(fList.size()==0) {cout <<
"Error, no file selected" << endl;
exit(1);}
173 if(fList.size()>1) {cout <<
"Error, multiple files selected" << endl;
exit(1);}
176 fDir = gSystem->DirName(ifroot);
177 fName = gSystem->BaseName(ifroot);
183 gOFILE.ReplaceAll(
".root",
".png");
185 if(
gPLOT) cout << endl <<
"Output Plot File Name : " <<
gOFILE << endl << endl;
194 if(err)
return -100000;
200 ebbh.wdat[
ifo].start(ebbh.seggps ? ebbh.wdat[
ifo].start()-ebbh.seggps : 0);
201 ebbh.winj[
ifo].start(ebbh.seggps ? ebbh.winj[
ifo].start()-ebbh.seggps : 0);
202 ebbh.wrec[
ifo].start(ebbh.seggps ? ebbh.wrec[
ifo].start()-ebbh.seggps : 0);
203 ebbh.srec[
ifo].start(ebbh.seggps ? ebbh.srec[
ifo].start()-ebbh.seggps : 0);
237 if(plot) plot->
graph[0]->SetTitle(TString::Format(
"%s : Rec(black), Inj(red))",ebbh.name.Data()));
244 if(plot) plot->
graph[0]->SetTitle(TString::Format(
"%s : Rec(black), Inj(red))",ebbh.name.Data()));
282 if(MDC != NULL)
delete MDC;
283 if(WTS != NULL)
delete WTS;
284 if(PCH != NULL)
delete PCH;
285 if(stft != NULL)
delete stft;
287 if(
hN != NULL)
delete hN;
288 if(
hL != NULL)
delete hL;
289 if(
heT != NULL)
delete heT;
290 if(
heF != NULL)
delete heF;
308 TFile*
froot =
new TFile(ifile,
"READ");
309 TTree*
itree = froot->Get(
"waveburst");
310 if(itree==NULL) {cout <<
"ReadDataFromROOT - Error : no waveburst present in the file" << endl;
return 1;}
313 TList*
list = itree->GetUserInfo();
314 int nIFO=list->GetSize();
315 if (nIFO==0) {cout <<
"ReadDataFromROOT - Error : no ifo present in the tree" << endl;
return 1;}
316 for (
int n=0;
n<list->GetSize();
n++) {
319 ebbh->ifo.push_back(pDetector->
Name);
324 itree->SetBranchAddress(
"ndim",&nIFO);
334 std::vector<netpixel>*
cluster;
347 cluster =
new std::vector<netpixel>;
349 itree->SetBranchAddress(
"mass",ebbh->mass);
350 itree->SetBranchAddress(
"eBBH",eBBH);
351 itree->SetBranchAddress(
"range",range);
352 itree->SetBranchAddress(
"spin",ebbh->spin);
353 itree->SetBranchAddress(
"iSNR",iSNR);
354 itree->SetBranchAddress(
"oSNR",oSNR);
356 itree->SetBranchAddress(
"ebbh_parms",parms);
358 itree->SetBranchAddress(TString::Format(
"ebbh_wDAT_%d",
n).Data(),&wDAT[
n]);
359 itree->SetBranchAddress(TString::Format(
"ebbh_wINJ_%d",n).Data(),&wINJ[n]);
360 itree->SetBranchAddress(TString::Format(
"ebbh_wREC_%d",n).Data(),&wREC[n]);
361 itree->SetBranchAddress(TString::Format(
"ebbh_sREC_%d",n).Data(),&sREC[n]);
364 itree->SetBranchAddress(
"ebbh_ch_mass", ebbh->ch_mass);
365 itree->SetBranchAddress(
"ebbh_ch_tmerger",ebbh->ch_tmerger);
366 itree->SetBranchAddress(
"ebbh_ch_merr", ebbh->ch_merr);
367 itree->SetBranchAddress(
"ebbh_ch_mchi2", ebbh->ch_mchi2);
368 itree->SetBranchAddress(
"ebbh_ch_energy", ebbh->ch_energy);
370 itree->SetBranchAddress(
"ebbh_seggps",&seggps);
371 itree->SetBranchAddress(
"ebbh_crate",&crate);
372 itree->SetBranchAddress(
"ebbh_cluster",&cluster);
378 ebbh->redshift = eBBH[3];
379 ebbh->dist = range[1];
381 for(
int n=0;
n<
nIFO;
n++) ebbh->isnr += iSNR[
n];
382 ebbh->isnr = sqrt(ebbh->isnr);
384 for(
int n=0;
n<
nIFO;
n++) ebbh->osnr += oSNR[
n];
385 ebbh->osnr = sqrt(ebbh->osnr);
394 cout <<
"segment start time " << seggps << endl;
395 cout <<
"cluster rate " << crate << endl;
396 cout <<
"cluster size " << cluster->size() << endl;
398 if(cluster->size()==0) {cout <<
"ReadDataFromROOT - Error : no clusters in the root file !!!" << endl;
return 1;}
401 std::vector<int> pList;
402 for(
int i=0;
i<cluster->size();
i++) {
403 ebbh->nc.pList.push_back((*cluster)[
i]);
406 ebbh->nc.cList.push_back(pList);
408 ebbh->nc.cData.push_back(cd);
410 ebbh->seggps = seggps;
412 ebbh->mchirp = pow(ebbh->mass[0]*ebbh->mass[1],3./5.)/pow(ebbh->mass[0]+ebbh->mass[1],1./5.);
415 sprintf(name,
"source : m1=%0.1f m2=%0.1f mchirp=%0.1f e0=%0.1f rp0=%0.1f dist=%0.1f (Mpc) redshift=%0.1f isnr=%0.1f osnr=%0.1f",
416 ebbh->mass[0], ebbh->mass[1], ebbh->mchirp, ebbh->e0, ebbh->rp0, ebbh->dist, ebbh->redshift, ebbh->isnr, ebbh->osnr);
420 if(wDAT[
n])
delete wDAT[
n];
421 if(wINJ[n])
delete wINJ[
n];
422 if(wREC[n])
delete wREC[
n];
423 if(sREC[n])
delete sREC[
n];
426 if(itree)
delete itree;
427 if(froot)
delete froot;
442 for(
int i=0;
i<
N;
i++) {avr+=
i*x[
i]*x[
i]; E+=x[
i]*x[
i];}
449 double sum = ((M>=0)&&(M<N)) ? x[M]*x[M] : 0.;
450 for(
int j=1;
j<
N;
j++) {
451 a = ((M-
j>=0)&&(M-j<N)) ? x[M-j] : 0.;
452 b = ((M+j>=0)&&(M+j<N)) ? x[M+j] : 0.;
470 if(wf1==NULL)
return wf;
471 if(wf1->
size()==0)
return wf;
473 double R=wf1->
rate();
475 double b_wf1 = wf1->
start();
476 double e_wf1 = wf1->
start()+wf1->
size()/R;
477 double b_wf2 = wf2->
start();
478 double e_wf2 = wf2->
start()+wf2->
size()/R;
480 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
481 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
483 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
484 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
485 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
487 for(
int i=0;
i<sizeXCOR;
i++) wf[
i+o_wf2] = wf1->
data[
i+o_wf1];
494 double R=wf1->
rate();
496 double b_wf1 = wf1->
start();
497 double e_wf1 = wf1->
start()+wf1->
size()/R;
498 double b_wf2 = wf2->
start();
499 double e_wf2 = wf2->
start()+wf2->
size()/R;
501 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
502 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
504 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
505 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
506 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
511 wfdif.
start(b_wf1+
double(o_wf1)/R);
513 for(
int i=0;
i<sizeXCOR;
i++) wfdif[
i] = wf1->
data[
i+o_wf1] - wf2->
data[
i+o_wf2];
526 double A = (96./5.) * pow(Pi,8./3.) * pow(G*SM*mchirp/C/C/C, 5./3);
537 std::vector<int>* vint = &(pwc->
cList[0]);
538 int V = vint->size();
539 for(
int j=0;
j<V;
j++) {
541 if(!pix->
core)
continue;
543 for(
int m=0;
m<2;
m++) {
551 WTS->
plot(pwc, 1, 2,
'L', 0, const_cast<char*>(
"COLZ"));
552 WTS->
hist2D->GetYaxis()->SetRangeUser(fLow, fHigh);
559 EColor color[
NCHIRP_MAX] = {kBlack, kBlue, kGreen, kMagenta};
576 mchirp[
i] = ebbh->ch_mass[
i];
577 energy[
i] = ebbh->ch_energy[
i];
581 sprintf(title,
"chirp mass : rec = %3.3f / %3.3f / %3.3f / %3.3f - chirp_energy = %3.2f / %3.2f / %3.2f / %3.2f",
582 mchirp[0],mchirp[1],mchirp[2],mchirp[3],energy[0],energy[1],energy[2],energy[3]);
583 xgr[0]->SetTitle(title);
590 void PlotChirp(EBBH* ebbh,
int mch_order,
double& tmerger,
double& xmin,
double& xmax, EColor color) {
596 double echirp = ebbh->nc.mchirp5(1,zmax_thr,chi2_thr,tmerger_cut);
600 ebbh->ch_mass[mch_order] = pcd->
mchirp;
601 ebbh->ch_merr[mch_order] = pcd->
mchirperr;
602 ebbh->ch_mchi2[mch_order] = pcd->
chi2chirp;
603 ebbh->ch_energy[mch_order] = echirp;
605 TGraphErrors*
gr = &(pcd->
chirp);
607 xgr[mch_order] =
new TGraphErrors(gr->GetN(),gr->GetX(),gr->GetY(),gr->GetEX(),gr->GetEY());
610 sprintf(title,
"chirp mass : rec = %3.3f [%3.2f] , chi2 = %3.2f",
613 xgr[mch_order]->SetTitle(title);
614 xgr[mch_order]->GetHistogram()->SetStats(kFALSE);
615 xgr[mch_order]->GetHistogram()->SetTitleFont(12);
616 xgr[mch_order]->SetFillColor(kWhite);
617 xgr[mch_order]->SetLineColor(kBlack);
618 xgr[mch_order]->GetXaxis()->SetNdivisions(506);
619 xgr[mch_order]->GetXaxis()->SetLabelFont(42);
620 xgr[mch_order]->GetXaxis()->SetLabelOffset(0.014);
621 xgr[mch_order]->GetXaxis()->SetTitleOffset(1.4);
622 xgr[mch_order]->GetYaxis()->SetTitleOffset(1.2);
623 xgr[mch_order]->GetYaxis()->SetNdivisions(506);
624 xgr[mch_order]->GetYaxis()->SetLabelFont(42);
625 xgr[mch_order]->GetYaxis()->SetLabelOffset(0.01);
626 xgr[mch_order]->GetXaxis()->SetTitleFont(42);
627 xgr[mch_order]->GetXaxis()->SetTitle(
"Time (sec)");
628 xgr[mch_order]->GetXaxis()->CenterTitle(
true);
629 xgr[mch_order]->GetYaxis()->SetTitleFont(42);
630 xgr[mch_order]->GetYaxis()->SetTitle(
"Frequency^{-8/3}");
631 xgr[mch_order]->GetYaxis()->CenterTitle(
true);
632 xgr[mch_order]->GetXaxis()->SetLabelSize(0.03);
633 xgr[mch_order]->GetYaxis()->SetLabelSize(0.03);
635 xgr[mch_order]->SetLineColor(kGreen);
636 xgr[mch_order]->SetMarkerStyle(20);
637 xgr[mch_order]->SetMarkerColor(color);
638 xgr[mch_order]->SetMarkerSize(1);
639 mch_order==0 ?
xgr[mch_order]->Draw(
"XAP") :
xgr[mch_order]->Draw(
"XPsame");
641 TF1* fit = &(pcd->
fit);
643 if(tmerger==0) tmerger = -fit->GetParameter(1)/fit->GetParameter(0);
646 xmin = fit->GetXmin();
647 xmax = tmerger-0.001;
651 xfit[mch_order] =
new TF1(fit->GetName(), fit->GetTitle(), xmin, xmax);
652 xfit[mch_order]->SetLineColor(kRed);
653 xfit[mch_order]->SetParameter(0, p0);
654 xfit[mch_order]->SetParameter(1, p1);
655 xgr[mch_order]->Fit(
xfit[mch_order],
"Q");
656 xfit[mch_order]->Draw(
"same");
658 ebbh->ch_tmerger[mch_order] = -
xfit[mch_order]->GetParameter(1)/
xfit[mch_order]->GetParameter(0);;
669 ebbh->nc.cData[0].mchirp = 0;
670 ebbh->nc.cData[0].mchirperr = 0;
671 ebbh->nc.cData[0].tmrgr = 0;
672 ebbh->nc.cData[0].tmrgrerr = 0;
673 ebbh->nc.cData[0].chi2chirp = 0;
675 PCH =
new watplot(const_cast<char*>(
"chirp"));
679 ebbh->nc.mchirp5(1,zmax_thr,chi2_thr,tmerger_cut);
682 printf(
"mchirp : %.2e %.3f %.3f %.3f %.3f \n\n",
689 ofile.ReplaceAll(
"gTYPE_6",TString::Format(
"gTYPE_6_%d",
i+1).Data());
693 PCH->
canvas->Print(ofile);
695 cout <<
"WARNING : Not Implemented : use gtype = -6" << endl;
exit(0);
697 sprintf(title,
"chirp mass : rec = %3.3f [%3.2f] , chi2 = %3.2f",
699 TGraphErrors*
gr = &(pcd->
chirp);
700 xgr[
i] =
new TGraphErrors(gr->GetN(),gr->GetX(),gr->GetY(),gr->GetEX(),gr->GetEY());
701 xgr[
i]->SetTitle(title);
704 TF1* fit = &(pcd->
fit);
705 double tmerger = -fit->GetParameter(1)/fit->GetParameter(0);
706 double xmin = fit->GetXmin()-0.1;
707 double xmax = tmerger-0.001;
708 xfit[
i] =
new TF1(fit->GetName(),
"pow([0]*(x-[1]),-3./8.)", xmin, xmax);
711 xfit[
i]->SetLineColor(kRed);
712 xfit[
i]->SetParameter(0, p0);
713 xfit[
i]->SetParameter(1, p1);
714 xfit[
i]->Draw(
"same");
731 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
732 cout << ebbh->name << endl;
734 cout <<
"spin1x=" << ebbh->spin[0] <<
"\tspin1y=" << ebbh->spin[1] <<
"\tspin1z=" << ebbh->spin[2]
735 <<
"\tspin2x=" << ebbh->spin[3] <<
"\tspin2y=" << ebbh->spin[4] <<
"\tspin2z=" << ebbh->spin[2] << endl;
736 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
740 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
747 for(
int i=0;
i<
NCHIRP_MAX;
i++)
if(ebbh->ch_energy[
i]>emax) {emax=ebbh->ch_energy[
i];imax=
i;}
751 if(
i==imax)
continue;
752 if(ebbh->ch_mass[
i]>0) {
753 if(ebbh->ch_mass[
i]>ebbh->ch_mass[imax])
if(ebbh->ch_energy[
i]>ebbh->ch_energy[imax]/4.) imax2=
i;
759 if(ebbh->ch_mass[
i]>0) {
760 if(ebbh->ch_mass[
i]<ebbh->ch_mass[imax]) ebbh->ei+=ebbh->ch_energy[
i];
761 if(ebbh->ch_mass[
i]>ebbh->ch_mass[imax]) ebbh->ei-=ebbh->ch_energy[
i];
764 ebbh->ei/=ebbh->ch_energy[imax];
767 cout <<
"CHIRP_M -> " <<
" MCH_MASS : " <<
" rec :" << ebbh->ch_mass[imax] <<
" [" << ebbh->ch_merr[imax] <<
"]" 768 <<
" / "<<
" inj : " << ebbh->mchirp <<
"\t\t\t\tMCH_EI : " << ebbh->ei <<
"\t\tMCH_TIME : " << ebbh->ch_tmerger[imax] <<
" (sec)" << endl;
769 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
776 if((ptype!=
"like")&&(ptype!=
"stft")&&(ptype!=
"")) {
777 cout <<
"PlotMultiChirp2 Error : wrong ptype, available value are : like/stft" << endl;
785 EColor lcolor = (ptype==
"like") ? kBlack : kWhite;
789 if(mch_order==0 && ptype==
"like") {
790 WTS =
new watplot(const_cast<char*>(
"wts"));
791 WTS->
plot(&ebbh->nc, 1, 2,
'L', 0, const_cast<char*>(
"COLZ"));
796 double echirp = ebbh->nc.mchirp5(1,zmax_thr,chi2_thr,tmerger_cut);
798 if(mch_order==0 && ptype==
"like") {
803 TF1* fit = &(pcd->
fit);
807 if(tmerger==0) tmerger = -fit->GetParameter(1)/fit->GetParameter(0);
808 double Xmin = fit->GetXmin()-0.1;
809 double Xmax = tmerger-0.001;
810 if(mch_order==0) {xmin=Xmin;xmax=Xmax;}
811 if(Xmin<xmin) xmin = Xmin;
812 if(Xmax>xmax) xmax = Xmax;
817 ebbh->ch_mass[mch_order] = pcd->
mchirp;
818 ebbh->ch_tmerger[mch_order] = -fit->GetParameter(1)/fit->GetParameter(0);
819 ebbh->ch_merr[mch_order] = pcd->
mchirperr;
820 ebbh->ch_mchi2[mch_order] = pcd->
chi2chirp;
821 ebbh->ch_energy[mch_order] = echirp;
824 xfit[mch_order] =
new TF1(fit->GetName(),
"pow([0]*(x-[1]),-3./8.)", xmin, xmax);
825 xfit[mch_order]->SetLineColor(lcolor);
826 xfit[mch_order]->SetLineWidth(lwidth);
827 xfit[mch_order]->SetLineStyle(lstyle);
828 xfit[mch_order]->SetParameter(0, p0);
829 xfit[mch_order]->SetParameter(1, p1);
832 if(mch_order==0 && ptype==
"stft") {
833 if(wtype==
"wdat") MDC->
Draw(ebbh->wdat[ifo],
MDC_TF);
834 if(wtype==
"winj") MDC->
Draw(ebbh->winj[ifo],
MDC_TF);
835 if(wtype==
"wrec") MDC->
Draw(ebbh->wrec[ifo],
MDC_TF);
840 if(stft) stft->
GetHistogram()->GetXaxis()->SetRangeUser(xmin,xmax+0.3);
842 if(ptype!=
"")
xfit[mch_order]->Draw(
"same");
849 cout.setf(ios::fixed, ios::floatfield);
851 cout <<
"CHIRP_" << mch_order+1 <<
" -> " 852 <<
" MCH_MASS : " << ebbh->ch_mass[mch_order] <<
"\t\tMCH_ERR : " << ebbh->ch_merr[mch_order]
853 <<
"\t\tMCH_CHI2 : " << ebbh->ch_mchi2[mch_order] <<
"\t\tMCH_EN : " << ebbh->ch_energy[mch_order]
854 <<
"\t\tMCH_TIME : " << setprecision(2) << ebbh->ch_tmerger[mch_order] <<
" (sec)" << endl;
864 int nifo = ebbh->ifo.size();
868 std::vector<int>* vint = &(pwc->
cList[cid-1]);
870 int V = vint->size();
873 double zmax = -1e100;
875 for(
int j=0;
j<V;
j++) {
881 double zthr = zmax_thr*zmax;
889 for(
int j=0;
j<V;
j++) {
891 if(!pix->
core)
continue;
899 if(time<minTime) minTime=time;
900 if(time+dt>maxTime) maxTime=time+
dt;
903 if(freq<minFreq) minFreq=
freq;
904 if(freq>maxFreq) maxFreq=
freq;
907 int minRate=RATE/(maxLayers-1);
908 int maxRate=RATE/(minLayers-1);
910 double mindt = 1./maxRate;
911 double maxdt = 1./minRate;
912 double mindf = minRate/2.;
913 double maxdf = maxRate/2.;
916 cout.setf(ios::fixed, ios::floatfield);
926 double iminTime = minTime-maxdt;
927 double imaxTime = maxTime+maxdt;
928 int nTime = (imaxTime-iminTime)*maxRate;
930 if(hN) {
delete hN; hN=NULL; }
931 hN =
new TH2F(
"hN",
"hN", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
932 if(hL) {
delete hL; hL=NULL; }
933 hL =
new TH2F(
"hL",
"hL", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
934 if(heT) {
delete heT; heT=NULL; }
935 heT =
new TH2F(
"heT",
"heT", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
936 if(heF) {
delete heF; heF=NULL; }
937 heF =
new TH2F(
"heF",
"heF", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
939 double dFreq = (maxFreq-minFreq)/10.>2*maxdf ? (maxFreq-minFreq)/10. : 2*maxdf ;
940 double mFreq = minFreq-dFreq<0 ? 0 : minFreq-
dFreq;
941 double MFreq = maxFreq+dFreq>RATE/2 ? RATE/2 : maxFreq+
dFreq;
943 double dTime = (maxTime-minTime)/10.>2*maxdt ? (maxTime-minTime)/10. : 2*maxdt ;
944 double mTime = minTime-dTime<iminTime ? iminTime : minTime-dTime;
945 double MTime = maxTime+dTime>imaxTime ? imaxTime : maxTime+dTime;
949 for(
int n=0;
n<V;
n++) {
951 if(!pix->
core)
continue;
961 int iRATE =
int(pix->
rate+0.5);
963 int K=2*(maxLayers-1)/(pix->
layers-1);
967 int i=(itime-iminTime)*maxRate;
972 for(
int m=0;
m<
M;
m++) {
973 for(
int k=0;
k<
K;
k++) {
974 double L = hL->GetBinContent(i+1+
m,j+1+
k-K/2);
975 hL->SetBinContent(i+1+
m,j+1+
k-K/2,sSNR+L);
977 double N = hN->GetBinContent(i+1+
m,j+1+
k-K/2);
978 hN->SetBinContent(i+1+
m,j+1+
k-K/2,N+1);
980 double eT = heT->GetBinContent(i+1+
m,j+1+
k-K/2);
982 heT->SetBinContent(i+1+
m,j+1+
k-K/2,eT+M);
984 double eF = heF->GetBinContent(i+1+
m,j+1+
k-K/2);
986 heF->SetBinContent(i+1+
m,j+1+
k-K/2,eF+K);
991 cout <<
"Likelihood : " << Likelihood <<
" npix : " << npix << endl;
993 for(
int i=0;
i<=hL->GetNbinsX();
i++) {
994 for(
int j=0;
j<=hL->GetNbinsY();
j++) {
996 double L = hL->GetBinContent(
i,
j);
999 double N = hN->GetBinContent(
i,
j);
1001 double eT = heT->GetBinContent(
i,
j);
1004 heT->SetBinContent(
i,
j,mindt*eT/N);
1006 double eF = heF->GetBinContent(
i,
j);
1009 heF->SetBinContent(
i,
j,(mindf/2.)*eF/N);
1025 h2d->SetTitle(ebbh->name);
1027 h2d->GetYaxis()->SetRangeUser(
FLOW,
FHIGH);
1029 h2d->SetStats(kFALSE);
1030 h2d->SetTitleFont(12);
1031 h2d->SetFillColor(kWhite);
1033 h2d->GetXaxis()->SetNdivisions(506);
1034 h2d->GetXaxis()->SetLabelFont(42);
1035 h2d->GetXaxis()->SetLabelOffset(0.014);
1036 h2d->GetXaxis()->SetTitleOffset(1.4);
1037 h2d->GetYaxis()->SetTitleOffset(1.2);
1038 h2d->GetYaxis()->SetNdivisions(506);
1039 h2d->GetYaxis()->SetLabelFont(42);
1040 h2d->GetYaxis()->SetLabelOffset(0.01);
1041 h2d->GetZaxis()->SetLabelFont(42);
1042 h2d->GetZaxis()->SetNoExponent(
false);
1043 h2d->GetZaxis()->SetNdivisions(506);
1045 h2d->GetXaxis()->SetTitleFont(42);
1046 h2d->GetXaxis()->SetTitle(
"Time (sec)");
1047 h2d->GetXaxis()->CenterTitle(
true);
1048 h2d->GetYaxis()->SetTitleFont(42);
1049 h2d->GetYaxis()->SetTitle(
"Frequency (Hz)");
1050 h2d->GetYaxis()->CenterTitle(
true);
1052 h2d->GetZaxis()->SetTitleOffset(0.6);
1053 h2d->GetZaxis()->SetTitleFont(42);
1054 h2d->GetZaxis()->CenterTitle(
true);
1056 h2d->GetXaxis()->SetLabelSize(0.03);
1057 h2d->GetYaxis()->SetLabelSize(0.03);
1058 h2d->GetZaxis()->SetLabelSize(0.03);
1077 double Mc = ebbh->ch_mass[0];
1082 double p0 = 256.*Pi/5*pow(G*Mc*SM*Pi/C/C/C, 5./3);
1083 double p1 = ebbh->ch_tmerger[0];
1085 double xmin = h2d->GetXaxis()->GetXmin();
1086 double xmax = h2d->GetXaxis()->GetXmax();
1087 if(p1<xmax) xmax=
p1;
1092 fchirp =
new TF1(
"fchirp",
"pow([0]*([1]-x),-3./8.)", xmin, xmax);
1093 fchirp->SetLineColor(kBlack);
1096 fchirp->SetParameter(0, p0);
1097 fchirp->SetParameter(1, p1);
1099 double dT =
hL->GetXaxis()->GetBinWidth(0);
1100 double dF =
hL->GetYaxis()->GetBinWidth(0);
1104 for(
int i=1;
i<=
hL->GetNbinsX();
i++) {
1105 double T =
hL->GetXaxis()->GetBinCenter(
i)+
hL->GetXaxis()->GetBinWidth(
i)/2.;
1107 for(
int j=0;
j<=
hL->GetNbinsY();
j++) {
1109 double L =
hL->GetBinContent(
i,
j);
1112 double F =
hL->GetYaxis()->GetBinCenter(
j)+
hL->GetYaxis()->GetBinWidth(
j)/2.;
1115 if(F-
fchirp->Eval(T-dT)<DF && (F-
fchirp->Eval(T-dT)>0)) cenergy+=
L;
1130 if(wtype==
"winj") wf = ebbh->winj[
ifo];
1131 if(wtype==
"sinj") wf = ebbh->sinj[
ifo];
1132 if(wtype==
"wrec") wf = ebbh->wrec[
ifo];
1133 if(wtype==
"srec") wf = ebbh->srec[
ifo];
1134 if(wtype==
"wsim") wf = ebbh->wsim[0];
1137 double imchirp = ebbh->ch_mass[0];
1139 double tmerger = ebbh->ch_tmerger[0];
1140 cout <<
"mchirp5 - mchirp : " << imchirp << endl;
1141 cout <<
"mchirp5 - tmerger : " << tmerger << endl;
1153 gr->SetTitle(ebbh->name);
1161 for(
int i=0;
i<fwf.
size();
i++) {
1162 fwf[
i] = fwf[
i]>
FLOW ? pow(fwf[
i]/sF,-8./3.) : 0;
1171 double M1=ebbh->mass[0];
1172 double M2=ebbh->mass[1];
1173 double Mc = pow(M1*M2,3./5.)/pow(M1+M2,1./5.);
1176 cout <<
"Mc " << Mc << endl;
1178 double kk = 256.*Pi/5*pow(G*SM*Pi/C/C/C, 5./3);
1179 double K = 256.*Pi/5*pow(G*Mc*Pi/C/C/C, 5./3);
1181 kk *= pow(sF, 8./3);
1189 double dt = 1./ff.
rate();
1190 double Tc = tmerger;
1191 for(
int i=0;
i<ff.
size();
i++) {
1194 double F = T<Tc ? pow(K*(Tc-T),-3./8.) : 0;
1196 if(F<0 || F>1000) F=0;
1197 F = F>0 ? pow(F,-8./3.) : 0;
1205 double emax=ewf.
max();
1207 for(
int i=0;
i<fwf.
size();
i++) {
1208 if(ewf[
i]/emax<0.1) SS++;
else break;
1211 for(
int i=fwf.
size()-1;
i>=0;
i--) {
1212 if(ewf[
i]/emax<0.2) EE++;
else break;
1221 TGraphErrors *grr =
new TGraphErrors(fwf.
size()-SS-EE, tt.
data+SS, fwf.
data+SS, 0, eff.
data+SS);
1222 grr->GetHistogram()->SetTitle(ebbh->name);
1223 grr->GetHistogram()->GetXaxis()->SetTitle(
"time (sec)");
1224 grr->GetHistogram()->GetYaxis()->SetTitle(
"freq^-3/8 ");
1225 grr->GetHistogram()->GetXaxis()->SetTitleOffset(1.1);
1226 grr->GetHistogram()->GetYaxis()->SetTitleOffset(1.1);
1227 grr->SetMarkerStyle(7);
1228 grr->SetMarkerColor(kGray);
1229 grr->SetLineColor(kGray);
1231 TF1 *func =
new TF1(
"func",
"[0]*(x-[1])", 0.05,Tc);
1235 func->SetParameter(0,-kk*pow(imchirp,1./0.6));
1236 func->SetParameter(1,Tc);
1237 func->SetLineColor(kRed);
1238 TCanvas *
canvas =
new TCanvas(
"canvas",
"Linear and robust linear fitting");
1241 printf(
"Ordinary least squares:\n");
1245 double mch = -func->GetParameter(0)/kk;
1246 double mchirp = mch>0 ? pow(mch, 0.6) : -pow(-mch, 0.6);
1248 cout <<
"mchirp : " << mchirp << endl;
1249 cout <<
"mchirp-MC : " << mchirp-MC << endl;
1250 cout <<
"m1 m2 ichirp ochirp ochirp-ichirp : " << M1 <<
" " << M2 <<
" " << MC <<
" " <<
" " << mchirp <<
" " << mchirp-MC << endl;
1253 double mm = (pow(80.,-8./3.)-pow(30.,-8./3.))/(0.13);
1254 double mch1 = -mm/kk;
1255 double mchirp1 = mch1>0 ? pow(mch1, 0.6) : -pow(-mch1, 0.6);
1256 cout <<
"mchirp1 : " << mchirp1 << endl;
1263 double To = 931072130;
1265 double Tc=ebbh->ch_tmerger[0];
1267 double M1 = ebbh->mass[0]<ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1268 double M2 = ebbh->mass[0]>ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1270 double S1 =
fabs(ebbh->spin[0])<
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1271 double S2 =
fabs(ebbh->spin[0])>
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1273 double DIST=ebbh->dist;
1279 inspOptions+= TString::Format(
"--gps-start-time %f --gps-end-time %f ",Tc+To,Tc+To);
1280 inspOptions+=
"--taper-injection start --seed 962488 ";
1281 inspOptions+=
"--dir ./ ";
1282 inspOptions+=
"--f-lower 24.000000 ";
1283 inspOptions+=
"--time-step 60 ";
1285 inspOptions+=
"--waveform IMRPhenomBthreePointFivePN ";
1286 inspOptions+=
"--l-distr random ";
1287 inspOptions+=
"--i-distr uniform ";
1289 inspOptions+= TString::Format(
"--min-mass1 %f --max-mass1 %f ",M1,M1);
1290 inspOptions+= TString::Format(
"--min-mass2 %f --max-mass2 %f ",M2,M2);
1291 inspOptions+= TString::Format(
"--min-mtotal %f --max-mtotal %f ",M1+M1,M2+M2);
1293 inspOptions+=
"--m-distr componentMass ";
1294 inspOptions+=
"--enable-spin --aligned ";
1296 inspOptions+= TString::Format(
"--min-spin1 %f --max-spin1 %f ",S1,S1);
1297 inspOptions+= TString::Format(
"--min-spin2 %f --max-spin2 %f ",S2,S2);
1299 inspOptions+=
"--amp-order 0 ";
1300 inspOptions+=
"--d-distr volume ";
1301 inspOptions+= TString::Format(
"--min-distance %f --max-distance %f ",DIST,DIST);
1304 MDC->SetInspiral(
"IMRPhenomBthreePointFivePN",inspOptions.Data());
1307 ebbh->wsim[0] = MDC->GetInspiral(
"hp",Tc+To-200,Tc+To+200);
1308 ebbh->wsim[1] = MDC->GetInspiral(
"hx",Tc-200,Tc+200);
1309 ebbh->wsim[0].start(ebbh->wsim[0].start()-To);
1310 ebbh->wsim[0].resample(2*
FHIGH);
1311 ebbh->wsim[1].start(ebbh->wsim[1].start()-To);
1312 ebbh->wsim[1].resample(2*
FHIGH);
1313 cout <<
"size : " << ebbh->wsim[0].size() <<
" rate : " << ebbh->wsim[0].rate() <<
" start : " << (
int)ebbh->wsim[0].start() << endl;
1320 double To = ebbh->wrec[0].start();
1322 double Tc=ebbh->ch_tmerger[0];
1324 double M1 = ebbh->mass[0]<ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1325 double M2 = ebbh->mass[0]>ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1327 double S1 =
fabs(ebbh->spin[0])<
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1328 double S2 =
fabs(ebbh->spin[0])>
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1330 double DIST=ebbh->dist;
1332 double E0 = ebbh->e0;
1333 double RP0 = ebbh->rp0>00 ? ebbh->rp0 : 14;
1334 double REDSHIFT = ebbh->redshift;
1337 TString ebbh_parms = TString::Format(
"1 %f %f %f %f %f %f",M1,M2,RP0,E0,DIST,REDSHIFT);
1338 cout <<
"ebbh_parms : " << ebbh_parms << endl;
1344 par[0].name=ebbh_parms;
1351 ebbh->wsim[0] = wf.
hp;
1352 ebbh->wsim[1] = wf.
hx;
1353 ebbh->wsim[0].start(ebbh->wrec[0].start()-ebbh->seggps);
1354 ebbh->wsim[0].resample(2*
FHIGH);
1355 ebbh->wsim[1].start(ebbh->wrec[1].start()-ebbh->seggps);
1356 ebbh->wsim[1].resample(2*
FHIGH);
1357 cout <<
"size : " << ebbh->wsim[0].size() <<
" rate : " << ebbh->wsim[0].rate() <<
" start : " << (
int)ebbh->wsim[0].start() << endl;
detectorParams getDetectorParams()
watplot * Draw(TString name, int id=0, TString polarization="hp", MDC_DRAW type=MDC_TIME, TString options="ALP", Color_t color=kBlack)
std::vector< wavearray< double > > wREC[MAX_TRIALS]
virtual void rate(double r)
void Print(TString pname)
std::vector< pixel > cluster
wavearray< double > a(hp.size())
int EccentricityIndex(TString ifroot, int gtype=0, int entry=0, int ifo=0, EBBH *xebbh=NULL)
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1) *itime+ifreq;double time=itime *dT;double freq=(ifreq >0) ? ifreq *dF :dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
int ReadDataFromROOT(TString ifile, EBBH *ebbh)
std::vector< TGraph * > graph
void DrawMChirpInstantaneousFrequency(EBBH *ebbh, TString wtype, int ifo)
std::vector< double > oSNR[NIFO_MAX]
std::vector< vector_int > cList
virtual void start(double s)
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
void PlotChirp(EBBH *ebbh, int mch_order, double &tmerger, double &xmin, double &xmax, EColor color)
mdcid AddWaveform(MDC_TYPE mdc_type, vector< mdcpar > par, TString uname="")
void PlotCluster(watplot *WTS, netcluster *pwc, double fLow, double fHigh)
virtual size_t size() const
double GetTimeBoundaries(wavearray< double > x, double P, double &bT, double &eT)
wavearray< double > GetAlignedWaveform(wavearray< double > *wf, wavearray< double > *wref)
TGraphErrors * xgr[NCHIRP_MAX]
watplot p1(const_cast< char *>("TFMap1"))
void PlotMultiChirp(EBBH *ebbh)
printf("total live time: non-zero lags = %10.1f \, liveTot)
std::vector< double > iSNR[NIFO_MAX]
netpixel * getPixel(size_t n, size_t i)
double ChirpIntegralHistogram(EBBH *ebbh, TH2F &*h2d, double dMc)
double GravitationalConstant()
TGraphErrors chirp
chirp fit parameters (don't remove ! fix crash when exit from CINT)
wavearray< double > GetDifWaveform(wavearray< double > *wf1, wavearray< double > *wf2)
void PlotHistogram(EBBH *ebbh, TH2F &*hH)
void PlotMultiChirp2(EBBH *ebbh, int ifo=0, TString ptype="", TString wtype="")
double fabs(const Complex &x)
void FindChirp(EBBH *ebbh, int mch_order, double &tmerger, double &xmin, double &xmax, int ifo, TString ptype, TString wtype)
double GetFitParameter(double mchirp)
waveform GetWaveform(int ID, int id=0)
virtual DataType_t max() const
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void SetZoom(double epzoom=EPZOOM)
wavearray< double > wINJ[NIFO_MAX]
void PlotMChirp(EBBH *ebbh)
double getdata(char type='R', size_t n=0)
void FillHistogram(EBBH *ebbh, TH2F &*hN, TH2F &*hL, TH2F &*heT, TH2F &*heF, double zmax_thr=0.)
double SpeedOfLightInVacuo()
bool setdata(double a, char type='R', size_t n=0)