Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cwb_epparameters.C
Go to the documentation of this file.
1 // exec pparameters macro, used after the user_pparameters.C
2 
3 {
4  CheckAnalysis(); // check consistency with the environment CWB_ANALYSIS
5 
6  if(simulation<0) return; // super report mode
7 
8  // ----------------------------------------------------------
9  // Warning if zero lag analysis
10  // ----------------------------------------------------------
11 
12  if(!pp_batch&&(cwb_lag_number==0)&&(cwb_slag_number==0)&&(simulation==0)) {
13  char answer[1024];
14  strcpy(answer,"");
15  do {
16  cout << "You are going to produce the report for lag zero" << endl;
17  cout << "Do you want to procede ? (y/n) ";
18  cin >> answer;
19  cout << endl << endl;
20  } while ((strcmp(answer,"y")!=0)&&(strcmp(answer,"n")!=0));
21  if (strcmp(answer,"n")==0) exit(1);
22  }
23 
24  // ----------------------------------------------------------
25  // Declare standard cuts & standard pp_label
26  // ----------------------------------------------------------
27 
28  #include "GToolbox.hh"
29 
30  if(pp_rho_min<0.) {cout << "Error : pp_rho_min must be >=0" << endl;exit(1);}
31  if(pp_rho_max<=pp_rho_min) {cout << "Error : pp_rho_max must be > pp_rho_min" << endl;exit(1);}
32 
34 
35  if(pp_rho_bin>100) pp_rho_bin=100; // the upper value is limited because it requires big memory resources
36  if(pp_rho_bin<=0) {cout << "Error : pp_rho_bin must be >0, check pp_rho_min, pp_rho_max, pp_drho" << endl;exit(1);}
37 
38  if(TString(gSystem->Getenv("CWB_REPORT_PE"))!="") { // parameter estimation report
39  if(optim) pp_label=TString("_PE_")+TString(SEARCH())+"SRA";
40  else pp_label=TString("_PE_")+TString(SEARCH())+"MRA";
41  } else {
42  if(optim) pp_label=TString("_")+TString(SEARCH())+"SRA";
43  else pp_label=TString("_")+TString(SEARCH())+"MRA";
44  }
45 
46  double ifLow=fLow;
47  double ifHigh=fHigh;
48 
49 #ifdef PP_64_200_HZ
50  //pp_label="64_200";
51  ifLow=64;ifHigh=200;
52 #endif
53 #ifdef PP_200_2048_HZ
54  //pp_label="200_2048";
55  ifLow=200;ifHigh=2048;
56 #endif
57 #ifdef PP_1600_5000_HZ
58  //pp_label="1600_5000";
59  ifLow=1600;ifHigh=5000;
60 #endif
61 
62 #ifdef CAT2_VETO
63  pp_label=pp_label+"_cat2";
64 #endif
65 #ifdef HVETO_VETO
66  pp_label=pp_label+"_hveto";
67 #endif
68 #ifdef CAT3_VETO
69  pp_label=pp_label+"_cat3";
70 #endif
71 #ifdef PEM_VETO
72  pp_label=pp_label+"_pem";
73 #endif
74 
75  char L_cor[32]="";
76  char L_cut[32]="";
77  char L_CUT[32]="";
78  char L_vED[32]="";
79  char L_scc[32]="";
80  char L_pen[32]="";
81  char L_win[32]="";
82  char L_ifar[32]="";
83 
84  if(T_cor>=0) sprintf(L_cor,"i%dcc%.2i", pp_inetcc, (int)(T_cor*100));
85  if(T_cut>=0) sprintf(L_cut,"i%drho%i", pp_irho, (int)(T_cut*10));
86  if(T_vED>0) sprintf(L_vED,"vED%.2i",(int)(T_vED*100));
87  if(T_scc>0) sprintf(L_scc,"scc%.2i",(int)(T_scc*100));
88  if(T_pen>0) sprintf(L_pen,"pen%.2i",(int)(T_pen*100));
89  if(simulation) {if(T_win>0) sprintf(L_win,"win%.2i",(int)(T_win*10));
90  else {cout << "Error : T_win must be >0" << endl;exit(1);}}
91  TString sT_ifar = TString::Format("%g",T_ifar);
92  sT_ifar.ReplaceAll(".","d");
93  if(T_ifar>0) sprintf(L_ifar,"ifar%s",sT_ifar.Data());
94 
95  if(TString(L_cor)!="") pp_label=pp_label+TString("_"+TString(L_cor));
96  if(TString(L_cut)!="") pp_label=pp_label+TString("_"+TString(L_cut));
97  if(TString(L_CUT)!="") pp_label=pp_label+TString("_"+TString(L_CUT));
98  if(TString(L_vED)!="") pp_label=pp_label+TString("_"+TString(L_vED));
99  if(TString(L_scc)!="") pp_label=pp_label+TString("_"+TString(L_scc));
100  if(TString(L_pen)!="") pp_label=pp_label+TString("_"+TString(L_pen));
101  if(TString(L_win)!="") pp_label=pp_label+TString("_"+TString(L_win));
102  if(TString(L_ifar)!="") pp_label=pp_label+TString("_"+TString(L_ifar));
103 
105 
106  // ----------------------------------------------------------
107  // check pp parameters
108  // ----------------------------------------------------------
109 
110  if((pp_irho!=0)&&(pp_irho!=1)) {
111  cout << "cwb_epparameters.C : Error - wrong pp_irho=" << pp_irho << " value "
112  << "must be 0/1" << endl;
113  gSystem->Exit(1);
114  }
115  if((pp_inetcc!=0)&&(pp_inetcc!=1)) {
116  cout << "cwb_epparameters.C : Error - wrong pp_irho=" << pp_inetcc << " value "
117  << "must be 0/1" << endl;
118  gSystem->Exit(1);
119  }
120 
121  // ----------------------------------------------------------
122  // frequency cuts
123  // ----------------------------------------------------------
124 
125 #ifdef PP_64_200_HZ
126  lowFCUT[nFCUT] = 200.; highFCUT[nFCUT] = 2048.; nFCUT++;
127 #endif
128 #ifdef PP_200_2048_HZ
129  lowFCUT[nFCUT] = 0.; highFCUT[nFCUT] = 200.; nFCUT++;
130 #endif
131 #ifdef PP_1600_5000_HZ
132  lowFCUT[nFCUT] = 0.; highFCUT[nFCUT] = 1600.; nFCUT++;
133  lowFCUT[nFCUT] = 5000.; highFCUT[nFCUT] = 8192.; nFCUT++;
134 #endif
135 
136  // check frequency cuts consistency
137  for(int i=0;i<nFCUT;i++) {
138  if(highFCUT[i]<lowFCUT[i]) {
139  cout<< "Error in Frequency cuts : lowFCUT imust be < highFCUT"
140  << lowFCUT[i] << " " << highFCUT[i] << endl;
141  exit(1);
142  }
143  }
144  // select freequncy range for plots
145  double freqLow=fLow;
146  double freqHigh=fHigh;
147  for(int i=0;i<nFCUT;i++) {
148  if(fLow>=lowFCUT[i] && fLow<=highFCUT[i]) freqLow=highFCUT[i];
149  if(fHigh>=lowFCUT[i] && fHigh<=highFCUT[i]) freqHigh=lowFCUT[i];
150  }
151 #ifdef _USE_ROOT6
152  // export to CINT (this is a fix for ROOT6)
153  char epp_cmd[128];
154  sprintf(epp_cmd,"freqLow = %f;",freqLow); EXPORT(double,freqLow,epp_cmd)
155  sprintf(epp_cmd,"freqHigh = %f;",freqHigh); EXPORT(double,freqHigh,epp_cmd)
156 #endif
157 
158  // union of freq rages to get label
160  vector<waveSegment> iseg; iseg.clear();
161  seg.index=0; seg.start=0; seg.stop=fLow; iseg.push_back(seg);
162  seg.index=1; seg.start=fHigh; seg.stop=inRate/2.; iseg.push_back(seg);
163  for(int i=0;i<nFCUT;i++) {
164  seg.index=i+2; seg.start=lowFCUT[i]; seg.stop=highFCUT[i];
165  iseg.push_back(seg);
166  }
167  vector<waveSegment> oseg = CWB::Toolbox::unionSegments(iseg);
168  char freqs_label[1024]="";
169  for(int n=0;n<oseg.size()-1;n++) {
170  sprintf(freqs_label,"%s_freq%d_%d",freqs_label,int(oseg[n].stop),int(oseg[n+1].start));
171  }
173  sfreqs_label.ReplaceAll(".","d");
175 
176  // ----------------------------------------------------------
177  // Build title & subtitle for reports
178  // ----------------------------------------------------------
179 
180  strcpy(RunLabel,RUN_LABEL);
181 
182  char xtitle[1024];
183  if(strlen(ifo[0])>0) strcpy(xtitle,ifo[0]); else strcpy(xtitle,detParms[0].name);
184  for(int i=1;i<nIFO;i++) {
185  TString xtmp = xtitle;
186  if(strlen(ifo[i])>0) sprintf(xtitle,"%s-%s",xtmp.Data(),ifo[i]); // built in detector
187  else sprintf(xtitle,"%s-%s",xtmp.Data(),detParms[i].name); // user define detector
188  }
189 
191  sprintf(title,"SIMULATION - Network %s [%4.1f-%4.1f]",xtitle,ifLow,ifHigh);
192  } else {
193  if((cwb_lag_number==-1)&&(cwb_slag_number==-1)) {
194  sprintf(title,"BACKGROUND NON ZERO LAG - Network %s [%4.1f-%4.1f]",xtitle,ifLow,ifHigh);
195  }
196  if((cwb_lag_number>=0)&&(cwb_slag_number>=0)) {
197  sprintf(title,"BACKGROUND LAG %d SLAG %d - Network %s [%4.1f-%4.1f]",cwb_lag_number,cwb_slag_number,xtitle,ifLow,ifHigh);
198  }
199  if((cwb_lag_number>=0)&&(cwb_slag_number==-1)) {
200  sprintf(title,"BACKGROUND LAG %d - Network %s [%4.1f-%4.1f]",cwb_lag_number,xtitle,ifLow,ifHigh);
201  }
202  if((cwb_lag_number==-1)&&(cwb_slag_number>=0)) {
203  sprintf(title,"BACKGROUND SLAG %d - Network %s [%4.1f-%4.1f]",cwb_slag_number,xtitle,ifLow,ifHigh);
204  }
205  }
206 
207 
208  // ----------------------------------------------------------
209  // Build output directory names
210  // ----------------------------------------------------------
211 
212  if(cwb_merge_label.Sizeof()>1) sprintf(pp_dir,"%s/%s",pp_dir,cwb_merge_label.Data());
213  if(pp_label.Sizeof()>1) {
214  if((cwb_lag_number==-1)&&(cwb_slag_number==-1)) {
215  sprintf(pp_dir,"%s.R%s",pp_dir,pp_label.Data());
216  }
217  if((cwb_lag_number>=0)&&(cwb_slag_number>=0)) {
218  sprintf(pp_dir,"%s.R%s_lag%d_slag%d",pp_dir,pp_label.Data(),cwb_lag_number,cwb_slag_number);
219  }
220  if((cwb_lag_number>=0)&&(cwb_slag_number==-1)) {
221  sprintf(pp_dir,"%s.R%s_lag%d",pp_dir,pp_label.Data(),cwb_lag_number);
222  }
223  if((cwb_lag_number==-1)&&(cwb_slag_number>=0)) {
224  sprintf(pp_dir,"%s.R%s_slag%d",pp_dir,pp_label.Data(),cwb_slag_number);
225  }
226  } else {
227  if((cwb_lag_number==-1)&&(cwb_slag_number==-1)) {
228  sprintf(pp_dir,"%s.R",pp_dir);
229  }
230  if((cwb_lag_number>=0)&&(cwb_slag_number>=0)) {
231  sprintf(pp_dir,"%s.Rlag%d_slag%d",pp_dir,cwb_lag_number,cwb_slag_number);
232  }
233  if((cwb_lag_number>=0)&&(cwb_slag_number==-1)) {
234  sprintf(pp_dir,"%s.Rlag%d",pp_dir,cwb_lag_number);
235  }
236  if((cwb_lag_number==-1)&&(cwb_slag_number>=0)) {
237  sprintf(pp_dir,"%s.Rslag%d",pp_dir,cwb_slag_number);
238  }
239  }
240  sprintf(netdir,"%s/%s",pp_dir,pp_data_dir);
241 
242  // ----------------------------------------------------------
243  // build cuts
244  // ----------------------------------------------------------
245 
246  char ch2[2048]="";
247  if((cwb_lag_number==-1)&&(cwb_slag_number==-1)) {
248  sprintf(ch2,"netcc[%d]>%f&&!(lag[%d]==0&&slag[%d]==0)",pp_inetcc,T_cor,nIFO,nIFO);
249  }
251  sprintf(ch2,"netcc[%d]>%f&&lag[%d]==%d&&slag[%d]==%d",
253  }
254  if((cwb_lag_number>=0)&&(cwb_slag_number==-1)) {
255  sprintf(ch2,"netcc[%d]>%f&&lag[%d]==%d",pp_inetcc,T_cor,nIFO,cwb_lag_number);
256  }
257  if((cwb_lag_number==-1)&&(cwb_slag_number>=0)) {
258  sprintf(ch2,"netcc[%d]>%f&&slag[%d]==%d",pp_inetcc,T_cor,nIFO,cwb_slag_number);
259  }
260 
261  if(simulation) sprintf(ch2,"netcc[%d]>%f",pp_inetcc,T_cor);
262  else sprintf(ch2,"%s&&(rho[%d]>%f)",ch2,pp_irho,T_cut);
263 
264  if (T_vED>0) sprintf(ch2,"%s&&neted[0]/ecor<%f",ch2,T_vED);
265  if (T_scc>0) sprintf(ch2,"%s&&netcc[3]>%f",ch2,T_scc);
266  if (T_pen>0) sprintf(ch2,"%s&&penalty>%f",ch2,T_pen);
267  if (T_hrss>0) sprintf(ch2,"%s&&abs((TMath::Log10(hrss[%i])-TMath::Log10(hrss[%i])))<%f",ch2,i_hrss1,i_hrss2,T_hrss);
268 
269  for(int i=0;i<nFCUT;i++) {
270  sprintf(ch2,"%s&&((frequency[0]<%f)||(frequency[0]>=%f))",ch2,lowFCUT[i],highFCUT[i]);
271  }
272 
273 /*
274 #if defined (CAT2_VETO) || defined (HVETO_VETO) || defined (CAT3_VETO) || defined (PEM_VETO)
275  for(int i=0;i<nvdqf;i++) {
276  bool belongToNet=false;
277  for(int j=0;j<nIFO;j++) if(TString(vdqf[i].ifo)==ifo[j]) belongToNet=true;
278  if(!belongToNet) {
279  cout << "cwb_epparameters.C : Error in vdqf list defined in user_pparameters.C" << endl;
280  cout << " it includes ifo " << vdqf[i].ifo
281  << " which is not declared in the network" << endl << endl;
282  gSystem->Exit(1);
283  }
284  }
285 #endif
286 */
287 
288 #ifdef CAT2_VETO
289  for(int i=0;i<nvdqf;i++) {
290  if((vdqf[i].cat==CWB_CAT0)||(vdqf[i].cat==CWB_CAT1)||(vdqf[i].cat==CWB_CAT2)) VDQF[nVDQF++]=vdqf[i];
291  }
292  char veto_cat2[1024] = "";
293  for(int i=0;i<nvdqf;i++) {
294  if(vdqf[i].cat==CWB_CAT2) {
295  if(strlen(veto_cat2)==0) {
296  sprintf(veto_cat2,"%s_%s",CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
297  } else {
298  sprintf(veto_cat2,"%s&&%s_%s",veto_cat2,CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
299  }
300  }
301  }
302  cout << "veto_cat2 : " << veto_cat2 << endl;
303  sprintf(ch2,"%s&&(%s)",ch2,veto_cat2);
304 #endif
305 
306 #if defined (HVETO_VETO)
307  for(int i=0;i<nvdqf;i++) if(vdqf[i].cat==CWB_HVETO) VDQF[nVDQF++]=vdqf[i];
308 
309  for(int i=0;i<nvdqf;i++) {
310  if(vdqf[i].cat==CWB_HVETO) {
311  if(strlen(veto_not_vetoed)==0) {
312  sprintf(veto_not_vetoed,"!%s_%s",CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
313  } else {
314  char _veto_not_vetoed[1024];strcpy(_veto_not_vetoed,veto_not_vetoed);
315  sprintf(veto_not_vetoed,"%s&&!%s_%s",_veto_not_vetoed,CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
316  }
317  if(strlen(veto_vetoed)==0) {
318  sprintf(veto_vetoed,"%s_%s",CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
319  } else {
320  sprintf(veto_vetoed,"%s||%s_%s",veto_vetoed,CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
321  }
322  }
323  }
324 #endif
325 
326 #if defined (CAT3_VETO)
327  for(int i=0;i<nvdqf;i++) if(vdqf[i].cat==CWB_CAT3) VDQF[nVDQF++]=vdqf[i];
328 
329  for(int i=0;i<nvdqf;i++) {
330  if(vdqf[i].cat==CWB_CAT3) {
331  if(strlen(veto_not_vetoed)==0) {
332  sprintf(veto_not_vetoed,"!%s_%s",CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
333  } else {
334  sprintf(veto_not_vetoed,"%s&&!%s_%s",veto_not_vetoed,CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
335  }
336  if(strlen(veto_vetoed)==0) {
337  sprintf(veto_vetoed,"%s_%s",CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
338  } else {
339  sprintf(veto_vetoed,"%s||%s_%s",veto_vetoed,CWB_CAT_NAME[vdqf[i].cat].Data(),vdqf[i].ifo);
340  }
341  }
342  }
343 #endif
344 
345 #if defined (PEM_VETO)
346  for(int i=0;i<nvdqf;i++) if(vdqf[i].cat==CWB_PEM) VDQF[nVDQF++]=vdqf[i];
347 #endif
348 
349 #if defined (USER_VETO)
350  for(int i=0;i<nvdqf;i++) if(vdqf[i].cat==CWB_USER) VDQF[nVDQF++]=vdqf[i];
351 #endif
352 
353  cout << "ch2 : " << ch2 << endl;
354 
355 #if defined (HVETO_VETO) || defined (CAT3_VETO)
356  char _veto_vetoed[1024]; strcpy(_veto_vetoed,veto_vetoed);
357  sprintf(veto_vetoed,"%s&&(%s)",ch2,_veto_vetoed);
358  char _veto_not_vetoed[1024]; strcpy(_veto_not_vetoed,veto_not_vetoed);
359  sprintf(veto_not_vetoed,"%s&&(%s)",ch2,_veto_not_vetoed);
360  cout << "veto_vetoed : " << veto_vetoed << endl;
361  cout << "veto_not_vetoed : " << veto_not_vetoed << endl;
362 #endif
363 }
int i_hrss2
char ch2[2048]
TString sfreqs_label
double T_ifar
char xtitle[1024]
double start
Definition: network.hh:37
double T_pen
char L_pen[32]
tuple f
Definition: cwb_online.py:91
double fHigh
char name[32]
Definition: detector.hh:32
par[0] name
int n
Definition: cwb_net.C:10
vector< waveSegment > oseg
dqfile VDQF[100]
TString("c")
double T_cor
char RunLabel[1024]
double T_hrss
bool optim
TString sT_ifar
char freqs_label[1024]
int cwb_lag_number
char L_ifar[32]
i pp_inetcc
static TString CWB_CAT_NAME[14]
Definition: GToolbox.hh:4
int nVDQF
i drho i
double pp_drho
char ifo[NIFO_MAX][8]
static vector< waveSegment > unionSegments(vector< waveSegment > &ilist)
Definition: Toolbox.cc:101
#define nIFO
int cwb_slag_number
char L_scc[32]
char L_win[32]
double pp_rho_min
char netdir[1024]
else pp_label
int i_hrss1
pp_rho_bin
double pp_rho_max
waveSegment seg
seg start
seg stop
int index
Definition: network.hh:36
#define EXPORT(TYPE, VAR, CMD)
Definition: config.cc:74
char title[256]
Definition: SSeriesExample.C:1
vector< waveSegment > iseg
char answer[256]
double fLow
double T_win
char L_vED[32]
char pp_dir[512]
Definition: test_config1.C:155
char L_cut[32]
double highFCUT[100]
TString cwb_merge_label
char pp_data_dir[1024]
strcpy(RunLabel, RUN_LABEL)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
char veto_not_vetoed[1024]
double T_cut
CheckAnalysis()
Definition: Toolfun.hh:281
double freqHigh
double ifLow
char L_CUT[32]
int cat
double freqLow
double T_scc
double T_vED
simulation
Definition: cwb_eced.C:9
detectorParams detParms[4]
TString user_pp_label
double stop
Definition: network.hh:38
char L_cor[32]
i drho pp_irho
#define SEARCH(TYPE)
Definition: xroot.hh:4
double lowFCUT[100]
double ifHigh
exit(0)
char veto_vetoed[1024]