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