Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_AmplitudeMisCal.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 "gwavearray.hh"
10 #include "TString.h"
11 #include "TObjArray.h"
12 #include "TObjString.h"
13 #include "TRandom.h"
14 
15 #define L1_AMP_CAL_ERR_SIGMA 0.2 // 20% amplitude uncertainty
16 #define H1_AMP_CAL_ERR_SIGMA 0.2 // 20% amplitude uncertainty
17 #define V1_AMP_CAL_ERR_SIGMA 0.1 // 10% amplitude uncertainty
18 
19 //#define SAVE_PLOT // plot data in ROOT format before/after mis-calibration
20 
21 void
23 //!MISCALIBRATION
24 // Plugin to mis-calibrate in amplitude the MDC
25 
26 // The jittering procedure depends on the model describing the calibration uncertainties distribution.
27 // For each detector, jittering values are extracted, via MonteCarlo, from a gaussian distribution,
28 // centered on 1 and with standard deviation equal to the interferometer nominal uncertainty
29 // (i.e., 20% for LIGO observatories, 10% for Virgo).
30 // Such values are then used to rescale the MDC waveforms amplitude before the injection in the detectors data.
31 
32 // The waveforms are injected in the detectors data after having been jittered, with different
33 // values for the three detectors. Since cWB performs a coherent search, a fraction of events
34 // is therefore rejected by the algorithm. How large such fraction is, depends on how extreme
35 // the considered jittering models are. It is expected to get larger for increasing possible jittering values.
36 // Given that part of the jittered injected signals is rejected by the algorithm, the detection efficiency
37 // curves are expected to get lower. Such variations in the detection efficiency induce changes
38 // of the 90% confidence upper limit on the total event rate. i
39 
40  cout << endl;
41  cout << "-----> CWB_Plugin_AmplitudeMisCal.C" << endl;
42  cout << "ifo " << ifo.Data() << endl;
43  cout << "type " << type << endl;
44  cout << endl;
45 
46  if(type==CWB_PLUGIN_MDC) { // mdc
47  cout << "APPLY AMPLITUDE MIS-CALIBRATION !!!" << endl;
48 #ifdef SAVE_PLOT
50  gx.Draw(GWAT_TIME); // draw signal before cfactor (BLACK)
51 #endif
52  for (int nmdc=0; nmdc<(int)net->mdcListSize(); nmdc++) {
53  TString mdcstring(net->getmdcList(nmdc));
54  TObjArray* token = mdcstring.Tokenize(' ');
55  TObjString* iname = (TObjString*)token->At(11);
56  TString wavename = iname->GetString();
57  TObjString* itime = (TObjString*)token->At(10);
58  TString wavetime = itime->GetString();
59  double mdctime = wavetime.Atof();
60  if (mdctime<x->start()||mdctime>x->start()+x->size()/x->rate()) continue;
61  //cout << mdcstring.Data() << endl;
62  //printf(" Time : %s %f %f %f", wavetime.Data(), mdctime, x->start(), x->start()+x->size()/x->rate());
63  //cout << "String: " << wavename.Data() << " time : " << wavetime.Data() << " " <<mdctime;
64  int starti = (mdctime - x->start()-cfg->iwindow/2.)*x->rate();
65  int stopi = (mdctime - x->start()+cfg->iwindow/2.)*x->rate();
66  if (starti<0) starti=0;
67  if (stopi>(int)x->size()) stopi=x->size();
68  double cfactor = 0;
69  if(ifo=="L1") cfactor = gRandom->Gaus(1,L1_AMP_CAL_ERR_SIGMA);
70  if(ifo=="H1") cfactor = gRandom->Gaus(1,H1_AMP_CAL_ERR_SIGMA);
71  if(ifo=="V1") cfactor = gRandom->Gaus(1,V1_AMP_CAL_ERR_SIGMA);
72  //cout << " starti " << starti << " stopi " << stopi << " cfactor : " << cfactor << endl;
73  //cout << "Apply amplitude factor : " << cfactor << endl;
74  for (int jj=starti; jj<stopi; jj++) {
75  //if(x->data[jj]!=0) cout << jj << " " << cfactor << " " << x->data[jj] << endl;
76  x->data[jj] *= cfactor;
77  }
78  }
79 #ifdef SAVE_PLOT
80  gx.Draw(x,GWAT_TIME,"SAME",kRed); // draw signal after cfactor (RED)
81  TString gfile="CWB_Plugin_AmplitudeMisCal_Plot_MDC_"+ifo+".root";
82  watplot* plot = gx.GetWATPLOT(); // get pointer to watplot object
83  (*plot) >> gfile;
84  cout << "CWB_Plugin_AmplitudeMisCal.C : created plot file name : " << gfile << endl;
85 #endif
86  }
87 
88  return;
89 }
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
double iwindow
Definition: config.hh:182
virtual size_t size() const
Definition: wavearray.hh:127
virtual void rate(double r)
Definition: wavearray.hh:123
#define L1_AMP_CAL_ERR_SIGMA
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
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
x plot
jfile
Definition: cwb_job_obj.C:25
i() int(T_cor *100))
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
gwavearray< double > * gx
#define V1_AMP_CAL_ERR_SIGMA
TObjArray * token
TString gfile
watplot * GetWATPLOT()
Definition: gwavearray.hh:70
DataType_t * data
Definition: wavearray.hh:301
double * itime
#define H1_AMP_CAL_ERR_SIGMA
void Draw(GWAT_DRAW type=GWAT_TIME, TString options="ALP", Color_t color=kBlack)
Definition: gwavearray.cc:71