Logo coherent WaveBurst  
Library Reference Guide
Logo
monster.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 MONSTER_HH
20 #define MONSTER_HH
21 
22 #include "WDM.hh"
23 #include "netcluster.hh"
24 #include "wavearray.hh"
25 #include <algorithm>
26 #include "stdint.h"
27 
28 using namespace std;
29 
30 struct xtalk{int index; float CC[4];}; // AA, AQ, QA, QQ
31 
32 struct xtalkArray{struct xtalk* data; int size;};
33 
34 typedef vector<xtalk> vector_XT;
35 
36 //template <class T>
37 class monster{
38 public:
39 
40  // dummy constructor
41  monster();
42 
43  // constructor; computes catalog
44  //! param: array of pointers to WDM transforms
45  //! param: number of WDM transforms in the array
46  monster(WDM<double>** wdm, int nRes);
47 
48  // constructor; reads catalog from file
49  //! param: catalog file name
50  monster(char* filename);
51 
52  // copy constructor
53  //! param: object to be copied
54  monster(const monster& x);
55 
56  // destructor
57  virtual ~monster();
58 
59  // release memory used by the catalog
60  void deallocate();
61 
62  // write the catalog to file
63  //! param: file name
64  void write(char* filename);
65 
66  // read catalog from file
67  //! param: file name
68  void read(char* filename);
69 
70 
71  // returns the overlap values for two pixels
72  //! param: numbers of layers identifying the resolution of the first pixel
73  //! param: TF map index of the first pixel
74  //! param: numbers of layers identifying the resolution of the second pixel
75  //! param: TF map index of the second pixel
76  //! return: xtalk structure, use the CC values (coupling coefficients)
77  xtalk getXTalk(int nLay1, size_t indx1, int nLay2, size_t indx2);
78 
79  // same as above but now the quadratures are specified, too (quad1, quad2)
80  // returns the corresponding overlap (coupling coefficient)
81  float getXTalk(int nLay1, int quad1, size_t indx1, int nLay2, int quad2, size_t indx2);
82 
83  // FILL cluster overlap amplitudes
84  //! param: pointer to netcluster structure
85  //! param: which cluster to process
86  //! param: check TD vectors or not
87  //! return list of pixel IDs
88  std::vector<int> getXTalk(netcluster* pwc, int id, bool check=true);
89 
90  // get xtalk size - number of neighbour pixel including the main one
91  inline int size() {
92  if(clusterCC.size()!=sizeCC.size()) exit(1);
93  return clusterCC.size();
94  }
95 
96  // get xtalk vector size for pixel m
97  inline int size(int m) {
98  return sizeCC[m];
99  }
100 
101  // get pointer to xtalk vector for pixel m
102  inline float* getXTalk(int m) {
103  return clusterCC[m];
104  }
105 
106  // returns 4 x-talk coefficients between pixels p1 and p2
108  return getXTalk(p1->layers, p1->time, p2->layers, p2->time);
109  }
110 
111 
112  //void PrintSums();
113 
114 //protected:
115  xtalkArray (***catalog)[2]; // stores overlap values [r1][r2][r1_freq][parity] ; r2<=r1
116  int tag; // catalog tag number
117  int nRes; // number of resolutions
118  int BetaOrder; // beta function order for Meyer
119  int precision; // wavelet precision
120  int KWDM; // WDM K - parameter K/M
121  int* layers; //! M for each resolution
122  std::vector<float*> clusterCC; // cluster coupling coefficients
123  std::vector<int> sizeCC; // size of the vector for cluster coupling coefficients
124 
125  // used by THtml doc
126  ClassDef(monster,3)
127 };
128 
129 
130 #endif
int KWDM
Definition: monster.hh:120
int index
Definition: monster.hh:30
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
vector< xtalk > vector_XT
Definition: monster.hh:34
float * getXTalk(int m)
Definition: monster.hh:102
STL namespace.
size_t layers
Definition: netpixel.hh:112
int m
Definition: cwb_net.C:28
std::vector< int > sizeCC
Definition: monster.hh:123
watplot p2(const_cast< char *>("TFMap2"))
Definition: monster.hh:30
watplot p1(const_cast< char *>("TFMap1"))
int size(int m)
Definition: monster.hh:97
xtalk getXTalk(netpixel *p1, netpixel *p2)
Definition: monster.hh:107
size_t time
Definition: netpixel.hh:110
int size()
Definition: monster.hh:91
std::vector< float * > clusterCC
M for each resolution.
Definition: monster.hh:122
int * layers
Definition: monster.hh:121
int tag
Definition: monster.hh:116
int nRes
Definition: monster.hh:117
int size
Definition: monster.hh:32
int BetaOrder
Definition: monster.hh:118
int check
exit(0)
int precision
Definition: monster.hh:119