Logo coherent WaveBurst  
Library Reference Guide
Logo
ChirpMass.C
Go to the documentation of this file.
1 // this macro shows how to read the eBBH results from output ROOT file produced with CWB_Plugin_eBBH.C
2 // Author : G.Vedovato
3 
4 #include "constants.hh"
5 
6 #define NCHIRP_MAX 4
7 
8 // ------------------------------------------------------------
9 // ebbh structure
10 // ------------------------------------------------------------
11 
12 typedef struct { // structure for output for estimated parameters
13 
14  TString name;
15 
16  std::vector<TString> ifo;
17 
18  float isnr;
19  float osnr;
20 
21  double seggps; // segment start time
22 
23  float parms[NIFO_MAX]; // null pixel statistic, for each detector
24 
25  float mchirp;
26  float mass[2];
27  float spin[6]; // spin
28  float e0;
29  float rp0;
30  float dist;
31  float redshift;
32 
33  float ch_mass[NCHIRP_MAX]; // chirp mass
34  float ch_tmerger[NCHIRP_MAX]; // merger time
35  float ch_merr[NCHIRP_MAX]; // mchirp error
36  float ch_mchi2[NCHIRP_MAX]; // mchirp chi2
37  float ch_energy[NCHIRP_MAX]; // chirp energy
38 
39  float ei; // eccentricity index
40 
41  netcluster nc; // netcluster
42 
43  wavearray<double> wdat[NIFO_MAX]; // whitened data (in the vREC time range)
44  wavearray<double> winj[NIFO_MAX]; // whiten injected waveforms
45  wavearray<double> sinj[NIFO_MAX]; // strain injected waveforms
46  wavearray<double> wrec[NIFO_MAX]; // whiten reconstructed waveforms
47  wavearray<double> srec[NIFO_MAX]; // strain injected waveforms
48 
49  wavearray<double> wsim[2]; // strain simulated waveforms hp,hc
50 
51 } EBBH;
52 
53 
54 // ------------------------------------------------------------
55 // functions
56 // ------------------------------------------------------------
57 
59 
60 void PlotMultiChirp(EBBH* ebbh);
61 void PlotMultiChirp2(EBBH* ebbh, int ifo=0, TString ptype="", TString wtype="");
62 void PlotMChirp(EBBH* ebbh);
63 void PlotChirp(EBBH* ebbh, int mch_order, double& tmerger, double& xmin, double& xmax, EColor color);
64 
65 double GetTimeBoundaries(wavearray<double> x, double P, double& bT, double& eT);
68 
69 double GetFitParameter(double mchirp);
70 void PlotCluster(watplot* WTS, netcluster* pwc, double fLow, double fHigh);
71 
72 void FindChirp(EBBH* ebbh, int mch_order, double& tmerger, double& xmin, double& xmax, int ifo, TString ptype, TString wtype);
73 
74 void FillHistogram(EBBH* ebbh, TH2F*& hN, TH2F*& hL, TH2F*& heT, TH2F*& heF, double zmax_thr=0.);
75 void PlotHistogram(EBBH* ebbh, TH2F*& hH);
76 double ChirpIntegralHistogram(EBBH* ebbh, TH2F*& h2d, double dMc);
77 
78 void DrawMChirpInstantaneousFrequency(EBBH* ebbh, TString wtype, int ifo);
79 
80 void GetCBC(EBBH* ebbh);
81 void GetEBBH(EBBH* ebbh);
82 
83 void Init();
84 void Clear();
85 
86 // -----------------------------------------------------------------------------------------------------------
87 // defines
88 // -----------------------------------------------------------------------------------------------------------
89 
90 #define FLOW 16
91 #define FHIGH 1024
92 
93 // default threshold (used in network::likelihoodWP)
94 /*
95 #define CHI2_THR 2.0
96 #define TMERGER_CUT 1.e20
97 #define ZMAX_THR 0.0
98 */
99 
100 
101 //#define CHI2_THR -2.5 // if negative the chirp pixels are tagged with pix->likelihood=0 after the selection
102 //#define TMERGER_CUT 0.1
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
105 #define ZMAX_THR 0.2
106 
107 
108 
109 // ------------------------------------------------------------
110 // global variables
111 // ------------------------------------------------------------
112 
113 int gTYPE;
114 int gENTRY;
115 bool gPLOT;
117 
122 TF1* fchirp;
123 
124 TH2F* hN;
125 TH2F* hL;
126 TH2F* heT;
127 TH2F* heF;
128 
130 TGraphErrors* xgr[NCHIRP_MAX];
131 
132 TCanvas* canvas;
133 
134 int ChirpMass(TString ifroot, int gtype=0, int entry=0, int ifo=0, EBBH* xebbh=NULL) {
135  //
136  // ifroot : input root file
137  //
138  // gtype : plot type
139  // if gtype<0 the plot is saved with name with the following format : gTYPE_gtype_file_name.png
140  //
141  // gtype = 0 -> no plots, only computation of ei
142  // gtype = 1 -> plot chirp fit function with rec spectrogram
143  // gtype = 2 -> plot chirp fit function with likelihood
144  // gtype = 3 -> plot chirp fit function with likelihood without the main chirp
145  // show residuals after chirp1 removal ( only with PlotMultiChirp2 & "like" )
146  // gtype = 4 -> plot with inj spectrogram
147  // gtype = 5 -> plot likelihood TF after with pixels selected with zmax_thr
148  // gtype = 6 -> plot chirp mass fit in f^-3/8 vs time plane
149  // gtype = 7 -> plot chirp mass fit in f^-3/8 vs time plane for all chirp
150  // gtype = 8 -> plot ifo waveform in time
151  // gtype = 9 -> plot ifo waveform in frequency
152  // gtype = 10 -> plot whitened data spectrogram
153  // gtype = 11 -> plot inj waveform spectrogram
154  // gtype = 12 -> plot rec waveform spectrogram
155  // gtype = 13 -> plot inj waveform instantaneous frequency mchirp
156  // gtype = 14 -> plot rec waveform instantaneous frequency mchirp
157  // gtype = 15 -> plot sim waveform (GetCBC) instantaneous frequency mchirp
158  // gtype = 16 -> plot sim waveform (GetEBBH) instantaneous frequency mchirp
159  //
160  // entry : entry id of the event in the root file
161  //
162  // ifo : detector id : 0,1,... (see definition in user_parameters.C)
163  //
164  // xebbh : pointer to the EBBH structure : used by a macro to return the ebbh parameters
165  //
166  // Ex : root 'ChirpMass.C("root_file.root",1,0,0)'
167  //
168 
169  Init();
170 
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);}
173 
174  gPLOT = gtype<0 ? true : false;
175  gTYPE = abs(gtype);
176 
177  if(gPLOT) gROOT->SetBatch(true);
178 
179  gENTRY = entry;
180 
181  TString fDir = gSystem->DirName(ifroot);
182  TString fName = gSystem->BaseName(ifroot);
183 
184  if(fName.Contains("*")) {
185  TString fTag = fName;
186  fTag.ReplaceAll("*","");
187  vector<TString> fList = CWB::Toolbox::getFileListFromDir(fDir, ".root", "wave_", fTag, true);
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);}
190 
191  ifroot = fList[0];
192  fDir = gSystem->DirName(ifroot);
193  fName = gSystem->BaseName(ifroot);
194  }
195 
196  CWB::Toolbox::checkFile(ifroot);
197 
198  gOFILE = fName;
199  gOFILE.ReplaceAll(".root",".png"); // output file name for plot
200  gOFILE = TString::Format("gTYPE_%d_%s",gTYPE,gOFILE.Data());
201  if(gPLOT) cout << endl << "Output Plot File Name : " << gOFILE << endl << endl;
202 
203  CWB::Toolbox::checkFile(ifroot);
204 
205  EBBH ebbh;
206  MDC = new CWB::mdc();
207 
208  // read ebbh from input root file
209  int err = ReadDataFromROOT(ifroot, &ebbh);
210  if(err) return -100000;
211 
212  if(gTYPE==15) GetCBC(&ebbh); // get simulated CBC waveforms
213  if(gTYPE==16) GetEBBH(&ebbh); // get simulated EBBH waveforms
214 
215  // set waveforms start time at start segment time
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);
220 
221  if(gTYPE==0) {PlotMultiChirp2(&ebbh); if(xebbh) {*xebbh=ebbh; Clear(); return 0;} else exit(0);}
222  if(gTYPE==1) {PlotMultiChirp2(&ebbh, ifo, "stft", "wrec");return 0;}
223  if(gTYPE==2 || gTYPE==3) {PlotMultiChirp2(&ebbh, ifo, "like", "wrec");return 0;}
224  if(gTYPE==4) {PlotMultiChirp2(&ebbh, ifo, "stft", "winj");return 0;}
225  if(gTYPE==5) {
226  FillHistogram(&ebbh, hN, hL, heT, heF, ZMAX_THR);
227  PlotHistogram(&ebbh, hL); return 0;
228 /*
229  FillHistogram(&ebbh, hN, hL, heT, heF, 0);
230  double cenergy = ChirpIntegralHistogram(&ebbh, hL, 0);
231  PlotHistogram(&ebbh, hL); return 0;
232  TH1F* hC = new TH1F("hC","hC",41,-20,20);
233  for(int i=0;i<=40;i++) {
234  double dMc = i-20;
235  double cenergy = ChirpIntegralHistogram(&ebbh, hL, dMc);
236  cout << "CHIRP ENERGY : " << dMc << " -> " << cenergy << endl;
237  hC->SetBinContent(i,cenergy);
238  }
239  hC->Draw();
240  return 0;
241 */
242  //PlotHistogram(&ebbh, hL); return 0;
243  //PlotHistogram(&ebbh, heF); return 0;
244  //PlotHistogram(&ebbh, heT); return 0;
245  //PlotHistogram(&ebbh, hN); return 0;
246  }
247  if(gTYPE==6) {PlotMChirp(&ebbh); return 0;}
248  if(gTYPE==7) {PlotMultiChirp(&ebbh);return 0;}
249  if(gTYPE==8) {
250  MDC->SetZoom(0.999);
251  watplot* plot=NULL;
252  if(ebbh.winj[ifo].size()!=0) {
253  plot=MDC->Draw(ebbh.winj[ifo],MDC_TIME,"ALP ZOOM",kRed);
254  MDC->Draw(ebbh.wrec[ifo],MDC_TIME,"SAME",kBlack);
255  } else {
256  plot=MDC->Draw(ebbh.wrec[ifo],MDC_TIME,"ALP ZOOM",kRed);
257  }
258  if(plot) plot->graph[0]->SetTitle(TString::Format("%s : Rec(black), Inj(red))",ebbh.name.Data()));
259  if(gPLOT) {stft->Print(gOFILE);exit(0);} else return 0;
260  }
261  if(gTYPE==9) {
262  MDC->SetZoom(0.999);
263  watplot* plot=NULL;
264  if(ebbh.winj[ifo].size()!=0) {
265  plot=MDC->Draw(ebbh.winj[ifo],MDC_FFT,"ALP ZOOM",kRed);
266  MDC->Draw(ebbh.wrec[ifo],MDC_FFT,"SAME",kBlack);
267  } else {
268  plot=MDC->Draw(ebbh.wrec[ifo],MDC_FFT,"ALP ZOOM",kRed);
269  }
270  if(plot) plot->graph[0]->SetTitle(TString::Format("%s : Rec(black), Inj(red))",ebbh.name.Data()));
271  if(gPLOT) {MDC->GetWatPlot()->canvas->Print(gOFILE);exit(0);} else return 0;
272  }
273  if(gTYPE==10) {MDC->Draw(ebbh.wdat[ifo],MDC_TF);if(gPLOT) {MDC->GetSTFT()->Print(gOFILE);exit(0);} else return 0;}
274  if(gTYPE==11) {MDC->Draw(ebbh.winj[ifo],MDC_TF);if(gPLOT) {MDC->GetSTFT()->Print(gOFILE);exit(0);} else return 0;}
275  if(gTYPE==12) {MDC->Draw(ebbh.wrec[ifo],MDC_TF);if(gPLOT) {MDC->GetSTFT()->Print(gOFILE);exit(0);} else return 0;}
276 
277  if(gTYPE==13) {DrawMChirpInstantaneousFrequency(&ebbh, "winj", ifo); return 0;}
278  if(gTYPE==14) {DrawMChirpInstantaneousFrequency(&ebbh, "wrec", ifo); return 0;}
279  if(gTYPE==15) {DrawMChirpInstantaneousFrequency(&ebbh, "wsim", ifo); return 0;}
280 
281  return 0;
282 }
283 
284 void Init() {
285 
286  MDC = NULL;
287  WTS = NULL;
288  PCH = NULL;
289  stft = NULL;
290 
291  hN = NULL;
292  hL = NULL;
293  heT = NULL;
294  heF = NULL;
295 
296  for(int i=0;i<NCHIRP_MAX;i++) {
297  xfit[i] = NULL;
298  xgr[i] = NULL;
299  }
300 
301  fchirp = NULL;
302 
303  canvas = NULL;
304 }
305 
306 void Clear() {
307 
308  if(MDC != NULL) delete MDC;
309  if(WTS != NULL) delete WTS;
310  if(PCH != NULL) delete PCH;
311  if(stft != NULL) delete stft;
312 
313  if(hN != NULL) delete hN;
314  if(hL != NULL) delete hL;
315  if(heT != NULL) delete heT;
316  if(heF != NULL) delete heF;
317 
318  for(int i=0;i<NCHIRP_MAX;i++) {
319  if(xfit[i] != NULL) delete xfit[i];
320  if(xgr[i] != NULL) delete xgr[i];
321  }
322 
323  if(fchirp != NULL) delete fchirp;
324 
325  if(canvas != NULL) delete canvas;
326 }
327 
329 //
330 // ----------------------------------------------------
331 // ROOT Output PE Parameters
332 // ----------------------------------------------------
333 
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;}
337 
338  // get detector list
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++) {
343  detector* pDetector;
344  pDetector = (detector*)list->At(n);
345  ebbh->ifo.push_back(pDetector->Name);
346  detectorParams dParams = pDetector->getDetectorParams();
347  //pDetector->print();
348  }
349 
350  itree->SetBranchAddress("ndim",&nIFO);
351  itree->GetEntry(gENTRY);
352 
353  double seggps=0; // segment start time
354  float crate; // netcluster::rate
355  float parms[NIFO_MAX]; // ebbh parameters
356  float eBBH[4]; // ebbh parameters
357  float range[2]; // distance (Mpc)
358  float iSNR[NIFO_MAX];
359  float oSNR[NIFO_MAX];
360  std::vector<netpixel>* cluster;
365 
366  for(int n=0;n<nIFO;n++) {
367  wDAT[n] = new wavearray<double>;
368  wINJ[n] = new wavearray<double>;
369  wREC[n] = new wavearray<double>;
370  sREC[n] = new wavearray<double>;
371  }
372 
373  cluster = new std::vector<netpixel>;
374 
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);
381 
382  itree->SetBranchAddress("ebbh_parms",parms);
383  for(int n=0;n<nIFO;n++) {
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]);
388  }
389 
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);
395 
396  itree->SetBranchAddress("ebbh_seggps",&seggps);
397  itree->SetBranchAddress("ebbh_crate",&crate);
398  itree->SetBranchAddress("ebbh_cluster",&cluster);
399 
400  itree->GetEntry(gENTRY);
401 
402  ebbh->e0 = eBBH[1];
403  ebbh->rp0 = eBBH[2];
404  ebbh->redshift = eBBH[3];
405  ebbh->dist = range[1];
406  ebbh->isnr = 0;
407  for(int n=0;n<nIFO;n++) ebbh->isnr += iSNR[n];
408  ebbh->isnr = sqrt(ebbh->isnr);
409  ebbh->osnr = 0;
410  for(int n=0;n<nIFO;n++) ebbh->osnr += oSNR[n];
411  ebbh->osnr = sqrt(ebbh->osnr);
412 
413  for(int n=0;n<nIFO;n++) {
414  ebbh->wdat[n] = GetAlignedWaveform(wDAT[n],wREC[n]);
415  ebbh->winj[n] = wINJ[n]->size() ? GetAlignedWaveform(wINJ[n],wREC[n]) : 0;
416  ebbh->wrec[n] = GetAlignedWaveform(wREC[n],wREC[n]);
417  ebbh->srec[n] = GetAlignedWaveform(sREC[n],wREC[n]);
418  }
419 
420  cout << "segment start time " << seggps << endl;
421  cout << "cluster rate " << crate << endl;
422  cout << "cluster size " << cluster->size() << endl;
423 
424  if(cluster->size()==0) {cout << "ReadDataFromROOT - Error : no clusters in the root file !!!" << endl;return 1;}
425 
426  ebbh->nc.rate=crate;
427  std::vector<int> pList;
428  for(int i=0;i<cluster->size();i++) {
429  ebbh->nc.pList.push_back((*cluster)[i]);
430  pList.push_back(i);
431  }
432  ebbh->nc.cList.push_back(pList);
433  clusterdata cd; // dummy cluster data
434  ebbh->nc.cData.push_back(cd);
435 
436  ebbh->seggps = seggps;
437 
438  ebbh->mchirp = pow(ebbh->mass[0]*ebbh->mass[1],3./5.)/pow(ebbh->mass[0]+ebbh->mass[1],1./5.);
439 
440  char name[1024];
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);
443  ebbh->name = name;
444 
445  for(int n=0;n<nIFO;n++) {
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];
450  }
451  if(cluster) delete cluster;
452  if(itree) delete itree;
453  if(froot) delete froot;
454 
455  return 0;
456 }
457 
458 
459 double GetTimeBoundaries(wavearray<double> x, double P, double& bT, double& eT) {
460 
461  if(P<0) P=0;
462  if(P>1) P=1;
463 
464  int N = x.size();
465 
466  double E = 0; // signal energy
467  double avr = 0; // average
468  for(int i=0;i<N;i++) {avr+=i*x[i]*x[i]; E+=x[i]*x[i];}
469  int M=int(avr/E); // central index
470 
471  // search range which contains percentage P of the total energy E
472  int jB=0;
473  int jE=N-1;
474  double a,b;
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.;
479  if(a) jB=M-j;
480  if(b) jE=M+j;
481  sum += a*a+b*b;
482  if(sum/E > P) break;
483  }
484 
485  bT = x.start()+jB/x.rate();
486  eT = x.start()+jE/x.rate();
487 
488  return eT-bT;
489 }
490 
492 
493  wavearray<double> wf = *wf2;
494  wf=0;
495 
496  if(wf1==NULL) return wf;
497  if(wf1->size()==0) return wf;
498 
499  double R=wf1->rate();
500 
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;
505 
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);
508 
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);
512 
513  for(int i=0;i<sizeXCOR;i++) wf[i+o_wf2] = wf1->data[i+o_wf1];
514 
515  return wf;
516 }
517 
519 
520  double R=wf1->rate();
521 
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;
526 
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);
529 
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);
533 
534  wavearray<double> wfdif(sizeXCOR);
535  wfdif=0.;
536  wfdif.rate(R);
537  wfdif.start(b_wf1+double(o_wf1)/R);
538 
539  for(int i=0;i<sizeXCOR;i++) wfdif[i] = wf1->data[i+o_wf1] - wf2->data[i+o_wf2];
540 
541  return wfdif;
542 }
543 
544 double GetFitParameter(double mchirp) {
545 
546  const double G = watconstants::GravitationalConstant();
547  const double SM = watconstants::SolarMass();
548  const double C = watconstants::SpeedOfLightInVacuo();
549  const double Pi = TMath::Pi();
550 
551 
552  double A = (96./5.) * pow(Pi,8./3.) * pow(G*SM*mchirp/C/C/C, 5./3);
553  double B = 3./8.;
554 
555  double p0 = -A/B;
556 
557  return p0;
558 }
559 
560 void PlotCluster(watplot* WTS, netcluster* pwc, double fLow, double fHigh) {
561 
562  double RATE = pwc->rate; // original rate
563  std::vector<int>* vint = &(pwc->cList[0]); // pixel list
564  int V = vint->size(); // cluster size
565  for(int j=0; j<V; j++) { // loop over the pixels
566  netpixel* pix = pwc->getPixel(1,j);
567  if(!pix->core) continue;
568  if(pix->likelihood==0) {
569  for(int m=0; m<2; m++) {
570  pix->setdata(0,'S',m); // snr whitened reconstructed signal 00
571  pix->setdata(0,'P',m); // snr whitened reconstructed signal 90
572  pix->setdata(0,'W',m); // snr whitened at the detector 00
573  pix->setdata(0,'U',m); // snr whitened at the detector 90
574  }
575  }
576  }
577  WTS->plot(pwc, 1, 2, 'L', 0, const_cast<char*>("COLZ"));
578  WTS->hist2D->GetYaxis()->SetRangeUser(fLow, fHigh);
579  WTS->canvas->SetLogy();
580  return;
581 }
582 
583 void PlotMultiChirp(EBBH* ebbh) {
584 
585  EColor color[NCHIRP_MAX] = {kBlack, kBlue, kGreen, kMagenta};
586 
587  double mchirp[NCHIRP_MAX];
588  double energy[NCHIRP_MAX];
589 
590  canvas = new TCanvas;
591  canvas->SetGridx();
592  canvas->SetGridy();
593 
594  // plot multi chirp likelihood tf
595 
596  double tmerger=0;
597  double xmin=0;
598  double xmax=0;
599 
600  for(int i=0; i<NCHIRP_MAX; i++) {
601  PlotChirp(ebbh, i, tmerger, xmin, xmax, color[i]);
602  mchirp[i] = ebbh->ch_mass[i];
603  energy[i] = ebbh->ch_energy[i];
604  }
605 
606  char title[256];
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);
610 
611  if(gPLOT) {canvas->Print(gOFILE);exit(0);}
612 
613  return;
614 }
615 
616 void PlotChirp(EBBH* ebbh, int mch_order, double& tmerger, double& xmin, double& xmax, EColor color) {
617 
618  double chi2_thr = CHI2_THR;
619  double tmerger_cut = TMERGER_CUT;
620  double zmax_thr = ZMAX_THR;
621 
622  double echirp = ebbh->nc.mchirp(1,chi2_thr,tmerger_cut,zmax_thr);
623 
624  clusterdata* pcd = &ebbh->nc.cData[0];
625 
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;
630 
631  TGraphErrors* gr = &(pcd->chirp);
632 
633  xgr[mch_order] = new TGraphErrors(gr->GetN(),gr->GetX(),gr->GetY(),gr->GetEX(),gr->GetEY());
634 
635  char title[256];
636  sprintf(title,"chirp mass : rec = %3.3f [%3.2f] , chi2 = %3.2f",
637  pcd->mchirp,pcd->mchirperr,pcd->chi2chirp);
638 
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);
660 
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");
666 
667  TF1* fit = &(pcd->fit);
668  double mchirp = pcd->mchirp;
669  if(tmerger==0) tmerger = -fit->GetParameter(1)/fit->GetParameter(0);
670  //if(xmin==0) xmin = fit->GetXmin();
671  //if(xmax==0) xmax = tmerger-0.001;
672  xmin = fit->GetXmin();
673  xmax = tmerger-0.001;
674  double p0 = GetFitParameter(mchirp);
675  double p1 = tmerger;
676 
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");
683 
684  ebbh->ch_tmerger[mch_order] = -xfit[mch_order]->GetParameter(1)/xfit[mch_order]->GetParameter(0);;
685 
686  return;
687 }
688 
689 void PlotMChirp(EBBH* ebbh) {
690 
691  double chi2_thr = CHI2_THR;
692  double tmerger_cut = TMERGER_CUT;
693  double zmax_thr = ZMAX_THR;
694 
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;
700 
701  PCH = new watplot(const_cast<char*>("chirp"));
702 
703  for(int i=0; i<NCHIRP_MAX; i++) {
704 
705  ebbh->nc.mchirp(1,chi2_thr,tmerger_cut,zmax_thr);
706 
707  clusterdata* pcd = &ebbh->nc.cData[0];
708  printf("mchirp : %.2e %.3f %.3f %.3f %.3f \n\n",
709  pcd->mchirp, pcd->mchirperr, pcd->tmrgr,
710  pcd->tmrgrerr, pcd->chi2chirp);
711 
712  // draw chirp : f^(-8/3) vs time
713  if(gPLOT) {
714  TString ofile = gOFILE;
715  ofile.ReplaceAll("gTYPE_6",TString::Format("gTYPE_6_%d",i+1).Data());
716 
717  PCH->canvas->cd();
718  PCH->plot(pcd, 0);
719  PCH->canvas->Print(ofile);
720  } else {
721  cout << "WARNING : Not Implemented : use gtype = -6" << endl;exit(0);
722  char title[256];
723  sprintf(title,"chirp mass : rec = %3.3f [%3.2f] , chi2 = %3.2f",
724  pcd->mchirp,pcd->mchirperr,pcd->chi2chirp);
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);
728  xgr[i]->Draw("ALP");
729  return;
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);
735  double p0 = GetFitParameter(pcd->mchirp);
736  double p1 = tmerger;
737  xfit[i]->SetLineColor(kRed);
738  xfit[i]->SetParameter(0, p0);
739  xfit[i]->SetParameter(1, p1);
740  xfit[i]->Draw("same");
741  return;
742  }
743  }
744 
745  exit(0);
746 }
747 
748 void PlotMultiChirp2(EBBH* ebbh, int ifo, TString ptype, TString wtype) {
749 
750  double tmerger=0;
751  double xmin=0;
752  double xmax=0;
753 
754  // plot chirp
755 
756  cout << endl;
757  cout << "-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
758  cout << ebbh->name << endl;
759  cout << 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;
763 
764  for(int i=0;i<NCHIRP_MAX;i++) FindChirp(ebbh, i, tmerger, xmin, xmax, ifo, ptype, wtype);
765 
766  cout << "-------------------------------------------------------------------------------------------------------------------------------------------" << endl;
767 
768  // print final
769 
770  int imax=0;
771  float emax=0;
772  // find chirp with max energy
773  for(int i=0;i<NCHIRP_MAX;i++) if(ebbh->ch_energy[i]>emax) {emax=ebbh->ch_energy[i];imax=i;}
774  int imax2=imax;
775  // find chirp with highest chirp mass and energy > (max chirp energy)/4
776  for(int i=0;i<NCHIRP_MAX;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;
780  }
781  }
782  imax=imax2;
783  float ebbh->ei=0;
784  for(int i=0;i<NCHIRP_MAX;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];
788  }
789  }
790  ebbh->ei/=ebbh->ch_energy[imax];
791  ebbh->ei*=100;
792 
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;
796 
797  return;
798 }
799 
800 void FindChirp(EBBH* ebbh, int mch_order, double& tmerger, double& xmin, double& xmax, int ifo, TString ptype, TString wtype) {
801 
802  if((ptype!="like")&&(ptype!="stft")&&(ptype!="")) {
803  cout << "PlotMultiChirp2 Error : wrong ptype, available value are : like/stft" << endl;
804  exit(1);
805  }
806 
807  double chi2_thr = CHI2_THR;
808  double tmerger_cut = TMERGER_CUT;
809  double zmax_thr = ZMAX_THR;
810 
811  EColor lcolor = (ptype=="like") ? kBlack : kWhite;
812  int lwidth=3;
813  int lstyle=2;
814 
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"));
818  WTS->hist2D->GetYaxis()->SetRangeUser(FLOW, FHIGH);
819  WTS->canvas->SetLogy();
820  }
821 
822  double echirp = ebbh->nc.mchirp(1,chi2_thr,tmerger_cut,zmax_thr);
823 
824  if(mch_order==0 && ptype=="like") {
825  if(gTYPE==3) PlotCluster(WTS, &ebbh->nc, FLOW, FHIGH);
826  }
827 
828  clusterdata* pcd = &ebbh->nc.cData[0];
829  TF1* fit = &(pcd->fit);
830 
831  double mchirp = pcd->mchirp;
832 
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;
839 
840  double p0 = GetFitParameter(mchirp);
841  double p1 = tmerger;
842 
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;
848 
849  // fit function -> freq = p0 * (time-p1);
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);
856  //mch_order==0 ? xfit[mch_order]->SetParameter(1, p1) : xfit[mch_order]->FixParameter(1, p1);
857 
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);
862  stft = MDC->GetSTFT();
863  stft->GetHistogram()->SetTitle(ebbh->name);
864  stft->GetHistogram()->GetYaxis()->SetRangeUser(FLOW,FHIGH);
865  }
866  if(stft) stft->GetHistogram()->GetXaxis()->SetRangeUser(xmin,xmax+0.3);
867 
868  if(ptype!="") xfit[mch_order]->Draw("same");
869 
870  if(gPLOT && mch_order==NCHIRP_MAX-1 && ptype=="stft") {stft->Print(gOFILE);exit(0);}
871  if(gPLOT && mch_order==NCHIRP_MAX-1 && ptype=="like") {WTS->canvas->Print(gOFILE);exit(0);}
872 
873  // format standard output
874  cout.precision(1);
875  cout.setf(ios::fixed, ios::floatfield);
876 
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;
881 
882  return;
883 }
884 
885 void FillHistogram(EBBH* ebbh, TH2F*& hN, TH2F*& hL, TH2F*& heT, TH2F*& heF, double zmax_thr) {
886 
887  netcluster* pwc = &(ebbh->nc);
888 
889  int cid = 1;
890  int nifo = ebbh->ifo.size();
891 
892  double RATE = pwc->rate; // original rate
893 
894  std::vector<int>* vint = &(pwc->cList[cid-1]); // pixel list
895 
896  int V = vint->size(); // cluster size
897  if(!V) return;
898 
899  double zmax = -1e100;
900  double etot = 0;
901  for(int j=0; j<V; j++) {
902  netpixel* pix = pwc->getPixel(cid, j);
903  if(pix->likelihood<1. || pix->frequency==0 ) continue;
904  if(pix->likelihood>zmax) zmax = pix->likelihood;
905  etot+=pix->likelihood;
906  }
907  double zthr = zmax_thr*zmax;
908 
909  int minLayers=1000;
910  int maxLayers=0;
911  double minTime=1e20;
912  double maxTime=0.;
913  double minFreq=1e20;
914  double maxFreq=0.;
915  for(int j=0; j<V; j++) { // loop over the pixels
916  netpixel* pix = pwc->getPixel(cid,j);
917  if(!pix->core) continue;
918 
919  if(pix->layers<minLayers) minLayers=pix->layers;
920  if(pix->layers>maxLayers) maxLayers=pix->layers;
921 
922  double dt = 1./pix->rate;
923  double time = int(pix->time/pix->layers)/double(pix->rate); // central bin time
924  time -= dt/2.; // begin bin time
925  if(time<minTime) minTime=time;
926  if(time+dt>maxTime) maxTime=time+dt;
927 
928  double freq = pix->frequency*pix->rate/2.;
929  if(freq<minFreq) minFreq=freq;
930  if(freq>maxFreq) maxFreq=freq;
931  }
932 
933  int minRate=RATE/(maxLayers-1);
934  int maxRate=RATE/(minLayers-1);
935 
936  double mindt = 1./maxRate;
937  double maxdt = 1./minRate;
938  double mindf = minRate/2.;
939  double maxdf = maxRate/2.;
940 
941  cout.precision(1);
942  cout.setf(ios::fixed, ios::floatfield);
943 
944 /*
945  cout << "minRate : " << minRate << "\t\t\t maxRate : " << maxRate << endl;
946  cout << "minTime : " << minTime << "\t\t\t maxTime : " << maxTime << endl;
947  cout << "minFreq : " << minFreq << "\t\t\t maxFreq : " << maxFreq << endl;
948  cout << "mindt : " << mindt << "\t\t\t maxdt : " << maxdt << endl;
949  cout << "mindf : " << mindf << "\t\t\t maxdf : " << maxdf << endl;
950 */
951 
952  double iminTime = minTime-maxdt;
953  double imaxTime = maxTime+maxdt;
954  int nTime = (imaxTime-iminTime)*maxRate;
955 
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);
964 
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;
968 
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;
972 
973  int npix=0;
974  double Likelihood=0;
975  for(int n=0; n<V; n++) {
976  netpixel* pix = pwc->getPixel(cid,n);
977  if(!pix->core) continue;
978 
979  if(pix->likelihood<zthr) continue;
980 
981  double sSNR=0;
982  for(int m=0; m<nifo; m++) {
983  sSNR += pow(pix->getdata('S',m),2); // snr whitened reconstructed signal 00
984  sSNR += pow(pix->getdata('P',m),2); // snr whitened reconstructed signal 90
985  }
986 
987  int iRATE = int(pix->rate+0.5);
988  int M=maxRate/iRATE;
989  int K=2*(maxLayers-1)/(pix->layers-1);
990  double dt = 1./pix->rate;
991  double itime = int(pix->time/pix->layers)/double(pix->rate); // central bin time
992  itime -= dt/2.; // begin bin time
993  int i=(itime-iminTime)*maxRate;
994  int j=pix->frequency*K;
995  Likelihood+=sSNR;
996 // sSNR /= M*K; // Normalization (watplot not use normalization !!!)
997 //sSNR = pix->likelihood; // Use original oriinal likelihood before WP
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);
1002 
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);
1005 
1006  double eT = heT->GetBinContent(i+1+m,j+1+k-K/2);
1007  //heT->SetBinContent(i+1+m,j+1+k-K/2,eT+M*M*L);
1008  heT->SetBinContent(i+1+m,j+1+k-K/2,eT+M);
1009 
1010  double eF = heF->GetBinContent(i+1+m,j+1+k-K/2);
1011  //heF->SetBinContent(i+1+m,j+1+k-K/2,eF+K*K*L);
1012  heF->SetBinContent(i+1+m,j+1+k-K/2,eF+K);
1013  }
1014  }
1015  npix++;
1016  }
1017  cout << "Likelihood : " << Likelihood << " npix : " << npix << endl;
1018 
1019  for(int i=0;i<=hL->GetNbinsX();i++) {
1020  for(int j=0;j<=hL->GetNbinsY();j++) {
1021 
1022  double L = hL->GetBinContent(i,j);
1023  if(L<=0) continue;
1024 
1025  double N = hN->GetBinContent(i,j);
1026 
1027  double eT = heT->GetBinContent(i,j);
1028  //heT->SetBinContent(i,j,mindt*sqrt(eT/L));
1029  //heT->SetBinContent(i,j,mindt);
1030  heT->SetBinContent(i,j,mindt*eT/N);
1031 
1032  double eF = heF->GetBinContent(i,j);
1033  //heF->SetBinContent(i,j,(mindf/2.)*sqrt(eF/L));
1034  //heF->SetBinContent(i,j,(mindf/2.));
1035  heF->SetBinContent(i,j,(mindf/2.)*eF/N);
1036  }
1037  }
1038 
1039  return;
1040 }
1041 
1042 void PlotHistogram(EBBH* ebbh, TH2F*& h2d) {
1043 
1044  if(!h2d) return;
1045 
1046  if(!canvas) canvas = new TCanvas;
1047  canvas->SetGridx();
1048  canvas->SetGridy();
1049  canvas->SetLogy();
1050 
1051  h2d->SetTitle(ebbh->name);
1052 
1053  h2d->GetYaxis()->SetRangeUser(FLOW,FHIGH);
1054 
1055  h2d->SetStats(kFALSE);
1056  h2d->SetTitleFont(12);
1057  h2d->SetFillColor(kWhite);
1058 
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);
1070 
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);
1077 
1078  h2d->GetZaxis()->SetTitleOffset(0.6);
1079  h2d->GetZaxis()->SetTitleFont(42);
1080  h2d->GetZaxis()->CenterTitle(true);
1081 
1082  h2d->GetXaxis()->SetLabelSize(0.03);
1083  h2d->GetYaxis()->SetLabelSize(0.03);
1084  h2d->GetZaxis()->SetLabelSize(0.03);
1085 
1086  h2d->Draw("colz");
1087  if(fchirp) fchirp->Draw("same");
1088 
1089  if(gPLOT) {canvas->Print(gOFILE);exit(0);}
1090 
1091  return;
1092 }
1093 
1094 double ChirpIntegralHistogram(EBBH* ebbh, TH2F*& h2d, double dMc) {
1095 
1096  if(!h2d) return;
1097 
1098  const double G = watconstants::GravitationalConstant();
1099  const double SM = watconstants::SolarMass();
1100  const double C = watconstants::SpeedOfLightInVacuo();
1101  const double Pi = TMath::Pi();
1102 
1103  double Mc = ebbh->ch_mass[0];
1104  //cout << "Estimated Mc : " << Mc << endl;
1105 
1106  Mc+=dMc;
1107 
1108  double p0 = 256.*Pi/5*pow(G*Mc*SM*Pi/C/C/C, 5./3);
1109  double p1 = ebbh->ch_tmerger[0];
1110 
1111  double xmin = h2d->GetXaxis()->GetXmin();
1112  double xmax = h2d->GetXaxis()->GetXmax();
1113  if(p1<xmax) xmax=p1;
1114  cout.precision(3);
1115  //cout << "xmin : " << xmin << " xmax : " << xmax << endl;
1116 
1117  // fit function -> freq = p0 * (time-p1);
1118  fchirp = new TF1("fchirp", "pow([0]*([1]-x),-3./8.)", xmin, xmax);
1119  fchirp->SetLineColor(kBlack);
1120  fchirp->SetLineWidth(3);
1121  fchirp->SetLineStyle(2);
1122  fchirp->SetParameter(0, p0);
1123  fchirp->SetParameter(1, p1);
1124 
1125  double dT = hL->GetXaxis()->GetBinWidth(0);
1126  double dF = hL->GetYaxis()->GetBinWidth(0);
1127  //cout << "dT = " << dT << " dF = " << dF << endl;
1128 
1129  double cenergy=0.;
1130  for(int i=1;i<=hL->GetNbinsX();i++) {
1131  double T = hL->GetXaxis()->GetBinCenter(i)+hL->GetXaxis()->GetBinWidth(i)/2.;
1132  double DF = fchirp->Eval(T)-fchirp->Eval(T-dT);
1133  for(int j=0;j<=hL->GetNbinsY();j++) {
1134 
1135  double L = hL->GetBinContent(i,j);
1136  if(L<=0) continue;
1137 
1138  double F = hL->GetYaxis()->GetBinCenter(j)+hL->GetYaxis()->GetBinWidth(j)/2.;
1139 
1140  //if(F-fchirp->Eval(T-dT)<DF && (F-fchirp->Eval(T-dT)>0)) hL->SetBinContent(i,j,0);
1141  if(F-fchirp->Eval(T-dT)<DF && (F-fchirp->Eval(T-dT)>0)) cenergy+=L;
1142  }
1143  }
1144 
1145  //cout << "CHIRP ENERGY : " << cenergy << endl;
1146 
1147  delete fchirp; fchirp=NULL;
1148 
1149  return cenergy;
1150 }
1151 
1153 
1155 
1156  if(wtype=="winj") wf = ebbh->winj[ifo]; // whiten injected waveforms
1157  if(wtype=="sinj") wf = ebbh->sinj[ifo]; // strain injected waveforms
1158  if(wtype=="wrec") wf = ebbh->wrec[ifo]; // whiten reconstructed waveforms
1159  if(wtype=="srec") wf = ebbh->srec[ifo]; // strain injected waveforms
1160  if(wtype=="wsim") wf = ebbh->wsim[0]; // simulated waveforms -> hp
1161 
1162  double start = wf.start();
1163  double imchirp = ebbh->ch_mass[0];
1164  //double tmerger = ebbh->ch_tmerger[0]-start;
1165  double tmerger = ebbh->ch_tmerger[0];
1166  cout << "mchirp - mchirp : " << imchirp << endl;
1167  cout << "mchirp - tmerger : " << tmerger << endl;
1168 
1169  //wf.start(0);
1170 
1171  // Get hp envelope
1173  MDC->SetZoom(0.999);
1174  MDC->Draw(wf,MDC_TIME,"ALP ZOOM",kGray);
1175  MDC->Draw(ewf,MDC_TIME,"same",kRed);
1176 
1177  watplot* pts = MDC->GetWatPlot();
1178  TGraph* gr = pts->getGraph(0);
1179  gr->SetTitle(ebbh->name);
1180 
1181  // Get wf instantaneous frequency
1183  //MDC->Draw(fwf,MDC_TIME,"ALP ZOOM",kBlack);return;
1184 
1185  // F -> F^-3/8
1186  double sF = 128;
1187  for(int i=0;i<fwf.size();i++) {
1188  fwf[i] = fwf[i]>FLOW ? pow(fwf[i]/sF,-8./3.) : 0;
1189  }
1190  //MDC->Draw(fwf,MDC_TIME,"ALP ZOOM",kBlack);return;
1191 
1192  const double G = watconstants::GravitationalConstant();
1193  const double SM = watconstants::SolarMass();
1194  const double C = watconstants::SpeedOfLightInVacuo();
1195  const double Pi = TMath::Pi();
1196 
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.);
1200  double MC = Mc;
1201  double mc = Mc;
1202  cout << "Mc " << Mc << endl;
1203  Mc *= SM;
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);
1206  // scaling of frequency: in units of 128Hz
1207  kk *= pow(sF, 8./3);
1208  K *= pow(sF, 8./3);
1209 
1210  wavearray<double> tt = fwf;
1211  wavearray<double> ff = fwf;
1212  tt=0;
1213  ff=0;
1214 
1215  double dt = 1./ff.rate();
1216  double Tc = tmerger;
1217  for(int i=0;i<ff.size();i++) {
1218  double T = ff.start()+i*dt;
1219  //double F = pow(Tc-K*T,-3./8.);
1220  double F = T<Tc ? pow(K*(Tc-T),-3./8.) : 0;
1221  //double F = pow(K*(T),-3./8.);
1222  if(F<0 || F>1000) F=0;
1223  F = F>0 ? pow(F,-8./3.) : 0;
1224  tt.data[i] = T;
1225  ff.data[i] = F;
1226  if(F>1) F=0;
1227  }
1228  //MDC->Draw(ff,MDC_TIME,"ALP",kBlack);return;
1229 
1230  // remove data where the waveform amplitude (ewf) is negligeable
1231  double emax=ewf.max();
1232  int SS = 0;
1233  for(int i=0;i<fwf.size();i++) {
1234  if(ewf[i]/emax<0.1) SS++; else break;
1235  }
1236  int EE=0;
1237  for(int i=fwf.size()-1;i>=0;i--) {
1238  if(ewf[i]/emax<0.2) EE++; else break;
1239  }
1240 
1241  // ff errors
1242  wavearray<double> eff = ff;
1243  //eff=1.e20;
1244  //for(int i=0;i<fwf.size();i++) eff[i] = ewf[i]/emax>0.01 ? 1./ewf[i] : 1.e20;
1245  eff=0;
1246 
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);
1256 
1257  TF1 *func = new TF1("func", "[0]*(x-[1])", 0.05,Tc);
1258  //func->FixParameter(0,-kk*pow(MC,1./0.6));
1259  //func->FixParameter(0,-kk*pow(imchirp,1./0.6));
1260  //func->FixParameter(1,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");
1265  canvas->SetGrid();
1266  grr->Draw("ALP");
1267  printf("Ordinary least squares:\n");
1268  grr->Fit(func);
1269  func->Draw("same");
1270 
1271  double mch = -func->GetParameter(0)/kk;
1272  double mchirp = mch>0 ? pow(mch, 0.6) : -pow(-mch, 0.6);
1273 
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;
1277 
1278 
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;
1283 
1284  return;
1285 }
1286 
1287 void GetCBC(EBBH* ebbh) {
1288 
1289  double To = 931072130;
1290 
1291  double Tc=ebbh->ch_tmerger[0];
1292 
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];
1295 
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]);
1298 
1299  double DIST=ebbh->dist;
1300 
1301  // ---------------------------------
1302  // set inspiral parms
1303  // ---------------------------------
1304  TString inspOptions="";
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 ";
1310 
1311  inspOptions+= "--waveform IMRPhenomBthreePointFivePN ";
1312  inspOptions+= "--l-distr random ";
1313  inspOptions+= "--i-distr uniform ";
1314 
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);
1318 
1319  inspOptions+= "--m-distr componentMass ";
1320  inspOptions+= "--enable-spin --aligned ";
1321 
1322  inspOptions+= TString::Format("--min-spin1 %f --max-spin1 %f ",S1,S1);
1323  inspOptions+= TString::Format("--min-spin2 %f --max-spin2 %f ",S2,S2);
1324 
1325  inspOptions+= "--amp-order 0 ";
1326  inspOptions+= "--d-distr volume ";
1327  inspOptions+= TString::Format("--min-distance %f --max-distance %f ",DIST,DIST);
1328  //inspOptions+= "--output inspirals.xml "; // set output xml file
1329 
1330  MDC->SetInspiral("IMRPhenomBthreePointFivePN",inspOptions.Data());
1331 
1332  // Get the first waveform hp,hx components starting from gps = 931072130
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;
1340 
1341  return;
1342 }
1343 
1344 void GetEBBH(EBBH* ebbh) {
1345 
1346  double To = ebbh->wrec[0].start();
1347 
1348  double Tc=ebbh->ch_tmerger[0];
1349 
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];
1352 
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]);
1355 
1356  double DIST=ebbh->dist;
1357 
1358  double E0 = ebbh->e0;
1359  double RP0 = ebbh->rp0>00 ? ebbh->rp0 : 14;
1360  double REDSHIFT = ebbh->redshift;
1361 
1362  // get ebbh parameters from input command line
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;
1365 
1366  int gps = To+Tc;
1367 
1368  vector<mdcpar> par;
1369  par.resize(1);
1370  par[0].name=ebbh_parms;
1371  MDC->AddWaveform(MDC_EBBH, par);
1372  MDC->Print(0);
1373 
1374  // Get the first waveform hp,hx components starting from gps = 931072130
1375 
1376  waveform wf = MDC->GetWaveform("eBBH");
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;
1384 
1385  return;
1386 }
char ofile[1024]
detectorParams getDetectorParams()
Definition: detector.cc:218
#define ZMAX_THR
Definition: ChirpMass.C:105
void FillHistogram(EBBH *ebbh, TH2F *&hN, TH2F *&hL, TH2F *&heT, TH2F *&heF, double zmax_thr=0.)
Definition: ChirpMass.C:885
Definition: mdc.hh:202
static const double C
Definition: GNGen.cc:28
int ChirpMass(TString ifroot, int gtype=0, int entry=0, int ifo=0, EBBH *xebbh=NULL)
Definition: ChirpMass.C:134
bool gPLOT
Definition: ChirpMass.C:115
static vector< TString > getFileListFromDir(TString dir_name, TString endString="", TString beginString="", TString containString="", bool fast=false)
Definition: Toolbox.cc:5108
double M
Definition: DrawEBHH.C:13
void Init()
Definition: ChirpMass.C:284
watplot * Draw(TString name, int id=0, TString polarization="hp", MDC_DRAW type=MDC_TIME, TString options="ALP", Color_t color=kBlack)
Definition: mdc.cc:2317
std::vector< wavearray< double > > wREC[MAX_TRIALS]
Definition: mdc.hh:219
double dist
Definition: ConvertGWGC.C:48
double fHigh
virtual void rate(double r)
Definition: wavearray.hh:141
void PlotHistogram(EBBH *ebbh, TH2F *&hH)
Definition: ChirpMass.C:1042
void Print(TString pname)
Definition: STFT.cc:315
std::vector< pixel > cluster
Definition: wavepath.hh:61
TString ptype[nPLOT]
Definition: cwb_mkfad.C:112
TH2F * hL
Definition: ChirpMass.C:125
float M2
double ChirpIntegralHistogram(EBBH *ebbh, TH2F *&h2d, double dMc)
Definition: ChirpMass.C:1094
TF1 * xfit[NCHIRP_MAX]
Definition: ChirpMass.C:129
wavearray< double > a(hp.size())
size_t frequency
Definition: netpixel.hh:111
float likelihood
Definition: netpixel.hh:114
par [0] name
#define B
int n
Definition: cwb_net.C:28
CWB::STFT * GetSTFT()
Definition: mdc.hh:435
Definition: mdc.hh:203
#define NCHIRP_MAX
Definition: ChirpMass.C:6
#define FHIGH
Definition: ChirpMass.C:91
TString("c")
float mchirp
Definition: netcluster.hh:84
float tmrgrerr
Definition: netcluster.hh:83
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
double SolarMass()
Definition: constants.hh:202
void PlotChirp(EBBH *ebbh, int mch_order, double &tmerger, double &xmin, double &xmax, EColor color)
Definition: ChirpMass.C:616
netpixel pix(nifo)
netcluster * pwc
Definition: cwb_job_obj.C:38
TString mdc[4]
std::vector< TGraph * > graph
Definition: watplot.hh:194
void PlotMultiChirp(EBBH *ebbh)
Definition: ChirpMass.C:583
wavearray< double > hp
Definition: mdc.hh:226
#define FLOW
Definition: ChirpMass.C:90
static wavearray< double > getHilbertIFrequency(wavearray< double > x)
Definition: Toolbox.cc:6935
waveform wf
float tmrgr
Definition: netcluster.hh:82
size_t layers
Definition: netpixel.hh:112
int m
Definition: cwb_net.C:28
std::vector< double > oSNR[NIFO_MAX]
std::vector< vector_int > cList
Definition: netcluster.hh:397
virtual void start(double s)
Definition: wavearray.hh:137
int j
Definition: cwb_net.C:28
canvas cd(1)
i drho i
double rate
Definition: netcluster.hh:378
TList * list
void Clear()
Definition: ChirpMass.C:306
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:4670
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
Definition: watplot.cc:150
TGraph * getGraph(int n)
Definition: watplot.hh:186
#define N
mdcid AddWaveform(MDC_TYPE mdc_type, vector< mdcpar > par, TString uname="")
Definition: mdc.cc:472
void Print(int level=0)
Definition: mdc.cc:2736
bool core
Definition: netpixel.hh:120
char ifo[NIFO_MAX][8]
TH2F * hist2D
Definition: watplot.hh:193
void PlotMultiChirp2(EBBH *ebbh, int ifo=0, TString ptype="", TString wtype="")
Definition: ChirpMass.C:748
Definition: mdc.hh:204
#define nIFO
TCanvas * canvas
Definition: ChirpMass.C:132
virtual size_t size() const
Definition: wavearray.hh:145
TCanvas * canvas
Definition: watplot.hh:192
TH2F * hN
Definition: ChirpMass.C:124
wavearray< double > freq
Definition: Regression_H1.C:79
x plot
int gENTRY
Definition: ChirpMass.C:114
Meyer< double > * S2
double G
Definition: DrawEBHH.C:12
void DrawMChirpInstantaneousFrequency(EBBH *ebbh, TString wtype, int ifo)
Definition: ChirpMass.C:1152
Definition: mdc.hh:248
TGraph * gr
TH2F * heT
Definition: ChirpMass.C:126
TGraphErrors * xgr[NCHIRP_MAX]
Definition: ChirpMass.C:130
watplot * WTS
Definition: ChirpMass.C:119
static const double SM
Definition: GNGen.cc:26
watplot * PCH
Definition: ChirpMass.C:120
i() int(T_cor *100))
double Pi
watplot p1(const_cast< char *>("TFMap1"))
const int NIFO_MAX
Definition: wat.hh:22
TH2D * GetHistogram()
Definition: STFT.hh:71
int ReadDataFromROOT(TString ifile, EBBH *ebbh)
Definition: ChirpMass.C:328
printf("total live time: non-zero lags = %10.1f \, liveTot)
float mchirp
TString gOFILE
Definition: ChirpMass.C:116
TString inspOptions
std::vector< double > iSNR[NIFO_MAX]
int k
CWB::mdc * MDC
Definition: ChirpMass.C:118
float spin[6]
static double A
Definition: geodesics.cc:26
void GetCBC(EBBH *ebbh)
Definition: ChirpMass.C:1287
float chi2chirp
Definition: netcluster.hh:86
TH2F * heF
Definition: ChirpMass.C:127
double F
size_t time
Definition: netpixel.hh:110
vector< mdcpar > par
double * entry
Definition: cwb_setcuts.C:224
TFile * ifile
void FindChirp(EBBH *ebbh, int mch_order, double &tmerger, double &xmin, double &xmax, int ifo, TString ptype, TString wtype)
Definition: ChirpMass.C:800
TFile * froot
netpixel * getPixel(size_t n, size_t i)
Definition: netcluster.hh:413
int npix
double dt
double GravitationalConstant()
Definition: constants.hh:131
#define RATE
#define CHI2_THR
Definition: ChirpMass.C:103
float mchirperr
Definition: netcluster.hh:85
int nifo
wavearray< double > hx
Definition: mdc.hh:227
char title[256]
Definition: SSeriesExample.C:1
double e0
Definition: RescaleEBBH.C:17
void PlotMChirp(EBBH *ebbh)
Definition: ChirpMass.C:689
double gps
void PlotCluster(watplot *WTS, netcluster *pwc, double fLow, double fHigh)
Definition: ChirpMass.C:560
watplot * GetWatPlot()
Definition: mdc.hh:436
double T
Definition: testWDM_4.C:11
TGraphErrors chirp
chirp fit parameters (don&#39;t remove ! fix crash when exit from CINT)
Definition: netcluster.hh:93
double fLow
EBBH * ebbh
Definition: LoopChirpMass.C:24
int gTYPE
Definition: ChirpMass.C:113
char Name[16]
Definition: detector.hh:327
double fabs(const Complex &x)
Definition: numpy.cc:55
TF1 * fchirp
Definition: ChirpMass.C:122
waveform GetWaveform(int ID, int id=0)
Definition: mdc.cc:2541
vector< TString > fList
Definition: LoopChirpMass.C:28
float M1
wavearray< double > GetDifWaveform(wavearray< double > *wf1, wavearray< double > *wf2)
Definition: ChirpMass.C:518
virtual DataType_t max() const
Definition: wavearray.cc:1334
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void SetZoom(double epzoom=EPZOOM)
Definition: mdc.hh:431
TTree * itree
DataType_t * data
Definition: wavearray.hh:319
double * itime
double dFreq
Definition: DrawPSD.C:17
static wavearray< double > getHilbertEnvelope(wavearray< double > x)
Definition: Toolbox.cc:6915
double dT
Definition: testWDM_5.C:12
float mass[2]
wavearray< double > wINJ[NIFO_MAX]
float rate
Definition: netpixel.hh:113
double getdata(char type='R', size_t n=0)
Definition: netpixel.hh:74
#define TMERGER_CUT
Definition: ChirpMass.C:104
double GetFitParameter(double mchirp)
Definition: ChirpMass.C:544
char fName[256]
wavearray< double > GetAlignedWaveform(wavearray< double > *wf, wavearray< double > *wref)
Definition: ChirpMass.C:491
double rp0
Definition: RescaleEBBH.C:16
void GetEBBH(EBBH *ebbh)
Definition: ChirpMass.C:1344
double GetTimeBoundaries(wavearray< double > x, double P, double &bT, double &eT)
Definition: ChirpMass.C:459
Definition: mdc.hh:159
CWB::STFT * stft
Definition: ChirpMass.C:121
exit(0)
double SpeedOfLightInVacuo()
Definition: constants.hh:114
bool setdata(double a, char type='R', size_t n=0)
Definition: netpixel.hh:58
double avr