Logo coherent WaveBurst  
Library Reference Guide
Logo
network.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Sergey Klimenko, Gabriele Vedovato
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 //**************************************************************
20 // Wavelet Analysis Tool
21 // Sergey Klimenko, University of Florida
22 // class for coherent network analysis used with DMT and ROOT
23 //**************************************************************
24 
25 #ifndef NETWORK_HH
26 #define NETWORK_HH
27 
28 #include <iostream>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <vector>
32 #include "TH2F.h"
33 #include "wavearray.hh"
34 #include "wseries.hh"
35 #include "detector.hh"
36 #include "skymap.hh"
37 #include "netcluster.hh"
38 #include "wat.hh"
39 #include "monster.hh"
40 #include "watplot.hh" // remove
41 #include "TMatrixDSym.h"
42 #include "TMatrixDSymEigen.h"
43 #include "TVectorD.h"
44 #ifndef __CINT__
45 #include "watsse.hh"
46 #include "watavx.hh"
47 #endif
48 
49 using namespace std;
50 
51 typedef std::vector<double> vectorD;
52 
53 struct waveSegment {
54  int index;
55  double start;
56  double stop;
57 };
58 
59 class network : public TNamed
60 {
61  public:
62 
63  // constructors
64 
65  //: Default constructor
66  network();
67 
68  //: Copy constructor
69  //!param: value - object to copy from
70  network(const network&);
71 
72  //: destructor
73  virtual ~network();
74 
75  // operators
76 
77  network& operator= (const network&);
78 
79  // accessors
80 
81  //: add detector to the network
82  //!param: detector structure
83  //!return number of detectors in the network
84  size_t add(detector*);
85 
86  //:do forward/inverse wavelet transformation by k steps
87  //!param: number of steps
88  // do not use with WDM transform !!!
89  void Forward(size_t k)
90  { for(size_t i=0; i<ifoList.size(); i++) ifoList[i]->TFmap.Forward(k); }
91  void Inverse(size_t k)
92  { for(size_t i=0; i<ifoList.size(); i++) ifoList[i]->TFmap.Inverse(k); }
93 
94  // set time shifts
95  //!param number of time lags
96  //!param time shift step in seconds
97  //!param first lag ID
98  //!param maximum lag ID
99  //!param file name for lag configurations
100  //!param r/w/s - read/write/string mode
101  int setTimeShifts(size_t=1, double=1., size_t=0, size_t=0,
102  const char* = NULL, const char* = "w", size_t* = NULL);
103 
104  // print wc_List
105  //param - time lag
106  void printwc(size_t);
107 
108  //: initialize cluster for selected TF area, put it in wc_List[0];
109  //!param: cluster start time relative to segment start
110  //!param: cluster duration
111  //!return cluster list size
112  // time shifts between detectors are controlled by sHIFt parameters in the detector objects
113  // cluster bandwidth is controlled by TFmap.low(), TFmap.high() parameters.
114  virtual size_t initwc(double, double);
115 
116  //: initialize network sky maps: fill netvork sensitivity and alignment factor
117  //!param: sky map granularity step, degrees
118  //!param: theta begin, degrees
119  //!param: theta end, degrees
120  //!param: phi begin, degrees
121  //!param: phi end, degrees
122  void setSkyMaps(double,double=0.,double=180.,double=0.,double=360.);
123 
124  //: initialize network sky maps: fill netvork sensitivity and alignment factor
125  //!param: healpix order
126  void setSkyMaps(int);
127 
128  //:calculate network data matrix (NDM)
129  //!param: cluster ID
130  //!param: lag index
131  //!param: statistic identificator
132  //!param: resolution idenificator
133  //!return: status
134  bool setndm(size_t, size_t, bool=true, int=1);
135  bool SETNDM(size_t, size_t, bool=true, int=1); // used with likelihoodI
136 
137  //:read NDM element defined by detectors i,j
138  //!param: first detector
139  //!param: second detector
140  inline double getNDM(size_t i, size_t j) { return NDM[i][j]; }
141 
142  //:set delay filters for a network
143  //:(-t,t)_i=0, (-t,t)_i=1, .....
144  //!param: detector
145  // return number of delays for each layer.
146  size_t setFilter(detector* = NULL); // from detector object
147 
148  //:set delay filters and index arrays for a network
149  void setDelayFilters(detector* = NULL); // from detector
150  void setDelayFilters(char*, char* = NULL); // from detector filter files
151  void setFilter(char*, char* = NULL); // from network filter files
152 
153  //: Dumps network filter to file *fname in binary format.
154  void writeFilter(const char *fname);
155 
156  //: reads network filter from file
157  void readFilter(const char*);
158 
159  // set veto array from the input list of DQ segments
160  //!param: time window around injections
161  double setVeto(double=5.);
162 
163  //: read injections
164  //!param: MDC log file
165  //!param: approximate gps time
166  // (injections in a window +-10000 sec around gps are selected)
167  //!param: position of time field
168  //!param: position of type field
169  // returns number of injections
170  size_t readMDClog(char*,double=0.,int=11,int=12);
171 
172  //: read segment list
173  //!param: segment list file
174  //!param: start time collumn number
175  // returns number of segments
176  size_t readSEGlist(char*,int=1);
177 
178  //: read DQ segments
179  //!param: MDC log file
180  // returns number of injections
181  //size_t readSegments(char*,int=11,int=12);
182 
183  // set optimal delay index
184  // new version which works with WDM delay filters
185  // the delay index is symmetric - can be negative.
186  // index=0 corresponds to zero delay
187  // index>0 corresponds to positive delay (shift right)
188  // index<0 corresponds to negative delay (shift left)
189  // rate: effective data rate (1/delay_step)
190  void setDelayIndex(double rate);
191 
192  // set optimal delay index
193  // work with dumb wavelet 1G delay filters
194  //!param: dummy
195  void setDelayIndex(int=0);
196 
197  //:set sky index array
198  //: mode: 0 - now downselection
199  //: 1 - exclude duplicate delay configurations
200  //: 2 - downselect by 2
201  //: 4 - downselect by 4
202  size_t setIndexMode(size_t=0);
203 
204  //:get sky index for given theta, phi
205  //!param: theta [deg]
206  //!param: phi [deg]
207  inline int getIndex(double theta, double phi) {
208  return getifo(0)->tau.getSkyIndex(theta,phi);
209  }
210 
211  //:set antenna pattern buffers
212  //!param: detector (use theta, phi index array)
213  void setAntenna(detector*);
214  // set antenna patterns for all detectors
215  void setAntenna();
216 
217  // 1G: delay detectors in the network with respect to reference
218  // to match sky location theta and phi
219  // index array should be setup
220  void delay(double theta, double phi);
221  // 1G delay detector in the network:
222  // time delay convention: + - shift TS right
223  // - - shift TS left
224  //!param: detector pointer
225  //!param: delay filter index
226  void delay(detector*, size_t);
227 
228  // 1G analysis algorithm for selection of significant network pixles
229  //:select TF pixels by setting a threshold on the pixel network likelihood.
230  //:integrated time shifts for estimation of the background
231  //:input parameters define threshold on TF pixel parameters
232  //!param: threshold on lognormal pixel energy (in units of noise rms)
233  //!param: threshold on total pixel energy (in units of noise rms)
234  //!param: threshold on likelihood (in units of amplitude SNR per detector)
235  //!return: number of selected samples.
236  long coherence(double, double=0., double=0.);
237 
238  // 2G analysis algorithm for selection of significant network pixles
239  // LAG - time shift lag defining how detectors are shifted wrt each other.
240  // Eo - pixel energy threshold
241  // DD - dummy
242  // hist- pointer to a diagnostic histogram showing network pixel energy.
243  long getNetworkPixels(int LAG, double Eo, double DD=1., TH1F* hist=NULL);
244 
245  //:selection of clusters based on:
246  // 'C' - network correlation coefficient
247  // 'l' - likelihood (biased)
248  // 'L' - likelihood (unbiased)
249  // 'A' - snr - null assymetry (double OR)
250  // 'E' - snr - null energy (double OR)
251  // 'a' - snr - null assymetry (strict)
252  // 'e' - snr - null energy (strict)
253  //!param: threshold
254  //!param: minimum cluster size processed by the corrcut
255  //!param: cluster type
256  //!return: number of rejected pixels.
257  size_t netcut(double, char='L', size_t=0, int=1);
258 
259  // apply subnetwork cut
260  // subnet: sub network threshold
261  // subcut: sub network threshold in the skyloop
262  // lag: lag index
263  // return number of processed pixels
264  // works only with TD amplitudes.
265  // Includes x regulator for background rejection
266  long subNetCut(int lag, float subnet=0.6, float subcut=0.33, TH2F* hist=NULL);
267 
268  // calculate network likelihood for reconstructed clusters when
269  // independent h+ and hx polarisations are reconstructed
270  // implementation for 2-5 detector network.
271  //!param: maximized statistic:
272  //!param: threshold to define core pixels (in units of noise rms)
273  // effective only if the second parameter is false
274  //!param: cluster ID, if ID=0 - fill likelihood field for all clusters
275  // otherwise, calculate likelihood only for specified cluster.
276  // fill nLikelihood skymap if ID<=0 - need for CED
277  //!param: lag index
278  //!param: sky index
279  //!param: true - for core pixels, false - for core & halo pixels
280  //!return number of processed pixels
281  // Options for sky statistics
282  // 'e'/'E' - power
283  // 'b'/'B' - un-modeled search with 0 phase data
284  long likelihoodB(char='E', double=sqrt(2.), int=0, size_t=0, int=-1, bool=false);
285 
286  // implementation for 2-5 detector network and elliptical constraint
287  // 'p'/'P' - un-modeled search with 0 and 90deg phase data
288  // 'i'/'I' - (inspiral) elliptical constraint
289  // 's'/'S' - (supernova) linear constraint
290  // 'g'/'G' - (short GRB) circular constraint
291  long likelihoodI(char='P', double=sqrt(2.), int=0, size_t=0, int=-1, bool=false);
292 
293  // 2G likelihood with multi-resolution cluster analysis
294  // mode: analysis mode
295  // lag: lag index
296  // ID: cluster ID, if ID=0 - process all clusters
297  // fill nLikelihood skymap if ID<=0 - need for CED
298  // hist: chirp histogram: If not needed, TGraphErrors* hist=NULL
299  // shold be used as input
300  //return number of processed pixels
301  long likelihood2G(char mode, int lag, int ID, TH2F* hist=NULL);
302  long likelihoodWP(char mode, int lag, int ID, TH2F* hist=NULL);
303 
304  // combines likelihood0() and likelihoodI() and likelihoodB()
305  long likelihood(char='E', double=sqrt(2.), int=0, size_t=0, int=-1, bool=false);
306 
307  // set pixel ranks in the network netcluster structure
308  // param: time window around pixel for rank calculation
309  // param: frequency window around pixel for rank calculation (not used)
310  size_t setRank(double, double=0.);
311 
312 
313  // read the wdm xtalk catalog
314  // param: catalog filename
315  inline void setMRAcatalog(char* fn){ wdmMRA.read(fn);}
316 
317 
318  //:reconstruct time clusters
319  //!param: time gap in pixels
320  //!return: number of reconstructed clusters
321  size_t cluster(int kt, int kf) {
322  if(!wc_List.size()) return 0;
323  size_t m = 0;
324  for(size_t n=0; n<nLag; n++) m += wc_List[n].cluster(kt,kf);
325  return m;
326  }
327 
328  //:return number of events
329  size_t events() {
330  if(!wc_List.size()) return 0;
331  size_t m = 0;
332  for(size_t n=0; n<nLag; n++) {
333  m += wc_List[n].esize();
334  }
335  return m;
336  }
337 
338  //:return number of events with specified type, lag and cID
339  // type : sCuts
340  // lag : lag<0 -> select all lags
341  size_t events(int type, int lag=-1) {
342  if(!wc_List.size()) return 0;
343  if(lag>=(int)nLag) lag=nLag-1;
344  size_t m = 0;
345  if(lag>=0) m += wc_List[lag].esize(type);
346  else for(size_t n=0; n<nLag; n++) m += wc_List[n].esize(type);
347  return m;
348  }
349 
350  // set noise rms fields for pixels in the network netcluster structure
351  inline void setRMS();
352 
353  // delink superclusters in wc_List
354  inline void delink(){
355  for(size_t i=0; i<nLag; i++) wc_List[i].delink();
356  }
357 
358  //: extract time series for detector responses
359  //!param: cluster ID
360  //!param: delay index
361  //!param: time series type
362  //!return: true if time series are extracted
363  bool getwave(size_t, size_t, char='W');
364 
365  // get MRA waveforms of type atype in time domain given lag nomber and cluster ID
366  // if tof = true, apply time-of-flight corrections
367  // fill in waveform arrays in the detector class
368  // atype = 'W' - get whitened detector Wavelet PC
369  // atype = 'w' - get detector Wavelet PC
370  // atype = 'S' - get whitened reconstructed response (Signal)
371  // atype = 's' - get reconstructed response (Signal)
372  // mode: -1/0/1 - return 90/mra/0 phase
373  // tof: false/true - time-of-flight correction
374  bool getMRAwave(size_t ID, size_t lag, char atype='S', int mode=0, bool tof=false);
375 
376  //: calculation of sky error regions
377  //!param: cluster id
378  //!param: lag
379  //!param: cluster time
380  void getSkyArea(size_t id, size_t lag, double T);
381  //!param: noise rms per DoF
382  void getSkyArea(size_t id, size_t lag, double T, double rms);
383 
384  // read earth skyMask coordinates from file (1G)
385  // parameter - fraction of skymap to be rejected
386  // parameter - file name
387  size_t setSkyMask(double f, char* fname);
388 
389  // read celestial/earth skyMask coordinates from file
390  // parameter - file name
391  // parameter - sky coordinates : 'e'=earth, 'c'=celestial
392  size_t setSkyMask(char* fname, char skycoord);
393 
394  // read celestial/earth skyMask coordinates from skymap
395  // parameter - skymap
396  // parameter - sky coordinates : 'e'=earth, 'c'=celestial
397  size_t setSkyMask(skymap sm, char skycoord);
398 
399  // set threshold on amplitude of core pixels
400  // set threshold on subnetwork energy
401  inline void setAcore(double a) {
402  this->acor = a;
403  a = 1-Gamma(ifoList.size(),a*a*ifoList.size()); // probability
404  this->e2or = iGamma(ifoList.size()-1,a); // subnetwork energy threshold
405  }
406 
407  //: get size of mdcList
408  inline size_t mdcListSize() { return mdcList.size(); }
409  //: get size of mdcType
410  inline size_t mdcTypeSize() { return mdcType.size(); }
411  //: get size of mdcTime
412  inline size_t mdcTimeSize() { return mdcTime.size(); }
413  //: get size of mdc__ID
414  inline size_t mdc__IDSize() { return mdc__ID.size(); }
415  //: get size of livTime
416  inline size_t livTimeSize() { return livTime.size(); }
417  //: get element of mdcList
418  inline string getmdcList(size_t n) { return mdcListSize()>n ? mdcList[n] : "\n"; }
419  //: get element of mdcType
420  inline string getmdcType(size_t n) { return mdcTypeSize()>n ? mdcType[n] : "\n"; }
421  //: get pointer to mdcTime
422  inline std::vector<double>* getmdcTime() { return &mdcTime; }
423  //: get element of mdcTime
424  inline double getmdcTime(size_t n) { return mdcTimeSize()>n ? mdcTime[n] : 0.; }
425  //: get element of mdc__ID
426  inline size_t getmdc__ID(size_t n) { return mdc__IDSize()>n ? mdc__ID[n] : 0; }
427  //: get element of livTime
428  inline double getliveTime(size_t n) { return livTimeSize()>n ? livTime[n] : 0.; }
429 
430  //: get size of ifoList
431  inline size_t ifoListSize() { return ifoList.size(); }
432  //: get size of wc_List
433  inline size_t wc_ListSize() { return wc_List.size(); }
434  //:return pointer to a detector n
435  //!param: detector index
436  inline detector* getifo(size_t n) { return ifoListSize()>n ? ifoList[n] : NULL; }
437  //:return pointer to a netcluster in wc_List
438  //!param: delay index
439  inline netcluster* getwc(size_t n) { return wc_ListSize()>n ? &wc_List[n] : NULL; }
440 
441  //: add wdm
442  //!param: pointer to wdm
443  //!return number of wdm tronsforms in the list
444  size_t add(WDM<double>* wdm) {if(wdm) wdmList.push_back(wdm); return wdmList.size();}
445  //: get size of wdmList
446  inline size_t wdmListSize() { return wdmList.size(); }
447  //!param: number of wdm layers
448  inline WDM<double>* getwdm(size_t M) {
449  for(size_t n=0;n<wdmListSize();n++) if(M==(wdmList[n]->maxLayer()+1)) return wdmList[n];
450  return NULL;
451  }
452 
453  // set run number
454  //!param: run
455  inline void setRunID(size_t n) { this->nRun=n; return; }
456 
457  // set wavelet boundary offset
458  //!param: run
459  inline void setOffset(double t) { this->Edge = t; return; }
460 
461  // set constraint parameter
462  //!param: constraint parameter, p=0 - no constraint
463  inline void constraint(double d=1., double g=0.0001) {
464  this->delta = d==0. ? 0.00001 : d;
465  this->gamma = g;
466  //this->gamma=g>0. ? g : 0.00001;
467  }
468 
469  // set threshold for double OR energy
470  //!param: threshold
471  inline void set2or(double p) { this->e2or = p; }
472 
473  // calculate WaveBurst threshold as a function of resolution
474  //!param: selected fraction of LTF pixels assuming Gaussian noise
475  //!param: maximum time delay between detectors
476  double threshold(double, double);
477 
478  // calculate WaveBurst threshold as a function of resolution
479  //!param: selected fraction of LTF pixels assuming Gaussian noise
480  double THRESHOLD(double bpp);
481 
482  // calculate WaveBurst threshold for patterns
483  //!param: selected fraction of LTF pixels assuming Gaussian noise
484  //!param: Gamma distribution shape parameter
485  double THRESHOLD(double bpp, double shape);
486 
487  // calculate maximum delay between detectors
488  // "max" - maximum delay
489  // "min" - minimum delay
490  // "MAX" - max(abs(max),abs(min)
491  // def - max-min
492  double getDelay(const char* c="");
493 
494  //:recalculate time delay skymaps from Earth center to
495  //:'L1' - Livingston
496  //:'H1' - Hanford
497  //:'V1' - Cashina
498  //:'G1' - Hannover
499  //:'T1' - Tama
500  //:'A1' - Australia
501  void setDelay(const char* = "L1");
502 
503  // extract accurate time delay amplitudes for a given sky location
504  // parameter 1 - sky location index
505  // parameter 2 - array for 0-phase delayed amplitudes
506  // parameter 3 - array for 0-phase delayed amplitudes
507  void updateTDamp(int, float**, float**);
508 
509  // return WDM used/unused
510  bool wdm() {return _WDM;}
511  // get likelihood type, X=likelihoodX, M=likelihoodM, ''=others
512  char like() {return _LIKE;}
513 
514  // print network parameters
515  void print(); // *MENU*
516  virtual void Browse(TBrowser*) {print();}
517 
518  static inline double sumx(double*);
519  static inline double dotx(double*, double*);
520  static inline double dotx(float*, float*);
521  static inline double dot4(double*, double*);
522  static inline double dotx(double*, double*, double*);
523  static inline double dotx(float*, float*, float*);
524  static inline double dot4(double*, double*, double*);
525  static inline double dotx(double*, double**, size_t);
526  static inline double dotx(double**, size_t, double*);
527  static inline double dotx(double**, size_t, double**, size_t);
528  static inline double dotx(double**, size_t, double**, size_t, double*);
529  static inline double dotx(double*, double*, double);
530  static inline double dotx(float*, float*, float);
531  static inline void addx(double*, double*, double*);
532  static inline void addx(double*, double**, size_t, double*);
533  static inline void addx(double**, size_t, double**, size_t, double*);
534  static inline double dotx(double*, double**, size_t, double*);
535  static inline double dot32(std::vector<float>*, double*, std::vector<short>*);
536  static inline double dot32(double*, double*, int*);
537  static inline double divx(double*, double*);
538  static inline double rotx(double*, double, double*, double, double*);
539  static inline double rotx(float*, float, float*, float, float*);
540  static inline double rot4(double*, double, double*, double, double*);
541  static inline float rots(float*, float, float*, float, float*);
542  static inline void mulx(double**, size_t, double**, size_t, double*);
543  static inline void mulx(double*, double, double*);
544  static inline void mulx(float*, float, float*);
545  static inline void mulx(double*, double);
546  static inline void mulx(float*, float);
547  static inline void inix(double**, size_t, double*);
548  static inline void inix(double*, double);
549  static inline void inix(float*, float);
550  static inline int netx(double*, double, double*, double, double);
551  static inline int netx(float*, float, float*, float, float);
552  static inline void pnt_(float**, float**, short**, int, int);
553  static inline void cpp_(float*&, float**);
554  static inline void cpf_(float*& a, double** p);
555  static inline void cpf_(float*& a, double** p, size_t);
556 
557  static inline void dpfx(float* fp, float* fx);
558  static inline void pnpx(float* fp, float* fx, float* am, float* AM, float* u, float* v);
559  static inline void dspx(float* u, float* v, float* am, float* AM);
560  static inline void dspx(float* fp, float* fx, float* am, float* AM, float* u, float* v);
561 
562  inline int _sse_MRA_ps(float*, float*, float, int);
563  inline int _sse_mra_ps(float*, float*, float, int);
564  inline wavearray<float> _avx_norm_ps(float**, float**, std::vector<float*> &, int);
565  inline wavearray<float> _avx_norm_ps(float**, float**, float*, int);
566  inline void _avx_saveGW_ps(float**, float**, int);
567 
568  void test_sse(int, int);
569 
570 // data members
571 
572  size_t nRun; // run number
573  size_t nLag; // number of time lags
574  long nSky; // number of pixels for sky probability area
575  size_t mIFO; // master IFO
576  double rTDF; // effective rate of time-delay filter
577  double Step; // time shift step
578  double Edge; // time offset at the boundaries
579  double gNET; // network sensitivity
580  double aNET; // network alignment
581  double iNET; // network index
582  double eCOR; // correlation energy
583  double norm; // norm factor
584  double e2or; // threshold on double OR energy
585  double acor; // threshold on coherent pixel energy
586  bool pOUT; // true/false printout flag
587  bool EFEC; // true/false - EFEC/selestial coordinate system
588  char tYPe; // likelihood type
589  bool local; // true/false - local/global normalization
590  bool optim; // true/false - process optimal/all resolutions
591  double delta; // weak constraint parameter:
592  double gamma; // hard constraint parameter:
593  double precision; // precision of energy calculation
594  double pSigma; // integration limit in sigmas for probability
595  double penalty; // penalty factor:
596  double netCC; // threshold on netcc:
597  double netRHO; // threshold on rho:
598  bool eDisbalance; // true/false - enable/disable energy disbalance ECED
599  bool MRA; // true/false - used/not-used likelihoodMRA
600  bool wfsave; // true/false - if false only simulated wf are saved (2G)
601  int pattern; // clustering pattern
602 
603  std::vector<vectorD> NDM; // network data matrix
604 
605  WSeries<double> whp; // + polarization
606  WSeries<double> whx; // x polarization
607 
608  std::vector<detector*> ifoList; // detectors
609  std::vector<char*> ifoName; // detector's names
610  std::vector<netcluster> wc_List; // netcluster structures for time shifts
611  std::vector<double> livTime; // live time for time shifts
612  std::vector<std::string> mdcList; // list of injections
613  std::vector<std::string> mdcType; // list of injection types
614  std::vector<double> mdcTime; // gps time of selected injections
615  std::vector<size_t> mdc__ID; // ID of selected injections
616  std::vector<waveSegment> segList; // DQ segment list
617  std::vector<WDM<double>*> wdmList; //! list of wdm tranformations
618 
619  skymap nSensitivity; // network sensitivity
620  skymap nAlignment; // network alignment factor
621  skymap nCorrelation; // network correlation coefficient
622  skymap nLikelihood; // network likelihood
623  skymap nNullEnergy; // network null energy
624  skymap nPenalty; // signal * noise penalty factor
625  skymap nCorrEnergy; // reduced correlated energy
626  skymap nNetIndex; // network index
627  skymap nDisbalance; // energy disbalance
628  skymap nSkyStat; // sky optimization statistic
629  skymap nEllipticity; // waveform ellipticity
630  skymap nPolarisation; // polarisation angle
631  skymap nProbability; // probability skymap
632  skymap nAntenaPrior; // network sensitivtiy used as a prior for skyloc
633 
634  WSeries<double> pixeLHood; // pixel likelihood statistic
635  WSeries<double> pixeLNull; // pixel null statistic
636 
637  std::vector<delayFilter> filter; // delay filter (1G)
638  std::vector<delayFilter> filter90; // phase shifted delay filter (1G)
639 
640  wavearray<int> index; // theta, phi mask index array
641  wavearray<short> skyMask; // index array for setting sky mask
642  wavearray<double> skyMaskCC; // index array for setting sky mask Celestial Coordinates
643  wavearray<double> skyHole; // static sky mask describing "holes"
644  wavearray<short> veto; // veto array for pixel selection
645  wavearray<double> skyProb; // sky probability
646  wavearray<double> skyENRG; // energy skymap
647 
648 // data arrays for MRA and likelihood analysis
649 
650  std::vector<netpixel*> pList; //! list of pixel pointers for MRA
651  monster wdmMRA; //! wdm multi-resolution analysis
652  wavearray<float> a_00; //! buffer for cluster sky 00 amplitude
653  wavearray<float> a_90; //! buffer for cluster sky 90 amplitudes
654  wavearray<float> rNRG; //! buffers for cluster residual energy
655  wavearray<float> pNRG; //! buffers for cluster MRA energy
656 
657 // data arrays for polar coordinates storage : [0,1] = [radius,angle]
658 
659  wavearray<double> p00_POL[2]; //! buffer for projection on network plane 00 ampl
660  wavearray<double> p90_POL[2]; //! buffer for projection on network plane 90 ampl
661  wavearray<double> r00_POL[2]; //! buffer for standard response 00 ampl
662  wavearray<double> r90_POL[2]; //! buffer for standard response 90 ampl
663 
664 private:
665 
666  void like(char _LIKE) {this->_LIKE=_LIKE;} // set likelihood type
667  void wdm(bool _WDM) {this->_WDM =_WDM; } // set wdm used/unused
668  bool _WDM; // true/false - used/not-used WDM
669  char _LIKE; // X=likelihoodX, M=likelihoodM, ''=others
670 
671  ClassDef(network,4)
672 
673 }; // class network
674 
675 //inline void network::setCatalogFile(char* fn)
676 //{ wdmOvlp.read(fn);}
677 
678 // set noise rms fields for pixels in the network netcluster structure
679 inline void network::setRMS() {
680  size_t n = ifoList.size();
681  if(!ifoList.size() || wc_List.size()!=nLag) return;
682  for(size_t i=0; i<n; i++) {
683  for(size_t j=0; j<nLag; j++) {
684  if(!getwc(j)->size()) continue;
685  if(!getifo(i)->setrms(getwc(j),i)) {
686  cout<<"network::setRMS() error\n";
687  exit(1);
688  }
689  }
690  }
691  return;
692 }
693 
694 // special functions
695 inline double network::sumx(double* a) {
696  double d=0.;
697  NETX(d+= a[0]; ,
698  d+= a[1]; ,
699  d+= a[2]; ,
700  d+= a[3]; ,
701  d+= a[4]; ,
702  d+= a[5]; ,
703  d+= a[6]; ,
704  d+= a[7]; )
705  return d;
706 }
707 
708 inline double network::dotx(double* a, double* b) {
709  double d=0.;
710  NETX(d+= a[0]*b[0]; ,
711  d+= a[1]*b[1]; ,
712  d+= a[2]*b[2]; ,
713  d+= a[3]*b[3]; ,
714  d+= a[4]*b[4]; ,
715  d+= a[5]*b[5]; ,
716  d+= a[6]*b[6]; ,
717  d+= a[7]*b[7]; )
718  return d;
719 }
720 
721 inline double network::dotx(float* a, float* b) {
722  float d=0.;
723  NETX(d+= a[0]*b[0]; ,
724  d+= a[1]*b[1]; ,
725  d+= a[2]*b[2]; ,
726  d+= a[3]*b[3]; ,
727  d+= a[4]*b[4]; ,
728  d+= a[5]*b[5]; ,
729  d+= a[6]*b[6]; ,
730  d+= a[7]*b[7]; )
731  return d;
732 }
733 
734 inline double network::dot4(double* a, double* b) {
735  double d=0.;
736  d+= a[0]*b[0];
737  d+= a[1]*b[1];
738  d+= a[2]*b[2];
739  d+= a[3]*b[3];
740  return d;
741 }
742 
743 inline double network::dotx(double* a, double* b, double* c) {
744  double d=0.;
745  NETX(c[0] = a[0]*b[0]; d+=c[0]; ,
746  c[1] = a[1]*b[1]; d+=c[1]; ,
747  c[2] = a[2]*b[2]; d+=c[2]; ,
748  c[3] = a[3]*b[3]; d+=c[3]; ,
749  c[4] = a[4]*b[4]; d+=c[4]; ,
750  c[5] = a[5]*b[5]; d+=c[5]; ,
751  c[6] = a[6]*b[6]; d+=c[6]; ,
752  c[7] = a[7]*b[7]; d+=c[7]; )
753  return d;
754 }
755 
756 inline double network::dotx(float* a, float* b, float* c) {
757  float d=0.;
758  NETX(c[0] = a[0]*b[0]; d+=c[0]; ,
759  c[1] = a[1]*b[1]; d+=c[1]; ,
760  c[2] = a[2]*b[2]; d+=c[2]; ,
761  c[3] = a[3]*b[3]; d+=c[3]; ,
762  c[4] = a[4]*b[4]; d+=c[4]; ,
763  c[5] = a[5]*b[5]; d+=c[5]; ,
764  c[6] = a[6]*b[6]; d+=c[6]; ,
765  c[7] = a[7]*b[7]; d+=c[7]; )
766  return d;
767 }
768 
769 inline double network::dot4(double* a, double* b, double* c) {
770  double d=0.;
771  c[0] = a[0]*b[0]; d+=c[0];
772  c[1] = a[1]*b[1]; d+=c[1];
773  c[2] = a[2]*b[2]; d+=c[2];
774  c[3] = a[3]*b[3]; d+=c[3];
775  return d;
776 }
777 
778 inline double network::dotx(double* a, double** b, size_t j) {
779  double d=0.;
780  NETX(d+= a[0]*b[0][j]; ,
781  d+= a[1]*b[1][j]; ,
782  d+= a[2]*b[2][j]; ,
783  d+= a[3]*b[3][j]; ,
784  d+= a[4]*b[4][j]; ,
785  d+= a[5]*b[5][j]; ,
786  d+= a[6]*b[6][j]; ,
787  d+= a[7]*b[7][j]; )
788  return d;
789 }
790 
791 inline double network::dotx(double** a, size_t i, double* b) {
792  double d=0.;
793  NETX(d+= a[0][i]*b[0]; ,
794  d+= a[1][i]*b[1]; ,
795  d+= a[2][i]*b[2]; ,
796  d+= a[3][i]*b[3]; ,
797  d+= a[4][i]*b[4]; ,
798  d+= a[5][i]*b[5]; ,
799  d+= a[6][i]*b[6]; ,
800  d+= a[7][i]*b[7]; )
801  return d;
802 }
803 
804 inline double network::dotx(double** a, size_t i, double** b, size_t j) {
805  double d=0.;
806  NETX(d+= a[0][i]*b[0][j]; ,
807  d+= a[1][i]*b[1][j]; ,
808  d+= a[2][i]*b[2][j]; ,
809  d+= a[3][i]*b[3][j]; ,
810  d+= a[4][i]*b[4][j]; ,
811  d+= a[5][i]*b[5][j]; ,
812  d+= a[6][i]*b[6][j]; ,
813  d+= a[7][i]*b[7][j]; )
814  return d;
815 }
816 
817 inline double network::divx(double* a, double* b) {
818  double d=0.;
819  NETX(d+= a[0]/b[0]; ,
820  d+= a[1]/b[1]; ,
821  d+= a[2]/b[2]; ,
822  d+= a[3]/b[3]; ,
823  d+= a[4]/b[4]; ,
824  d+= a[5]/b[5]; ,
825  d+= a[6]/b[6]; ,
826  d+= a[7]/b[7]; )
827  return d;
828 }
829 
830 inline int network::netx(double* u, double um, double* v, double vm, double g) {
831  double d=0.;
832  double q = (1.-g)*um;
833  NETX(d+= int(u[0]*u[0]>q) - int((u[0]*u[0]/um+v[0]*v[0]/vm)>g); ,
834  d+= int(u[1]*u[1]>q) - int((u[1]*u[1]/um+v[1]*v[1]/vm)>g); ,
835  d+= int(u[2]*u[2]>q) - int((u[2]*u[2]/um+v[2]*v[2]/vm)>g); ,
836  d+= int(u[3]*u[3]>q) - int((u[3]*u[3]/um+v[3]*v[3]/vm)>g); ,
837  d+= int(u[4]*u[4]>q) - int((u[4]*u[4]/um+v[4]*v[4]/vm)>g); ,
838  d+= int(u[5]*u[5]>q) - int((u[5]*u[5]/um+v[5]*v[5]/vm)>g); ,
839  d+= int(u[6]*u[6]>q) - int((u[6]*u[6]/um+v[6]*v[6]/vm)>g); ,
840  d+= int(u[7]*u[7]>q) - int((u[7]*u[7]/um+v[7]*v[7]/vm)>g); )
841  return d;
842 }
843 
844 inline int network::netx(float* u, float um, float* v, float vm, float g) {
845  float d=0.;
846  float q = (1.-g)*um;
847  NETX(d+= int(u[0]*u[0]>q) - int((u[0]*u[0]/um+v[0]*v[0]/vm)>g); ,
848  d+= int(u[1]*u[1]>q) - int((u[1]*u[1]/um+v[1]*v[1]/vm)>g); ,
849  d+= int(u[2]*u[2]>q) - int((u[2]*u[2]/um+v[2]*v[2]/vm)>g); ,
850  d+= int(u[3]*u[3]>q) - int((u[3]*u[3]/um+v[3]*v[3]/vm)>g); ,
851  d+= int(u[4]*u[4]>q) - int((u[4]*u[4]/um+v[4]*v[4]/vm)>g); ,
852  d+= int(u[5]*u[5]>q) - int((u[5]*u[5]/um+v[5]*v[5]/vm)>g); ,
853  d+= int(u[6]*u[6]>q) - int((u[6]*u[6]/um+v[6]*v[6]/vm)>g); ,
854  d+= int(u[7]*u[7]>q) - int((u[7]*u[7]/um+v[7]*v[7]/vm)>g); )
855  return d;
856 }
857 
858 inline double network::dotx(double** a, size_t i, double** b, size_t j, double* p) {
859  double d=0.;
860  NETX(p[0] = a[0][i]*b[0][j];d+=p[0]; ,
861  p[1] = a[1][i]*b[1][j];d+=p[1]; ,
862  p[2] = a[2][i]*b[2][j];d+=p[2]; ,
863  p[3] = a[3][i]*b[3][j];d+=p[3]; ,
864  p[4] = a[4][i]*b[4][j];d+=p[4]; ,
865  p[5] = a[5][i]*b[5][j];d+=p[5]; ,
866  p[6] = a[6][i]*b[6][j];d+=p[6]; ,
867  p[7] = a[7][i]*b[7][j];d+=p[7]; )
868  return d;
869 }
870 
871 inline double network::dotx(double* a, double* b, double c) {
872  double d=0.;
873  NETX(d+= a[0]*b[0]; ,
874  d+= a[1]*b[1]; ,
875  d+= a[2]*b[2]; ,
876  d+= a[3]*b[3]; ,
877  d+= a[4]*b[4]; ,
878  d+= a[5]*b[5]; ,
879  d+= a[6]*b[6]; ,
880  d+= a[7]*b[7]; )
881  return c*d;
882 }
883 
884 inline double network::dotx(float* a, float* b, float c) {
885  float d=0.;
886  NETX(d+= a[0]*b[0]; ,
887  d+= a[1]*b[1]; ,
888  d+= a[2]*b[2]; ,
889  d+= a[3]*b[3]; ,
890  d+= a[4]*b[4]; ,
891  d+= a[5]*b[5]; ,
892  d+= a[6]*b[6]; ,
893  d+= a[7]*b[7]; )
894  return c*d;
895 }
896 
897 inline double network::dotx(double* a, double** b, size_t j, double* p) {
898  double d=0.;
899  NETX(p[0] = a[0]*b[0][j];d+=p[0]; ,
900  p[1] = a[1]*b[1][j];d+=p[1]; ,
901  p[2] = a[2]*b[2][j];d+=p[2]; ,
902  p[3] = a[3]*b[3][j];d+=p[3]; ,
903  p[4] = a[4]*b[4][j];d+=p[4]; ,
904  p[5] = a[5]*b[5][j];d+=p[5]; ,
905  p[6] = a[6]*b[6][j];d+=p[6]; ,
906  p[7] = a[7]*b[7][j];d+=p[7]; )
907  return d;
908 }
909 
910 inline void network::addx(double* a, double* b, double* p) {
911  NETX(p[0] += a[0]*b[0]; ,
912  p[1] += a[1]*b[1]; ,
913  p[2] += a[2]*b[2]; ,
914  p[3] += a[3]*b[3]; ,
915  p[4] += a[4]*b[4]; ,
916  p[5] += a[5]*b[5]; ,
917  p[6] += a[6]*b[6]; ,
918  p[7] += a[7]*b[7]; )
919  return;
920 }
921 
922 inline void network::addx(double* a, double** b, size_t j, double* p) {
923  NETX(p[0] += a[0]*b[0][j]; ,
924  p[1] += a[1]*b[1][j]; ,
925  p[2] += a[2]*b[2][j]; ,
926  p[3] += a[3]*b[3][j]; ,
927  p[4] += a[4]*b[4][j]; ,
928  p[5] += a[5]*b[5][j]; ,
929  p[6] += a[6]*b[6][j]; ,
930  p[7] += a[7]*b[7][j]; )
931  return;
932 }
933 
934 inline void network::addx(double** a, size_t i, double** b, size_t j, double* p) {
935  NETX(p[0] += a[0][i]*b[0][j]; ,
936  p[1] += a[1][i]*b[1][j]; ,
937  p[2] += a[2][i]*b[2][j]; ,
938  p[3] += a[3][i]*b[3][j]; ,
939  p[4] += a[4][i]*b[4][j]; ,
940  p[5] += a[5][i]*b[5][j]; ,
941  p[6] += a[6][i]*b[6][j]; ,
942  p[7] += a[7][i]*b[7][j]; )
943  return;
944 }
945 
946 inline void network::mulx(double** a, size_t i, double** b, size_t j, double* p) {
947  NETX(p[0] = a[0][i]*b[0][j]; ,
948  p[1] = a[1][i]*b[1][j]; ,
949  p[2] = a[2][i]*b[2][j]; ,
950  p[3] = a[3][i]*b[3][j]; ,
951  p[4] = a[4][i]*b[4][j]; ,
952  p[5] = a[5][i]*b[5][j]; ,
953  p[6] = a[6][i]*b[6][j]; ,
954  p[7] = a[7][i]*b[7][j]; )
955  return;
956 }
957 
958 inline void network::mulx(double* a, double b, double* p) {
959  NETX(p[0] = a[0]*b; ,
960  p[1] = a[1]*b; ,
961  p[2] = a[2]*b; ,
962  p[3] = a[3]*b; ,
963  p[4] = a[4]*b; ,
964  p[5] = a[5]*b; ,
965  p[6] = a[6]*b; ,
966  p[7] = a[7]*b; )
967  return;
968 }
969 
970 inline void network::mulx(float* a, float b, float* p) {
971  NETX(p[0] = a[0]*b; ,
972  p[1] = a[1]*b; ,
973  p[2] = a[2]*b; ,
974  p[3] = a[3]*b; ,
975  p[4] = a[4]*b; ,
976  p[5] = a[5]*b; ,
977  p[6] = a[6]*b; ,
978  p[7] = a[7]*b; )
979  return;
980 }
981 
982 inline void network::mulx(double* a, double b) {
983  NETX(a[0] *= b; ,
984  a[1] *= b; ,
985  a[2] *= b; ,
986  a[3] *= b; ,
987  a[4] *= b; ,
988  a[5] *= b; ,
989  a[6] *= b; ,
990  a[7] *= b; )
991  return;
992 }
993 
994 inline void network::mulx(float* a, float b) {
995  NETX(a[0] *= b; ,
996  a[1] *= b; ,
997  a[2] *= b; ,
998  a[3] *= b; ,
999  a[4] *= b; ,
1000  a[5] *= b; ,
1001  a[6] *= b; ,
1002  a[7] *= b; )
1003  return;
1004 }
1005 
1006 inline void network::inix(double** a, size_t j, double* p) {
1007  NETX(p[0] = a[0][j]; ,
1008  p[1] = a[1][j]; ,
1009  p[2] = a[2][j]; ,
1010  p[3] = a[3][j]; ,
1011  p[4] = a[4][j]; ,
1012  p[5] = a[5][j]; ,
1013  p[6] = a[6][j]; ,
1014  p[7] = a[7][j]; )
1015  return;
1016 }
1017 
1018 inline void network::inix(double* p, double a) {
1019  NETX(p[0] = a; ,
1020  p[1] = a; ,
1021  p[2] = a; ,
1022  p[3] = a; ,
1023  p[4] = a; ,
1024  p[5] = a; ,
1025  p[6] = a; ,
1026  p[7] = a; )
1027  return;
1028 }
1029 
1030 inline void network::inix(float* p, float a) {
1031  NETX(p[0] = a; ,
1032  p[1] = a; ,
1033  p[2] = a; ,
1034  p[3] = a; ,
1035  p[4] = a; ,
1036  p[5] = a; ,
1037  p[6] = a; ,
1038  p[7] = a; )
1039  return;
1040 }
1041 
1042 inline double network::rotx(double* u, double c, double* v, double s, double* e) {
1043  double d=0.;
1044  NETX(e[0] = u[0]*c + v[0]*s;d+=e[0]*e[0]; ,
1045  e[1] = u[1]*c + v[1]*s;d+=e[1]*e[1]; ,
1046  e[2] = u[2]*c + v[2]*s;d+=e[2]*e[2]; ,
1047  e[3] = u[3]*c + v[3]*s;d+=e[3]*e[3]; ,
1048  e[4] = u[4]*c + v[4]*s;d+=e[4]*e[4]; ,
1049  e[5] = u[5]*c + v[5]*s;d+=e[5]*e[5]; ,
1050  e[6] = u[6]*c + v[6]*s;d+=e[6]*e[6]; ,
1051  e[7] = u[7]*c + v[7]*s;d+=e[7]*e[7]; )
1052  return d;
1053 }
1054 
1055 inline double network::rotx(float* u, float c, float* v, float s, float* e) {
1056  double d=0.;
1057  NETX(e[0] = u[0]*c + v[0]*s;d+=e[0]*e[0]; ,
1058  e[1] = u[1]*c + v[1]*s;d+=e[1]*e[1]; ,
1059  e[2] = u[2]*c + v[2]*s;d+=e[2]*e[2]; ,
1060  e[3] = u[3]*c + v[3]*s;d+=e[3]*e[3]; ,
1061  e[4] = u[4]*c + v[4]*s;d+=e[4]*e[4]; ,
1062  e[5] = u[5]*c + v[5]*s;d+=e[5]*e[5]; ,
1063  e[6] = u[6]*c + v[6]*s;d+=e[6]*e[6]; ,
1064  e[7] = u[7]*c + v[7]*s;d+=e[7]*e[7]; )
1065  return d;
1066 }
1067 
1068 inline double network::rot4(double* u, double c, double* v, double s, double* e) {
1069  double d=0.;
1070  e[0] = u[0]*c + v[0]*s;d+=e[0]*e[0];
1071  e[1] = u[1]*c + v[1]*s;d+=e[1]*e[1];
1072  e[2] = u[2]*c + v[2]*s;d+=e[2]*e[2];
1073  e[3] = u[3]*c + v[3]*s;d+=e[3]*e[3];
1074  return d;
1075 }
1076 
1077 inline float network::rots(float* u, float c, float* v, float s, float* e) {
1078  float d=0.;
1079  NETX(e[0] -= u[0]*c + v[0]*s; d+=e[0]*e[0]; ,
1080  e[1] -= u[1]*c + v[1]*s; d+=e[1]*e[1]; ,
1081  e[2] -= u[2]*c + v[2]*s; d+=e[2]*e[2]; ,
1082  e[3] -= u[3]*c + v[3]*s; d+=e[3]*e[3]; ,
1083  e[4] -= u[4]*c + v[4]*s; d+=e[4]*e[4]; ,
1084  e[5] -= u[5]*c + v[5]*s; d+=e[5]*e[5]; ,
1085  e[6] -= u[6]*c + v[6]*s; d+=e[6]*e[6]; ,
1086  e[7] -= u[7]*c + v[7]*s; d+=e[7]*e[7]; )
1087  return d/2.;
1088 }
1089 
1090 
1091 inline void network::pnt_(float** q, float** p, short** m, int l, int n) {
1092 // point 0-7 float pointers to first network pixel
1093  NETX(q[0] = (p[0] + m[0][l]*n);,
1094  q[1] = (p[1] + m[1][l]*n);,
1095  q[2] = (p[2] + m[2][l]*n);,
1096  q[3] = (p[3] + m[3][l]*n);,
1097  q[4] = (p[4] + m[4][l]*n);,
1098  q[5] = (p[5] + m[5][l]*n);,
1099  q[6] = (p[6] + m[6][l]*n);,
1100  q[7] = (p[7] + m[7][l]*n);)
1101  return;
1102 }
1103 
1104 inline void network::cpf_(float*& a, double** p) {
1105 // copy to a data defined by array of pointers p and increment target pointer
1106  for(int i=0;i<XIFO;i++) *(a++) = *p[i];
1107  a+=NIFO-XIFO;
1108  return;
1109 }
1110 
1111 inline void network::cpf_(float*& a, double** p, size_t i) {
1112 // copy to a data defined by array of pointers p and increment target pointer
1113  for(int k=0;k<XIFO;k++) *(a++) = p[k][i];
1114  a+=NIFO-XIFO;
1115  return;
1116 }
1117 
1118 inline void network::cpp_(float*& a, float** p) {
1119 // copy to a data defined by array of pointers p and increment pointers
1120  for(int i=0;i<XIFO;i++) *(a++) = *p[i]++;
1121  a+=NIFO-XIFO;
1122  return;
1123 }
1124 
1125 inline double network::dot32(std::vector<float>* F, double* p, std::vector<short>* J) {
1126  return (*F)[0] *p[(*J)[0]] + (*F)[1] *p[(*J)[1]]
1127  + (*F)[2] *p[(*J)[2]] + (*F)[3] *p[(*J)[3]]
1128  + (*F)[4] *p[(*J)[4]] + (*F)[5] *p[(*J)[5]]
1129  + (*F)[6] *p[(*J)[6]] + (*F)[7] *p[(*J)[7]]
1130  + (*F)[8] *p[(*J)[8]] + (*F)[9] *p[(*J)[9]]
1131  + (*F)[10]*p[(*J)[10]] + (*F)[11]*p[(*J)[11]]
1132  + (*F)[12]*p[(*J)[12]] + (*F)[13]*p[(*J)[13]]
1133  + (*F)[14]*p[(*J)[14]] + (*F)[15]*p[(*J)[15]]
1134  + (*F)[16]*p[(*J)[16]] + (*F)[17]*p[(*J)[17]]
1135  + (*F)[18]*p[(*J)[18]] + (*F)[19]*p[(*J)[19]]
1136  + (*F)[20]*p[(*J)[20]] + (*F)[21]*p[(*J)[21]]
1137  + (*F)[22]*p[(*J)[22]] + (*F)[23]*p[(*J)[23]]
1138  + (*F)[24]*p[(*J)[24]] + (*F)[25]*p[(*J)[25]]
1139  + (*F)[26]*p[(*J)[26]] + (*F)[27]*p[(*J)[27]]
1140  + (*F)[28]*p[(*J)[28]] + (*F)[29]*p[(*J)[29]]
1141  + (*F)[30]*p[(*J)[30]] + (*F)[31]*p[(*J)[31]];
1142 }
1143 
1144 inline double network::dot32(double* F, double* p, int* J) {
1145  return F[0] *p[J[0]] + F[1] *p[J[1]] + F[2] *p[J[2]] + F[3] *p[J[3]]
1146  + F[4] *p[J[4]] + F[5] *p[J[5]] + F[6] *p[J[6]] + F[7] *p[J[7]]
1147  + F[8] *p[J[8]] + F[9] *p[J[9]] + F[10]*p[J[10]] + F[11]*p[J[11]]
1148  + F[12]*p[J[12]] + F[13]*p[J[13]] + F[14]*p[J[14]] + F[15]*p[J[15]]
1149  + F[16]*p[J[16]] + F[17]*p[J[17]] + F[18]*p[J[18]] + F[19]*p[J[19]]
1150  + F[20]*p[J[20]] + F[21]*p[J[21]] + F[22]*p[J[22]] + F[23]*p[J[23]]
1151  + F[24]*p[J[24]] + F[25]*p[J[25]] + F[26]*p[J[26]] + F[27]*p[J[27]]
1152  + F[28]*p[J[28]] + F[29]*p[J[29]] + F[30]*p[J[30]] + F[31]*p[J[31]];
1153 }
1154 
1155 inline void network::dpfx(float* fp, float* fx) {
1156 // transformation to DPF for 4 consecutive pixels.
1157 // rotate vectors fp and fx into DPF
1158 
1159 #ifndef __CINT__
1160  float t[32],T[32];
1161 
1162  __m128* _t = (__m128*) t; __m128* _T = (__m128*) T;
1163  __m128* _fp = (__m128*) fp; __m128* _fx = (__m128*) fx;
1164 
1165  _sse_dpf4_ps(_fp,_fx,_t,_T);
1166  _sse_cpf4_ps(_fp,_t);
1167  _sse_cpf4_ps(_fx,_T);
1168 #endif
1169 }
1170 
1171 inline void network::pnpx(float* fp, float* fx, float* am, float* AM, float* u, float* v) {
1172 // projection to network plane (pnp)
1173 // project vectors am and AM on the network plane fp,fx
1174 
1175 #ifndef __CINT__
1176  __m128* _fp = (__m128*) fp; __m128* _fx = (__m128*) fx;
1177  __m128* _am = (__m128*) am; __m128* _AM = (__m128*) AM;
1178  __m128* _u = (__m128*) u; __m128* _v = (__m128*) v;
1179 
1180  _sse_pnp4_ps(_fp,_fx,_am,_AM,_u,_v);
1181 #endif
1182 }
1183 
1184 inline void network::dspx(float* u, float* v, float* am, float* AM) {
1185 // dual stream phase (dsp) transformation
1186 // take projection vectors u and v,
1187 // make them orthogonal,
1188 // apply phase transformation boths to data a,A and projections u,v
1189 
1190 #ifndef __CINT__
1191  float U[32],V[32];
1192 
1193  __m128* _am = (__m128*) am; __m128* _AM = (__m128*) AM;
1194  __m128* _u = (__m128*) u; __m128* _v = (__m128*) v;
1195  __m128* _U = (__m128*) U; __m128* _V = (__m128*) V;
1196 
1197  _sse_dsp4_ps(_u,_v,_am,_AM,_U,_V);
1198  _sse_cpf4_ps(_u,_U);
1199  _sse_cpf4_ps(_v,_V);
1200 #endif
1201 }
1202 
1203 inline void network::dspx(float* fp, float* fx, float* am, float* AM, float* u, float* v) {
1204 // DPF + DSP transformations
1205 // applied dpfx+pnpx+dspx
1206 
1207  dpfx(fp, fx);
1208  pnpx(fp, fx, am, AM, u, v);
1209  dspx(u, v, am, AM);
1210 }
1211 
1212 inline int network::_sse_MRA_ps(float* amp, float* AMP, float Eo, int K) {
1213 // fast multi-resolution analysis inside sky loop
1214 // select max E pixel and either scale or skip it based on the value of residual
1215 // pointer to 00 phase amplitude of monster pixels
1216 // pointer to 90 phase amplitude of monster pixels
1217 // Eo - energy threshold
1218 // K - number of principle components to extract
1219 // returns number of MRA pixels
1220 
1221 #ifndef __CINT__
1222  int j,n,mm;
1223  int k = 0;
1224  int m = 0;
1225  int f = NIFO/4;
1226  int V = (int)this->rNRG.size();
1227  float* ee = this->rNRG.data; // residual energy
1228  float* pp = this->pNRG.data; // residual energy
1229  float EE = 0.; // extracted energy
1230  float E;
1231  float mam[NIFO] _ALIGNED;
1232  float mAM[NIFO] _ALIGNED;
1233  this->pNRG=-1;
1234  for(j=0; j<V; ++j) if(ee[j]>Eo) pp[j]=0;
1235 
1236  __m128* _m00 = (__m128*) mam;
1237  __m128* _m90 = (__m128*) mAM;
1238  __m128* _amp = (__m128*) amp;
1239  __m128* _AMP = (__m128*) AMP;
1240  __m128* _a00 = (__m128*) a_00.data;
1241  __m128* _a90 = (__m128*) a_90.data;
1242 
1243  while(k<K){
1244 
1245  for(j=0; j<V; ++j) if(ee[j]>ee[m]) m=j; // find max pixel
1246  if(ee[m]<=Eo) break; mm = m*f;
1247 
1248  E = _sse_abs_ps(_a00+mm,_a90+mm); EE += E; // get PC energy
1249  int J = wdmMRA.size(m);
1250  float* c = wdmMRA.getXTalk(m); // c1*c2+c3*c4=c1*c3+c2*c4=0
1251 
1252  if(E/EE < 0.01) break; // ignore small PC
1253 
1254  _sse_cpf_ps(mam,_a00+mm); // store a00 for max pixel
1255  _sse_cpf_ps(mAM,_a90+mm); // store a90 for max pixel
1256  _sse_add_ps(_amp+mm,_m00); // update 00 PC
1257  _sse_add_ps(_AMP+mm,_m90); // update 90 PC
1258 
1259  for(j=0; j<J; j++) {
1260  n = int(c[0]+0.1);
1261  if(ee[n]>Eo) {
1262  ee[n] = _sse_rotsub_ps(_m00,c[4],_m90,c[5],_a00+n*f); // subtract PC from a00
1263  ee[n]+= _sse_rotsub_ps(_m00,c[6],_m90,c[7],_a90+n*f); // subtract PC from a90
1264  }
1265  c += 8;
1266  }
1267  pp[m] = _sse_abs_ps(_amp+mm,_AMP+mm); // store PC energy
1268  k++;
1269  }
1270  return k;
1271 #else
1272  return 0;
1273 #endif
1274 }
1275 
1276 inline int network::_sse_mra_ps(float* amp, float* AMP, float Eo, int K) {
1277 // fast multi-resolution analysis inside sky loop
1278 // select max E pixel and either scale or skip it based on the value of residual
1279 // pointer to 00 phase amplitude of monster pixels
1280 // pointer to 90 phase amplitude of monster pixels
1281 // Eo - energy threshold
1282 // K - max number of principle components to extract
1283 // returns number of MRA pixels
1284 
1285 #ifndef __CINT__
1286  int j,n,mm,J;
1287  int k = 0;
1288  int m = 0;
1289  int f = NIFO/4;
1290  int V = (int)this->rNRG.size();
1291  float* ee = this->rNRG.data; // residual energy
1292  float* pp = this->pNRG.data; // PC energy
1293  float* c = NULL;
1294  float E2 = Eo/2; // threshold
1295  float E;
1296  float mam[NIFO] _ALIGNED;
1297  float mAM[NIFO] _ALIGNED;
1298 
1299  __m128* _m00 = (__m128*) mam;
1300  __m128* _m90 = (__m128*) mAM;
1301  __m128* _amp = (__m128*) amp;
1302  __m128* _AMP = (__m128*) AMP;
1303  __m128* _a00 = (__m128*) a_00.data;
1304  __m128* _a90 = (__m128*) a_90.data;
1305 
1306  this->pNRG = 0;
1307 
1308  while(k<K){
1309 
1310  for(j=0; j<V; ++j) if(ee[j]>ee[m]) m=j; // find max pixel
1311  if(ee[m]<=Eo) break; mm = m*f;
1312 
1313  //cout<<k<<" "<<" V= "<<V<<" m="<<m<<" ee[m]="<<ee[m];
1314 
1315  float cc = 0.;
1316 
1317  _sse_zero_ps(_m00);
1318  _sse_zero_ps(_m90);
1319 
1320  J = wdmMRA.size(m);
1321  c = wdmMRA.getXTalk(m); // c1*c2+c3*c4=c1*c3+c2*c4=0
1322  for(j=0; j<J; j++) {
1323  n = int(c[0]+0.1);
1324  if(ee[n]>Eo) {
1325  _sse_rotadd_ps(_a00+n*f,c[4],_a90+n*f,c[6],_m00); // construct 00 vector
1326  _sse_rotadd_ps(_a00+n*f,c[5],_a90+n*f,c[7],_m90); // construct 90 vector
1327  }
1328  if(ee[n]>0) cc += c[1];
1329  c += 8;
1330  }
1331  _sse_mul_ps(_m00,cc>1?1./cc:0.7);
1332  _sse_mul_ps(_m90,cc>1?1./cc:0.7);
1333  E = _sse_abs_ps(_m00,_m90); // get PC energy
1334 
1335  if(E > ee[m]) { // correct overtuning PC
1336  _sse_cpf_ps(mam,_a00+mm); // store a00 for max pixel
1337  _sse_cpf_ps(mAM,_a90+mm); // store a90 for max pixel
1338  }
1339  _sse_add_ps(_amp+mm,_m00); // update 00 PC
1340  _sse_add_ps(_AMP+mm,_m90); // update 90 PC
1341 
1342  J = wdmMRA.size(m);
1343  c = wdmMRA.getXTalk(m); // c1*c2+c3*c4=c1*c3+c2*c4=0
1344  for(j=0; j<J; j++) {
1345  n = int(c[0]+0.1);
1346  if(E<E2 && n!=m) {c+=8; continue;}
1347  if(ee[n]>Eo) {
1348  ee[n] = _sse_rotsub_ps(_m00,c[4],_m90,c[5],_a00+n*f); // subtract PC from a00
1349  ee[n]+= _sse_rotsub_ps(_m00,c[6],_m90,c[7],_a90+n*f); // subtract PC from a90
1350  ee[n]+= 1.e-6;
1351  }
1352  c += 8;
1353  }
1354  pp[m] = _sse_abs_ps(_amp+mm,_AMP+mm)+E2/2; // store PC energy
1355  //cout<<" "<<ee[m]<<" "<<k<<" "<<E<<" "<<EE<<" "<<endl;
1356  //cout<<" "<<m<<" "<<cc<<" "<<ee[m]<<" "<<E<<" "<<pp[m]<<endl;
1357  k++;
1358  }
1359  return k;
1360 #else
1361  return 0;
1362 #endif
1363 }
1364 
1365 inline wavearray<float> network::_avx_norm_ps(float** p, float** q,
1366  std::vector<float*> &pAVX, int I) {
1367  wavearray<float> norm(NIFO+1); // output array for packet norms
1368  float* g = norm.data+1; norm=0.;
1369 
1370 #ifndef __CINT__
1371 
1372 // return packet norm for each detector
1373  int i,j,k,n,m;
1374  int M = abs(I);
1375  int II = abs(I*2);
1376  float o = 1.e-12;
1377  float* mk = pAVX[1]; // pixel energy mask
1378  float* rn = pAVX[22]; // halo noise
1379  wavearray<float> tmp(NIFO); // array to store data
1380  float* t = tmp.data; tmp=0.;
1381  float e,u,v;
1382 
1383  float am[4*8] _ALIGNED; __m128* _am = (__m128*)am;
1384  float x[4*8] _ALIGNED; __m128* _x = (__m128*)x;
1385  float h[4*8] _ALIGNED; __m128* _h = (__m128*)h; // halo
1386 
1387  float* an = pAVX[17]; // M*4*NIFO array
1388  NETX(__m128* _a0 = (__m128*)(an+4*M*0);, __m128* _a1 = (__m128*)(an+4*M*1);,
1389  __m128* _a2 = (__m128*)(an+4*M*2);, __m128* _a3 = (__m128*)(an+4*M*3);,
1390  __m128* _a4 = (__m128*)(an+4*M*4);, __m128* _a5 = (__m128*)(an+4*M*5);,
1391  __m128* _a6 = (__m128*)(an+4*M*6);, __m128* _a7 = (__m128*)(an+4*M*7);)
1392 
1393  for(m=0; m<M; m++) {
1394  if(I>0) rn[m] = 0.;
1395  NETX(_a0[m] = _mm_set_ps(q[0][m],q[0][m],p[0][m],p[0][m]); q[0][M+m]=0; ,
1396  _a1[m] = _mm_set_ps(q[1][m],q[1][m],p[1][m],p[1][m]); q[1][M+m]=0; ,
1397  _a2[m] = _mm_set_ps(q[2][m],q[2][m],p[2][m],p[2][m]); q[2][M+m]=0; ,
1398  _a3[m] = _mm_set_ps(q[3][m],q[3][m],p[3][m],p[3][m]); q[3][M+m]=0; ,
1399  _a4[m] = _mm_set_ps(q[4][m],q[4][m],p[4][m],p[4][m]); q[4][M+m]=0; ,
1400  _a5[m] = _mm_set_ps(q[5][m],q[5][m],p[5][m],p[5][m]); q[5][M+m]=0; ,
1401  _a6[m] = _mm_set_ps(q[6][m],q[6][m],p[6][m],p[6][m]); q[6][M+m]=0; ,
1402  _a7[m] = _mm_set_ps(q[7][m],q[7][m],p[7][m],p[7][m]); q[7][M+m]=0; )
1403  }
1404 
1405  for(m=0; m<M; m++) {
1406  if(mk[m]<=0.) continue;
1407 
1408  int J = wdmMRA.size(m)*2;
1409  float cc = 0;
1410  float* c = wdmMRA.getXTalk(m);
1411  __m128* _c = (__m128*)(c+4);
1412 
1413  NETX(u=p[0][m]; v=q[0][m]; _am[0]=_mm_set_ps(v,u,v,u); _x[0]=_mm_setzero_ps(); ,
1414  u=p[1][m]; v=q[1][m]; _am[1]=_mm_set_ps(v,u,v,u); _x[1]=_mm_setzero_ps(); ,
1415  u=p[2][m]; v=q[2][m]; _am[2]=_mm_set_ps(v,u,v,u); _x[2]=_mm_setzero_ps(); ,
1416  u=p[3][m]; v=q[3][m]; _am[3]=_mm_set_ps(v,u,v,u); _x[3]=_mm_setzero_ps(); ,
1417  u=p[4][m]; v=q[4][m]; _am[4]=_mm_set_ps(v,u,v,u); _x[4]=_mm_setzero_ps(); ,
1418  u=p[5][m]; v=q[5][m]; _am[5]=_mm_set_ps(v,u,v,u); _x[5]=_mm_setzero_ps(); ,
1419  u=p[6][m]; v=q[6][m]; _am[6]=_mm_set_ps(v,u,v,u); _x[6]=_mm_setzero_ps(); ,
1420  u=p[7][m]; v=q[7][m]; _am[7]=_mm_set_ps(v,u,v,u); _x[7]=_mm_setzero_ps(); )
1421 
1422  for(j=0; j<J; j+=2) {
1423  n = int(c[j*4]);
1424  NETX(_x[0]=_mm_add_ps(_x[0],_mm_mul_ps(_c[j],_a0[n]));,
1425  _x[1]=_mm_add_ps(_x[1],_mm_mul_ps(_c[j],_a1[n]));,
1426  _x[2]=_mm_add_ps(_x[2],_mm_mul_ps(_c[j],_a2[n]));,
1427  _x[3]=_mm_add_ps(_x[3],_mm_mul_ps(_c[j],_a3[n]));,
1428  _x[4]=_mm_add_ps(_x[4],_mm_mul_ps(_c[j],_a4[n]));,
1429  _x[5]=_mm_add_ps(_x[5],_mm_mul_ps(_c[j],_a5[n]));,
1430  _x[6]=_mm_add_ps(_x[6],_mm_mul_ps(_c[j],_a6[n]));,
1431  _x[7]=_mm_add_ps(_x[7],_mm_mul_ps(_c[j],_a7[n]));)
1432  }
1433 
1434  NETX(_h[0]=_mm_mul_ps(_x[0],_am[0]);,
1435  _h[1]=_mm_mul_ps(_x[1],_am[1]);,
1436  _h[2]=_mm_mul_ps(_x[2],_am[2]);,
1437  _h[3]=_mm_mul_ps(_x[3],_am[3]);,
1438  _h[4]=_mm_mul_ps(_x[4],_am[4]);,
1439  _h[5]=_mm_mul_ps(_x[5],_am[5]);,
1440  _h[6]=_mm_mul_ps(_x[6],_am[6]);,
1441  _h[7]=_mm_mul_ps(_x[7],_am[7]);)
1442 
1443  NETX(t[0]=h[ 0]+h[ 1]+h[ 2]+h[ 3]; t[0]=t[0]>0?t[0]:0; g[0]+=t[0]; ,
1444  t[1]=h[ 4]+h[ 5]+h[ 6]+h[ 7]; t[1]=t[1]>0?t[1]:0; g[1]+=t[1]; ,
1445  t[2]=h[ 8]+h[ 9]+h[10]+h[11]; t[2]=t[2]>0?t[2]:0; g[2]+=t[2]; ,
1446  t[3]=h[12]+h[13]+h[14]+h[15]; t[3]=t[3]>0?t[3]:0; g[3]+=t[3]; ,
1447  t[4]=h[16]+h[17]+h[18]+h[19]; t[4]=t[4]>0?t[4]:0; g[4]+=t[4]; ,
1448  t[5]=h[20]+h[21]+h[22]+h[23]; t[5]=t[5]>0?t[5]:0; g[5]+=t[5]; ,
1449  t[6]=h[24]+h[25]+h[26]+h[27]; t[6]=t[6]>0?t[6]:0; g[6]+=t[6]; ,
1450  t[7]=h[28]+h[29]+h[30]+h[31]; t[7]=t[7]>0?t[7]:0; g[7]+=t[7]; )
1451 
1452  if(I<0) continue;
1453 
1454  NETX(u=p[0][m]; v=q[0][m]; e=(u*u+v*v)/(t[0]+o); q[0][M+m]=(e>=1)?0:e; ,
1455  u=p[1][m]; v=q[1][m]; e=(u*u+v*v)/(t[1]+o); q[1][M+m]=(e>=1)?0:e; ,
1456  u=p[2][m]; v=q[2][m]; e=(u*u+v*v)/(t[2]+o); q[2][M+m]=(e>=1)?0:e; ,
1457  u=p[3][m]; v=q[3][m]; e=(u*u+v*v)/(t[3]+o); q[3][M+m]=(e>=1)?0:e; ,
1458  u=p[4][m]; v=q[4][m]; e=(u*u+v*v)/(t[4]+o); q[4][M+m]=(e>=1)?0:e; ,
1459  u=p[5][m]; v=q[5][m]; e=(u*u+v*v)/(t[5]+o); q[5][M+m]=(e>=1)?0:e; ,
1460  u=p[6][m]; v=q[6][m]; e=(u*u+v*v)/(t[6]+o); q[6][M+m]=(e>=1)?0:e; ,
1461  u=p[7][m]; v=q[7][m]; e=(u*u+v*v)/(t[7]+o); q[7][M+m]=(e>=1)?0:e; )
1462 
1463  NETX(u=x[ 0]+x[ 2]; v=x[ 1]+x[ 3]; rn[m]+=u*u+v*v; ,
1464  u=x[ 4]+x[ 6]; v=x[ 5]+x[ 7]; rn[m]+=u*u+v*v; ,
1465  u=x[ 8]+x[10]; v=x[ 9]+x[11]; rn[m]+=u*u+v*v; ,
1466  u=x[12]+x[14]; v=x[13]+x[15]; rn[m]+=u*u+v*v; ,
1467  u=x[16]+x[18]; v=x[17]+x[19]; rn[m]+=u*u+v*v; ,
1468  u=x[20]+x[22]; v=x[21]+x[23]; rn[m]+=u*u+v*v; ,
1469  u=x[24]+x[26]; v=x[25]+x[27]; rn[m]+=u*u+v*v; ,
1470  u=x[28]+x[30]; v=x[29]+x[31]; rn[m]+=u*u+v*v; )
1471 
1472  }
1473 
1474  for(n=1; n<=XIFO; n++) { // save norms
1475  if(I>0) {
1476  e = q[n-1][II+4]*q[n-1][II+4]; // TF-Domain SNR
1477  if(norm.data[n]<2.) norm.data[n]=2;
1478  q[n-1][II+5] = norm.data[n]; // save norms
1479  norm.data[n] = e/norm.data[n]; // detector {1:NIFO} SNR
1480  }
1481  norm.data[0] += norm.data[n]; // total SNR
1482  }
1483 #endif
1484  return norm;
1485 }
1486 
1487 inline wavearray<float> network::_avx_norm_ps(float** p, float** q, float* ec, int I) {
1488 // use GW norm from data packet
1489 // p - GW array
1490 // q - Data array
1491  float e;
1492  int II = abs(I*2);
1493  wavearray<float> norm(NIFO+1); // array for packet norms
1494  float* nn = norm.data; // array for packet norms
1495  norm = 0;
1496  for(int n=1; n<=XIFO; n++) { // save norms
1497  nn[n] = q[n-1][II+5]; // get data norms
1498  p[n-1][II+5] = nn[n]; // save norms
1499  e = p[n-1][II+4]*p[n-1][II+4]; // TF-Domain SNR
1500  nn[n] = e/nn[n]; // detector {1:NIFO} SNR
1501  nn[0] += nn[n]; // total SNR
1502  for(int i=0; i<I; i++) { // save signal norms
1503  p[n-1][I+i] = ec[i]>0 ? q[n-1][I+i] : 0.; // set signal norms
1504  }
1505  }
1506  return norm;
1507 }
1508 
1509 inline void network::_avx_saveGW_ps(float** p, float** q, int I) {
1510 // save GW strain amplitudes into a_00, a_90 arrays
1511 // p,q - input - GW warray
1512 // I - number of GW pixels
1513 // in likelihoodWP these arrays should be stored exactly in the same order.
1514 
1515  for(int i=0; i<I; i++) {
1516  for(int n=0; n<NIFO; n++) {
1517  a_00[i*NIFO+n]=p[n][i];
1518  a_90[i*NIFO+n]=q[n][i];
1519  }
1520  }
1521  return;
1522 }
1523 
1524 #endif // NETWORK_HH
wavearray< double > t(hp.size())
monster wdmMRA
list of pixel pointers for MRA
Definition: network.hh:651
std::vector< char * > ifoName
Definition: network.hh:609
size_t mdcTypeSize()
Definition: network.hh:410
wavearray< short > veto
Definition: network.hh:644
detector * getifo(size_t n)
param: detector index
Definition: network.hh:436
static float _sse_abs_ps(__m128 *_a)
Definition: watsse.hh:137
double netCC
Definition: network.hh:596
#define NIFO
Definition: wat.hh:74
size_t nLag
Definition: network.hh:573
double start
Definition: network.hh:55
static double g(double e)
Definition: GNGen.cc:116
wavearray< double > skyHole
Definition: network.hh:643
void like(char _LIKE)
buffer for standard response 90 ampl
Definition: network.hh:666
WSeries< double > pixeLHood
Definition: network.hh:634
double M
Definition: DrawEBHH.C:13
std::vector< netcluster > wc_List
Definition: network.hh:610
void set2or(double p)
param: threshold
Definition: network.hh:471
std::vector< double > * getmdcTime()
Definition: network.hh:422
static void cpp_(float *&, float **)
Definition: network.hh:1118
double delta
static float rots(float *, float, float *, float, float *)
Definition: network.hh:1077
std::vector< pixel > cluster
Definition: wavepath.hh:61
double THRESHOLD
#define _ALIGNED
Definition: wat.hh:71
wavearray< double > a(hp.size())
size_t setSkyMask(double, char *, bool *, int)
Definition: CreateSkyMask.C:72
WSeries< float > v[nIFO]
Definition: cwb_net.C:80
static void mulx(double **, size_t, double **, size_t, double *)
Definition: network.hh:946
static void inix(double **, size_t, double *)
Definition: network.hh:1006
void wdm(bool _WDM)
Definition: network.hh:667
double Gamma(double r)
Definition: watfun.hh:193
static void pnpx(float *fp, float *fx, float *am, float *AM, float *u, float *v)
Definition: network.hh:1171
int n
Definition: cwb_net.C:28
static void _sse_zero_ps(__m128 *_p)
Definition: watsse.hh:44
skymap nSkyStat
Definition: network.hh:628
wavearray< float > _avx_norm_ps(float **, float **, std::vector< float *> &, int)
Definition: network.hh:1365
std::vector< vectorD > NDM
Definition: network.hh:603
wavearray< float > a_90
buffer for cluster sky 00 amplitude
Definition: network.hh:653
double iGamma(double r, double p)
Definition: watfun.hh:205
static void _sse_dsp4_ps(__m128 *u, __m128 *v, __m128 *_am, __m128 *_AM, __m128 *_u, __m128 *_v)
Definition: watsse.hh:662
size_t nRun
Definition: network.hh:572
double getliveTime(size_t n)
Definition: network.hh:428
int ID
Definition: TestMDC.C:70
double getmdcTime(size_t n)
Definition: network.hh:424
skymap nPenalty
Definition: network.hh:624
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 bpp
Definition: test_config1.C:22
static void _sse_cpf4_ps(__m128 *_aa, __m128 *_pp)
Definition: watsse.hh:317
int _sse_mra_ps(float *, float *, float, int)
Definition: network.hh:1276
float theta
WDM< double > wdm(nLAYERS, nLAYERS, 6, 10)
bool eDisbalance
Definition: network.hh:598
std::vector< netpixel * > pList
Definition: network.hh:650
string getmdcType(size_t n)
Definition: network.hh:420
skymap nAntenaPrior
Definition: network.hh:632
static float _sse_rotsub_ps(__m128 *_u, float c, __m128 *_v, float s, __m128 *_a)
Definition: watsse.hh:399
void _avx_saveGW_ps(float **, float **, int)
Definition: network.hh:1509
std::vector< std::string > mdcType
Definition: network.hh:613
size_t mIFO
Definition: network.hh:575
STL namespace.
skymap nPolarisation
Definition: network.hh:630
string getmdcList(size_t n)
Definition: network.hh:418
static void _sse_cpf_ps(float *a, __m128 *_p)
Definition: watsse.hh:307
int m
Definition: cwb_net.C:28
std::vector< size_t > mdc__ID
Definition: network.hh:615
int j
Definition: cwb_net.C:28
static double rotx(double *, double, double *, double, double *)
Definition: network.hh:1042
i drho i
std::vector< double > mdcTime
Definition: network.hh:614
size_t cluster(int kt, int kf)
param: time gap in pixels return: number of reconstructed clusters
Definition: network.hh:321
void setRunID(size_t n)
param: run
Definition: network.hh:455
std::vector< double > vectorD
Definition: network.hh:51
std::vector< detector * > ifoList
Definition: network.hh:608
static void _sse_rotadd_ps(__m128 *_u, float c, __m128 *_v, float s, __m128 *_a)
Definition: watsse.hh:388
long subNetCut(network *net, int lag, float snc, TH2F *hist)
SUPERCLUSTER.
size_t mdcListSize()
Definition: network.hh:408
cout<< "SNR "<< xsnr<< endl;wavearray< double > f
Definition: ComputeSNR.C:75
size_t mdcTimeSize()
Definition: network.hh:412
wavearray< double > skyENRG
Definition: network.hh:646
size_t wdmListSize()
Definition: network.hh:446
r add(tfmap, const_cast< char *>("hchannel"))
skymap nCorrEnergy
Definition: network.hh:625
double Edge
Definition: network.hh:578
size_t events(int type, int lag=-1)
Definition: network.hh:341
virtual void Browse(TBrowser *)
Definition: network.hh:516
size_t ifoListSize()
Definition: network.hh:431
void constraint(double d=1., double g=0.0001)
param: constraint parameter, p=0 - no constraint
Definition: network.hh:463
WDM< double > * getwdm(size_t M)
param: number of wdm layers
Definition: network.hh:448
static int netx(double *, double, double *, double, double)
Definition: network.hh:830
double aNET
Definition: network.hh:580
skymap nLikelihood
Definition: network.hh:622
bool optim
Definition: network.hh:590
size_t mode
wavearray< float > pNRG
buffers for cluster residual energy
Definition: network.hh:655
float phi
double precision
Definition: network.hh:593
std::vector< delayFilter > filter90
Definition: network.hh:638
static double divx(double *, double *)
Definition: network.hh:817
void Forward(size_t k)
param: number of steps
Definition: network.hh:89
int _sse_MRA_ps(network *net, float *amp, float *AMP, float Eo, int K)
static void dspx(float *u, float *v, float *am, float *AM)
Definition: network.hh:1184
std::vector< double > livTime
Definition: network.hh:611
wavearray< double > h
Definition: Regression_H1.C:25
static void addx(double *, double *, double *)
Definition: network.hh:910
bool local
Definition: network.hh:589
r setFilter(10)
i() int(T_cor *100))
std::vector< std::string > mdcList
Definition: network.hh:612
static void dpfx(float *fp, float *fx)
Definition: network.hh:1155
double * tmp
Definition: testWDM_5.C:31
double eCOR
Definition: network.hh:582
void setRMS()
Definition: network.hh:679
wavearray< float > a_00
wdm multi-resolution analysis
Definition: network.hh:652
std::vector< WDM< double > * > wdmList
Definition: network.hh:617
double gNET
Definition: network.hh:579
int l
char fname[1024]
static void cpf_(float *&a, double **p)
Definition: network.hh:1104
size_t mdc__IDSize()
Definition: network.hh:414
double Step
Definition: network.hh:577
void delink()
Definition: network.hh:354
double acor
static void pnt_(float **, float **, short **, int, int)
Definition: network.hh:1091
int k
int pattern
Definition: network.hh:601
void setOffset(double t)
param: run
Definition: network.hh:459
void Inverse(size_t k)
Definition: network.hh:91
std::vector< waveSegment > segList
Definition: network.hh:616
int _sse_mra_ps(network *NET, float *amp, float *AMP, float Eo, int K)
wavearray< int > index
Definition: network.hh:640
double acor
Definition: network.hh:585
static double dot32(std::vector< float > *, double *, std::vector< short > *)
Definition: network.hh:1125
double F
int getIndex(double theta, double phi)
param: theta [deg] param: phi [deg]
Definition: network.hh:207
Definition: skymap.hh:63
double e2or
Definition: network.hh:584
double e
wavearray< double > skyProb
Definition: network.hh:645
void setAcore(double a)
Definition: network.hh:401
WSeries< double > whp
Definition: network.hh:605
char like()
Definition: network.hh:512
size_t events()
Definition: network.hh:329
s s
Definition: cwb_net.C:155
static double rot4(double *, double, double *, double, double *)
Definition: network.hh:1068
int index
Definition: network.hh:54
bool _WDM
Definition: network.hh:668
std::vector< delayFilter > filter
Definition: network.hh:637
bool wfsave
Definition: network.hh:600
WSeries< double > pixeLNull
Definition: network.hh:635
double pSigma
Definition: network.hh:594
skymap nAlignment
Definition: network.hh:620
double T
Definition: testWDM_4.C:11
static void _sse_add_ps(__m128 *_a, __m128 *_b)
Definition: watsse.hh:248
WSeries< double > whx
Definition: network.hh:606
static double dot4(double *, double *)
Definition: network.hh:734
skymap nDisbalance
Definition: network.hh:627
double getNDM(size_t i, size_t j)
param: first detector param: second detector
Definition: network.hh:140
size_t add(WDM< double > *wdm)
param: pointer to wdm return number of wdm tronsforms in the list
Definition: network.hh:444
bool pOUT
Definition: network.hh:586
double norm
Definition: network.hh:583
iD print()
size_t livTimeSize()
Definition: network.hh:416
double gamma
Definition: network.hh:592
wavearray< double > skyMaskCC
Definition: network.hh:642
netcluster * getwc(size_t n)
param: delay index
Definition: network.hh:439
skymap nNetIndex
Definition: network.hh:626
skymap nSensitivity
list of wdm tranformations
Definition: network.hh:619
int _sse_MRA_ps(float *, float *, float, int)
Definition: network.hh:1212
static double dotx(double *, double *)
Definition: network.hh:708
static void _sse_mul_ps(__m128 *_a, float b)
Definition: watsse.hh:56
DataType_t * data
Definition: wavearray.hh:319
wavearray< float > rNRG
buffer for cluster sky 90 amplitudes
Definition: network.hh:654
long nSky
Definition: network.hh:574
size_t wc_ListSize()
Definition: network.hh:433
void setMRAcatalog(char *fn)
Definition: network.hh:315
double rTDF
Definition: network.hh:576
skymap nNullEnergy
Definition: network.hh:623
wavearray< short > skyMask
Definition: network.hh:641
skymap nCorrelation
Definition: network.hh:621
size_t getmdc__ID(size_t n)
Definition: network.hh:426
bool MRA
Definition: network.hh:599
double penalty
Definition: network.hh:595
double stop
Definition: network.hh:56
double delta
Definition: network.hh:591
bool wdm()
Definition: network.hh:510
char _LIKE
Definition: network.hh:669
char tYPe
Definition: network.hh:588
double netRHO
Definition: network.hh:597
static void _sse_dpf4_ps(__m128 *_Fp, __m128 *_Fx, __m128 *_fp, __m128 *_fx)
Definition: watsse.hh:631
skymap nProbability
Definition: network.hh:631
static double sumx(double *)
Definition: network.hh:695
static void _sse_pnp4_ps(__m128 *_fp, __m128 *_fx, __m128 *_am, __m128 *_AM, __m128 *_u, __m128 *_v)
Definition: watsse.hh:641
bool EFEC
Definition: network.hh:587
double iNET
Definition: network.hh:581
exit(0)
skymap nEllipticity
Definition: network.hh:629