Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_SGW.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 "TComplex.h"
14 #include "TMath.h"
15 #include "mdc.hh"
16 #include <vector>
17 
18 
19 // ---------------------------------------------------------------------------------
20 // DEFINES
21 // ---------------------------------------------------------------------------------
22 
23 #define SGW_MDC_POLARIZATION "SCALAR"
24 #define SGW_SEARCH_POLARIZATION "SCALAR"
25 
26 // ---------------------------------------------------------------------------------
27 // USER SGW PLUGIN OPTIONS
28 // ---------------------------------------------------------------------------------
29 
30 struct uoptions {
31  TString mdc_polarization; // SCALAR/TENSOR polarizations used for MDC
32  TString search_polarization; // SCALAR/TENSOR polarizations used for SEARCH
33 };
34 
35 // ---------------------------------------------------------------------------------
36 // FUNCTIONS
37 // ---------------------------------------------------------------------------------
38 
39 void ResetUserOptions();
42 
43 // ---------------------------------------------------------------------------------
44 // Global Variables
45 // ---------------------------------------------------------------------------------
46 
47 uoptions gOPT; // global User Options
48 
49 void
51 
52  cout << endl;
53  cout << "-----> macro/CWB_Plugin_SGW.C" << endl;
54  cout << "ifo " << ifo.Data() << endl;
55  cout << "type " << type << endl;
56  cout << endl;
57 
58 
59  if(type==CWB_PLUGIN_CONFIG) {
60  ResetUserOptions(); // set default config options
61  ReadUserOptions(cfg->parPlugin); // user config options : read from parPlugin
62 
63  if(gOPT.search_polarization=="SCALAR") cfg->gamma = -1.0; // force hard constrain for SGW
64  }
65 
66  if(type==CWB_PLUGIN_NETWORK) {
67  // set polarization for MDC
68  PrintUserOptions(cfg); // print config options
69  for(int n=0;n<(int)net->ifoListSize();n++) {
70  detector *d = net->getifo(n);
71  d->setPolarization(gOPT.mdc_polarization=="SCALAR" ? SCALAR : TENSOR);
72  }
73  // restore skymaps
74  if(cfg->healpix) net->setSkyMaps(int(cfg->healpix));
75  else net->setSkyMaps(cfg->angle,cfg->Theta1,cfg->Theta2,cfg->Phi1,cfg->Phi2);
76  net->setAntenna();
77  net->setDelay(cfg->refIFO);
78  }
79 
80 
81  if(type==CWB_PLUGIN_ICOHERENCE) {
82  // set polarization for SEARCH
83  PrintUserOptions(cfg); // print config options
84  for(int n=0;n<(int)net->ifoListSize();n++) {
85  detector *d = net->getifo(n);
86  d->setPolarization(gOPT.search_polarization=="SCALAR" ? SCALAR : TENSOR);
87  }
88  // restore skymaps
89  if(cfg->healpix) net->setSkyMaps(int(cfg->healpix));
90  else net->setSkyMaps(cfg->angle,cfg->Theta1,cfg->Theta2,cfg->Phi1,cfg->Phi2);
91  net->setAntenna();
92  net->setDelay(cfg->refIFO);
93  }
94 
95  return;
96 }
97 
99 
100  // get plugin options
101 
102  if(TString(options)!="") {
103 
104  //cout << "SGW options : " << options << endl;
105  TObjArray* token = TString(options).Tokenize(TString(' '));
106  for(int j=0;j<token->GetEntries();j++) {
107 
108  TObjString* tok = (TObjString*)token->At(j);
109  TString stok = tok->GetString();
110 
111  if(stok.Contains("--sgw_mdc_polarization=")) {
112  gOPT.mdc_polarization=stok;
113  gOPT.mdc_polarization.Remove(0,gOPT.mdc_polarization.Last('=')+1);
114  gOPT.mdc_polarization.ToUpper();;
115  }
116  if(gOPT.mdc_polarization!="TENSOR" && gOPT.mdc_polarization!="SCALAR") {
117  cout << "CWB_Plugin_SGW Error : parameter sgw_mdc_polarization must be : SCALAR/TENSOR" << endl;
118  gSystem->Exit(1);
119  }
120 
121  if(stok.Contains("--sgw_search_polarization=")) {
122  gOPT.search_polarization=stok;
123  gOPT.search_polarization.Remove(0,gOPT.search_polarization.Last('=')+1);
124  gOPT.search_polarization.ToUpper();;
125  }
126  if(gOPT.search_polarization!="TENSOR" && gOPT.search_polarization!="SCALAR") {
127  cout << "CWB_Plugin_SGW Error : parameter sgw_search_polarization must be : SCALAR/TENSOR" << endl;
128  gSystem->Exit(1);
129  }
130 
131  }
132  }
133 }
134 
136 
137  gOPT.mdc_polarization = SGW_MDC_POLARIZATION;
138  gOPT.search_polarization = SGW_SEARCH_POLARIZATION;
139 }
140 
141 
143 
144  cout << "-----------------------------------------" << endl;
145  cout << "SGW config options " << endl;
146  cout << "-----------------------------------------" << endl << endl;
147  cout << "SGW_MDC_POLARIZATION " << gOPT.mdc_polarization << endl;
148  cout << "SGW_SEARCH_POLARIZATION " << gOPT.search_polarization << endl;
149  cout << endl;
150 }
151 
detector * getifo(size_t n)
param: detector index
Definition: network.hh:418
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
uoptions gOPT
void setAntenna(detector *)
param: detector (use theta, phi index array)
Definition: network.cc:2815
int n
Definition: cwb_net.C:10
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 PrintUserOptions(CWB::config *cfg)
void setPolarization(POLARIZATION polarization=TENSOR)
Definition: detector.hh:288
int j
Definition: cwb_net.C:10
double Phi1
Definition: config.hh:261
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
size_t ifoListSize()
Definition: network.hh:413
double Theta2
Definition: config.hh:260
void ResetUserOptions()
jfile
Definition: cwb_job_obj.C:25
i() int(T_cor *100))
char parPlugin[1024]
Definition: config.hh:345
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.
#define SGW_SEARCH_POLARIZATION
size_t healpix
Definition: config.hh:264
char refIFO[4]
Definition: config.hh:107
TObjArray * token
void setDelay(const char *="L1")
Definition: network.cc:2736
void ReadUserOptions(TString options)
char options[256]
double Phi2
Definition: config.hh:262
double Theta1
Definition: config.hh:259
double gamma
Definition: config.hh:240
double angle
Definition: config.hh:258
void setSkyMaps(double, double=0., double=180., double=0., double=360.)
param: sky map granularity step, degrees param: theta begin, degrees param: theta end...
Definition: network.cc:2656
#define SGW_MDC_POLARIZATION