Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
wavepath.hh
Go to the documentation of this file.
1 /**********************************************************
2  * Package: wavegraph Class Library
3  * File name: wavepath.hh
4  * Authors: Eric Chassande-Mottin, Eric O. Le Bigot
5  **********************************************************/
6 
7 #ifndef WAVEPATH_HH
8 #define WAVEPATH_HH
9 
10 #include <math.h>
11 #include <vector>
12 #include <set>
13 #include <iostream>
14 #include <string>
15 #include <algorithm>
16 
17 #include "TNamed.h"
18 
19 typedef std::set<int> nodeids;
20 
21 typedef struct {
22  int nodeid; // node id (should match node rank in the graph -- stored for debugging purpose)
23  int timeix; // time index
24  int freqix; // freq index
25  int scaleix; // scale index
26  double value_avg; // node average value
27  double value_stdev; // value standard deviation
28  bool is_endnode; // flag is true if node is an end node
29  nodeids ancestors; // ids of the node ancestors
30 } wavenode;
31 
32 typedef struct {
33  int scaleix; // scale index
34  int timeix; // time index
35  int freqix; // freq index
36  int log2scale; // scale
37  int nodeid; // node ID
38  double time; // time (sec)
39  double freq; // freq (Hz)
40 } pixel;
41 
42 typedef std::vector<wavenode> nodes;
43 typedef std::vector<pixel> cluster;
44 
45 class wavepath : public TNamed {
46 public:
47 
48  wavepath() {};
49  ~wavepath() {};
50 
51  int length() {return path.size();}
52 
53  int nodeid(int id) {return path[id].nodeid;}
54 
55  int time(int id) {return path[id].timeix;}
56 
57  int freq(int id) {return path[id].freqix;}
58 
59  int scale(int id) {return path[id].scaleix;}
60 
61  double get_weight() {return weight;}
62  double get_weight() const {return weight;}
63 
64  int is_endnode(int id) {return path[id].is_endnode;}
65 
66  void clear(){offset=0; weight=0.0; path.clear();}
67 
68  void init(const wavenode node, const int offset, const int refscaleidx, const double path_weight);
69 
70  void add_node(const wavenode node);
71 
72  void print();
73 
74  cluster convert_to_cluster(const int scalemin, const double fs, const int path_width);
75 
76 private:
77 
78  nodes path; // list of nodes in the path
79  int offset; // time origin of the path in the full data segment
80  // offset corresponds to an number of pixels in the reference scale plane
81  int refscaleidx; // index of the reference scale
82  double weight; // total weight carried by the pixels in the path
83 
84  ClassDef(wavepath,0);
85 
86 };
87 
88 bool compare_paths(const wavepath& path1, const wavepath& path2);
89 std::vector<cluster> select_clusters_distinct_in_time(std::vector<cluster>& clusters,const double precision);
90 
91 #endif
double value_stdev
Definition: wavepath.hh:27
double time
Definition: wavepath.hh:38
int nodeid
Definition: wavepath.hh:37
int refscaleidx
Definition: wavepath.hh:81
std::vector< pixel > cluster
Definition: wavepath.hh:43
wavepath()
Definition: wavepath.hh:48
int length()
Definition: wavepath.hh:51
void init(const wavenode node, const int offset, const int refscaleidx, const double path_weight)
Definition: wavepath.cc:45
std::vector< cluster > select_clusters_distinct_in_time(std::vector< cluster > &clusters, const double precision)
Definition: wavepath.cc:148
int is_endnode(int id)
Definition: wavepath.hh:64
int scaleix
Definition: wavepath.hh:25
double get_weight() const
Definition: wavepath.hh:62
std::set< int > nodeids
Definition: wavepath.hh:19
int timeix
Definition: wavepath.hh:23
~wavepath()
Definition: wavepath.hh:49
int nodeid
Definition: wavepath.hh:22
double precision
int scaleix
Definition: wavepath.hh:33
bool is_endnode
Definition: wavepath.hh:28
int log2scale
Definition: wavepath.hh:36
int nodeid(int id)
Definition: wavepath.hh:53
int freqix
Definition: wavepath.hh:35
void clear()
Definition: wavepath.hh:66
int time(int id)
Definition: wavepath.hh:55
int offset
Definition: wavepath.hh:79
double value_avg
Definition: wavepath.hh:26
nodes path
Definition: wavepath.hh:78
double weight
Definition: wavepath.hh:82
int timeix
Definition: wavepath.hh:34
int freqix
Definition: wavepath.hh:24
void add_node(const wavenode node)
Definition: wavepath.cc:63
double freq
Definition: wavepath.hh:39
double get_weight()
Definition: wavepath.hh:61
Long_t id
int scale(int id)
Definition: wavepath.hh:59
cluster convert_to_cluster(const int scalemin, const double fs, const int path_width)
Definition: wavepath.cc:85
bool compare_paths(const wavepath &path1, const wavepath &path2)
Definition: wavepath.cc:5
std::vector< wavenode > nodes
Definition: wavepath.hh:42
int freq(int id)
Definition: wavepath.hh:57
nodeids ancestors
Definition: wavepath.hh:29
void print()
Definition: wavepath.cc:73