Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_MakeScalogram.C
Go to the documentation of this file.
1 #define XIFO 4
2 
3 #pragma GCC system_header
4 
5 #include "cwb.hh"
6 #include "config.hh"
7 #include "network.hh"
8 #include "wavearray.hh"
9 #include "TString.h"
10 #include "TObjArray.h"
11 #include "TObjString.h"
12 #include "TRandom.h"
13 #include "Toolbox.hh"
14 #include "watplot.hh"
15 
16 void
18 //!DISPLAY_SPECTRA
19 // Plugin to produce scalograms of input data
20 
21  cout << endl;
22  cout << "-----> CWB_Plugin_MakeScalogram.C" << endl;
23  cout << "ifo " << ifo.Data() << endl;
24  cout << "type " << type << endl;
25  cout << endl;
26 
27 // CWB_PLUGIN stage = CWB_PLUGIN_STRAIN;
28 // CWB_PLUGIN stage = CWB_PLUGIN_MDC;
29 // CWB_PLUGIN stage = CWB_PLUGIN_STRAIN_AND_MDC;
31 
32  if(type==stage) {
33  TString data_type="unknown";
34  if(stage==CWB_PLUGIN_STRAIN) data_type="strain";
35  if(stage==CWB_PLUGIN_MDC) data_type="mdc";
36  if(stage==CWB_PLUGIN_STRAIN_AND_MDC) data_type="strain_and_mdc";
37  if(stage==CWB_PLUGIN_WHITE) data_type="white";
38 
39  bool isWavearray=false;
40  if(TString(cfg->analysis)=="1G") {
41  if(stage==CWB_PLUGIN_STRAIN) isWavearray=true;
42  if(stage==CWB_PLUGIN_MDC) isWavearray=true;
43  if(stage==CWB_PLUGIN_STRAIN_AND_MDC) isWavearray=false;
44  if(stage==CWB_PLUGIN_WHITE) isWavearray=false;
45  }
46  if(TString(cfg->analysis)=="2G") {
47  if(stage==CWB_PLUGIN_STRAIN) isWavearray=true;
48  if(stage==CWB_PLUGIN_MDC) isWavearray=true;
49  if(stage==CWB_PLUGIN_STRAIN_AND_MDC) isWavearray=true;
50  if(stage==CWB_PLUGIN_WHITE) isWavearray=true;
51  }
52 
53  WSeries<double>* w = NULL;
54  if(isWavearray) { // x is a wavearray
55  // input x is a wavearray and must be converted in a WSeries<double> type and apply Forward
56  cout << "Input data is a wavearray" << endl;
57  Meyer<double> S(1024,2);
58  w = new WSeries<double>();
59  w->Forward(*x,S,cfg->levelD);
60  } else { // x is wseries
61  cout << "Input data is a wseries" << endl;
62  w = x;
63  }
64 
65  cout << "Decomposition Level : " << w->getLevel() << endl;
66 
67  watplot WTS(const_cast<char*>("wtswrc"));
68  //scalogram maps
69  double start = w->start()+cfg->segEdge;
70  double stop = w->start()+w->size()/w->rate()-cfg->segEdge;
71  double flow = 64;
72  double fhigh = 2048;
73  WTS.plot(w, 2, start, stop,const_cast<char*>("COLZ"));
74  WTS.hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
75  // dump spectrum
76  char fname[1024];
77  sprintf(fname,"%s/scalogram_%s_%s_%d_%s_lev%d_job%lu.root",cfg->dump_dir,data_type.Data(),ifo.Data(),
78  int(w->start()),cfg->data_label,w->getLevel(),net->nRun);
79  cout << endl << "Dump Scalogram : " << fname << endl << endl;
80  WTS.canvas->Print(fname);
81  int nIFO=net->ifoListSize();
82  if(isWavearray) delete w;
83  if(TString(ifo).CompareTo(net->ifoName[nIFO-1])==0) gSystem->Exit(0); // last ifo
84  }
85 
86  return;
87 }
std::vector< char * > ifoName
Definition: network.hh:591
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
char analysis[8]
Definition: config.hh:99
virtual size_t size() const
Definition: wavearray.hh:127
virtual void rate(double r)
Definition: wavearray.hh:123
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
TString("c")
size_t nRun
Definition: network.hh:554
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
CWB_PLUGIN
Definition: cwb.hh:74
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
int levelD
Definition: config.hh:136
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
TH2F * hist2D
Definition: watplot.hh:175
size_t ifoListSize()
Definition: network.hh:413
wavearray< double > w
Definition: Test1.C:27
double segEdge
Definition: config.hh:146
#define nIFO
TCanvas * canvas
Definition: watplot.hh:174
int getLevel()
Definition: wseries.hh:91
jfile
Definition: cwb_job_obj.C:25
watplot * WTS
Definition: ChirpMass.C:115
i() int(T_cor *100))
double fhigh
char fname[1024]
double flow
Definition: Meyer.hh:18
char dump_dir[1024]
Definition: config.hh:310
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
Definition: wseries.cc:228
Meyer< double > S(1024, 2)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
char data_label[1024]
Definition: config.hh:314
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.