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