Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gwseries.cc
Go to the documentation of this file.
1 #include "gwseries.hh"
2 
3 ClassImp(gWSeries<double>)
4 
5 
6 //______________________________________________________________________________
7 /* Begin_Html
8 <center><h2>gWSeries class</h2></center>
9 This class gWSeries is derived from the WSeries class
10 It uses the methods implemented in gwavearray and the scalogram plot
11 
12 <p>
13 <h3><a name="example">Example</a></h3>
14 <p>
15 The macro <a href="./tutorials/gwat/DrawGWSeries.C.html">DrawGWSeries.C</a> is an example which shown how to use the gWSeries class.<br>
16 The pictures below gives the macro output plots.<br>
17 <p>
18 
19 End_Html
20 
21 Begin_Macro
22 DrawGWSeries.C
23 End_Macro */
24 
25 
26 using namespace std;
27 
28 
29 //______________________________________________________________________________
30 // destructor
31 template<class DataType_t>
32 gWSeries<DataType_t>::~gWSeries()
33 {
34  if(gw!=NULL) delete gw;
35 
36  if(wsextern) {
37  this->data = NULL;
38  this->pWavelet = NULL;
39  }
40 
41 // if(wts!=NULL) delete wts;
42 }
43 
44 //______________________________________________________________________________
45 template<class DataType_t>
47 WSeries<DataType_t>(w) {this->Init();wsextern=false;}
48 
49 //______________________________________________________________________________
50 template<class DataType_t>
52 {
53  wsextern = true;
54 
55  this->data = w->data;
56  this->Rate = w->rate();
57  this->Size = w->size();
58  this->Start = w->start();
59  this->Stop = w->start() + w->size()/w->rate();
60  this->Slice = std::slice(0,w->size(),1);
61 
62  this->pWavelet = w->pWavelet;
63  this->bpp = w->getbpp();
64  this->wRate = w->wRate;
65  this->f_low = w->getlow();
66  this->f_high = w->gethigh();
67  this->w_mode = w->w_mode;
68 
69  this->Init();
70 }
71 
72 //______________________________________________________________________________
73 template<class DataType_t>
75 
76  wavearray<DataType_t>* p = this;
77  gw = new gwavearray<DataType_t>(p);
78 
79  gRandom->SetSeed(0);
80  rnID = int(gRandom->Rndm(13)*1.e9); // random name ID
81 
82 // wts=NULL;
83 }
84 
85 //______________________________________________________________________________
86 template<class DataType_t>
88 //
89 // Draw waveform scalogram
90 //
91 // Input:
92 // options - draw options (same as TH2D)
93 //
94 // return pointer to watplot object
95 //
96 
97  double tStart,tStop;
98  if(options.Contains("FULL")) {
99  options.ReplaceAll("FULL","");
100  tStart=this->start();
101  tStop=this->start()+this->size()/this->rate();
102  } else {
103  GetTimeRange(tStart, tStop);
104  }
105 
106  watplot* wts = GetWATPLOT();
107  if(wts!=NULL) delete wts;
108 
109  char name[32];sprintf(name,"sg-%d",rnID);
110  wts = new watplot(const_cast<char*>(name));
111  WSeries<DataType_t>* ws = x!=NULL ? x : this;
112  wts->plot(ws, 2, tStart, tStop,const_cast<char*>("COLZ"));
113 
114  double fLow = 32.;
115  double fHigh = this->rate()/2.;
116  wts->hist2D->GetYaxis()->SetRangeUser(fLow,fHigh);
117 
118  gw->SetWATPLOT(wts);
119 
120  return wts;
121 }
122 
123 // instantiations
124 
125 #define CLASS_INSTANTIATION(class_) template class gWSeries< class_ >;
126 
127 //CLASS_INSTANTIATION(short)
128 //CLASS_INSTANTIATION(int)
129 //CLASS_INSTANTIATION(unsigned int)
130 //CLASS_INSTANTIATION(long)
131 //CLASS_INSTANTIATION(long long)
132 //CLASS_INSTANTIATION(float)
133 CLASS_INSTANTIATION(double)
134 
virtual size_t size() const
Definition: wavearray.hh:127
void Init()
Definition: ChirpMass.C:280
double fHigh
virtual void rate(double r)
Definition: wavearray.hh:123
par[0] name
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
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
double bpp
Definition: test_config1.C:22
STL namespace.
Long_t size
virtual void start(double s)
Definition: wavearray.hh:119
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
Definition: watplot.cc:132
gts GetWATPLOT() -> canvas->cd()
TH2F * hist2D
Definition: watplot.hh:175
double wRate
Definition: wseries.hh:444
wavearray< double > w
Definition: Test1.C:27
gWSeries< double > gw(w)
double getlow() const
Definition: wseries.hh:111
double getbpp() const
Definition: wseries.hh:99
size_t w_mode
Definition: wseries.hh:440
i() int(T_cor *100))
void Init()
Definition: gwseries.cc:74
int Rate
#define CLASS_INSTANTIATION(class_)
Definition: gwseries.cc:125
double gethigh() const
Definition: wseries.hh:118
char options[256]
watplot * DrawSG(TString options="")
Definition: gwseries.hh:44
double fLow
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
DataType_t * data
Definition: wavearray.hh:301
WaveDWT< DataType_t > * pWavelet
Definition: wseries.hh:438
int rnID
bool wsextern
Definition: gwseries.hh:82
gWSeries()
Definition: gwseries.hh:21