Logo coherent WaveBurst  
Library Reference Guide
Logo
WDMOverlap.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Sergey Klimenko, Valentin Necula
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 #ifndef WDMOVERLAP_HH
20 #define WDMOVERLAP_HH
21 
22 #include "WDM.hh"
23 #include "netcluster.hh"
24 #include <algorithm>
25 #include "stdint.h"
26 
27 using namespace std;
28 
29 struct overlaps{int32_t index; float ovlpAA, ovlpAQ, ovlpQA, ovlpQQ;};
30 struct ovlArray{struct overlaps* data; int size;};
31 
32 template <class T>
33 class WDMOverlap{
34 public:
35 
36  // default constructor
37  WDMOverlap();
38 
39  // constructor that builds the catalog
40  //! param: vector of pointers to WDM objects
41  //! param: number of pointers (resolutions)
42  //! param: threshold on overlap values
43  WDMOverlap(WDM<T>** wdm, int nRes, double minOvlp = 0.01);
44 
45  // constructor that reads the catalog from a file
46  //! param: filename
47  WDMOverlap(char* filename);
48 
49  // copy constructor
50  //! param: other WDMOverlap object
51  WDMOverlap(const WDMOverlap<T>& x);
52 
53  // destructor
54  virtual ~WDMOverlap();
55 
56  // performs memory deallocation
57  void deallocate();
58 
59  // write to file
60  //! param: filename
61  void write(char* filename);
62 
63  // read from file
64  //! param: filename
65  void read(char* filename);
66 
67  // access function that returns all 4 overlap values between two pixels
68  //! param: defines resolution 1 (by number of layers)
69  //! param: defines pixel 1 at resolution 1
70  //! param: defines resolution 2 (by number of layers)
71  //! param: defines pixel 2 at resolution 2
72  // returns a struct overlap containing the four possible combinations
73  // amplitude-amplitude, amplitude-quadrature, quadrature-amplitude, quad-quad
74  struct overlaps getOverlap(int nLay1, size_t indx1, int nLay2, size_t indx2);
75 
76  // access function that returns one overlap value between two pixels
77  //! param: defines resolution 1 (by number of layers)
78  //! param: defines whether it's amplitude (0) or quadrature (1) for resolution 1
79  //! param: defines pixel 1 at resolution 1
80  //! param: defines whether it's amplitude (0) or quadrature (1) for resolution 2
81  //! param: defines resolution 2 (by number of layers)
82  //! param: defines pixel 2 at resolution 2
83  // returns the overlap value
84  float getOverlap(int nLay1, int quad1, size_t indx1, int nLay2, int quad2, size_t indx2); //quad: 0/1, 1 for quadrature
85 
86  // FILL cluster overlap amplitudes
87  //! param: pointer to netcluster structure
88  //! param: which cluster to process
89  //! param: number of pixels to process
90  //! param: address where to store the values (format: vector<vector<struct overlap> > )
91  void getClusterOverlaps(netcluster* pwc, int clIndex, int nPix, void* q);
92 
93  //void PrintSums();
94 
95 //protected:
96  struct ovlArray (***catalog)[2]; // stores overlap values [r1][r2][r1_freq][parity] ; r2<=r1
97  int nRes; // number of resolutions
98  int* layers; // M for each resolution
99 
100 // ClassDef(WDMOverlap,1)
101 
102 };
103 
104 #endif
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
WDM< double > wdm(nLAYERS, nLAYERS, 6, 10)
netcluster * pwc
Definition: cwb_job_obj.C:38
STL namespace.
int * layers
Definition: WDMOverlap.hh:98
Definition: WDM.hh:42
wavearray< int > index
float ovlpQQ
Definition: WDMOverlap.hh:29
int size
Definition: WDMOverlap.hh:30