21 #pragma GCC system_header 28 #include "TObjArray.h" 29 #include "TObjString.h" 32 #include "TGraphAsymmErrors.h" 76 #define TW_GPS_TIME 0.0 79 #define TW_CED_SPECTROGRAM_ZMAX 0.0 80 #define TW_DUMP false // true -> window is dumped to ascii file 90 double ced_spectrogram_zmax;
102 double TukeyWin(
double x,
double W,
double R);
126 if(gOPT.gps_time==0) {
127 cout <<
"CWB_Plugin_TukeyWindow Error : tw_gps_time not defined !!!" << endl;
132 cout <<
"CWB_Plugin_TukeyWindow Error : tw_width not defined !!!" << endl;
137 cout <<
"CWB_Plugin_TukeyWindow Error : tw_range not defined !!!" << endl;
145 if(!(gOPT.gps_time>start && gOPT.gps_time<stop))
return;
147 cout << endl <<
"CWB_Plugin_TukeyWindow.C : Apply Tukey Window to GW170817 L1 Glitch !!!" << endl << endl;
150 sprintf(ofname,
"%s_TukeyWindow.dat",ifo.Data());
157 double t = start+
i*dt-(gOPT.gps_time-gOPT.width/2);
158 double w = 1-
TukeyWin(t,gOPT.width,gOPT.range);
164 sprintf(ofname,
"%s_TukeyWindow.dat",ifo.Data());
167 sprintf(ofname,
"%s_TukeyWindow.dat",ifo.Data());
177 char ced_options[64];
178 sprintf(ced_options,
"ced_spectrogram_zmax=%f",gOPT.ced_spectrogram_zmax);
187 if(x<0 || x>W)
return y;
191 if(x>=0 && x<R/2 ) y = 0.5*(1+cos(2*Pi/R*(x-R/2)));
192 if(x>= R/2 && x<W-R/2) y = 1;
193 if(x>=(W-R/2) && x<=W ) y = 0.5*(1+cos(2*Pi/R*(x-W+R/2)));
202 if (!out.good()) {cout <<
"CWB_Plugin_TukeyWindow.C : Error Opening Output File : " << ofname << endl;
exit(1);}
203 cout <<
"Create Output File : " << ofname << endl;
211 double stop = start+2;
213 if(time>start && time<stop) out << time <<
" " << x->
data[
i] << endl;
227 for(
int j=0;
j<token->GetEntries();
j++) {
229 TObjString* tok = (TObjString*)token->At(
j);
230 TString stok = tok->GetString();
232 if(stok.Contains(
"tw_dump=")) {
234 tw_dump.Remove(0,tw_dump.Last(
'=')+1);
235 if(tw_dump==
"root") gOPT.dump=
true;
238 if(stok.Contains(
"tw_gps_time=")) {
240 tw_gps_time.Remove(0,tw_gps_time.Last(
'=')+1);
241 if(tw_gps_time.IsFloat()) gOPT.gps_time=tw_gps_time.Atof();
244 if(stok.Contains(
"tw_width=")) {
246 tw_width.Remove(0,tw_width.Last(
'=')+1);
247 if(tw_width.IsFloat()) gOPT.width=tw_width.Atof();
250 if(stok.Contains(
"tw_range=")) {
252 tw_range.Remove(0,tw_range.Last(
'=')+1);
253 if(tw_range.IsFloat()) gOPT.range=tw_range.Atof();
256 if(stok.Contains(
"tw_ced_spectrogram_zmax=")) {
257 TString tw_ced_spectrogram_zmax=stok;
258 tw_ced_spectrogram_zmax.Remove(0,tw_ced_spectrogram_zmax.Last(
'=')+1);
259 if(tw_ced_spectrogram_zmax.IsFloat()) gOPT.ced_spectrogram_zmax=tw_ced_spectrogram_zmax.Atof();
278 cout <<
"-----------------------------------------" << endl;
279 cout <<
"TW config options " << endl;
280 cout <<
"-----------------------------------------" << endl << endl;
281 cout <<
"TW_GPS_TIME " << gOPT.gps_time << endl;
282 cout <<
"TW_WIDTH " << gOPT.width << endl;
283 cout <<
"TW_RANGE " << gOPT.range << endl;
284 cout <<
"TW_CED_SPECTROGRAM_ZMAX " << gOPT.ced_spectrogram_zmax << endl;
285 cout <<
"TW_DUMP " << gOPT.dump << endl;
wavearray< double > t(hp.size())
void SetOptions(int simulation, double rho, double inRate, bool useSparse=false, char *gtype=const_cast< char *>("png"), int paletteId=0)
virtual void rate(double r)
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
virtual void start(double s)
virtual size_t size() const
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *NET, WSeries< double > *x, TString ifo, int type)
COHERENCE.
#define IMPORT(TYPE, VAR)
double TukeyWin(double x, double W, double R)
#define TW_CED_SPECTROGRAM_ZMAX
void ReadUserOptions(TString options)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void DumpData(wavearray< double > *x, TString ofname)