26 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
27 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
28 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
29 TB.
checkFile(gSystem->Getenv(
"CWB_PPARAMETERS_FILE"));
30 TB.
checkFile(gSystem->Getenv(
"CWB_UPPARAMETERS_FILE"));
31 TB.
checkFile(gSystem->Getenv(
"CWB_EPPARAMETERS_FILE"));
34 cout << endl <<
"cwb_report_loudest.C : Error - " 35 <<
"this command can not be used in simulation mode !!!" << endl << endl;
41 cout <<
"cwb_condor_loudest.C : Error - the accounting_group is not defined !!!" << endl;
42 cout <<
"The accounting_group must be defined in the user_parameters.C file" << endl;
43 cout <<
"See the following link:" << endl;
44 cout <<
" https://ldas-gridmon.ligo.caltech.edu/accounting/condor_groups/determine_condor_account_group.html" << endl;
45 cout <<
"Examples : " << endl;
46 cout <<
"strcpy(condor_tag,\"ligo.dev.o2.burst.allsky.cwboffline\");" << endl;
47 cout <<
"strcpy(condor_tag,\"ligo.prod.o2.burst.allsky.cwboffline\");" << endl;
48 cout <<
"If you don't need it set : strcpy(condor_tag,\"disabled\");" << endl << endl;
54 if(gSystem->Getenv(
"CWB_UPARAMETERS_FILE")==NULL) {
55 cout <<
"Error : environment CWB_UPARAMETERS_FILE is not defined!!!" << endl;
exit(1);
57 cwb_uparameters_file=
TString(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
74 if(cwb_report_options!=
"") {
80 if(option==
"FULL") cwb_loudest_stage = option;
84 if(option!=
"") cwb_loudest_odir = option;
88 if(option.IsDigit()) cwb_loudest_idmin = option.Atoi();
89 else { cout << endl <<
"cwb_report_loudest.C : Error - " 90 <<
"the option --idmin value is not a number !!!" 91 << endl << endl;
exit(1);}
97 if(option.IsDigit()) cwb_loudest_idmax = option.Atoi();
98 else { cout << endl <<
"cwb_report_loudest.C : Error - " 99 <<
"the option --idmax value is not a number !!!" 100 << endl << endl;
exit(1);}
102 if(cwb_loudest_idmax<cwb_loudest_idmin) {
103 cout << endl <<
"cwb_report_loudest.C : Error - " 104 <<
"the option --idmax value is < of --idmin value !!!" << endl << endl;
110 if(option.IsDigit()) cwb_loudest_nevt = option.Atoi();
111 else { cout << endl <<
"cwb_report_loudest.C : Error - " 112 <<
"the option --nevt value is not a number !!!" 113 << endl << endl;
exit(1);}
115 if(cwb_loudest_nevt==0) cwb_loudest_nevt=100000;
118 if(option!=
"") cwb_loudest_ufile = option;
121 if(option!=
"") cwb_loudest_veto = option;
122 cwb_loudest_veto.ToUpper();
125 if(option!=
"") cwb_loudest_ced = option;
126 cwb_loudest_ced.ToUpper();
130 if(option.IsFloat()) cwb_loudest_rho = option.Atof();
131 else { cout << endl <<
"cwb_report_loudest.C : Error - " 132 <<
"the option --rho value is not a number !!!" 133 << endl << endl;
exit(1);}
146 for(
int i=0;
i<jobList.size();
i++)
if(jobList[
i]>max_jobs) max_jobs=jobList[
i];
156 float icc,
icc2,
icc3,
irho,
iacor,
ilag,
islag,
ilik,
ipen,
icHH,
ivHH,
ivED;
166 vector<int>* lagLoudest =
new vector<int>[
max_jobs];
170 vector<TString>
JTAG;
171 ifstream
f_ev(events_sorted);
172 while(ievt<cwb_loudest_nevt) {
173 f_ev>>pm>>c3>>irho>>icc>>icc2>>icc3>>iacor>>ilag>>islag>>
ilik;
174 f_ev>>ipen>>icHH>>ifreq>>ilow>>ihigh>>idur>>isize>>irate>>
irun;
175 for(
int i=0;i<nIFO;i++) f_ev>>itime[
i];
176 for(
int i=0;i<nIFO;i++) f_ev>>iSNR[
i];
177 for(
int i=0;i<nIFO;i++) f_ev>>ihrss[
i];
179 if (!
f_ev.good())
break;
181 if (!
TString(pm).Contains(
"+"))
continue;
182 if ((cwb_loudest_veto==
"TRUE")&&(strcmp(pm,
"+")||strcmp(c3,
"-")))
continue;
183 if (cwb_loudest_idmin&&(iline<cwb_loudest_idmin))
continue;
184 if (cwb_loudest_idmax&&(iline>cwb_loudest_idmax))
continue;
185 if (irho<cwb_loudest_rho)
continue;
189 char jtag[1024];
sprintf(jtag,
"%i_%i_%i",irun,(
int)islag,(
int)ilag);
190 bool bjtag=
false;
for(
int j=0;
j<JTAG.size();
j++)
if(JTAG[
j]==jtag) bjtag=
true;
191 if(!bjtag) JTAG.push_back(jtag);
else continue;
193 cout << endl <<
"cwb_report_loudest.C : Error - " 194 <<
"job number is greater than max allowed jobs, check your yours dag and user_parameter.C files" << endl << endl;
197 lagLoudest[irun-1].push_back(ilag);
206 cout << endl <<
"cwb_report_loudest.C : Warning - " 207 <<
"no events has been selected !!!" << endl << endl;
217 for (
int i=0;
i<jobList.size();
i++) jobStage[jobList[
i]-1]=(
CWB_STAGE)0;
222 for(
int i=0;
i<fileList.size();
i++) {
225 TObjString* sloudestID = (TObjString*)token->At(token->GetEntries()-1);
226 if(sloudestID->GetString().IsDigit()) {
227 cout <<
i <<
" " << fileList[
i].Data() << endl;
228 int loudestID = sloudestID->GetString().Atoi();
229 if(iversion<loudestID) iversion=loudestID;
239 int estat = gSystem->GetPathInfo(ofile,&
id,&size,&flags,&mt);
244 cout <<
"File \"" << ofile <<
"\" already exist" << endl;
245 cout <<
"Do you want to overwrite the file ? (y/n) ";
247 cout << endl << endl;
248 }
while ((strcmp(answer,
"y")!=0)&&(strcmp(answer,
"n")!=0));
249 if (strcmp(answer,
"n")==0) {
256 if(gSystem->Getenv(
"CWB_STAGE_INPUT")!=NULL) {
257 cwb_stage_input=
TString(gSystem->Getenv(
"CWB_STAGE_INPUT"));
264 cout <<
"Starting reading output directory ..." << endl;
268 if(cwb_loudest_stage==
"AUTO")
for(
int n=0;
n<fileList2.size();
n++) {
273 if(fileList2[n].BeginsWith(cwb_stage_input+
"/init_"))
276 if(fileList2[n].BeginsWith(cwb_stage_input+
"/strain_"))
279 if(fileList2[n].BeginsWith(cwb_stage_input+
"/cstrain_"))
282 if(fileList2[n].BeginsWith(cwb_stage_input+
"/coherence_"))
285 if(fileList2[n].BeginsWith(cwb_stage_input+
"/supercluster_"))
295 if(cwb_loudest_ufile!=cwb_uparameters_file) {
304 cout <<
"No loudest events to be processed !!!" << endl;
308 cout <<
"New Loudest File " << endl;
309 cout << ofile << endl;
318 char full_condor_dir2[1024];
325 for (
int j=0;
j<lagLoudest[
i].size();
j++) {
329 char jtag[1024];
sprintf(jtag,
"%i_%i",jobID,lagLoudest[
i][
j]);
330 sprintf(ostring,
"JOB A%i_%s %s/%s.sub.loudest.%d",jID,jtag,full_condor_dir2,
data_label,iversion);
331 out << ostring << endl;
332 sprintf(ostring,
"VARS A%i_%s PID=\"%i\" CWB_UFILE=\"%s\" CWB_STAGE=\"%s\" ",
333 jID,jtag,jobID,
jobFiles[
i].Data(),cwb_stage_name.Data());
335 sprintf(ostring,
"CWB_MDC_FACTOR=\"0\" CWB_JOB_LAG=\"%i\" CWB_CED_DIR=\"%s\" ",
336 lagLoudest[
i][j],pp_loudest_dir.Data());
338 sprintf(ostring,
"CWB_INET_OPTIONS=\"%s\" CWB_UPARAMETERS_FILE=\"%s\" CWB_BATCH=\"true\"",
339 cwb_loudest_ced.Data(),cwb_loudest_ufile.Data());
340 out << ostring << endl;
341 sprintf(ostring,
"RETRY A%i_%s 3000",jID,jtag);
342 out << ostring << endl;
374 estat = gSystem->GetPathInfo(
TString(
condor_dir)+
"/loudest.sh",&
id,&size,&flags,&mt);
377 sprintf(cmd,
"ln -sf %s/cwb_loudest.sh %s/loudest.sh",cwb_scripts.Data(),
condor_dir);
384 sprintf(ofile_condor_sub,
"%s/%s.sub.loudest.%d",full_condor_dir2,
data_label,iversion);
387 if((fP = fopen(ofile_condor_sub,
"w")) == NULL) {
388 cout <<
"cwb_report_loudest.C : Error - cannot open file " << ofile_condor_sub << endl;
391 cout << ofile_condor_sub << endl;
393 fprintf(fP,
"universe = vanilla\n");
395 fprintf(fP,
"priority = $(PRI)\n");
396 fprintf(fP,
"on_exit_hold = ( ExitCode != 0 )\n");
397 fprintf(fP,
"request_memory = 2000\n");
398 fprintf(fP,
"executable = loudest.sh\n");
399 fprintf(fP,
"job_machine_attrs = Machine\n");
400 fprintf(fP,
"job_machine_attrs_history_length = 5\n");
401 fprintf(fP,
"requirements = target.machine =!= MachineAttrMachine1 && target.machine =!= MachineAttrMachine2 && target.machine =!= MachineAttrMachine3 && target.machine =!= MachineAttrMachine4 && target.machine =!= MachineAttrMachine5\n");
402 fprintf(fP,
"environment = CWB_JOBID=$(PID);CWB_UFILE=$(CWB_UFILE);CWB_STAGE=$(CWB_STAGE);CWB_MDC_FACTOR=$(CWB_MDC_FACTOR);CWB_JOB_LAG=$(CWB_JOB_LAG);CWB_CED_DIR=$(CWB_CED_DIR);CWB_INET_OPTIONS=$(CWB_INET_OPTIONS);CWB_UPARAMETERS_FILE=$(CWB_UPARAMETERS_FILE);CWB_BATCH=$(CWB_BATCH)\n");
403 if(
TString(condor_tag)!=
"")
fprintf(fP,
"accounting_group = %s\n",condor_tag);
404 fprintf(fP,
"output = %s/$(PID)_$(CWB_JOB_LAG)_%s_%s.out\n",full_condor_out_dir,
data_label,cwb_loudest_odir.Data());
405 fprintf(fP,
"error = %s/$(PID)_$(CWB_JOB_LAG)_%s_%s.err\n",full_condor_err_dir,
data_label,cwb_loudest_odir.Data());
407 fprintf(fP,
"notification = never\n");
413 cout <<
"Number of Jobs : " << jID <<
"/" << jobList.size() << endl;
415 cout <<
"To submit condor recovered jobs type :" << endl;
417 cout <<
"cwb_condor submit " << ofile << endl;
420 delete [] lagLoudest;
cout<< "slagList size : "<< slagList.size()<< endl;cout<< endl<< "Start segments selection from dq cat1 list ..."<< endl<< endl;rslagList=TB.getSlagList(slagList, ifos, segLen, segMLS, segEdge, nDQF, DQF, CWB_CAT1);cout<< "Number of selected jobs after cat1 : "<< rslagList.size()<< endl;cout<< endl<< "Start segments selection from dq cat2 list ..."<< endl<< endl;rslagList=TB.getSlagList(rslagList, ifos, segLen, segTHR, segEdge, nDQF, DQF, CWB_CAT2);cout<< "Number of selected jobs after cat2 : "<< rslagList.size()<< endl;vector< TString > jobFiles
char full_condor_dir[1024]
TString cwb_loudest_stage
sprintf(full_condor_dir,"%s/%s", work_dir, condor_dir)
fprintf(stdout,"start=%f duration=%f rate=%f\, x.start(), x.size()/x.rate(), x.rate())
char full_condor_out_dir[1024]
TString cwb_report_options
ifstream f_ev(events_sorted)
char full_condor_err_dir[1024]
char ofile_condor_sub[1024]
cout<< ofile_condor_sub<< endl;char full_condor_dir[1024];char full_condor_out_dir[1024];char full_condor_err_dir[1024];sprintf(full_condor_dir,"%s/%s", work_dir, condor_dir);sprintf(full_condor_out_dir,"%s/%s", work_dir, log_dir);sprintf(full_condor_err_dir,"%s/%s", work_dir, log_dir);fprintf(fP,"universe = vanilla\");fprintf(fP,"getenv = true\");fprintf(fP,"priority = $(PRI)\");fprintf(fP,"on_exit_hold = ( ExitCode != 0 )\");fprintf(fP,"request_memory = 2000\");fprintf(fP,"executable = ced.sh\");fprintf(fP,"job_machine_attrs = Machine\");fprintf(fP,"job_machine_attrs_history_length = 5\");fprintf(fP,"requirements = target.machine =!= MachineAttrMachine1 && target.machine =!= MachineAttrMachine2 && target.machine =!= MachineAttrMachine3 && target.machine =!= MachineAttrMachine4 && target.machine =!= MachineAttrMachine5\");fprintf(fP,"environment = CWB_JOBID=$(PID);CWB_GPS_EVENT=$(CWB_GPS_EVENT);CWB_INET_OPTIONS=$(CWB_INET_OPTIONS);CWB_MDC_FACTOR=$(CWB_MDC_FACTOR);CWB_JOB_LAG=$(CWB_JOB_LAG);CWB_CED_DIR=$(CWB_CED_DIR);CWB_BATCH=$(CWB_BATCH)\");if(TString(condor_tag)!="") fprintf(fP,"accounting_group = %s\", condor_tag);fprintf(fP,"output = %s/$(PID)_$(CWB_JOB_LAG)_%s.out\", full_condor_out_dir, condor_label);fprintf(fP,"error = %s/$(PID)_$(CWB_JOB_LAG)_%s.err\", full_condor_err_dir, condor_label);fprintf(fP,"log = %s/%s.log\", condor_log, condor_label);fprintf(fP,"notification = never\");fprintf(fP,"rank=memory\");fprintf(fP,"queue\");fclose(fP);char ofile_condor_dag[1024];sprintf(ofile_condor_dag,"%s/%s.dag", condor_dir, condor_label);ofstream out;out.open(ofile_condor_dag, ios::out);if(!out.good()) {cout<< "Error Opening File : "<< ofile_condor_dag<< endl;exit(1);} cout<< ofile_condor_dag<< endl;int ievt=0;vector< TString > JTAG
cout<< "Starting reading output directory ..."<< endl;vector< TString > fileList
strcpy(RunLabel, RUN_LABEL)
TString cwb_loudest_ufile