Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
config.hh
Go to the documentation of this file.
1 /**********************************************************
2  * Package: config Class Library
3  * File name: config.hh
4  * Author: Gabriele Vedovato (vedovato@lnl.infn.it)
5  **********************************************************/
6 
7 
8 #ifndef CONFIG_HH
9 #define CONFIG_HH
10 
11 #include "TObjString.h"
12 #include "TObjArray.h"
13 #include "TString.h"
14 #include "TROOT.h"
15 #include "TMath.h"
16 #include "TSystem.h"
17 #include "TLatex.h"
18 #include "TMacro.h"
19 #include "TNamed.h"
20 
21 #include <string>
22 #include <iostream>
23 #include <fstream>
24 #include <stdlib.h>
25 #include <math.h>
26 #include <ctype.h>
27 
28 #include "wavecomplex.hh"
29 #include "wavearray.hh"
30 #include "detector.hh"
31 #include "wat.hh"
32 
33 #include "Toolbox.hh"
34 #include "History.hh"
35 
36 // job file options
38  CWB_JOBF_SAVE_DISABLE = 0x00000000,
39  CWB_JOBF_SAVE_CONFIG = 0x00000001,
40  CWB_JOBF_SAVE_NETWORK = 0x00000002,
41  CWB_JOBF_SAVE_HISTORY = 0x00000004,
42  CWB_JOBF_SAVE_STRAIN = 0x00000008,
43  CWB_JOBF_SAVE_MDC = 0x00000010,
44  CWB_JOBF_SAVE_CSTRAIN = 0x00000020,
48  CWB_JOBF_SAVE_CED = 0x00000200,
50  CWB_JOBF_SAVE_CWB = 0x00000800,
51  CWB_JOBF_SAVE_SPARSE = 0x00001000,
52  CWB_JOBF_SAVE_WFINJ = 0x00002000,
53  CWB_JOBF_SAVE_WFREC = 0x00004000,
54  CWB_JOBF_SAVE_NODE = 0x00008000,
55  CWB_JOBF_SAVE_TRGFILE = 0x00010000,
56  CWB_JOBF_SAVE_CSPARSE = 0x00020000,
57  CWB_JOBF_SAVE_ALL = 0xFFFFFFFF
58 };
59 
60 // output root file options
62  CWB_OUTF_SAVE_DISABLE = 0x00000000,
63  CWB_OUTF_SAVE_VAR = 0x00000001,
64  CWB_OUTF_SAVE_NOISE = 0x00000002,
65  CWB_OUTF_SAVE_ALL = 0xFFFFFFFF
66 };
67 
68 const int FACTORS_MAX = 1000;
69 const int DQF_MAX = 100;
70 
71 namespace CWB {
72 
73 class config : public TNamed {
74 
75 public:
76 
77  config(TString umacro=""); // umacro=="" -> Reset config parameters
78  // unamed!="" -> Import config parameters from umacro
79  ~config();
80 
81  void Init(); // Reset parameters to 0/NULL/""/' '
82  void SetVar(bool MODE);
83  void Export(TString fname=""); // Export config values to CINT or to file fname
84  void Import(TString umacro=""); // umacro=="" -> Import config parameters from CINT
85  // unamed!="" -> Import config parameters from umacro
86  void Print(Option_t* option="");
88  void View(); // *MENU*
89  void DumpConfig(const char* filename = "", Option_t* option = ""); // *MENU*
90  void DumpPlugin(const char* filename = ""); // *MENU*
91  void DumpConfigPlugin(const char* filename = ""); // *MENU*
92  void SetSingleDetectorMode(); // Set configuration to works as 1 detector
93  void Check(); // check consistency of parameters
94 
95  virtual void Browse(TBrowser *b);
96 
97 // config parameters
98 
99  char analysis[8]; // 1G or 2G analysis
100  bool online; // true/false -> online/offline
101 
102  int nIFO; // size of network starting with first detector ifo[]
103  char search; // see description below
104  bool optim; // true -> optimal resolution likelihood analysis
105 
106  char ifo[NIFO_MAX][8];
107  char refIFO[4]; // reference IFO
108  // user define detectors list : is selected if detectorParams[n].name!=""
109  // {name, latitude, longitude, elevation, AltX, AzX, AltY, AzY
111 
112  // cWB settings
113 
114  size_t inRate; // input data rate
115  double bpp; // probability for pixel selection
116  double Tgap; // 1G: time gap between clusters (sec)
117  // 2G: defragmentation time gap between clusters (sec)
118  double Fgap; // 1G: frequency gap between clusters (Hz)
119  // 2G: defragmentation frequency gap between clusters (Hz)
120  double TFgap; // threshold on the time-frequency separation between two pixels
121 
122  double fLow; // low frequency of the search
123  double fHigh; // high frequency of the search
124  size_t fResample; // if zero resampling is not applied
125  double Acore; // threshold for selection of core pixels
126  double Tlpr; // training time for LPR filter
127 
128  double x2or; // 2 OR threshold
129  double netRHO; // threshold on rho
130  double netCC; // threshold on network correlation
131 
132  // wavelet transformation settings
133 
134  int levelR; // resampling level
135  int levelF; // level where second LPR filter is applied
136  int levelD; // decomposition level
137  int l_low; // low frequency resolution level
138  int l_high; // high frequency resolution level
139 
140  // time shift analysis settings
141 
142  // segments
143  double segLen; // Segment length [sec]
144  double segMLS; // Minimum Segment Length after DQ_CAT1 [sec]
145  double segTHR; // Minimum Segment Length after DQ_CAT2 [sec]
146  double segEdge; // wavelet boundary offset [sec]
147  double segOverlap; // overlap between segments [sec]
148 
149  // lags
150  size_t lagSize; // number of lags (simulation=1)
151  double lagStep; // time interval between lags [sec]
152  size_t lagOff; // first lag id (lagOff=0 - include zero lag )
153  size_t lagMax; // 0/>0 - standard/extended lags
154  char* lagFile; // lag file list
155  char lagMode[2]; // w/r - write/read lag list
156  size_t* lagSite; // site index starting with 0
157  double shift[NIFO_MAX]; // use for standard shifts
158 
159  // multi lags
160  int mlagStep; // if mlagStep=0 then 'standard lag mode' else cicle over lags with step mlagStep
161 
162  // super lags
163  int slagSize; // number of super lags (simulation=1) - if slagSize=0 -> Igor Segments
164  int slagMin; // if slagMax=0 -> slagMin must be < slagMax
165  int slagMax; // if slagMax=0
166  int slagOff; // first slag id (slagOff=0 - include zero slag )
167  size_t* slagSite; // site index starting with 0
168  char* slagFile; // slag file list
169 
170  // whitening parameters
171  double whiteWindow; // time window dT. if = 0 - dT=T, where T is wavearray duration
172  double whiteStride; // noise sampling interval (window stride)
173 
174  // Skymap probability pixels to be saved in the final output root file
175  int Psave;
176 
177  // DC corrections
178  double dcCal[NIFO_MAX];
179 
180  // simulation parameters
181  int simulation; // 1/2/3 for simulation [1=strain, 2=snr, 3=tshift], 0 for production
182  double iwindow; // analysis time window for injections (Range = Tinj +/- iwindow/2)
183  int nfactor; // number of strain/snr factors
184  double factors[FACTORS_MAX]; // array of strain/snr factors
185 
186  // noise shift data
188 
189  // use this parameter to shift in time the injections (sec)
190  // use {0,0,0} to set mdc_shift to 0
191  // if {-1,0,0} the shift is automaticaly selected
192  // {startMDC, stopMDC}
194 
195  // delay filter
196 
197  char wdmXTalk[1024]; // 2G: catalog of WDM cross-talk coefficients
198  size_t upTDF; // 2G: upsample factor to obtain rate of TD filter : TDrate = (inRate>>levelR)*upTDF
199  size_t TDSize; // 2G: time-delay filter size (max 20)
200  char filter[1024]; // 1G: delay filter suffix: "", or "up1", or "up2"
201 
202  // coherence stage settings
203  // select pixel pattern used to produce the energy max maps for pixel's selection
204  // patterns: "/" - ring-up, "\" - ring-down, "|" - delta, "-" line, "*" - single
205  //
206  // pattern = 0 - "*" 1-pixel standard search
207  // pattern = 1 - "3|" 3-pixels vertical packet (delta)
208  // pattern = 2 - "3-" 3-pixels horizontal packet (line)
209  // pattern = 3 - "3/" 3-pixels diagonal packet (ring-up)
210  // pattern = 4 - "3\" 3-pixels anti-diagonal packet (ring-down)
211  // pattern = 5 - "5/" 5-pixels diagonal packet (ring-up)
212  // pattern = 6 - "5\" 5-pixels anti-diagonal packet (ring-down)
213  // pattern = 7 - "3+" 5-pixels plus packet (plus)
214  // pattern = 8 - "3x" 5-pixels cross packet (cross)
215  // pattern = 9 - "9p" 9-pixels square packet (box)
216  // pattern = else - "*" 1-pixel packet (single)
217  //
218  // ------------------------------------------------------------------------------------
219  // pattern==0 Standard Search : std-pixel selection + likelihood2G
220  // pattern!=0 && pattern<0 Mixed Search : packet-pixel selection + likelihood2G
221  // pattern!=0 && pattern>0 Packed Search : packet-pixel selection + likelihoodWP
222 
223  int pattern;
224 
225  // supercluster stage
226 
227  int BATCH; // 2G: max number of pixel to process in one loadTDamp batch
228  int LOUD; // 2G: number of pixel per cluster to load TD amplitudes
229  double subnet; // 2G: sub network threshold (supercluster)
230  double subcut; // 2G: sub network threshold in the skyloop (supercluster)
231 
232  // regulator
233 
234  double delta; // 1G: [0/1] -> [weak/soft]
235 
236  // 2G: (0. - 0.1) - typical value is around |fx|^2,
237  // 2G: if high (>0.1) and than force the hard regulator
238  // 2G: this regulator is unlikely to change
239 
240  double gamma; // 1G: set params in net5, [0/1]->net5=[nIFO/0],
241  // if net5>[threshold=(nIFO-1)] weak/soft[according to delta] else hard
242 
243  // 2G:
244  // (0. - 0.1) - typical value is around |fx|^2,
245  // if high (>0.1) and than force the hard regulator
246  // this regulator is unlikely to change
247  // (0. - 1.) - defines threshold on coherent energy.
248  // If gamma=0, than all pixels with negative
249  // coherent energy are forced to produce zero signal response.
250  // It is not desirable to have gamma>1.
251 
252  bool eDisbalance; // 1G:
253 
254  // sky settings
255 
256  bool EFEC; // Earth Fixed / Selestial coordinates
257  size_t mode; // sky search mode
258  double angle; // angular resolution
259  double Theta1; // start theta
260  double Theta2; // end theta
261  double Phi1; // start theta
262  double Phi2; // end theta
263  double mask; // sky mask fraction
264  size_t healpix; // if not 0 use healpix sky map (healpix order)
265 
266  // error regions settings
267 
268  double precision; // 1G : No = nIFO*(K+KZero)+precision*E
269  // 2G : precision of energy calculation with time delay filter
270 
271  // file dump mode
272 
273  CWB_JOBF_OPTIONS jobfOptions; // job file options
274  CWB_OUTF_OPTIONS outfOptions; // output file options
275 
276  bool dumpHistory; // dump history into output root file
277  bool dump; // dump triggers into ascii file
278  bool savemode; // temporary save clusters on disc
279  bool cedDump; // dump ced plots with rho>cedRHO
280  double cedRHO;
281  long nSky; // if nSky>0 -> # of skymap prob pixels dumped to ascii
282  // if nSky=0 -> (#pixels==1000 || cum prob > 0.99)
283  // if nSky<0 -> nSky=-XYZ... save all pixels with prob < 0.XYZ...
284 
285  // directories, file names
286 
287  char filter_dir[1024];
288 
289  char injectionList[1024];
290  char skyMaskFile[1024];
291  char skyMaskCCFile[1024];
294 
295  // working dir
296  char work_dir[1024];
297 
298  char config_dir[1024];
299  char input_dir[1024];
300  char output_dir[1024];
301  char merge_dir[1024];
302  char condor_dir[1024];
303  char report_dir[1024];
304  char macro_dir[1024];
305  char log_dir[1024];
306  char data_dir[1024];
307  char tmp_dir[1024];
308  char ced_dir[1024];
309  char pp_dir[1024];
310  char dump_dir[1024];
311  char www_dir[1024];
312 
313  // data label
314  char data_label[1024];
315 
316  // condor declarations
317  char condor_log[1024];
318 
319  // Define a Unique Tag for Condor Jobs
320  char condor_tag[1024];
321 
322  // frame files list : [0:nIFO-1]/[nIFO:2*nIFO-1] contains strain/mdc file names
323  // If all mdc channels are in a single frame file -> mdc must be declared in the nIFO position
324  char frFiles[2*NIFO_MAX][1024];
325  // frame reading retry time (sec) : 0 -> disable
327 
328  // dq file list
329  // {ifo, dqcat_file, dqcat[0/1/2], shift[sec], inverse[false/true], 4columns[true/false]}
330  int nDQF;
332 
333  // read and dump data on local disk (nodedir)
334  char nodedir[1024];
335 
336  // cwb config path
337  char cwb_config_env[1024];
338 
339  // cluster site name
340  char site_cluster_env[1024];
341 
342  // Plugin
343  TMacro plugin; // Macro source
344  TMacro configPlugin; // Macro config
345  char parPlugin[1024]; // user defined parameters (used in the plugin)
346  bool dataPlugin; // if dataPlugin=true disable read data from frames
347  bool mdcPlugin; // if mdcPlugin=true disable read mdc from frames
348  bool dcPlugin; // if dcPlugin=true disable built-in data conditioning (only 2G)
349  bool cohPlugin; // if cohPlugin=true disable built-in coherence stage (only 2G)
350  bool scPlugin; // if scPlugin=true disable built-in supercluster function (only 2G)
351  bool outPlugin; // if outPlugin=true disable built-in output wave file (only 2G)
352 
353  char comment[1024]; // user defined comment
354 
355  // statistics:
356  // L - likelihood
357  // c - network correlation coefficient
358  // A - energy disbalance asymmetry
359  // P - penalty factor based on correlation coefficients <x,s>/sqrt(<x,x>*<s,s>)
360  // E - total energy in the data streams
361 
362  // 1G search modes
363  // 'c' - un-modeled search, fast S5 cWB version, requires constraint settings
364  // 'h' - un-modeled search, S5 cWB version, requires constraint settings
365  // 'B' - un-modeled search, max(P*L*c/E)
366  // 'b' - un-modeled search, max(P*L*c*A/E)
367  // 'I' - elliptical polarisation, max(P*L*c/E)
368  // 'S' - linear polarisation, max(P*L*c/E)
369  // 'G' - circular polarisation, max(P*L*c/E)
370  // 'i' - elliptical polarisation, max(P*L*c*A/E)
371  // 's' - linear polarisation, max(P*L*c*A/E)
372  // 'g' - circular polarisation, max(P*L*c*A/E)
373 
374  // 2G search modes
375  // r - un-modeled
376  // i - iota - wave (no dispersion correction)
377  // p - Psi - wave
378  // l,s - linear
379  // c,g - circular
380  // e,b - elliptical (no dispersion correction)
381 
382  ClassDef(config,24)
383 };
384 
385 } // end namespace
386 
387 #endif
char channelNamesMDC[NIFO_MAX][50]
Definition: config.hh:293
CWB_JOBF_OPTIONS jobfOptions
Definition: config.hh:273
char analysis[8]
Definition: config.hh:99
double iwindow
Definition: config.hh:182
double x2or
Definition: config.hh:128
char www_dir[1024]
Definition: config.hh:311
double precision
Definition: config.hh:268
size_t TDSize
Definition: config.hh:199
bool optim
Definition: config.hh:104
void Export(TString fname="")
Definition: config.cc:388
config(TString umacro="")
Definition: config.cc:145
void Print(Option_t *option="")
Definition: config.cc:719
int levelF
Definition: config.hh:135
TMacro configPlugin
Definition: config.hh:344
bool mdcPlugin
Definition: config.hh:347
Definition: ced.hh:24
void View()
Definition: config.cc:1278
double cedRHO
Definition: config.hh:280
char skyMaskFile[1024]
Definition: config.hh:290
size_t upTDF
Definition: config.hh:198
CWB_JOBF_OPTIONS
Definition: config.hh:37
bool dataPlugin
Definition: config.hh:346
char data_dir[1024]
Definition: config.hh:306
TString("c")
bool cohPlugin
Definition: config.hh:349
double shift[NIFO_MAX]
Definition: config.hh:157
const int DQF_MAX
Definition: config.hh:69
void Check()
Definition: config.cc:1393
double whiteWindow
Definition: config.hh:171
double fLow
Definition: config.hh:122
int pattern
Definition: config.hh:223
bool dcPlugin
Definition: config.hh:348
bool cedDump
Definition: config.hh:279
void Init()
Definition: config.cc:173
dqfile DQF[DQF_MAX]
Definition: config.hh:331
size_t * slagSite
Definition: config.hh:167
double netRHO
Definition: config.hh:129
char * lagFile
Definition: config.hh:154
int slagMin
Definition: config.hh:164
char report_dir[1024]
Definition: config.hh:303
void Import(TString umacro="")
Definition: config.cc:334
char nodedir[1024]
Definition: config.hh:334
double segTHR
Definition: config.hh:145
char macro_dir[1024]
Definition: config.hh:304
double Phi1
Definition: config.hh:261
int levelD
Definition: config.hh:136
CWB_OUTF_OPTIONS
Definition: config.hh:61
bool outPlugin
Definition: config.hh:351
double segOverlap
Definition: config.hh:147
int slagOff
Definition: config.hh:166
bool online
Definition: config.hh:100
double Tlpr
Definition: config.hh:126
int Psave
Definition: config.hh:175
char comment[1024]
Definition: config.hh:353
double segEdge
Definition: config.hh:146
size_t mode
Definition: config.hh:257
double dcCal[NIFO_MAX]
Definition: config.hh:178
detectorParams detParms[NIFO_MAX]
Definition: config.hh:110
double Theta2
Definition: config.hh:260
#define MODE
void DumpPlugin(const char *filename="")
Definition: config.cc:1191
const int FACTORS_MAX
Definition: config.hh:68
size_t fResample
Definition: config.hh:124
char filter_dir[1024]
Definition: config.hh:287
size_t lagOff
Definition: config.hh:152
char condor_log[1024]
Definition: config.hh:317
int simulation
Definition: config.hh:181
int l_high
Definition: config.hh:138
int nDQF
Definition: config.hh:330
double Fgap
Definition: config.hh:118
char input_dir[1024]
Definition: config.hh:299
CWB_OUTF_OPTIONS outfOptions
Definition: config.hh:274
char search
Definition: config.hh:103
size_t * lagSite
Definition: config.hh:156
int Compare(CWB::config config)
Definition: config.cc:1247
char site_cluster_env[1024]
Definition: config.hh:340
char output_dir[1024]
Definition: config.hh:300
void SetVar(bool MODE)
Definition: config.cc:402
const int NIFO_MAX
Definition: wat.hh:4
int BATCH
Definition: config.hh:227
char tmp_dir[1024]
Definition: config.hh:307
int slagMax
Definition: config.hh:165
char parPlugin[1024]
Definition: config.hh:345
double delta
Definition: config.hh:234
char fname[1024]
bool eDisbalance
Definition: config.hh:252
double dataShift[NIFO_MAX]
Definition: config.hh:187
char channelNamesRaw[NIFO_MAX][50]
Definition: config.hh:292
int slagSize
Definition: config.hh:163
double Acore
Definition: config.hh:125
char cwb_config_env[1024]
Definition: config.hh:337
int frRetryTime
Definition: config.hh:326
char log_dir[1024]
Definition: config.hh:305
int nfactor
Definition: config.hh:183
size_t healpix
Definition: config.hh:264
char refIFO[4]
Definition: config.hh:107
char filter[1024]
Definition: config.hh:200
char condor_tag[1024]
Definition: config.hh:320
size_t lagSize
Definition: config.hh:150
long nSky
Definition: config.hh:281
char lagMode[2]
Definition: config.hh:155
char pp_dir[1024]
Definition: config.hh:309
char injectionList[1024]
Definition: config.hh:289
double netCC
Definition: config.hh:130
bool EFEC
Definition: config.hh:256
double subnet
Definition: config.hh:229
mdcshift mdc_shift
Definition: config.hh:193
int l_low
Definition: config.hh:137
double whiteStride
Definition: config.hh:172
char * slagFile
Definition: config.hh:168
double fHigh
Definition: config.hh:123
bool savemode
Definition: config.hh:278
int mlagStep
Definition: config.hh:160
int LOUD
Definition: config.hh:228
TMacro plugin
Definition: config.hh:343
char ifo[NIFO_MAX][8]
Definition: config.hh:106
char ced_dir[1024]
Definition: config.hh:308
char work_dir[1024]
Definition: config.hh:296
void DumpConfig(const char *filename="", Option_t *option="")
Definition: config.cc:1317
double segLen
Definition: config.hh:143
char dump_dir[1024]
Definition: config.hh:310
void DumpConfigPlugin(const char *filename="")
Definition: config.cc:1219
virtual void Browse(TBrowser *b)
Definition: config.cc:163
double subcut
Definition: config.hh:230
double Phi2
Definition: config.hh:262
char skyMaskCCFile[1024]
Definition: config.hh:291
int nIFO
Definition: config.hh:102
double mask
Definition: config.hh:263
double Tgap
Definition: config.hh:116
double factors[FACTORS_MAX]
Definition: config.hh:184
bool dumpHistory
Definition: config.hh:276
char config_dir[1024]
Definition: config.hh:298
size_t lagMax
Definition: config.hh:153
char data_label[1024]
Definition: config.hh:314
char wdmXTalk[1024]
Definition: config.hh:197
double lagStep
Definition: config.hh:151
double TFgap
Definition: config.hh:120
double bpp
Definition: config.hh:115
double Theta1
Definition: config.hh:259
char merge_dir[1024]
Definition: config.hh:301
char condor_dir[1024]
Definition: config.hh:302
size_t inRate
Definition: config.hh:114
double gamma
Definition: config.hh:240
double segMLS
Definition: config.hh:144
int levelR
Definition: config.hh:134
char frFiles[2 *NIFO_MAX][1024]
Definition: config.hh:324
void SetSingleDetectorMode()
Definition: config.cc:1334
bool scPlugin
Definition: config.hh:350
double angle
Definition: config.hh:258
bool dump
Definition: config.hh:277