Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_TShiftMisCal.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 
14 void
16 //!MISCALIBRATION
17 // Plugin to mis-calibrate in time the injeted MDC
18 
20 
21  cout << endl;
22  cout << "-----> CWB_Plugin_TShiftMisCal.C" << endl;
23  cout << "ifo " << ifo.Data() << endl;
24  cout << "type " << type << endl;
25  cout << endl;
26 
27  if(type==CWB_PLUGIN_MDC) { // mdc
28 
29  // TEST PHASE CALIBRATION ERRORS //GV
30 
31  // upconvertion 16kHz -> 64kHz
32 
33  x->FFTW(1);
34  x->resize(4*x->size());
35  x->rate(4*x->rate());
36  x->FFTW(-1);
37 
38  y.resize(x->size());y.rate(x->rate());y.start(x->start());y=0; // temporary array
39  for (int nmdc=0; nmdc<(int)net->mdcListSize(); nmdc++) {
40  TString mdcstring(net->getmdcList(nmdc));
41  TObjArray* token = mdcstring.Tokenize(' ');
42  TObjString* iname = (TObjString*)token->At(11);
43  TString wavename = iname->GetString();
44  TObjString* itime = (TObjString*)token->At(10);
45  TString wavetime = itime->GetString();
46  double mdctime = wavetime.Atof();
47  if (mdctime<(int)x->start()||mdctime>x->start()+x->size()/x->rate()) continue;
48  //cout << mdcstring.Data() << endl;
49  //printf(" Time : %s %f %f %f", wavetime.Data(), mdctime, x->start(), x->start()+x->size()/x->rate());
50  //cout << "String: " << wavename.Data() << " time : " << wavetime.Data() << " " <<mdctime<< endl;
51  int cshift = 2*int(gRandom->Integer(3)-1);
52 
53  int starti = (mdctime - x->start()-1.)*x->rate();
54  int stopi = (mdctime - x->start()+1.)*x->rate();
55  if(cshift>0) {
56  if (starti<cshift) starti=cshift;
57  if (stopi>(int)x->size()-cshift) stopi=x->size()-cshift;
58  } else {
59  if (starti<0) starti=0;
60  if (stopi>(int)x->size()+cshift) stopi=x->size()+cshift;
61  }
62 
63  cout << " Start: " << starti << " Stop : " << stopi << " cshift : " << cshift << endl;
64  for (int jj=starti; jj<stopi; jj++) {
65  y.data[jj] = x->data[jj-cshift];
66  }
67  //for (int jj=starti; jj<stopi; jj++) {
68  // if(x->data[jj]!=0) cout << jj << " " << cshift << " " << x->data[jj] << " " << y.data[jj] << endl;
69  //}
70  }
71  (*x)=y;y.resize(0);
72 
73  // downconvertion 64kHz -> 16kHz
74  x->FFTW(1);
75  x->resize(x->size()/4);
76  x->rate(x->rate()/4);
77  x->FFTW(-1);
78  }
79 
80  return;
81 }
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
virtual void resize(unsigned int)
Definition: wseries.cc:883
virtual size_t size() const
Definition: wavearray.hh:127
virtual void rate(double r)
Definition: wavearray.hh:123
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
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.
string getmdcList(size_t n)
Definition: network.hh:400
virtual void start(double s)
Definition: wavearray.hh:119
size_t mdcListSize()
Definition: network.hh:390
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
int nmdc
Definition: cbc_plots.C:791
jfile
Definition: cwb_job_obj.C:25
i() int(T_cor *100))
TObjArray * token
virtual void FFTW(int=1)
Definition: wavearray.cc:878
DataType_t * data
Definition: wavearray.hh:301
double * itime
wavearray< double > y
Definition: Test10.C:31