Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_Template.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 "TMath.h"
15 #include "TSystem.h"
16 #include "mdc.hh"
17 #include "WDM.hh"
18 #include "regression.hh"
19 #include "frame.hh"
20 #include "watplot.hh"
21 #include "Biorthogonal.hh"
22 #include <fstream>
23 #include <vector>
24 
25 
26 using namespace CWB;
27 
28 //______________________________________________________________________________
29 void
31 
32 // Plugin Template
33 //
34 //
35 // jfile - pointer to job file
36 // this file is used by pipeline to store temporary informations like noise,mdc data
37 //
38 // cfg - pointer to the user configuration setup (see config.hh file)
39 // it can be used to read or change setting
40 //
41 // net - pointer to network object (see network.hh file)
42 // this is the class which perform tha main anaalysis
43 // this object contains the detector definitions
44 //
45 // x - this arrays contains the ifo noise or mdc data (see wseries.hh/wavearray.hh files)
46 //
47 // ifo - detector name (Ex: L1,H1,V1)
48 //
49 // type - is the stage of the cwb analysis
50 // this is the list of stage types
51 //
52 // CWB_PLUGIN_CONFIG = 0
53 // CWB_PLUGIN_NETWORK = 1
54 // CWB_PLUGIN_INIT_JOB = 9
55 // CWB_PLUGIN_DATA = 2
56 // CWB_PLUGIN_MDC = 3
57 // CWB_PLUGIN_RMDC = 11
58 // CWB_PLUGIN_OREADDATA = 14
59 // CWB_PLUGIN_IDATA_CONDITIONING = 4
60 // CWB_PLUGIN_DATA_CONDITIONING = 15
61 // CWB_PLUGIN_ODATA_CONDITIONING = 5
62 // CWB_PLUGIN_ICOHERENCE = 6
63 // CWB_PLUGIN_XCOHERENCE = 16
64 // CWB_PLUGIN_OCOHERENCE = 13
65 // CWB_PLUGIN_ISUPERCLUSTER = 7
66 // CWB_PLUGIN_OSUPERCLUSTER = 17
67 // CWB_PLUGIN_ILIKELIHOOD = 12
68 // CWB_PLUGIN_OLIKELIHOOD = 8
69 // CWB_PLUGIN_CLOSE_JOB = 10
70 //
71 
72 
73  cout << endl;
74  cout << "-----> CWB_Plugin_Template.C : " << ifo.Data() << endl;
75  cout << endl;
76 
77  if(type==CWB_PLUGIN_CONFIG) {
78  //
79  // at this stage the config contains the configuration
80  // user can read or change the configuration parameters
81  //
82  // jfile : NULL
83  // cfg : configured
84  // net : not configured
85  // x : NULL
86  // ifo : ""
87  //
88  // Examples
89  //
90  // cfg->Print(); // print configuration
91  // cfg->bpp = 0.0001; // change probability for black pixel selection
92  }
93 
94  if(type==CWB_PLUGIN_NETWORK) {
95  //
96  // at this stage the network object has been created
97  // Ex: user can read/change the detectors objects
98  //
99  // jfile : NULL
100  // cfg : configured
101  // net : configured
102  // x : NULL
103  // ifo : ""
104  //
105  // Examples
106  //
107  // CWB_Plugin_SGW.C : Set Scalar Gravitational Wave Model
108  }
109 
110  if(type==CWB_PLUGIN_INIT_JOB) {
111  //
112  // at this stage the data quality list has been read
113  // the job segment is computed according the DQ and run ID
114  // this stage is performed for each detector, ifo parameter
115  //
116  // jfile : NULL
117  // cfg : configured
118  // net : configured
119  // x : is the pointer to a dummy wavearray
120  // used only to get x.rate(),x.start(),x.size()
121  // ifo : ifo label (L1,H1,V1,...)
122  //
123  }
124 
125  if(type==CWB_PLUGIN_DATA) {
126  //
127  // at this stage the detector strain has been read and stored in x array
128  // user can modify or inject its own noise (Ex: on the fly noise)
129  // user can read/change noise data (Ex: Calibration)
130  //
131  // jfile : opened in update mode
132  // When noise is read it is stored to job file :
133  // TDirectoryFile* strain
134  // KEY: wavearray<double> L1;1
135  // KEY: wavearray<double> H1;1
136  // KEY: wavearray<double> V1;1
137  //
138  // cfg : configured
139  // net : configured
140  // x : is the pointer to noise data wavearray of detector ifo
141  // ifo : ifo label (L1,H1,V1,...)
142  //
143  // Examples
144  //
145  // CWB_Plugin_SimNoise.C : generate simulated gaussian noise
146  //
147  // for(int i=0;i<x->size();i++) x->data[i]=0; // access to ifo noise data array
148  }
149 
150  if(type==CWB_PLUGIN_MDC) {
151  //
152  // at this stage the mdc has been read and stored in x array
153  // user can modify or inject its own mdc (Ex: on the fly mdc)
154  //
155  // jfile : opened in update mode
156  // When mdc is read it is stored to job file :
157  // TDirectoryFile* mdc
158  // KEY: wavearray<double> L1;1
159  // KEY: wavearray<double> H1;1
160  // KEY: wavearray<double> V1;1
161  //
162  // cfg : configured
163  // net : configured
164  // x : is the pointer to MDC data wavearray of detector ifo
165  // ifo : ifo label (L1,H1,V1,...)
166  //
167  // Examples
168  //
169  // CWB_Plugin_MDC_OTF.C : injected MDC 'on the fly'
170  //
171  // for(int i=0;i<x->size();i++) x->data[i]=0; // access to mdc ifo data array
172  }
173 
174  if(type==CWB_PLUGIN_RMDC) {
175  //
176  // at this stage the mdc has been read and stored in x array
177  // user can modify or inject its own mdc (Ex: on the fly mdc)
178  //
179  // jfile : opened in update mode
180  // job file contains :
181  // TDirectoryFile* strain
182  // KEY: wavearray<double> L1;1
183  // KEY: wavearray<double> H1;1
184  // KEY: wavearray<double> V1;1
185  // TDirectoryFile* mdc
186  // KEY: wavearray<double> L1;1
187  // KEY: wavearray<double> H1;1
188  // KEY: wavearray<double> V1;1
189  //
190  // cfg : configured
191  // net : configured
192  // x : is the pointer to MDC data wavearray of detector ifo
193  // ifo : ifo label (L1,H1,V1,...)
194  //
195  }
196 
197  if(type==CWB_PLUGIN_OREADDATA) {
198  //
199  // at this stage the mdc has been read
200  // this plugin is called only if simulation=2
201  // when simulation=2 (fixed input SNR) the MDC are rescaled to snr network = 1
202  // user can modify or inject its own mdc (Ex: on the fly mdc)
203  //
204  // jfile : opened in update mode
205  // job file contains :
206  // TDirectoryFile* strain
207  // KEY: wavearray<double> L1;1
208  // KEY: wavearray<double> H1;1
209  // KEY: wavearray<double> V1;1
210  // TDirectoryFile* mdc
211  // KEY: wavearray<double> L1;1
212  // KEY: wavearray<double> H1;1
213  // KEY: wavearray<double> V1;1
214  //
215  // cfg : configured
216  // net : configured
217  // - MDC rescaled to snr network = 1 : stored in net->getifo(ifoID)->HoT
218  // x : NULL
219  // ifo : ""
220  //
221  // Examples
222  //
223  // CWB_Plugin_SNR.C : compute and save the mdc SNR
224  }
225 
227  //
228  // called at the begining of DATA_CONDITIONING stage
229  // at this stage the rescaled mdc is added to noise data and stored in x array
230  //
231  // jfile : opened in update mode
232  // job file contains :
233  // TDirectoryFile* strain
234  // KEY: wavearray<double> L1;1
235  // KEY: wavearray<double> H1;1
236  // KEY: wavearray<double> V1;1
237  // TDirectoryFile* mdc
238  // KEY: wavearray<double> L1;1
239  // KEY: wavearray<double> H1;1
240  // KEY: wavearray<double> V1;1
241  //
242  // if analysis is done in 2 stages job file contains also :
243  // TDirectoryFile* waveform
244  // TDirectoryFile* waveform-f0
245  // KEY: detector L1;1
246  // KEY: detector H1;1
247  // KEY: detector V1;1
248  //
249  // cfg : configured
250  // net : configured
251  // x : is the pointer to MDC+noise data wavearray of detector ifo
252  // ifo : ifo label (L1,H1,V1,...)
253  //
254  // Examples
255  //
256  // CWB_Plugin_MakeScalogram.C : produce scalograms of input data
257  }
258 
259  if(type==CWB_PLUGIN_DATA_CONDITIONING) {
260  //
261  // at this stage the rescaled mdc is added to noise data and stored in x array
262  // this stage is executed only if cfg.dcPlugin=true
263  // if cfg.dcPlugin=true : user can apply data conditioning (Ex: regression analysis)
264  //
265  // jfile : opened in update mode
266  // job file contains :
267  // TDirectoryFile* strain
268  // KEY: wavearray<double> L1;1
269  // KEY: wavearray<double> H1;1
270  // KEY: wavearray<double> V1;1
271  // TDirectoryFile* mdc
272  // KEY: wavearray<double> L1;1
273  // KEY: wavearray<double> H1;1
274  // KEY: wavearray<double> V1;1
275  //
276  // cfg : configured
277  // net : configured
278  // x : is the pointer to MDC+noise data wavearray of detector ifo
279  // ifo : ifo label (L1,H1,V1,...)
280  //
281  // Examples
282  //
283  // CWB_Plugin_DataConditioning.C : shows how to implement a custom Data Conditioning
284  }
285 
287  //
288  // called at the end of DATA_CONDITIONING stage
289  // at this stage the noise+mdc data is whitened and stored in x array
290  // Ex : user can monitor if whitened is correct
291  //
292  // jfile : opened in update mode
293  // job file contains :
294  // TDirectoryFile* strain
295  // KEY: wavearray<double> L1;1
296  // KEY: wavearray<double> H1;1
297  // KEY: wavearray<double> V1;1
298  // TDirectoryFile* mdc
299  // KEY: wavearray<double> L1;1
300  // KEY: wavearray<double> H1;1
301  // KEY: wavearray<double> V1;1
302  //
303  // if analysis is done in 2 stages job file contains also :
304  // TDirectoryFile* waveform
305  // TDirectoryFile* waveform-f0
306  // KEY: detector L1;1
307  // KEY: detector H1;1
308  // KEY: detector V1;1
309  // .. for each factor
310  //
311  // cfg : configured
312  // net : configured
313  // x : is the pointer to MDC+noise whitened data wavearray of detector ifo
314  // ifo : ifo label (L1,H1,V1,...)
315  //
316  // Examples
317  //
318  // CWB_Plugin_WDM_freqCuts.C : Implements the 2G frequency cuts after the whitening
319  // CWB_Plugin_MakeWhiteFrame.C : produces frames of whitened data
320  }
321 
322  if(type==CWB_PLUGIN_ICOHERENCE) {
323  //
324  // called at the begining of COHERENCE stage
325  // at this stage the noise+mdc data is whitened and stored in x array
326  // Ex : user can monitor if whitened is correct
327  //
328  // jfile : opened in update mode
329  //
330  // if analysis is done in 2 stages job file contains also :
331  // TDirectoryFile* waveform
332  //
333  // cfg : configured
334  // net : configured
335  // x : NULL
336  // ifo : factor index
337  //
338  }
339 
340  if(type==CWB_PLUGIN_XCOHERENCE) {
341  //
342  // called at the inside the resolution level loop in the COHERENCE stage
343  //
344  // to get the factor the variable gIFACTOR must be imported
345  // int gIFACTOR=-1; IMPORT(int,gIFACTOR)
346  // to get the resolution level the variable gILEVEL must be imported
347  // size_t gILEVEL=-1; IMPORT(size_t,gILEVEL)
348  //
349  // at this stage the max energy TF has been computed
350  // max energy TF are stored in net->getifo(ifoID)->getTFmap()
351  // Ex : user can monitor the max energy TF
352  //
353  // jfile : opened in update mode
354  // TDirectoryFile* coherence
355  // OBJ: TTree clusters-cycle:0
356  //
357  // if analysis is done in 2 stages job file contains also :
358  // TDirectoryFile* waveform
359  //
360  // cfg : configured
361  // net : configured
362  // - TF max energy is stored net->getifo(ifoID)->getTFmap()
363  // x : NULL
364  // ifo : factor index
365  //
366  // Examples
367  //
368  // CWB_Plugin_fCuts.C : Implements the 2G frequency cuts in pixel selection stage
369  }
370 
371  if(type==CWB_PLUGIN_OCOHERENCE) {
372  //
373  // called at the end of COHERENCE stage
374  // at this stage the coherence analysis has been done
375  // selected pixels are stored in jfile
376  // user can read/modify pixels
377  //
378  // jfile : opened in update mode
379  // TDirectoryFile* coherence
380  // OBJ: TTree clusters-cycle:0
381  //
382  // if analysis is done in 2 stages job file contains also :
383  // TDirectoryFile* waveform
384  //
385  // cfg : configured
386  // net : configured
387  // - clusters are stored in the net
388  // x : NULL
389  // ifo : factor index
390  //
391  }
392 
393  if(type==CWB_PLUGIN_ISUPERCLUSTER) {
394  //
395  // at this stage the supercluster analysis started
396  //
397  }
398 
399  if(type==CWB_PLUGIN_OSUPERCLUSTER) {
400  //
401  // at this stage the supercluster analysis has been done and stored in net object
402  // user can read clusters
403  //
404  // jfile : opened in update mode
405  // TDirectoryFile* coherence
406  // KEY: TTree clusters-cycle:0;1
407  // TDirectoryFile* supercluster
408  // OBJ: TTree clusters-cycle:0
409  //
410  // if analysis is done in 2 stages job file contains also :
411  // TDirectoryFile* waveform
412  //
413  // cfg : configured
414  // net : configured
415  // - clusters are stored in the net
416  // x : NULL
417  // ifo : ""
418  //
419  }
420 
421  if(type==CWB_PLUGIN_ILIKELIHOOD) {
422  //
423  // this stage is the bebinning of likelihood analysis
424  // sparse maps are loaded
425  // reconstructed events are stored net object
426  // user can extract reconstructed events (waveform, params) and compute parameters estimation
427  //
428  // jfile : opened in update mode
429  // TDirectoryFile* sparse
430  // KEY: SSeries<double> L1-level:0:8;1
431  // KEY: SSeries<double> H1-level:0:8;1
432  // KEY: SSeries<double> V1-level:0:8;1
433  // .. for all resolution levels
434  // KEY: TDirectoryFile supercluster;1
435  // KEY: TTree clusters-cycle:0;1
436  //
437  // if analysis is done in 2 stages job file contains also :
438  // KEY: TDirectoryFile waveform;1
439  // KEY: CWB::config config;1
440  // KEY: network network;1
441  // KEY: CWB::History history;1
442  // KEY: cwb2G cwb;1
443  //
444  // cfg : configured
445  // net : configured
446  // - sparse map is stored net->getifo(ifoID)->vSS[ifoID]
447  // - clusters are stored in the net
448  // x : NULL
449  // ifo : factor-id or lag id
450  //
451  // Examples
452  //
453  // CWB_Plugin_cwb_inet.C : plot sparse TF maps
454  }
455 
456  if(type==CWB_PLUGIN_OLIKELIHOOD) {
457  //
458  // at this stage the likelihood analysis has been done
459  // reconstructed events are stored net object
460  // user can extract reconstructed events (waveform, params) and compute parameters estimation
461  // user can store custom results to jfile
462  //
463  // jfile : opened in update mode
464  // TDirectoryFile* sparse
465  // KEY: SSeries<double> L1-level:0:8;1
466  // KEY: SSeries<double> H1-level:0:8;1
467  // KEY: SSeries<double> V1-level:0:8;1
468  // .. all resolution levels
469  // KEY: TDirectoryFile supercluster;1
470  // KEY: TTree clusters-cycle:0;1 0
471  //
472  // if analysis is done in 2 stages job file contains also :
473  // KEY: TDirectoryFile waveform;1
474  // KEY: CWB::config config;1
475  // KEY: network network;1
476  // KEY: CWB::History history;1
477  // KEY: cwb2G cwb;1
478  //
479  // cfg : configured
480  // net : configured
481  // - reconstructed clusters are contained in net object net->getwc(lag)
482  // x : NULL
483  // ifo : ""
484  //
485  // Examples
486  //
487  // CWB_Plugin_NN.C : includes netcluster event stricture into the output wave root file
488  // CWB_Plugin_SkyProb.C : save SkyProb into the output wave root file
489  // CWB_Plugin_pixeLHood.C : dump/plot the likelihood/null pixels of the detected/reconstructed event
490  }
491 
492  if(type==CWB_PLUGIN_CLOSE_JOB) {
493  //
494  // at this stage job is finished and
495  //
496  // jfile : opened in update mode
497  // if analysis is done in 2 stages job file contains also :
498  // This is the trigger file used as input for the final stage analysis
499  // KEY: TDirectoryFile waveform;1
500  // KEY: TDirectoryFile supercluster;1
501  // KEY: TDirectoryFile sparse;1
502  // KEY: CWB::config config;1
503  // KEY: network network;1
504  // KEY: CWB::History history;1
505  // KEY: cwb2G cwb;1
506  //
507  // cfg : configured
508  // net : configured
509  // x : is the pointer to a dummy wavearray
510  // used only to get x.rate(),x.start(),x.size()
511  // ifo : ifo label (L1,H1,V1,...)
512  //
513  }
514 
515  return;
516 }
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
Definition: ced.hh:24
TString("c")
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
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.
jfile
Definition: cwb_job_obj.C:25