16 std::vector<TString>
ifo;
63 void PlotChirp(EBBH*
ebbh,
int mch_order,
double& tmerger,
double& xmin,
double& xmax, EColor color);
103 #define CHI2_THR -4.5 // if negative the chirp pixels are tagged with pix->likelihood=0 after the selection 104 #define TMERGER_CUT 0.01 171 if(gtype<-16 || gtype>16) {cout <<
"Error, gtype parameter value not allowed : [-1:11]" << endl;
exit(1);}
172 if(ifroot==
"") {cout <<
"Error, input root file name not defined" << endl;
exit(1);}
174 gPLOT = gtype<0 ? true :
false;
177 if(
gPLOT) gROOT->SetBatch(
true);
181 TString fDir = gSystem->DirName(ifroot);
184 if(fName.Contains(
"*")) {
186 fTag.ReplaceAll(
"*",
"");
188 if(fList.size()==0) {cout <<
"Error, no file selected" << endl;
exit(1);}
189 if(fList.size()>1) {cout <<
"Error, multiple files selected" << endl;
exit(1);}
192 fDir = gSystem->DirName(ifroot);
193 fName = gSystem->BaseName(ifroot);
199 gOFILE.ReplaceAll(
".root",
".png");
201 if(
gPLOT) cout << endl <<
"Output Plot File Name : " <<
gOFILE << endl << endl;
210 if(err)
return -100000;
216 ebbh.wdat[
ifo].start(ebbh.seggps ? ebbh.wdat[
ifo].start()-ebbh.seggps : 0);
217 ebbh.winj[
ifo].start(ebbh.seggps ? ebbh.winj[
ifo].start()-ebbh.seggps : 0);
218 ebbh.wrec[
ifo].start(ebbh.seggps ? ebbh.wrec[
ifo].start()-ebbh.seggps : 0);
219 ebbh.srec[
ifo].start(ebbh.seggps ? ebbh.srec[
ifo].start()-ebbh.seggps : 0);
252 if(ebbh.winj[
ifo].size()!=0) {
258 if(plot) plot->
graph[0]->SetTitle(TString::Format(
"%s : Rec(black), Inj(red))",ebbh.name.Data()));
264 if(ebbh.winj[
ifo].size()!=0) {
270 if(plot) plot->
graph[0]->SetTitle(TString::Format(
"%s : Rec(black), Inj(red))",ebbh.name.Data()));
308 if(MDC != NULL)
delete MDC;
309 if(WTS != NULL)
delete WTS;
310 if(PCH != NULL)
delete PCH;
311 if(stft != NULL)
delete stft;
313 if(
hN != NULL)
delete hN;
314 if(
hL != NULL)
delete hL;
315 if(
heT != NULL)
delete heT;
316 if(
heF != NULL)
delete heF;
334 TFile*
froot =
new TFile(ifile,
"READ");
335 TTree*
itree = (TTree*)froot->Get(
"waveburst");
336 if(itree==NULL) {cout <<
"ReadDataFromROOT - Error : no waveburst present in the file" << endl;
return 1;}
339 TList*
list = itree->GetUserInfo();
340 int nIFO=list->GetSize();
341 if (nIFO==0) {cout <<
"ReadDataFromROOT - Error : no ifo present in the tree" << endl;
return 1;}
342 for (
int n=0;
n<list->GetSize();
n++) {
345 ebbh->ifo.push_back(pDetector->
Name);
350 itree->SetBranchAddress(
"ndim",&nIFO);
360 std::vector<netpixel>*
cluster;
373 cluster =
new std::vector<netpixel>;
375 itree->SetBranchAddress(
"mass",ebbh->mass);
376 itree->SetBranchAddress(
"eBBH",eBBH);
377 itree->SetBranchAddress(
"range",range);
378 itree->SetBranchAddress(
"spin",ebbh->spin);
379 itree->SetBranchAddress(
"iSNR",iSNR);
380 itree->SetBranchAddress(
"oSNR",oSNR);
382 itree->SetBranchAddress(
"ebbh_parms",parms);
384 itree->SetBranchAddress(TString::Format(
"ebbh_wDAT_%d",
n).Data(),&wDAT[
n]);
385 itree->SetBranchAddress(TString::Format(
"ebbh_wINJ_%d",n).Data(),&wINJ[n]);
386 itree->SetBranchAddress(TString::Format(
"ebbh_wREC_%d",n).Data(),&wREC[n]);
387 itree->SetBranchAddress(TString::Format(
"ebbh_sREC_%d",n).Data(),&sREC[n]);
390 itree->SetBranchAddress(
"ebbh_ch_mass", ebbh->ch_mass);
391 itree->SetBranchAddress(
"ebbh_ch_tmerger",ebbh->ch_tmerger);
392 itree->SetBranchAddress(
"ebbh_ch_merr", ebbh->ch_merr);
393 itree->SetBranchAddress(
"ebbh_ch_mchi2", ebbh->ch_mchi2);
394 itree->SetBranchAddress(
"ebbh_ch_energy", ebbh->ch_energy);
396 itree->SetBranchAddress(
"ebbh_seggps",&seggps);
397 itree->SetBranchAddress(
"ebbh_crate",&crate);
398 itree->SetBranchAddress(
"ebbh_cluster",&cluster);
404 ebbh->redshift = eBBH[3];
405 ebbh->dist = range[1];
407 for(
int n=0;
n<
nIFO;
n++) ebbh->isnr += iSNR[
n];
408 ebbh->isnr = sqrt(ebbh->isnr);
410 for(
int n=0;
n<
nIFO;
n++) ebbh->osnr += oSNR[
n];
411 ebbh->osnr = sqrt(ebbh->osnr);
420 cout <<
"segment start time " << seggps << endl;
421 cout <<
"cluster rate " << crate << endl;
422 cout <<
"cluster size " << cluster->size() << endl;
424 if(cluster->size()==0) {cout <<
"ReadDataFromROOT - Error : no clusters in the root file !!!" << endl;
return 1;}
427 std::vector<int> pList;
428 for(
int i=0;
i<cluster->size();
i++) {
429 ebbh->nc.pList.push_back((*cluster)[
i]);
432 ebbh->nc.cList.push_back(pList);
434 ebbh->nc.cData.push_back(cd);
436 ebbh->seggps = seggps;
438 ebbh->mchirp = pow(ebbh->mass[0]*ebbh->mass[1],3./5.)/pow(ebbh->mass[0]+ebbh->mass[1],1./5.);
441 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",
442 ebbh->mass[0], ebbh->mass[1], ebbh->mchirp, ebbh->e0, ebbh->rp0, ebbh->dist, ebbh->redshift, ebbh->isnr, ebbh->osnr);
446 if(wDAT[
n])
delete wDAT[
n];
447 if(wINJ[n])
delete wINJ[
n];
448 if(wREC[n])
delete wREC[
n];
449 if(sREC[n])
delete sREC[
n];
452 if(itree)
delete itree;
453 if(froot)
delete froot;
468 for(
int i=0;
i<
N;
i++) {avr+=
i*x[
i]*x[
i]; E+=x[
i]*x[
i];}
475 double sum = ((M>=0)&&(M<N)) ? x[M]*x[M] : 0.;
476 for(
int j=1;
j<
N;
j++) {
477 a = ((M-
j>=0)&&(M-j<N)) ? x[M-j] : 0.;
478 b = ((M+j>=0)&&(M+j<N)) ? x[M+j] : 0.;
496 if(wf1==NULL)
return wf;
497 if(wf1->
size()==0)
return wf;
499 double R=wf1->
rate();
501 double b_wf1 = wf1->
start();
502 double e_wf1 = wf1->
start()+wf1->
size()/R;
503 double b_wf2 = wf2->
start();
504 double e_wf2 = wf2->
start()+wf2->
size()/R;
506 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
507 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
509 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
510 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
511 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
513 for(
int i=0;
i<sizeXCOR;
i++) wf[
i+o_wf2] = wf1->
data[
i+o_wf1];
520 double R=wf1->
rate();
522 double b_wf1 = wf1->
start();
523 double e_wf1 = wf1->
start()+wf1->
size()/R;
524 double b_wf2 = wf2->
start();
525 double e_wf2 = wf2->
start()+wf2->
size()/R;
527 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
528 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
530 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
531 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
532 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
537 wfdif.
start(b_wf1+
double(o_wf1)/R);
539 for(
int i=0;
i<sizeXCOR;
i++) wfdif[
i] = wf1->
data[
i+o_wf1] - wf2->
data[
i+o_wf2];
552 double A = (96./5.) * pow(Pi,8./3.) * pow(G*SM*mchirp/C/C/C, 5./3);
563 std::vector<int>* vint = &(pwc->
cList[0]);
564 int V = vint->size();
565 for(
int j=0;
j<V;
j++) {
567 if(!pix->
core)
continue;
569 for(
int m=0;
m<2;
m++) {
577 WTS->
plot(pwc, 1, 2,
'L', 0, const_cast<char*>(
"COLZ"));
578 WTS->
hist2D->GetYaxis()->SetRangeUser(fLow, fHigh);
585 EColor color[
NCHIRP_MAX] = {kBlack, kBlue, kGreen, kMagenta};
602 mchirp[
i] = ebbh->ch_mass[
i];
603 energy[
i] = ebbh->ch_energy[
i];
607 sprintf(title,
"chirp mass : rec = %3.3f / %3.3f / %3.3f / %3.3f - chirp_energy = %3.2f / %3.2f / %3.2f / %3.2f",
608 mchirp[0],mchirp[1],mchirp[2],mchirp[3],energy[0],energy[1],energy[2],energy[3]);
609 xgr[0]->SetTitle(title);
616 void PlotChirp(EBBH*
ebbh,
int mch_order,
double& tmerger,
double& xmin,
double& xmax, EColor color) {
622 double echirp = ebbh->nc.mchirp(1,chi2_thr,tmerger_cut,zmax_thr);
626 ebbh->ch_mass[mch_order] = pcd->
mchirp;
627 ebbh->ch_merr[mch_order] = pcd->
mchirperr;
628 ebbh->ch_mchi2[mch_order] = pcd->
chi2chirp;
629 ebbh->ch_energy[mch_order] = echirp;
631 TGraphErrors*
gr = &(pcd->
chirp);
633 xgr[mch_order] =
new TGraphErrors(gr->GetN(),gr->GetX(),gr->GetY(),gr->GetEX(),gr->GetEY());
636 sprintf(title,
"chirp mass : rec = %3.3f [%3.2f] , chi2 = %3.2f",
639 xgr[mch_order]->SetTitle(title);
640 xgr[mch_order]->GetHistogram()->SetStats(kFALSE);
641 xgr[mch_order]->GetHistogram()->SetTitleFont(12);
642 xgr[mch_order]->SetFillColor(kWhite);
643 xgr[mch_order]->SetLineColor(kBlack);
644 xgr[mch_order]->GetXaxis()->SetNdivisions(506);
645 xgr[mch_order]->GetXaxis()->SetLabelFont(42);
646 xgr[mch_order]->GetXaxis()->SetLabelOffset(0.014);
647 xgr[mch_order]->GetXaxis()->SetTitleOffset(1.4);
648 xgr[mch_order]->GetYaxis()->SetTitleOffset(1.2);
649 xgr[mch_order]->GetYaxis()->SetNdivisions(506);
650 xgr[mch_order]->GetYaxis()->SetLabelFont(42);
651 xgr[mch_order]->GetYaxis()->SetLabelOffset(0.01);
652 xgr[mch_order]->GetXaxis()->SetTitleFont(42);
653 xgr[mch_order]->GetXaxis()->SetTitle(
"Time (sec)");
654 xgr[mch_order]->GetXaxis()->CenterTitle(
true);
655 xgr[mch_order]->GetYaxis()->SetTitleFont(42);
656 xgr[mch_order]->GetYaxis()->SetTitle(
"Frequency^{-8/3}");
657 xgr[mch_order]->GetYaxis()->CenterTitle(
true);
658 xgr[mch_order]->GetXaxis()->SetLabelSize(0.03);
659 xgr[mch_order]->GetYaxis()->SetLabelSize(0.03);
661 xgr[mch_order]->SetLineColor(kGreen);
662 xgr[mch_order]->SetMarkerStyle(20);
663 xgr[mch_order]->SetMarkerColor(color);
664 xgr[mch_order]->SetMarkerSize(1);
665 mch_order==0 ?
xgr[mch_order]->Draw(
"XAP") :
xgr[mch_order]->Draw(
"XPsame");
667 TF1* fit = &(pcd->
fit);
669 if(tmerger==0) tmerger = -fit->GetParameter(1)/fit->GetParameter(0);
672 xmin = fit->GetXmin();
673 xmax = tmerger-0.001;
677 xfit[mch_order] =
new TF1(fit->GetName(), fit->GetTitle(), xmin, xmax);
678 xfit[mch_order]->SetLineColor(kRed);
679 xfit[mch_order]->SetParameter(0, p0);
680 xfit[mch_order]->SetParameter(1, p1);
681 xgr[mch_order]->Fit(
xfit[mch_order],
"Q");
682 xfit[mch_order]->Draw(
"same");
684 ebbh->ch_tmerger[mch_order] = -
xfit[mch_order]->GetParameter(1)/
xfit[mch_order]->GetParameter(0);;
695 ebbh->nc.cData[0].mchirp = 0;
696 ebbh->nc.cData[0].mchirperr = 0;
697 ebbh->nc.cData[0].tmrgr = 0;
698 ebbh->nc.cData[0].tmrgrerr = 0;
699 ebbh->nc.cData[0].chi2chirp = 0;
701 PCH =
new watplot(const_cast<char*>(
"chirp"));
705 ebbh->nc.mchirp(1,chi2_thr,tmerger_cut,zmax_thr);
708 printf(
"mchirp : %.2e %.3f %.3f %.3f %.3f \n\n",
715 ofile.ReplaceAll(
"gTYPE_6",TString::Format(
"gTYPE_6_%d",
i+1).Data());
719 PCH->
canvas->Print(ofile);
721 cout <<
"WARNING : Not Implemented : use gtype = -6" << endl;
exit(0);
723 sprintf(title,
"chirp mass : rec = %3.3f [%3.2f] , chi2 = %3.2f",
725 TGraphErrors*
gr = &(pcd->
chirp);
726 xgr[
i] =
new TGraphErrors(gr->GetN(),gr->GetX(),gr->GetY(),gr->GetEX(),gr->GetEY());
727 xgr[
i]->SetTitle(title);
730 TF1* fit = &(pcd->
fit);
731 double tmerger = -fit->GetParameter(1)/fit->GetParameter(0);
732 double xmin = fit->GetXmin()-0.1;
733 double xmax = tmerger-0.001;
734 xfit[
i] =
new TF1(fit->GetName(),
"pow([0]*(x-[1]),-3./8.)", xmin, xmax);
737 xfit[
i]->SetLineColor(kRed);
738 xfit[
i]->SetParameter(0, p0);
739 xfit[
i]->SetParameter(1, p1);
740 xfit[
i]->Draw(
"same");
757 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
758 cout << ebbh->name << endl;
760 cout <<
"spin1x=" << ebbh->spin[0] <<
"\tspin1y=" << ebbh->spin[1] <<
"\tspin1z=" << ebbh->spin[2]
761 <<
"\tspin2x=" << ebbh->spin[3] <<
"\tspin2y=" << ebbh->spin[4] <<
"\tspin2z=" << ebbh->spin[2] << endl;
762 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
766 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
773 for(
int i=0;
i<
NCHIRP_MAX;
i++)
if(ebbh->ch_energy[
i]>emax) {emax=ebbh->ch_energy[
i];imax=
i;}
777 if(
i==imax)
continue;
778 if(ebbh->ch_mass[
i]>0) {
779 if(ebbh->ch_mass[
i]>ebbh->ch_mass[imax])
if(ebbh->ch_energy[
i]>ebbh->ch_energy[imax]/4.) imax2=
i;
785 if(ebbh->ch_mass[
i]>0) {
786 if(ebbh->ch_mass[
i]<ebbh->ch_mass[imax]) ebbh->ei+=ebbh->ch_energy[
i];
787 if(ebbh->ch_mass[
i]>ebbh->ch_mass[imax]) ebbh->ei-=ebbh->ch_energy[
i];
790 ebbh->ei/=ebbh->ch_energy[imax];
793 cout <<
"CHIRP_M -> " <<
" MCH_MASS : " <<
" rec :" << ebbh->ch_mass[imax] <<
" [" << ebbh->ch_merr[imax] <<
"]" 794 <<
" / "<<
" inj : " << ebbh->mchirp <<
"\t\t\t\tMCH_EI : " << ebbh->ei <<
"\t\tMCH_TIME : " << ebbh->ch_tmerger[imax] <<
" (sec)" << endl;
795 cout <<
"-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
802 if((ptype!=
"like")&&(ptype!=
"stft")&&(ptype!=
"")) {
803 cout <<
"PlotMultiChirp2 Error : wrong ptype, available value are : like/stft" << endl;
811 EColor lcolor = (ptype==
"like") ? kBlack : kWhite;
815 if(mch_order==0 && ptype==
"like") {
816 WTS =
new watplot(const_cast<char*>(
"wts"));
817 WTS->
plot(&ebbh->nc, 1, 2,
'L', 0, const_cast<char*>(
"COLZ"));
822 double echirp = ebbh->nc.mchirp(1,chi2_thr,tmerger_cut,zmax_thr);
824 if(mch_order==0 && ptype==
"like") {
829 TF1* fit = &(pcd->
fit);
833 if(tmerger==0) tmerger = -fit->GetParameter(1)/fit->GetParameter(0);
834 double Xmin = fit->GetXmin()-0.1;
835 double Xmax = tmerger-0.001;
836 if(mch_order==0) {xmin=Xmin;xmax=Xmax;}
837 if(Xmin<xmin) xmin = Xmin;
838 if(Xmax>xmax) xmax = Xmax;
843 ebbh->ch_mass[mch_order] = pcd->
mchirp;
844 ebbh->ch_tmerger[mch_order] = -fit->GetParameter(1)/fit->GetParameter(0);
845 ebbh->ch_merr[mch_order] = pcd->
mchirperr;
846 ebbh->ch_mchi2[mch_order] = pcd->
chi2chirp;
847 ebbh->ch_energy[mch_order] = echirp;
850 xfit[mch_order] =
new TF1(fit->GetName(),
"pow([0]*(x-[1]),-3./8.)", xmin, xmax);
851 xfit[mch_order]->SetLineColor(lcolor);
852 xfit[mch_order]->SetLineWidth(lwidth);
853 xfit[mch_order]->SetLineStyle(lstyle);
854 xfit[mch_order]->SetParameter(0, p0);
855 xfit[mch_order]->SetParameter(1, p1);
858 if(mch_order==0 && ptype==
"stft") {
859 if(wtype==
"wdat") MDC->
Draw(ebbh->wdat[ifo],
MDC_TF);
860 if(wtype==
"winj") MDC->
Draw(ebbh->winj[ifo],
MDC_TF);
861 if(wtype==
"wrec") MDC->
Draw(ebbh->wrec[ifo],
MDC_TF);
866 if(stft) stft->
GetHistogram()->GetXaxis()->SetRangeUser(xmin,xmax+0.3);
868 if(ptype!=
"")
xfit[mch_order]->Draw(
"same");
875 cout.setf(ios::fixed, ios::floatfield);
877 cout <<
"CHIRP_" << mch_order+1 <<
" -> " 878 <<
" MCH_MASS : " << ebbh->ch_mass[mch_order] <<
"\t\tMCH_ERR : " << ebbh->ch_merr[mch_order]
879 <<
"\t\tMCH_CHI2 : " << ebbh->ch_mchi2[mch_order] <<
"\t\tMCH_EN : " << ebbh->ch_energy[mch_order]
880 <<
"\t\tMCH_TIME : " << setprecision(2) << ebbh->ch_tmerger[mch_order] <<
" (sec)" << endl;
890 int nifo = ebbh->ifo.size();
894 std::vector<int>* vint = &(pwc->
cList[cid-1]);
896 int V = vint->size();
899 double zmax = -1e100;
901 for(
int j=0;
j<V;
j++) {
907 double zthr = zmax_thr*zmax;
915 for(
int j=0;
j<V;
j++) {
917 if(!pix->
core)
continue;
925 if(time<minTime) minTime=time;
926 if(time+dt>maxTime) maxTime=time+
dt;
929 if(freq<minFreq) minFreq=
freq;
930 if(freq>maxFreq) maxFreq=
freq;
933 int minRate=RATE/(maxLayers-1);
934 int maxRate=RATE/(minLayers-1);
936 double mindt = 1./maxRate;
937 double maxdt = 1./minRate;
938 double mindf = minRate/2.;
939 double maxdf = maxRate/2.;
942 cout.setf(ios::fixed, ios::floatfield);
952 double iminTime = minTime-maxdt;
953 double imaxTime = maxTime+maxdt;
954 int nTime = (imaxTime-iminTime)*maxRate;
956 if(hN) {
delete hN; hN=NULL; }
957 hN =
new TH2F(
"hN",
"hN", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
958 if(hL) {
delete hL; hL=NULL; }
959 hL =
new TH2F(
"hL",
"hL", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
960 if(heT) {
delete heT; heT=NULL; }
961 heT =
new TH2F(
"heT",
"heT", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
962 if(heF) {
delete heF; heF=NULL; }
963 heF =
new TH2F(
"heF",
"heF", nTime, iminTime, imaxTime, 2*(maxLayers-1), 0, RATE/2);
965 double dFreq = (maxFreq-minFreq)/10.>2*maxdf ? (maxFreq-minFreq)/10. : 2*maxdf ;
966 double mFreq = minFreq-dFreq<0 ? 0 : minFreq-
dFreq;
967 double MFreq = maxFreq+dFreq>RATE/2 ? RATE/2 : maxFreq+
dFreq;
969 double dTime = (maxTime-minTime)/10.>2*maxdt ? (maxTime-minTime)/10. : 2*maxdt ;
970 double mTime = minTime-dTime<iminTime ? iminTime : minTime-dTime;
971 double MTime = maxTime+dTime>imaxTime ? imaxTime : maxTime+dTime;
975 for(
int n=0;
n<V;
n++) {
977 if(!pix->
core)
continue;
987 int iRATE =
int(pix->
rate+0.5);
989 int K=2*(maxLayers-1)/(pix->
layers-1);
993 int i=(itime-iminTime)*maxRate;
998 for(
int m=0;
m<
M;
m++) {
999 for(
int k=0;
k<
K;
k++) {
1000 double L = hL->GetBinContent(i+1+
m,j+1+
k-K/2);
1001 hL->SetBinContent(i+1+
m,j+1+
k-K/2,sSNR+L);
1003 double N = hN->GetBinContent(i+1+
m,j+1+
k-K/2);
1004 hN->SetBinContent(i+1+
m,j+1+
k-K/2,N+1);
1006 double eT = heT->GetBinContent(i+1+
m,j+1+
k-K/2);
1008 heT->SetBinContent(i+1+
m,j+1+
k-K/2,eT+M);
1010 double eF = heF->GetBinContent(i+1+
m,j+1+
k-K/2);
1012 heF->SetBinContent(i+1+
m,j+1+
k-K/2,eF+K);
1017 cout <<
"Likelihood : " << Likelihood <<
" npix : " << npix << endl;
1019 for(
int i=0;
i<=hL->GetNbinsX();
i++) {
1020 for(
int j=0;
j<=hL->GetNbinsY();
j++) {
1022 double L = hL->GetBinContent(
i,
j);
1025 double N = hN->GetBinContent(
i,
j);
1027 double eT = heT->GetBinContent(
i,
j);
1030 heT->SetBinContent(
i,
j,mindt*eT/N);
1032 double eF = heF->GetBinContent(
i,
j);
1035 heF->SetBinContent(
i,
j,(mindf/2.)*eF/N);
1051 h2d->SetTitle(ebbh->name);
1053 h2d->GetYaxis()->SetRangeUser(
FLOW,
FHIGH);
1055 h2d->SetStats(kFALSE);
1056 h2d->SetTitleFont(12);
1057 h2d->SetFillColor(kWhite);
1059 h2d->GetXaxis()->SetNdivisions(506);
1060 h2d->GetXaxis()->SetLabelFont(42);
1061 h2d->GetXaxis()->SetLabelOffset(0.014);
1062 h2d->GetXaxis()->SetTitleOffset(1.4);
1063 h2d->GetYaxis()->SetTitleOffset(1.2);
1064 h2d->GetYaxis()->SetNdivisions(506);
1065 h2d->GetYaxis()->SetLabelFont(42);
1066 h2d->GetYaxis()->SetLabelOffset(0.01);
1067 h2d->GetZaxis()->SetLabelFont(42);
1068 h2d->GetZaxis()->SetNoExponent(
false);
1069 h2d->GetZaxis()->SetNdivisions(506);
1071 h2d->GetXaxis()->SetTitleFont(42);
1072 h2d->GetXaxis()->SetTitle(
"Time (sec)");
1073 h2d->GetXaxis()->CenterTitle(
true);
1074 h2d->GetYaxis()->SetTitleFont(42);
1075 h2d->GetYaxis()->SetTitle(
"Frequency (Hz)");
1076 h2d->GetYaxis()->CenterTitle(
true);
1078 h2d->GetZaxis()->SetTitleOffset(0.6);
1079 h2d->GetZaxis()->SetTitleFont(42);
1080 h2d->GetZaxis()->CenterTitle(
true);
1082 h2d->GetXaxis()->SetLabelSize(0.03);
1083 h2d->GetYaxis()->SetLabelSize(0.03);
1084 h2d->GetZaxis()->SetLabelSize(0.03);
1103 double Mc = ebbh->ch_mass[0];
1108 double p0 = 256.*Pi/5*pow(G*Mc*SM*Pi/C/C/C, 5./3);
1109 double p1 = ebbh->ch_tmerger[0];
1111 double xmin = h2d->GetXaxis()->GetXmin();
1112 double xmax = h2d->GetXaxis()->GetXmax();
1113 if(p1<xmax) xmax=
p1;
1118 fchirp =
new TF1(
"fchirp",
"pow([0]*([1]-x),-3./8.)", xmin, xmax);
1119 fchirp->SetLineColor(kBlack);
1122 fchirp->SetParameter(0, p0);
1123 fchirp->SetParameter(1, p1);
1125 double dT =
hL->GetXaxis()->GetBinWidth(0);
1126 double dF =
hL->GetYaxis()->GetBinWidth(0);
1130 for(
int i=1;
i<=
hL->GetNbinsX();
i++) {
1131 double T =
hL->GetXaxis()->GetBinCenter(
i)+
hL->GetXaxis()->GetBinWidth(
i)/2.;
1133 for(
int j=0;
j<=
hL->GetNbinsY();
j++) {
1135 double L =
hL->GetBinContent(
i,
j);
1138 double F =
hL->GetYaxis()->GetBinCenter(
j)+
hL->GetYaxis()->GetBinWidth(
j)/2.;
1141 if(F-
fchirp->Eval(T-dT)<DF && (F-
fchirp->Eval(T-dT)>0)) cenergy+=
L;
1156 if(wtype==
"winj") wf = ebbh->winj[
ifo];
1157 if(wtype==
"sinj") wf = ebbh->sinj[
ifo];
1158 if(wtype==
"wrec") wf = ebbh->wrec[
ifo];
1159 if(wtype==
"srec") wf = ebbh->srec[
ifo];
1160 if(wtype==
"wsim") wf = ebbh->wsim[0];
1163 double imchirp = ebbh->ch_mass[0];
1165 double tmerger = ebbh->ch_tmerger[0];
1166 cout <<
"mchirp - mchirp : " << imchirp << endl;
1167 cout <<
"mchirp - tmerger : " << tmerger << endl;
1179 gr->SetTitle(ebbh->name);
1187 for(
int i=0;
i<fwf.
size();
i++) {
1188 fwf[
i] = fwf[
i]>
FLOW ? pow(fwf[
i]/sF,-8./3.) : 0;
1197 double M1=ebbh->mass[0];
1198 double M2=ebbh->mass[1];
1199 double Mc = pow(M1*M2,3./5.)/pow(M1+M2,1./5.);
1202 cout <<
"Mc " << Mc << endl;
1204 double kk = 256.*Pi/5*pow(G*SM*Pi/C/C/C, 5./3);
1205 double K = 256.*Pi/5*pow(G*Mc*Pi/C/C/C, 5./3);
1207 kk *= pow(sF, 8./3);
1215 double dt = 1./ff.
rate();
1216 double Tc = tmerger;
1217 for(
int i=0;
i<ff.
size();
i++) {
1220 double F = T<Tc ? pow(K*(Tc-T),-3./8.) : 0;
1222 if(F<0 || F>1000) F=0;
1223 F = F>0 ? pow(F,-8./3.) : 0;
1231 double emax=ewf.
max();
1233 for(
int i=0;
i<fwf.
size();
i++) {
1234 if(ewf[
i]/emax<0.1) SS++;
else break;
1237 for(
int i=fwf.
size()-1;
i>=0;
i--) {
1238 if(ewf[
i]/emax<0.2) EE++;
else break;
1247 TGraphErrors *grr =
new TGraphErrors(fwf.
size()-SS-EE, tt.
data+SS, fwf.
data+SS, 0, eff.
data+SS);
1248 grr->GetHistogram()->SetTitle(ebbh->name);
1249 grr->GetHistogram()->GetXaxis()->SetTitle(
"time (sec)");
1250 grr->GetHistogram()->GetYaxis()->SetTitle(
"freq^-3/8 ");
1251 grr->GetHistogram()->GetXaxis()->SetTitleOffset(1.1);
1252 grr->GetHistogram()->GetYaxis()->SetTitleOffset(1.1);
1253 grr->SetMarkerStyle(7);
1254 grr->SetMarkerColor(kGray);
1255 grr->SetLineColor(kGray);
1257 TF1 *func =
new TF1(
"func",
"[0]*(x-[1])", 0.05,Tc);
1261 func->SetParameter(0,-kk*pow(imchirp,1./0.6));
1262 func->SetParameter(1,Tc);
1263 func->SetLineColor(kRed);
1264 TCanvas *
canvas =
new TCanvas(
"canvas",
"Linear and robust linear fitting");
1267 printf(
"Ordinary least squares:\n");
1271 double mch = -func->GetParameter(0)/kk;
1272 double mchirp = mch>0 ? pow(mch, 0.6) : -pow(-mch, 0.6);
1274 cout <<
"mchirp : " << mchirp << endl;
1275 cout <<
"mchirp-MC : " << mchirp-MC << endl;
1276 cout <<
"m1 m2 ichirp ochirp ochirp-ichirp : " << M1 <<
" " << M2 <<
" " << MC <<
" " <<
" " << mchirp <<
" " << mchirp-MC << endl;
1279 double mm = (pow(80.,-8./3.)-pow(30.,-8./3.))/(0.13);
1280 double mch1 = -mm/kk;
1281 double mchirp1 = mch1>0 ? pow(mch1, 0.6) : -pow(-mch1, 0.6);
1282 cout <<
"mchirp1 : " << mchirp1 << endl;
1289 double To = 931072130;
1291 double Tc=ebbh->ch_tmerger[0];
1293 double M1 = ebbh->mass[0]<ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1294 double M2 = ebbh->mass[0]>ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1296 double S1 =
fabs(ebbh->spin[0])<
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1297 double S2 =
fabs(ebbh->spin[0])>
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1299 double DIST=ebbh->dist;
1305 inspOptions+= TString::Format(
"--gps-start-time %f --gps-end-time %f ",Tc+To,Tc+To);
1306 inspOptions+=
"--taper-injection start --seed 962488 ";
1307 inspOptions+=
"--dir ./ ";
1308 inspOptions+=
"--f-lower 24.000000 ";
1309 inspOptions+=
"--time-step 60 ";
1311 inspOptions+=
"--waveform IMRPhenomBthreePointFivePN ";
1312 inspOptions+=
"--l-distr random ";
1313 inspOptions+=
"--i-distr uniform ";
1315 inspOptions+= TString::Format(
"--min-mass1 %f --max-mass1 %f ",M1,M1);
1316 inspOptions+= TString::Format(
"--min-mass2 %f --max-mass2 %f ",M2,M2);
1317 inspOptions+= TString::Format(
"--min-mtotal %f --max-mtotal %f ",M1+M1,M2+M2);
1319 inspOptions+=
"--m-distr componentMass ";
1320 inspOptions+=
"--enable-spin --aligned ";
1322 inspOptions+= TString::Format(
"--min-spin1 %f --max-spin1 %f ",S1,S1);
1323 inspOptions+= TString::Format(
"--min-spin2 %f --max-spin2 %f ",S2,S2);
1325 inspOptions+=
"--amp-order 0 ";
1326 inspOptions+=
"--d-distr volume ";
1327 inspOptions+= TString::Format(
"--min-distance %f --max-distance %f ",DIST,DIST);
1330 MDC->SetInspiral(
"IMRPhenomBthreePointFivePN",inspOptions.Data());
1333 ebbh->wsim[0] = MDC->GetInspiral(
"hp",Tc+To-200,Tc+To+200);
1334 ebbh->wsim[1] = MDC->GetInspiral(
"hx",Tc-200,Tc+200);
1335 ebbh->wsim[0].start(ebbh->wsim[0].start()-To);
1336 ebbh->wsim[0].resample(2*
FHIGH);
1337 ebbh->wsim[1].start(ebbh->wsim[1].start()-To);
1338 ebbh->wsim[1].resample(2*
FHIGH);
1339 cout <<
"size : " << ebbh->wsim[0].size() <<
" rate : " << ebbh->wsim[0].rate() <<
" start : " << (
int)ebbh->wsim[0].start() << endl;
1346 double To = ebbh->wrec[0].start();
1348 double Tc=ebbh->ch_tmerger[0];
1350 double M1 = ebbh->mass[0]<ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1351 double M2 = ebbh->mass[0]>ebbh->mass[1] ? ebbh->mass[0] : ebbh->mass[1];
1353 double S1 =
fabs(ebbh->spin[0])<
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1354 double S2 =
fabs(ebbh->spin[0])>
fabs(ebbh->spin[1]) ?
fabs(ebbh->spin[0]) :
fabs(ebbh->spin[1]);
1356 double DIST=ebbh->dist;
1358 double E0 = ebbh->e0;
1359 double RP0 = ebbh->rp0>00 ? ebbh->rp0 : 14;
1360 double REDSHIFT = ebbh->redshift;
1363 TString ebbh_parms = TString::Format(
"1 %f %f %f %f %f %f",M1,M2,RP0,E0,DIST,REDSHIFT);
1364 cout <<
"ebbh_parms : " << ebbh_parms << endl;
1370 par[0].name=ebbh_parms;
1377 ebbh->wsim[0] = wf.
hp;
1378 ebbh->wsim[1] = wf.
hx;
1379 ebbh->wsim[0].
start(ebbh->wrec[0].start()-ebbh->seggps);
1380 ebbh->wsim[0].resample(2*
FHIGH);
1381 ebbh->wsim[1].start(ebbh->wrec[1].start()-ebbh->seggps);
1382 ebbh->wsim[1].resample(2*
FHIGH);
1383 cout <<
"size : " << ebbh->wsim[0].size() <<
" rate : " << ebbh->wsim[0].rate() <<
" start : " << (
int)ebbh->wsim[0].start() << endl;
detectorParams getDetectorParams()
void FillHistogram(EBBH *ebbh, TH2F *&hN, TH2F *&hL, TH2F *&heT, TH2F *&heF, double zmax_thr=0.)
int ChirpMass(TString ifroot, int gtype=0, int entry=0, int ifo=0, EBBH *xebbh=NULL)
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 PlotHistogram(EBBH *ebbh, TH2F *&hH)
void Print(TString pname)
std::vector< pixel > cluster
double ChirpIntegralHistogram(EBBH *ebbh, TH2F *&h2d, double dMc)
wavearray< double > a(hp.size())
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
void PlotChirp(EBBH *ebbh, int mch_order, double &tmerger, double &xmin, double &xmax, EColor color)
std::vector< TGraph * > graph
void PlotMultiChirp(EBBH *ebbh)
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)
mdcid AddWaveform(MDC_TYPE mdc_type, vector< mdcpar > par, TString uname="")
void PlotMultiChirp2(EBBH *ebbh, int ifo=0, TString ptype="", TString wtype="")
virtual size_t size() const
void DrawMChirpInstantaneousFrequency(EBBH *ebbh, TString wtype, int ifo)
TGraphErrors * xgr[NCHIRP_MAX]
watplot p1(const_cast< char *>("TFMap1"))
int ReadDataFromROOT(TString ifile, EBBH *ebbh)
printf("total live time: non-zero lags = %10.1f \, liveTot)
std::vector< double > iSNR[NIFO_MAX]
void FindChirp(EBBH *ebbh, int mch_order, double &tmerger, double &xmin, double &xmax, int ifo, TString ptype, TString wtype)
netpixel * getPixel(size_t n, size_t i)
double GravitationalConstant()
void PlotMChirp(EBBH *ebbh)
void PlotCluster(watplot *WTS, netcluster *pwc, double fLow, double fHigh)
TGraphErrors chirp
chirp fit parameters (don't remove ! fix crash when exit from CINT)
double fabs(const Complex &x)
waveform GetWaveform(int ID, int id=0)
wavearray< double > GetDifWaveform(wavearray< double > *wf1, wavearray< double > *wf2)
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]
double getdata(char type='R', size_t n=0)
double GetFitParameter(double mchirp)
wavearray< double > GetAlignedWaveform(wavearray< double > *wf, wavearray< double > *wref)
double GetTimeBoundaries(wavearray< double > x, double P, double &bT, double &eT)
double SpeedOfLightInVacuo()
bool setdata(double a, char type='R', size_t n=0)