Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_ChirpMass.C
Go to the documentation of this file.
1 #define XIFO 4
2 
3 #pragma GCC system_header
4 
5 #include "cwb.hh"
6 #include "config.hh"
7 #include "network.hh"
8 #include "wavearray.hh"
9 #include "TString.h"
10 #include "TObjArray.h"
11 #include "TObjString.h"
12 #include "TRandom.h"
13 #include "TComplex.h"
14 #include "TGraphAsymmErrors.h"
15 #include "TMath.h"
16 #include "mdc.hh"
17 #include "cwb2G.hh"
18 #include "watplot.hh"
19 #include "gwavearray.hh"
20 #include "network.hh"
21 #include <fstream>
22 #include <vector>
23 
24 
25 // ---------------------------------------------------------------------------------
26 // DEFINES
27 // ---------------------------------------------------------------------------------
28 
29 #define NCHIRP_MAX 4
30 
31 #define CHI2_THR -2.5 // if negative the chirp pixels are tagged with pix->likelihood=0 after the selection
32 #define TMERGER_CUT 0.1
33 #define ZMAX_THR 0.2
34 
35 #define DUMP_WAVE false // dump rec/inj/wht waveforms to output root file
36 #define DUMP_CLUSTER false // dump pixel cluster to output root file
37 
38 // ---------------------------------------------------------------------------------
39 // USER CONFIG OPTIONS
40 // ---------------------------------------------------------------------------------
41 
42 struct uoptions {
43  float chi2_thr;
44  float tmerger_cut;
45  float zmax_thr;
46 
47  bool dump_wave;
48  bool dump_cluster;
49 };
50 
51 // ---------------------------------------------------------------------------------
52 // FUNCTIONS
53 // ---------------------------------------------------------------------------------
54 
56 
57 void SetOutputFile(network* NET, netevent* &EVT, CWB::config* cfg, bool dump_ebbh);
58 void DumpOutputFile(network* NET, netevent* &EVT, CWB::config* cfg, int ID, int k, int factor);
59 
60 std::vector<netpixel> GetCluster(network* NET, CWB::config* cfg, int lag, int id);
61 
62 void SetEventWindow(CWB::config* cfg, double gps);
63 
65 double GetTimeBoundaries(wavearray<double> x, double P, double& bT, double& eT);
66 double GetFrequencyBoundaries(wavearray<double> x, double P, double& bF, double& eF);
68 
69 std::vector<netpixel> DoPCA(network* NET, CWB::config* cfg, int lag, int id);
70 void ResetPCA(network* NET, CWB::config* cfg, netcluster* pwc, std::vector<netpixel>* vPIX, int ID);
71 
72 std::vector<wavearray<double> > GetInjWaveform(network* NET, netevent* EVT, int id, double factor);
73 std::vector<wavearray<double> > GetRecWaveform(network* NET, netevent* EVT, int id);
74 
75 wavearray<double> GetWaveform(int ifoId, network* NET, int lag, int id, char type, bool shift=true);
76 
80 
82  wavearray<double>* wf2, wavearray<double>* wf3, wavearray<double>* wref, bool fft=false,TString pdir="", double P=0.99);
83 
84 void GetEccentricityIndex(network* NET, int lag, int id);
85 
87 void PrintUserOptions();
88 
89 // ----------------------------------------------------
90 // ROOT Output EBBH Parameters
91 // ----------------------------------------------------
92 
93 struct EBBH { // structure for output for estimated parameters
94 
95  int nch; // number of analyzed chirp
96  float ei; // eccentricity index
97  float ch_mass[NCHIRP_MAX]; // chirp mass
98  float ch_tmerger[NCHIRP_MAX]; // merger time
99  float ch_merr[NCHIRP_MAX]; // mchirp error
100  float ch_mchi2[NCHIRP_MAX]; // mchirp chi2
101  float ch_energy[NCHIRP_MAX]; // chirp energy
102 
103  wavearray<double>* wDAT[NIFO_MAX]; // whitened data (in the vREC time range)
104  wavearray<double>* wINJ[NIFO_MAX]; // whiten injected waveforms
105  wavearray<double>* sINJ[NIFO_MAX]; // strain injected waveforms
106  wavearray<double>* wREC[NIFO_MAX]; // whiten injected waveforms
107  wavearray<double>* sREC[NIFO_MAX]; // strain injected waveforms
108 
109  double segGPS; // segment start time
110  float cRATE; // netcluste::rate param
111 
112  std::vector<netpixel> *pCLUSTER; // netcluster
113 };
114 
115 // ---------------------------------------------------------------------------------
116 // Global Variables
117 // ---------------------------------------------------------------------------------
118 
119 uoptions gOPT; // global User Options
120 
121 EBBH gEBBH; // global output for estimated parameters
122 TTree* gTREE; // output tree file name
123 TString gOUTPUT; // output root file name
125 
126 wavearray<double> gHOT[NIFO_MAX]; // HoT time series used to save whitened data
127 
128 double gINRATE; // input data sampling rate
129 int gRATEANA; // analysis data rate
130 
131 wavearray<double> gwDAT[NIFO_MAX]; // whitened data (in the vREC time range)
132 wavearray<double> gwINJ[NIFO_MAX]; // whiten injected waveforms
133 wavearray<double> gsINJ[NIFO_MAX]; // strain injected waveforms
134 wavearray<double> gwREC[NIFO_MAX]; // whiten injected waveforms
135 wavearray<double> gsREC[NIFO_MAX]; // strain injected waveforms
136 
137 double gSEGGPS; // segment start time
138 float gCRATE; // netcluster::rate
139 std::vector<netpixel> gCLUSTER; // netcluster
140 
141 void
143 //!MISCELLANEA
144 // Plugin used for eBBH Parameter Estimation
145 
146  if(type==CWB_PLUGIN_CONFIG) {
147  cwb2G* gCWB2G; IMPORT(cwb2G*,gCWB2G)
148 
149  if(gCWB2G->istage!=CWB_STAGE_FULL) {cout<< "CWB_Plugin_ChirpMass - Error : EBBH can be executed only in CWB_STAGE_FULL mode" << endl;exit(1);}
150 
151  ReadUserOptions(cfg); // user config options : read from parPlugin
152 
153  if(cfg->pattern<=0) {
154  cout << "CWB_Plugin_ChirpMass Error : EBBH enable only with pattern>0 !!!" << endl;
155  exit(1);
156  }
157  cfg->outPlugin=true; // disable built-in output root file
158  gINRATE=cfg->inRate; // input data sampling rate
159  gRATEANA=gCWB2G->rateANA; // analysis data rate
160 
161  gEBBH.ei = 1.e-20;
162  gEBBH.nch = NCHIRP_MAX;
163  for(int i=0;i<NCHIRP_MAX;i++) {
164  gEBBH.ch_mass[i] = 0;
165  gEBBH.ch_tmerger[i] = 0;
166  gEBBH.ch_merr[i] = 0;
167  gEBBH.ch_mchi2[i] = 0;
168  gEBBH.ch_energy[i] = 0;
169  }
170  }
171 
172  if(type==CWB_PLUGIN_NETWORK) {
173  PrintUserOptions(); // print config options
174  }
175 
177  // save whitened HoT
178  int ifoID =0; for(int n=0;n<cfg->nIFO;n++) if(ifo==NET->getifo(n)->Name) {ifoID=n;break;}
179  gHOT[ifoID] = *x;
180  }
181 
182  if(type==CWB_PLUGIN_OLIKELIHOOD) { // AFTER EVENT RECONSTRUCTION
183 
184  // import trials
185  int gLRETRY=-1; IMPORT(int,gLRETRY)
186 
187  // import ifactor
188  int gIFACTOR=-1; IMPORT(int,gIFACTOR)
189  double factor = cfg->simulation==3||cfg->simulation==4 ? -gIFACTOR : cfg->factors[gIFACTOR];
190  double ofactor=0;
191  if(cfg->simulation==4) ofactor=-gIFACTOR;
192  else if(cfg->simulation==3) ofactor=-gIFACTOR;
193  else ofactor=factor;
194 
195  int nIFO = NET->ifoListSize(); // number of detectors
196  int K = NET->nLag; // number of time lag
197  int rate = 0; // select all resolutions
198  netevent* EVT;
200 
201  SetOutputFile(NET, EVT, cfg, false); // set output root file
202 
203  for(int k=0; k<K; k++) { // loop over the lags
204 
205  id = NET->getwc(k)->get(const_cast<char*>("ID"), 0, 'L', rate);
206 
207  for(int j=0; j<(int)id.size(); j++) { // loop over cluster index
208 
209  int ID = size_t(id.data[j]+0.5);
210 
211  if(NET->getwc(k)->sCuts[ID-1]!=-1) continue; // skip rejected/processed clusters
212 
213  EVT->output2G(NULL,NET,ID,k,ofactor); // get reconstructed parameters
214 
215  // print event parameters
216  cout << endl;
217  cout << "event parameters : ID -> " << ID << endl;
218  for(int n=0;n<nIFO;n++) printf("rec_time %s : %.4f\n",NET->ifoName[n], EVT->time[n]);
219  cout << "rec_theta : " << EVT->theta[0] << " rec_phi : " << EVT->phi[0] << endl;
220  cout << "SNRnet : " << sqrt(EVT->likelihood) << " netcc[0] : " << EVT->netcc[0]
221  << " rho[0] : " << EVT->rho[0] << " size : " << EVT->size[0] << endl;
222 
223  gSEGGPS = EVT->gps[0]; // segment start time
224 
225  // get waveforms
226  if(cfg->simulation) {
227  std::vector<wavearray<double> > vINJ; // injected
228  vINJ = GetInjWaveform(NET, EVT, ID, factor); // get injected waveform
229  if(vINJ.size()!=nIFO) {
230  cout << "CWB_Plugin_ChirpMass Error : Injection Waveform Not Found !!!" << endl;
231  exit(1);
232  }
233  for(int n=0;n<nIFO;n++) gwINJ[n] = vINJ[n];
234  }
235  for(int n=0;n<nIFO;n++) {
236  gwREC[n] = GetWaveform(n, NET, k, ID, 'S'); // get whiten reconstructed waveform
237  gsREC[n] = GetWaveform(n, NET, k, ID, 's'); // get strain reconstructed waveform
238  gwDAT[n] = GetAlignedWaveform(&gHOT[n], &gwREC[n]); // get whitened data (in the vREC time range)
239  }
240  gCRATE = NET->getwc(k)->rate;
241  gCLUSTER = GetCluster(NET, cfg, k, ID); // get netcluster
242 
243  GetEccentricityIndex(NET, k, ID); // get eccentricity index
244 
245  SetOutputFile(NET, EVT, cfg, true); // set output root file
246  DumpOutputFile(NET, EVT, cfg, ID, k, ofactor); // dump event to output root file
247 
248  for(int n=0;n<nIFO;n++) {
249  detector* pD = NET->getifo(n);
250  if(!cfg->simulation) ClearWaveforms(pD); // release waveform memory
251  }
252  }
253  }
254 
255  jfile->cd();
256  if(EVT) delete EVT;
257 
258  while(!gCLUSTER.empty()) gCLUSTER.pop_back();
259  gCLUSTER.clear(); std::vector<netpixel>().swap(gCLUSTER);
260  }
261 
262  return;
263 }
264 
265 std::vector<netpixel> DoPCA(network* NET, CWB::config* cfg, int lag, int id) {
266 
267  double ee;
268 
269  size_t nIFO = NET->ifoList.size();
270 
271  float En = 2*NET->acor*NET->acor*nIFO; // network energy threshold in the sky loop
272 
273  int size = NET->a_00.size();
274  int f_ = NIFO/4;
275 
276  netpixel* pix;
277  netcluster* pwc = NET->getwc(lag);
278  std::vector<netpixel> vPIX;
279 
280  std::vector<int> pI = NET->wdmMRA.getXTalk(pwc, id, false); // buffer for pixel IDs
281  int V = pI.size();
282  if(V>cfg->BATCH) return vPIX; // attach TD amp to pixels < V
283 
284  wavearray<float> xi(size); xi=0; // PC 00 array
285  wavearray<float> XI(size); XI=0; // PC 90 array
286 
287  __m128* _xi = (__m128*) xi.data; // set pointer to PC 00 array
288  __m128* _XI = (__m128*) XI.data; // set pointer to PC 90 array
289 
290  __m128* _aa = (__m128*) NET->a_00.data; // set pointer to 00 array
291  __m128* _AA = (__m128*) NET->a_90.data; // set pointer to 90 array
292 
293  int nPC = 0;
294  for(int j=0; j<V; j++) {
295  int jf = j*f_; // source sse pointer increment
296  _sse_zero_ps(_xi+jf); // zero MRA amplitudes
297  _sse_zero_ps(_XI+jf); // zero MRA amplitudes
298  ee = _sse_abs_ps(_aa+jf,_AA+jf); // total pixel energy / quadrature
299  if(ee>En) nPC++; else ee=0.; // count core pixels
300  NET->rNRG.data[j] = ee; // init residual energy array
301  NET->pNRG.data[j] = NET->rNRG.data[j]; // init residual energy array
302  }
303 
304  nPC = NET->_sse_mra_ps(xi.data,XI.data,En,nPC); // get principal components
305 
306  for(int j=0; j<V; j++) { // loop over principal components
307  pix = pwc->getPixel(id,pI[j]);
308  vPIX.push_back(*pix); // save original pixels
309  pix->core = false;
310  ee = NET->pNRG.data[j]; // total pixel energy
311  if(ee<En) continue;
312  pix->core = true;
313  for(int i=0; i<nIFO; i++) {
314  pix->setdata(double(xi.data[j*NIFO+i]),'S',i); // store 00 whitened response PC
315  pix->setdata(double(XI.data[j*NIFO+i]),'P',i); // store 90 whitened response PC
316  }
317  }
318 
319  return vPIX;
320 }
321 
322 void ResetPCA(network* NET, CWB::config* cfg, netcluster* pwc, std::vector<netpixel>* vPIX, int ID) {
323 
324  std::vector<int> pI = NET->wdmMRA.getXTalk(pwc, ID, false); // buffer for pixel IDs
325  int V = pI.size();
326  if(V>cfg->BATCH) return; // attach TD amp to pixels < V
327  for(int j=0; j<V; j++) {
328  netpixel* pix = pwc->getPixel(ID,pI[j]);
329  *pix = (*vPIX)[j];
330  }
331 
332  while(!vPIX->empty()) vPIX->pop_back();
333  vPIX->clear(); std::vector<netpixel>().swap(*vPIX);
334 }
335 
336 std::vector<wavearray<double> > GetInjWaveform(network* NET, netevent* EVT, int ID, double factor) {
337 
338  std::vector<wavearray<double> > xINJ; // injected
339 
340  int nIFO = NET->ifoListSize(); // number of detectors
341 
342  double recTime = EVT->time[0]; // rec event time det=0
343 
344  injection INJ(nIFO);
345  // get inj ID
346  int M = NET->mdc__IDSize();
347  double injTime = 1.e12;
348  int injID = -1;
349  for(int m=0; m<M; m++) {
350  int mdcID = NET->getmdc__ID(m);
351  double T = fabs(recTime - NET->getmdcTime(mdcID));
352  if(T<injTime && INJ.fill_in(NET,mdcID)) {
353  injTime = T;
354  injID = mdcID;
355  }
356  }
357 
358  if(INJ.fill_in(NET,injID)) { // get inj parameters
359 
360  wavearray<double>** pwfINJ = new wavearray<double>*[nIFO];
361 
362  // extract whitened injected & reconstructed waveforms
363  for(int n=0; n<nIFO; n++) {
364 
365  detector* pd = NET->getifo(n);
366 
367  pwfINJ[n] = INJ.pwf[n];
368  if (pwfINJ[n]==NULL) {
369  cout << "CWB_Plugin_ChirpMass.C : Error : Injected waveform not saved !!! : detector "
370  << NET->ifoName[n] << endl;
371  continue;
372  }
373 
374  double rFactor = 1.;
375  rFactor *= factor>0 ? factor : 1;
376  wavearray<double>* wf = pwfINJ[n];
377  *wf*=rFactor; // injected wf is multiplied by the custom factor
378  xINJ.push_back(*wf);
379  *wf*=1./rFactor; // restore injected amplitude
380  }
381  delete [] pwfINJ;
382  }
383 
384  return xINJ;
385 }
386 
387 std::vector<wavearray<double> > GetRecWaveform(network* NET, netevent* EVT, int ID) {
388 
389  std::vector<wavearray<double> > xREC; // reconstructed
390 
391  int nIFO = NET->ifoListSize(); // number of detectors
392 
393  wavearray<double>** pwfREC = new wavearray<double>*[nIFO];
394  for(int n=0; n<nIFO; n++) {
395 
396  detector* pd = NET->getifo(n);
397  int idSize = pd->RWFID.size();
398  int wfIndex=-1;
399  for(int mm=0; mm<idSize; mm++) if (pd->RWFID[mm]==ID) wfIndex=mm;
400 
401  if(wfIndex<0) {
402  cout << "CWB_Plugin_ChirpMass.C : Error : Reconstructed waveform not saved !!! : ID -> "
403  << ID << " : detector " << NET->ifoName[n] << endl;
404  continue;
405  }
406  if(wfIndex>=0) pwfREC[n] = pd->RWFP[wfIndex];
407 
408  wavearray<double>* wf = pwfREC[n];
409  xREC.push_back(*wf);
410  }
411  delete [] pwfREC;
412 
413  return xREC;
414 }
415 
416 wavearray<double> GetWaveform(int ifoId, network* NET, int lag, int id, char type, bool shift) {
417 
418  if(type!='S' && type!='s' && type!='W' && type!='w' && type!='N' && type!='n') {
419  cout << "GetWaveform : not valid type : Abort" << endl; exit(1);
420  }
421 
422  netcluster* pwc = NET->getwc(lag);
423  detector* pd = NET->getifo(ifoId);
425 
426  if(type=='S' || type=='s') {
427  NET->getMRAwave(id,lag,type,0,shift); // reconstruct whitened/strain shifted pd->waveForm
428  wf = &pd->waveForm;
429  wf->start(pwc->start+pd->waveForm.start());
430  }
431 
432  if(type=='W' || type=='w') {
433  NET->getMRAwave(id,lag,type,0,shift); // reconstruct+noise whitened shifted pd->waveBand
434  wf = &pd->waveBand;
435  wf->start(pwc->start+pd->waveBand.start());
436  }
437 
438  if(type=='N' || type=='n') {
439  NET->getMRAwave(id,lag,'W',0,shift); // reconstruct+noise whitened shifted pd->waveBand
440  NET->getMRAwave(id,lag,'S',0,shift); // reconstruct whitened shifted pd->waveForm
441  pd->waveNull = pd->waveBand;
442  pd->waveNull-= pd->waveForm;
443  wf = &pd->waveNull;
444  wf->start(pwc->start+pd->waveNull.start());
445  }
446 
447  return *wf;
448 }
449 
451  wavearray<double>* wf2, wavearray<double>* wf3, wavearray<double>* wref, bool fft, TString pdir, double P) {
452 
453  watplot PTS(const_cast<char*>("ptspe"),200,20,800,500);
454 
455  //cout << "Print " << ofname << endl;
456  double tmin=1.e20;
457  if(wref==NULL) return;
458  if(wf1==NULL) return;
459  else tmin=wf1->start();
460  if(wf2!=NULL) if(wf2->start()<tmin) tmin=wf2->start();
461  if(wf3!=NULL) if(wf3->start()<tmin) tmin=wf3->start();
462 
463  wf1->start(wf1->start()-tmin);
464  if(wf2!=NULL) if(wf2!=wf1) wf2->start(wf2->start()-tmin);
465  if(wf3!=NULL) if(wf3!=wf1 && wf3!=wf2) wf3->start(wf3->start()-tmin);
466  if(wref!=wf1 && wref!=wf2 && wref!=wf3) wref->start(wref->start()-tmin);
467 
468  if(fft) {
469  PTS.plot(wf1, const_cast<char*>("AL"), kRed, 0, 0, true, cfg->fLow, cfg->fHigh);
470  } else {
471  double bT, eT;
472  GetTimeBoundaries(*wref, P, bT, eT);
473  PTS.plot(wf1, const_cast<char*>("AL"), kRed, bT, eT);
474  PTS.graph[0]->GetXaxis()->SetRangeUser(bT, eT);
475  }
476  PTS.graph[0]->SetLineWidth(1);
477  PTS.graph[0]->SetTitle(title);
478 
479  TString xtitle = TString::Format("Time (sec) : GPS OFFSET = %.3f",tmin);
480  PTS.graph[0]->GetXaxis()->SetTitle(xtitle);
481 
482  if(wf2!=NULL) {
483  if(fft) {
484  if(wf2!=NULL) PTS.plot(wf2, const_cast<char*>("SAME"), kBlue, 0, 0, true, cfg->fLow, cfg->fHigh);
485  } else {
486  if(wf2!=NULL) PTS.plot(wf2, const_cast<char*>("SAME"), kBlue, 0, 0);
487  }
488  if(wf2!=NULL) PTS.graph[1]->SetLineWidth(1);
489  }
490 
491  if(wf3!=NULL) {
492  if(fft) {
493  if(wf3!=NULL) PTS.plot(wf3, const_cast<char*>("SAME"), kGreen+2, 0, 0, true, cfg->fLow, cfg->fHigh);
494  } else {
495  if(wf3!=NULL) PTS.plot(wf3, const_cast<char*>("SAME"), kGreen+2, 0, 0);
496  }
497  if(wf3!=NULL) PTS.graph[2]->SetLineWidth(1);
498  }
499 
500  wf1->start(wf1->start()+tmin);
501  if(wf2!=NULL) if(wf2!=wf1) wf2->start(wf2->start()+tmin);
502  if(wf3!=NULL) if(wf3!=wf1 && wf3!=wf2) wf3->start(wf3->start()+tmin);
503  if(wref!=wf1 && wref!=wf2 && wref!=wf3) wref->start(wref->start()+tmin);
504 
505  if(fft) {
506  PTS.canvas->SetLogx();
507  PTS.canvas->SetLogy();
508  }
509 
510  if(ofname!="") {
511  ofname = TString(pdir)+TString("/")+ofname;
512  PTS.canvas->Print(ofname);
513  cout << "write : " << ofname << endl;
514  }
515 }
516 
518 
519  double R=wf1->rate();
520 
521  double b_wf1 = wf1->start();
522  double e_wf1 = wf1->start()+wf1->size()/R;
523  double b_wf2 = wf2->start();
524  double e_wf2 = wf2->start()+wf2->size()/R;
525 
526  int o_wf1 = b_wf1>b_wf2 ? 0 : int((b_wf2-b_wf1)*R+0.5);
527  int o_wf2 = b_wf1<b_wf2 ? 0 : int((b_wf1-b_wf2)*R+0.5);
528 
529  double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
530  double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
531  int sizeXCOR = int((endXCOR-startXCOR)*R+0.5);
532 
533  wavearray<double> wfdif(sizeXCOR);
534  wfdif=0.;
535  wfdif.rate(R);
536  wfdif.start(b_wf1+double(o_wf1)/R);
537 
538  for(int i=0;i<sizeXCOR;i++) wfdif[i] = wf1->data[i+o_wf1] - wf2->data[i+o_wf2];
539 
540  return wfdif;
541 }
542 
543 void SetOutputFile(network* NET, netevent* &EVT, CWB::config* cfg, bool dump_ebbh) {
544 
545  // import slagShift
546  float* gSLAGSHIFT=NULL; IMPORT(float*,gSLAGSHIFT)
547 
548  int nIFO = NET->ifoListSize(); // number of detectors
549 
550  // search output root file in the system list
551  TFile* froot = NULL;
552  TList *files = (TList*)gROOT->GetListOfFiles();
553  gOUTPUT="";
554  if (files) {
555  TIter next(files);
556  TSystemFile *file;
557  TString fname;
558  bool check=false;
559  while ((file=(TSystemFile*)next())) {
560  fname = file->GetName();
561  // set output root file as the current file
562  if(fname.Contains("wave_")) {
563  froot=(TFile*)file;froot->cd();
564  gOUTPUT=fname;
565  gOUTPUT.ReplaceAll(".root.tmp",".txt");
566  //cout << "output file name : " << fname << endl;
567  }
568  }
569  if(!froot) {
570  cout << "CWB_Plugin_ChirpMass.C : Error - output root file not found" << endl;
571  gSystem->Exit(1);
572  }
573  } else {
574  cout << "CWB_Plugin_ChirpMass.C : Error - output root file not found" << endl;
575  gSystem->Exit(1);
576  }
577 
578  gTREE = (TTree *) froot->Get("waveburst");
579  if(gTREE!=NULL) {
580  EVT = new netevent(gTREE,nIFO);
581  } else {
582  EVT = new netevent(nIFO);
583  gTREE = EVT->setTree();
584  }
585  EVT->setSLags(gSLAGSHIFT); // set slags into netevent
586  EVT->Psave=cfg->Psave;
587 
588  static bool ebbh_tree_init = false;
589  if(dump_ebbh) {
590 
591  gEBBH.segGPS = gSEGGPS;
592  if(gOPT.dump_wave) {
593  if(cfg->simulation) for(int n=0;n<nIFO;n++) gEBBH.wINJ[n] = &gwINJ[n];
594  for(int n=0;n<nIFO;n++) gEBBH.wDAT[n] = &gwDAT[n];
595  for(int n=0;n<nIFO;n++) gEBBH.wREC[n] = &gwREC[n];
596  for(int n=0;n<nIFO;n++) gEBBH.sREC[n] = &gsREC[n];
597  }
598  if(gOPT.dump_cluster) {
599  gEBBH.cRATE = gCRATE;
600  gEBBH.pCLUSTER = &gCLUSTER;
601  }
602 
603  if(!ebbh_tree_init) {
604 
605  ebbh_tree_init = true;
606 
607  gTREE->Branch("ebbh_ei", &gEBBH.ei,"ebbh_ei/F");
608  gTREE->Branch("ebbh_nch",&gEBBH.nch,"ebbh_nch/I");
609 
610  gTREE->Branch("ebbh_ch_mass", gEBBH.ch_mass,TString::Format("ebbh_ch_mass[%i]/F",NCHIRP_MAX));
611  gTREE->Branch("ebbh_ch_tmerger",gEBBH.ch_tmerger,TString::Format("ebbh_ch_tmerger[%i]/F",NCHIRP_MAX));
612  gTREE->Branch("ebbh_ch_merr", gEBBH.ch_merr,TString::Format("ebbh_ch_merr[%i]/F",NCHIRP_MAX));
613  gTREE->Branch("ebbh_ch_mchi2", gEBBH.ch_mchi2,TString::Format("ebbh_ch_mchi2[%i]/F",NCHIRP_MAX));
614  gTREE->Branch("ebbh_ch_energy", gEBBH.ch_energy,TString::Format("ebbh_ch_energy[%i]/F",NCHIRP_MAX));
615 
616  gTREE->Branch("ebbh_seggps",&gEBBH.segGPS,"ebbh_seggps/D");
617  if(gOPT.dump_wave) {
618  for(int n=0;n<nIFO;n++) {
619  if(cfg->simulation) gTREE->Branch(TString::Format("ebbh_wINJ_%d",n).Data(),"wavearray<double>",&gEBBH.wINJ[n],32000,0);
620  gTREE->Branch(TString::Format("ebbh_wDAT_%d",n).Data(),"wavearray<double>",&gEBBH.wDAT[n],32000,0);
621  gTREE->Branch(TString::Format("ebbh_wREC_%d",n).Data(),"wavearray<double>",&gEBBH.wREC[n],32000,0);
622  gTREE->Branch(TString::Format("ebbh_sREC_%d",n).Data(),"wavearray<double>",&gEBBH.sREC[n],32000,0);
623  }
624  }
625  if(gOPT.dump_cluster) {
626  gTREE->Branch("ebbh_crate",&gEBBH.cRATE,"ebbh_crate/F");
627  gTREE->Branch("ebbh_cluster","vector<netpixel>",&gEBBH.pCLUSTER,32000,0);
628  }
629 
630  } else {
631 
632  gTREE->SetBranchAddress("ebbh_ei", &gEBBH.ei);
633  gTREE->SetBranchAddress("ebbh_nch",&gEBBH.nch);
634 
635  gTREE->SetBranchAddress("ebbh_ch_mass", gEBBH.ch_mass);
636  gTREE->SetBranchAddress("ebbh_ch_tmerger",gEBBH.ch_tmerger);
637  gTREE->SetBranchAddress("ebbh_ch_merr", gEBBH.ch_merr);
638  gTREE->SetBranchAddress("ebbh_ch_mchi2", gEBBH.ch_mchi2);
639  gTREE->SetBranchAddress("ebbh_ch_energy", gEBBH.ch_energy);
640 
641  gTREE->SetBranchAddress("ebbh_seggps",&gEBBH.segGPS);
642  if(gOPT.dump_wave) {
643  for(int n=0;n<nIFO;n++) {
644  if(cfg->simulation) gTREE->SetBranchAddress(TString::Format("ebbh_wINJ_%d",n).Data(),&gEBBH.wINJ[n]);
645  gTREE->SetBranchAddress(TString::Format("ebbh_wDAT_%d",n).Data(),&gEBBH.wDAT[n]);
646  gTREE->SetBranchAddress(TString::Format("ebbh_wREC_%d",n).Data(),&gEBBH.wREC[n]);
647  gTREE->SetBranchAddress(TString::Format("ebbh_sREC_%d",n).Data(),&gEBBH.sREC[n]);
648  }
649  }
650  if(gOPT.dump_cluster) {
651  gTREE->SetBranchAddress("ebbh_crate",&gEBBH.cRATE);
652  gTREE->SetBranchAddress("ebbh_cluster",&gEBBH.pCLUSTER);
653  }
654  }
655  }
656 }
657 
659 
660  if(cfg->dump) EVT->dopen(gOUTPUT.Data(),const_cast<char*>("a"),false);
661  EVT->output2G(gTREE,NET,ID,k,factor); // get reconstructed parameters
662  if(cfg->dump) EVT->dclose();
663  if(!cfg->cedDump) NET->getwc(k)->sCuts[ID-1]=1; // mark as processed
664 }
665 
667 
668  wavearray<double> wf = *wf2;
669  wf=0;
670 
671  if(wf1==NULL) return wf;
672  if(wf1->size()==0) return wf;
673 
674  double R=wf1->rate();
675 
676  double b_wf1 = wf1->start();
677  double e_wf1 = wf1->start()+wf1->size()/R;
678  double b_wf2 = wf2->start();
679  double e_wf2 = wf2->start()+wf2->size()/R;
680 
681  int o_wf1 = b_wf1>b_wf2 ? 0 : int((b_wf2-b_wf1)*R+0.5);
682  int o_wf2 = b_wf1<b_wf2 ? 0 : int((b_wf1-b_wf2)*R+0.5);
683 
684  double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
685  double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
686  int sizeXCOR = int((endXCOR-startXCOR)*R+0.5);
687 
688  for(int i=0;i<sizeXCOR;i++) wf[i+o_wf2] = wf1->data[i+o_wf1];
689 
690  return wf;
691 }
692 
694 
695  double a;
696  double E=0.,T=0.;
697  int size=(int)x.size();
698  double rate=x.rate();
699  for(int j=0;j<size;j++) {
700  a = x[j];
701  T += a*a*j/rate; // central time
702  E += a*a; // energy
703  }
704  T = E>0 ? T/E : 0.5*size/rate;
705 
706  return T;
707 }
708 
709 double GetTimeBoundaries(wavearray<double> x, double P, double& bT, double& eT) {
710 
711  if(P<0) P=0;
712  if(P>1) P=1;
713 
714  int N = x.size();
715 
716  double E = 0; // signal energy
717  double avr = 0; // average
718  for(int i=0;i<N;i++) {avr+=i*x[i]*x[i]; E+=x[i]*x[i];}
719  int M=int(avr/E); // central index
720 
721  // search range which contains percentage P of the total energy E
722  int jB=0;
723  int jE=N-1;
724  double a,b;
725  double sum = ((M>=0)&&(M<N)) ? x[M]*x[M] : 0.;
726  for(int j=1; j<N; j++) {
727  a = ((M-j>=0)&&(M-j<N)) ? x[M-j] : 0.;
728  b = ((M+j>=0)&&(M+j<N)) ? x[M+j] : 0.;
729  if(a) jB=M-j;
730  if(b) jE=M+j;
731  sum += a*a+b*b;
732  if(sum/E > P) break;
733  }
734 
735  bT = x.start()+jB/x.rate();
736  eT = x.start()+jE/x.rate();
737 
738  return eT-bT;
739 }
740 
742 
743  double a;
744  double E=0.,F=0.;
745  int size=(int)x.size();
746  double rate=x.rate();
747  x.FFTW(1);
748  double dF=(rate/(double)size)/2.;
749  for(int j=0;j<size/2;j+=2) {
750  a = x[j]*x[j]+x[j+1]*x[j+1];
751  F += a*j*dF; // central frequency
752  E += a; // energy
753  }
754  F = E>0 ? F/E : 0.5*rate;
755 
756  return F;
757 }
758 
759 double GetFrequencyBoundaries(wavearray<double> x, double P, double& bF, double& eF) {
760 
761  if(P<0) P=0;
762  if(P>1) P=1;
763 
764  int N = x.size();
765 
766  x.FFTW(1);
767 
768  double E = 0; // signal energy
769  double avr = 0; // average
770  for(int i=0;i<N;i++) {avr+=i*x[i]*x[i]; E+=x[i]*x[i];}
771  int M=int(avr/E); // central index
772 
773  // search range which contains percentage P of the total energy E
774  int jB=0;
775  int jE=N-1;
776  double a,b;
777  double sum = ((M>=0)&&(M<N)) ? x[M]*x[M] : 0.;
778  for(int j=1; j<N; j++) {
779  a = ((M-j>=0)&&(M-j<N)) ? x[M-j] : 0.;
780  b = ((M+j>=0)&&(M+j<N)) ? x[M+j] : 0.;
781  if(a) jB=M-j;
782  if(b) jE=M+j;
783  sum += a*a+b*b;
784  if(sum/E > P) break;
785  }
786 
787  double dF=(x.rate()/(double)x.size())/2.;
788 
789  bF = jB*dF;
790  eF = jE*dF;
791 
792  return eF-bF;
793 }
794 
795 void
797 
798  int n;
799 
800  n = ifo->IWFP.size();
801  for (int i=0;i<n;i++) {
803  delete wf;
804  }
805  ifo->IWFP.clear();
806  ifo->IWFID.clear();
807 
808  n = ifo->RWFP.size();
809  for (int i=0;i<n;i++) {
811  delete wf;
812  }
813  ifo->RWFP.clear();
814  ifo->RWFID.clear();
815 }
816 
818 
819  wavearray<double> wf = *wf1;
820 
821  if(wf1==NULL) return wf;
822  if(wf1->size()==0) return wf;
823 
824  double R=wf1->rate();
825 
826  double b_wf1 = wf1->start();
827  double e_wf1 = wf1->start()+wf1->size()/R;
828  double b_wf2 = wf2->start();
829  double e_wf2 = wf2->start()+wf2->size()/R;
830 
831  int o_wf1 = b_wf1>b_wf2 ? 0 : int((b_wf2-b_wf1)*R+0.5);
832  int o_wf2 = b_wf1<b_wf2 ? 0 : int((b_wf1-b_wf2)*R+0.5);
833 
834  double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
835  double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
836  int sizeXCOR = int((endXCOR-startXCOR)*R+0.5);
837 
838  for(int i=0;i<sizeXCOR;i++) wf[i+o_wf1] += wf2->data[i+o_wf2];
839 
840  return wf;
841 }
842 
844 
845  if(gps<0) return;
846 
847  // dq file list
848  // {ifo, dqcat_file, dqcat[0/1/2], shift[sec], inverse[false/true], 4columns[true/false]}
849 
850  for(int n=0; n<cfg->nIFO; n++) {
851 
852  strcpy(cfg->DQF[cfg->nDQF].ifo, cfg->ifo[n]);
853  sprintf(cfg->DQF[cfg->nDQF].file, "%s/%s_%s.gps_%d",cfg->tmp_dir,cfg->ifo[n],cfg->data_label,int(gps));
854  cfg->DQF[cfg->nDQF].cat = CWB_CAT2;
855  cfg->DQF[cfg->nDQF].shift = 0.;
856  cfg->DQF[cfg->nDQF].invert = false;
857  cfg->DQF[cfg->nDQF].c4 = true;
858  cfg->nDQF++;
859 
860  cout << cfg->DQF[cfg->nDQF-1].file << endl;
861 
862  ofstream out;
863  out.open(cfg->DQF[cfg->nDQF-1].file,ios::out);
864  cout << "Write file : " << cfg->DQF[cfg->nDQF-1].file << endl;
865  if (!out.good()) {cout << "Error Opening File : " << cfg->DQF[cfg->nDQF-1].file << endl;exit(1);}
866  out.precision(14);
867  int istart = int(gps)-cfg->iwindow;
868  int istop = int(gps)+cfg->iwindow;
869  out << "1 " << istart << " " << istop << " " << 2*cfg->iwindow << endl;
870  out.close();
871  }
872 }
873 
874 std::vector<netpixel> GetCluster(network* NET, CWB::config* cfg, int lag, int id) {
875 
876  netpixel* pix;
877  netcluster* pwc = NET->getwc(lag);
878  std::vector<netpixel> vPIX;
879 
880  std::vector<int> pI = NET->wdmMRA.getXTalk(pwc, id, false); // buffer for pixel IDs
881 
882  int V = pI.size();
883  for(int j=0; j<V; j++) { // loop over principal components
884  pix = pwc->getPixel(id,pI[j]);
885  vPIX.push_back(*pix); // save original pixels
886  }
887 
888  return vPIX;
889 }
890 
891 void GetEccentricityIndex(network* NET, int lag, int id) {
892 
893  netcluster* pwc = NET->getwc(lag);
894 
895  double chi2_thr = gOPT.chi2_thr;
896  double tmerger_cut = gOPT.tmerger_cut;
897  double zmax_thr = gOPT.zmax_thr;
898 
899  clusterdata CD = pwc->cData[id-1]; // save loudest chirp
900 
901  for(int i=0;i<NCHIRP_MAX;i++) {
902 
903  double echirp = pwc->mchirp(id,chi2_thr,tmerger_cut,zmax_thr);
904 
905  clusterdata* pcd = &(pwc->cData[id-1]);
906  TF1* fit = &(pcd->fit);
907 
908  gEBBH.ch_mass[i] = pcd->mchirp;
909  gEBBH.ch_tmerger[i] = -fit->GetParameter(1)/fit->GetParameter(0);
910  gEBBH.ch_merr[i] = pcd->mchirperr;
911  gEBBH.ch_mchi2[i] = pcd->chi2chirp;
912  gEBBH.ch_energy[i] = echirp;
913  }
914 
915  // compute the eccentrycity index
916  int imax=0;
917  float emax=0;
918  // find chirp with max energy
919  for(int i=0;i<NCHIRP_MAX;i++) if(gEBBH.ch_energy[i]>emax) {emax=gEBBH.ch_energy[i];imax=i;}
920  int imax2=imax;
921  // find chirp with highest chirp mass and energy > (max chirp energy)/4
922  for(int i=0;i<NCHIRP_MAX;i++) {
923  if(i==imax) continue;
924  if(gEBBH.ch_mass[i]>0) {
925  if(gEBBH.ch_mass[i]>gEBBH.ch_mass[imax]) if(gEBBH.ch_energy[i]>gEBBH.ch_energy[imax]/4.) imax2=i;
926  }
927  }
928  imax=imax2;
929  gEBBH.ei=0;
930  for(int i=0;i<NCHIRP_MAX;i++) {
931  if(gEBBH.ch_mass[i]>0) {
932  if(gEBBH.ch_mass[i]<gEBBH.ch_mass[imax]) gEBBH.ei+=gEBBH.ch_energy[i];
933  if(gEBBH.ch_mass[i]>gEBBH.ch_mass[imax]) gEBBH.ei-=gEBBH.ch_energy[i];
934  }
935  }
936  gEBBH.ei/=gEBBH.ch_energy[imax];
937  gEBBH.ei*=100;
938 
939  cout << endl;
940  cout << "---------------------------------------------------" << endl;
941  for(int i=0;i<NCHIRP_MAX;i++) cout << "mchirp " << i << " -> " << gEBBH.ch_mass[i] << "\t\t echirp -> " << gEBBH.ch_energy[i] << endl;
942  cout << "Eccentricity Index : " << gEBBH.ei << endl;
943  cout << "---------------------------------------------------" << endl;
944  cout << endl;
945 
946  pwc->cData[id-1] = CD; // restore loudest chirp
947 }
948 
950 
951  TString options = cfg->parPlugin;
952 
953  gOPT.chi2_thr = CHI2_THR;
954  gOPT.tmerger_cut = TMERGER_CUT;
955  gOPT.zmax_thr = ZMAX_THR;
956 
957  gOPT.dump_wave = DUMP_WAVE;
958  gOPT.dump_cluster = DUMP_CLUSTER;
959 
960  if(options.CompareTo("")!=0) {
961  cout << options << endl;
962  if(!options.Contains("--")) { // parameters are used only by cwb_inet
963 
964  TObjArray* token = TString(options).Tokenize(TString(' '));
965  for(int j=0;j<token->GetEntries();j++){
966 
967  TObjString* tok = (TObjString*)token->At(j);
968  TString stok = tok->GetString();
969 
970  if(stok.Contains("ebbh_chi2_thr=")) {
971  TString ebbh_chi2_thr=stok;
972  ebbh_chi2_thr.Remove(0,ebbh_chi2_thr.Last('=')+1);
973  if(ebbh_chi2_thr.IsFloat()) gOPT.chi2_thr=ebbh_chi2_thr.Atof();
974  }
975 
976  if(stok.Contains("ebbh_tmerger_cut=")) {
977  TString ebbh_tmerger_cut=stok;
978  ebbh_tmerger_cut.Remove(0,ebbh_tmerger_cut.Last('=')+1);
979  if(ebbh_tmerger_cut.IsFloat()) gOPT.tmerger_cut=ebbh_tmerger_cut.Atof();
980  }
981 
982  if(stok.Contains("ebbh_zmax_thr=")) {
983  TString ebbh_zmax_thr=stok;
984  ebbh_zmax_thr.Remove(0,ebbh_zmax_thr.Last('=')+1);
985  if(ebbh_zmax_thr.IsFloat()) gOPT.zmax_thr=ebbh_zmax_thr.Atof();
986  }
987 
988  if(stok.Contains("ebbh_dump_wave=")) {
989  TString opt=stok;
990  opt.Remove(0,opt.Last('=')+1);
991  if(opt=="false") gOPT.dump_wave=false;
992  if(opt=="true") gOPT.dump_wave=true;
993  }
994 
995  if(stok.Contains("ebbh_dump_cluster=")) {
996  TString opt=stok;
997  opt.Remove(0,opt.Last('=')+1);
998  if(opt=="false") gOPT.dump_cluster=false;
999  if(opt=="true") gOPT.dump_cluster=true;
1000  }
1001  }
1002  }
1003  }
1004 }
1005 
1007 
1008  cout << "-----------------------------------------" << endl;
1009  cout << "eBBH Plugin config options" << endl;
1010  cout << "-----------------------------------------" << endl << endl;
1011  cout << endl;
1012  cout << "chi2_thr : " << gOPT.chi2_thr << endl;
1013  cout << "tmerger_cut : " << gOPT.tmerger_cut << endl;
1014  cout << "zmax_thr : " << gOPT.zmax_thr << endl;
1015  cout << "dump_wave : " << gOPT.dump_wave << endl;
1016  cout << "dump_cluster : " << gOPT.dump_cluster << endl;
1017  cout << endl;
1018 
1019 }
1020 
double GetTimeBoundaries(wavearray< double > x, double P, double &bT, double &eT)
monster wdmMRA
list of pixel pointers for MRA
Definition: network.hh:633
wavearray< double > gwREC[NIFO_MAX]
std::vector< char * > ifoName
Definition: network.hh:591
detector * getifo(size_t n)
param: detector index
Definition: network.hh:418
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
size_t rateANA
Definition: cwb.hh:267
static float _sse_abs_ps(__m128 *_a)
Definition: watsse.hh:119
void PlotWaveform(TString ofname, TString title, CWB::config *cfg, wavearray< double > *wf1, wavearray< double > *wf2, wavearray< double > *wf3, wavearray< double > *wref, bool fft=false, TString pdir="", double P=0.99)
double iwindow
Definition: config.hh:182
virtual size_t size() const
Definition: wavearray.hh:127
wavearray< double > GetAlignedWaveform(wavearray< double > *wf1, wavearray< double > *wf2)
#define NIFO
Definition: wat.hh:56
size_t nLag
Definition: network.hh:555
Float_t * rho
biased null statistics
Definition: netevent.hh:93
char xtitle[1024]
std::vector< netpixel > gCLUSTER
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *NET, WSeries< double > *x, TString ifo, int type)
std::vector< wavearray< double > > GetRecWaveform(network *NET, netevent *EVT, int id)
#define ZMAX_THR
std::vector< wavearray< double > > wREC[MAX_TRIALS]
void setSLags(float *slag)
Definition: netevent.cc:404
printf("total live time: non-zero lags = %10.1f \n", liveTot)
std::vector< double > * getmdcTime()
Definition: network.hh:404
wavearray< double > GetDifWaveform(wavearray< double > *wf1, wavearray< double > *wf2)
virtual void rate(double r)
Definition: wavearray.hh:123
wavearray< double > a(hp.size())
int n
Definition: cwb_net.C:10
static void _sse_zero_ps(__m128 *_p)
Definition: watsse.hh:26
bool invert
Definition: Toolbox.hh:70
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
wavearray< float > a_90
buffer for cluster sky 00 amplitude
Definition: network.hh:635
TTree * setTree()
Definition: netevent.cc:412
TString("c")
char ifo[32]
Definition: Toolbox.hh:66
int ID
Definition: TestMDC.C:70
Int_t * size
cluster volume
Definition: netevent.hh:61
float gCRATE
float mchirp
Definition: netcluster.hh:66
double gINRATE
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<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t 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
wavearray< double > get(char *name, size_t index=0, char atype='R', int type=1, bool=true)
param: string with parameter name param: index in the amplitude array, which define detector param: c...
Definition: netcluster.cc:2188
std::vector< wavearray< double > * > RWFP
Definition: detector.hh:364
bool c4
Definition: Toolbox.hh:71
int _sse_mra_ps(float *, float *, float, int)
Definition: network.hh:1258
double fLow
Definition: config.hh:122
double gSEGGPS
#define CHI2_THR
int pattern
Definition: config.hh:223
netpixel pix(nifo)
netcluster * pwc
Definition: cwb_job_obj.C:20
std::vector< TGraph * > graph
Definition: watplot.hh:176
CWB_STAGE istage
Definition: cwb.hh:235
bool cedDump
Definition: config.hh:279
TRandom3 P
Definition: compare_bkg.C:296
void ResetPCA(network *NET, CWB::config *cfg, netcluster *pwc, std::vector< netpixel > *vPIX, int ID)
dqfile DQF[DQF_MAX]
Definition: config.hh:331
std::vector< wavearray< double > > vINJ
wavearray< double > gsREC[NIFO_MAX]
waveform wf
Long_t size
WSeries< double > waveBand
Definition: detector.hh:338
#define M
Definition: UniqSLagsList.C:3
int m
Definition: cwb_net.C:10
virtual void start(double s)
Definition: wavearray.hh:119
int j
Definition: cwb_net.C:10
bool getMRAwave(size_t ID, size_t lag, char atype='S', int mode=0, bool tof=false)
Definition: network.cc:3635
i drho i
double rate
Definition: netcluster.hh:360
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:132
std::vector< detector * > ifoList
Definition: network.hh:590
#define N
bool outPlugin
Definition: config.hh:351
bool core
Definition: netpixel.hh:102
char ifo[NIFO_MAX][8]
void dopen(const char *fname, char *mode, bool header=true)
Definition: netevent.hh:291
Definition: cwb2G.hh:15
TTree * gTREE
size_t ifoListSize()
Definition: network.hh:413
std::vector< wavearray< double > > GetInjWaveform(network *NET, netevent *EVT, int id, double factor)
int Psave
Definition: config.hh:175
wavearray< double > AddWaveforms(wavearray< double > *wf1, wavearray< double > *wf2)
#define nIFO
ofstream out
Definition: cwb_merge.C:196
CWB_CAT cat
Definition: Toolbox.hh:68
wavearray< float > pNRG
buffers for cluster residual energy
Definition: network.hh:637
void PrintUserOptions()
double GetFrequencyBoundaries(wavearray< double > x, double P, double &bF, double &eF)
TCanvas * canvas
Definition: watplot.hh:174
double factor
wavearray< double > gwINJ[NIFO_MAX]
char file[1024]
Definition: Toolbox.hh:67
cwb gCWB
jfile
Definition: cwb_job_obj.C:25
void output2G(TTree *, network *, size_t, int, double)
Definition: netevent.cc:687
wavearray< double > gwDAT[NIFO_MAX]
TString gOUTPUT
std::vector< netpixel > DoPCA(network *NET, CWB::config *cfg, int lag, int id)
void ClearWaveforms(detector *ifo)
Int_t Psave
number of detectors
Definition: netevent.hh:48
int simulation
Definition: config.hh:181
int nDQF
Definition: config.hh:330
#define IMPORT(TYPE, VAR)
Definition: cwb.hh:51
xtalk getXTalk(int nLay1, size_t indx1, int nLay2, size_t indx2)
param: numbers of layers identifying the resolution of the first pixel param: TF map index of the fir...
Definition: monster.cc:351
Double_t * gps
average center_of_gravity time
Definition: netevent.hh:76
i() int(T_cor *100))
void DumpOutputFile(network *NET, netevent *&EVT, CWB::config *cfg, int ID, int k, int factor)
network NET
Definition: cwb_dump_inj.C:12
const int NIFO_MAX
Definition: wat.hh:4
int BATCH
Definition: config.hh:227
char tmp_dir[1024]
Definition: config.hh:307
char parPlugin[1024]
Definition: config.hh:345
wavearray< float > a_00
wdm multi-resolution analysis
Definition: network.hh:634
void SetEventWindow(CWB::config *cfg, double gps)
int gIFACTOR
double start
Definition: netcluster.hh:361
TIter next(twave->GetListOfBranches())
char fname[1024]
wavearray< double > gsINJ[NIFO_MAX]
double shift
Definition: Toolbox.hh:69
std::vector< int > RWFID
Definition: detector.hh:363
size_t mdc__IDSize()
Definition: network.hh:396
int gRATEANA
int k
uoptions gOPT
Float_t * netcc
effective correlated SNR
Definition: netevent.hh:94
std::vector< wavearray< double > * > IWFP
Definition: detector.hh:361
double mchirp(int ID, double=2.5, double=1.e20, double=0)
Definition: netcluster.cc:1405
TObjArray * token
float chi2chirp
Definition: netcluster.hh:68
double acor
Definition: network.hh:567
double F
std::vector< int > IWFID
Definition: detector.hh:360
wavearray< double > gHOT[NIFO_MAX]
double GetCentralFrequency(wavearray< double > x)
#define TMERGER_CUT
std::vector< netpixel > GetCluster(network *NET, CWB::config *cfg, int lag, int id)
wavearray< double > sINJ[NIFO_MAX]
double GetCentralTime(wavearray< double > x)
TFile * froot
netpixel * getPixel(size_t n, size_t i)
Definition: netcluster.hh:395
virtual void FFTW(int=1)
Definition: wavearray.cc:878
#define NCHIRP_MAX
void ReadUserOptions(CWB::config *cfg)
char options[256]
#define DUMP_CLUSTER
float mchirperr
Definition: netcluster.hh:67
void GetEccentricityIndex(network *NET, int lag, int id)
char title[256]
Definition: SSeriesExample.C:1
Float_t * phi
sqrt(h+*h+ + hx*hx)
Definition: netevent.hh:68
double gps
netevent EVT(itree, nifo)
Float_t * theta
[0]-reconstructed, [1]-injected phi angle, [2]-RA
Definition: netevent.hh:69
Double_t * time
beam pattern coefficients for hx
Definition: netevent.hh:75
double T
Definition: testWDM_4.C:11
std::vector< int > sCuts
Definition: netcluster.hh:374
WSeries< double > waveForm
Definition: detector.hh:337
void dclose()
Definition: netevent.hh:300
#define DUMP_WAVE
double fHigh
Definition: config.hh:123
char Name[16]
Definition: detector.hh:309
char ifo[NIFO_MAX][8]
Definition: config.hh:106
double fabs(const Complex &x)
Definition: numpy.cc:37
string file
Definition: cwb_online.py:385
wavearray< double > GetWaveform(int ifoId, network *NET, int lag, int id, char type, bool shift=true)
strcpy(RunLabel, RUN_LABEL)
Float_t likelihood
Definition: netevent.hh:105
netcluster * getwc(size_t n)
param: delay index
Definition: network.hh:421
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
std::vector< clusterdata > cData
Definition: netcluster.hh:373
int nIFO
Definition: config.hh:102
Definition: cwb.hh:119
DataType_t * data
Definition: wavearray.hh:301
wavearray< float > rNRG
buffer for cluster sky 90 amplitudes
Definition: network.hh:636
Long_t id
double factors[FACTORS_MAX]
Definition: config.hh:184
wavearray< double > wINJ[NIFO_MAX]
void SetOutputFile(network *NET, netevent *&EVT, CWB::config *cfg, bool dump_ebbh)
char data_label[1024]
Definition: config.hh:314
Bool_t fill_in(network *, int, bool=true)
Definition: injection.cc:325
list files
Definition: cwb_online.py:529
WSeries< double > waveNull
Definition: detector.hh:339
size_t getmdc__ID(size_t n)
Definition: network.hh:408
double shift[NIFO_MAX]
wavearray< double > ** pwf
[x1,y1,z1,x2,y2,z2] components of spin vector
Definition: injection.hh:82
int check
size_t inRate
Definition: config.hh:114
detector ** pD
EBBH gEBBH
exit(0)
bool setdata(double a, char type='R', size_t n=0)
Definition: netpixel.hh:40
double avr
bool dump
Definition: config.hh:277