Logo coherent WaveBurst  
Library Reference Guide
Logo
ced.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Gabriele Vedovato, Sergey Klimenko
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 /**********************************************************
20  * Package: ced Class Library
21  * File name: ced.hh
22  * Author: Gabriele Vedovato (vedovato@lnl.infn.it)
23  **********************************************************/
24 
25 
26 #ifndef CED_HH
27 #define CED_HH
28 
29 #include <TROOT.h>
30 #include <TChain.h>
31 #include <TFile.h>
32 #include "watfun.hh"
33 #include "injection.hh"
34 #include "detector.hh"
35 #include "netcluster.hh"
36 #include "network.hh"
37 #include "netevent.hh"
38 
39 
40 using namespace std;
41 
42 namespace CWB {
43 
44 class ced {
45 
46 public:
47 
48  // rbasedirCED : plots are stored in the sbasedirCED directory
49  ced(network* NET, netevent* EVT, char* sbasedirCED) {
50  if(NET==NULL) {cout << "ced::ced Error : NET is NULL" << endl;exit(1);}
51  if(EVT==NULL) {cout << "ced::CED Error : EVT is NULL" << endl;exit(1);}
52  if(sbasedirCED==NULL) {cout << "ced::ced Error : sbasedirCED is NULL" << endl;exit(1);}
53  this->NET = NET;
54  this->EVT = EVT;
55  this->sbasedirCED = sbasedirCED;
56  this->rbasedirCED = NULL;
57  this->simulation=0;
58  this->rho=0;
59  this->inRate=0;
60  this->spectrogram_zmax=0;
61  strcpy(this->gtype,"png");
62  this->paletteId=0;
63  strcpy(this->chName,"");
64  this->useSparse=false;
65  };
66 
67  // rbasedirCED : plots are stored in root file (opened externally)
68  ced(network* NET, netevent* EVT, TDirectory* rbasedirCED) {
69  if(NET==NULL) {cout << "ced::ced Error : NET is NULL" << endl;exit(1);}
70  if(EVT==NULL) {cout << "ced::ced Error : EVT is NULL" << endl;exit(1);}
71  if(rbasedirCED==NULL) {cout << "ced::ced Error : rbasedirCED is NULL" << endl;exit(1);}
72  this->NET = NET;
73  this->EVT = EVT;
74  this->sbasedirCED = NULL;
75  this->rbasedirCED = rbasedirCED;
76  this->simulation=0;
77  this->rho=0;
78  this->inRate=0;
79  this->spectrogram_zmax=0;
80  strcpy(this->gtype,"png");
81  this->paletteId=0;
82  strcpy(this->chName,"");
83  this->useSparse=false;
84  };
85 
86  ~ced() {};
87 
88  void SetOptions(int simulation, double rho, double inRate, bool useSparse=false,
89  char* gtype=const_cast<char*>("png"), int paletteId=0) {
90  this->simulation=simulation; // 1/2 for simulation(hrss/snr), 0 for production
91  this->rho=rho; // ced is produced for events with rho >= this->rho threshold
92  this->inRate=inRate; // original data rate, used to rescale data when data are resampled
93  if(inRate<=0) {cout << "ced::SetOptions : Error - inrate must be > 0" << endl;exit(1);}
94  strcpy(this->gtype,gtype);
95  this->paletteId=paletteId;
96  this->useSparse=useSparse; // if true sparse map are used instead of TF
97  }
98 
100 
101  void SetChannelName(char* chName) {strcpy(this->chName,chName);}
102  int Write(double factor, bool fullCED=true);
103 
104 private:
105 
106  void Write(double factor, size_t iID, int LAG, char* dirCED);
107 
108  // x : input array
109  // P : energy percentage
110  // bT,eT : begin,end time of the range which contains percentage P of the total energy E
111  double GetBoundaries(wavearray<double> x, double P, double& bT, double& eT);
112 
113  network* NET; //!
114  netevent* EVT; //!
115 
116  TDirectory* rbasedirCED; //!
117  char* sbasedirCED; //!
119  double rho;
120  double inRate;
121  char gtype[32];
122  int paletteId;
123  char chName[64];
124  bool useSparse;
126 
127  // used by THtml doc
128  ClassDef(ced,2)
129 };
130 
131 } // end namespace
132 
133 #endif
134 
void SetOptions(int simulation, double rho, double inRate, bool useSparse=false, char *gtype=const_cast< char *>("png"), int paletteId=0)
Definition: ced.hh:88
double rho
double spectrogram_zmax
Definition: ced.hh:125
double rho
Definition: ced.hh:119
Definition: ced.hh:42
float factor
double inRate
Definition: ced.hh:120
TString("c")
TDirectory * rbasedirCED
Definition: ced.hh:116
~ced()
Definition: ced.hh:86
netevent * EVT
Definition: ced.hh:114
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
char * sbasedirCED
Definition: ced.hh:117
STL namespace.
double GetBoundaries(wavearray< double > x, double P, double &bT, double &eT)
tlive_fix Write()
TString chName[NIFO_MAX]
int simulation
Definition: ced.hh:118
gSM SetOptions(cwb_antpat_projection, COORDINATES, RESOLUTION/2)
network NET
Definition: cwb_dump_inj.C:30
network * NET
Definition: ced.hh:113
void SetChannelName(char *chName)
Definition: ced.hh:101
ced(network *NET, netevent *EVT, char *sbasedirCED)
Definition: ced.hh:49
ced(network *NET, netevent *EVT, TDirectory *rbasedirCED)
Definition: ced.hh:68
char options[256]
netevent EVT(itree, nifo)
strcpy(RunLabel, RUN_LABEL)
bool useSparse
Definition: ced.hh:124
Definition: ced.hh:44
simulation
Definition: cwb_eced.C:26
exit(0)
int paletteId
Definition: ced.hh:122