8 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
9 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
10 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
11 TB.
checkFile(gSystem->Getenv(
"CWB_PPARAMETERS_FILE"));
12 TB.
checkFile(gSystem->Getenv(
"CWB_UPPARAMETERS_FILE"));
13 TB.
checkFile(gSystem->Getenv(
"CWB_EPPARAMETERS_FILE"));
16 cout << endl <<
"cwb_report_loudest.C : Error - "
17 <<
"this command can not be used in simulation mode !!!" << endl << endl;
23 cout <<
"cwb_condor_loudest.C : Error - the accounting_group is not defined !!!" << endl;
24 cout <<
"The accounting_group must be defined in the user_parameters.C file" << endl;
25 cout <<
"See the following link:" << endl;
26 cout <<
" https://ldas-gridmon.ligo.caltech.edu/accounting/condor_groups/determine_condor_account_group.html" << endl;
27 cout <<
"Examples : " << endl;
28 cout <<
"strcpy(condor_tag,\"ligo.dev.o2.burst.allsky.cwboffline\");" << endl;
29 cout <<
"strcpy(condor_tag,\"ligo.prod.o2.burst.allsky.cwboffline\");" << endl;
30 cout <<
"If you don't need it set : strcpy(condor_tag,\"disabled\");" << endl << endl;
36 if(gSystem->Getenv(
"CWB_UPARAMETERS_FILE")==NULL) {
37 cout <<
"Error : environment CWB_UPARAMETERS_FILE is not defined!!!" << endl;
exit(1);
39 cwb_uparameters_file=
TString(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
56 if(cwb_report_options!=
"") {
62 if(option==
"FULL") cwb_loudest_stage = option;
66 if(option!=
"") cwb_loudest_odir = option;
70 if(option.IsDigit()) cwb_loudest_idmin = option.Atoi();
71 else { cout << endl <<
"cwb_report_loudest.C : Error - "
72 <<
"the option --idmin value is not a number !!!"
73 << endl << endl;
exit(1);}
79 if(option.IsDigit()) cwb_loudest_idmax = option.Atoi();
80 else { cout << endl <<
"cwb_report_loudest.C : Error - "
81 <<
"the option --idmax value is not a number !!!"
82 << endl << endl;
exit(1);}
84 if(cwb_loudest_idmax<cwb_loudest_idmin) {
85 cout << endl <<
"cwb_report_loudest.C : Error - "
86 <<
"the option --idmax value is < of --idmin value !!!" << endl << endl;
92 if(option.IsDigit()) cwb_loudest_nevt = option.Atoi();
93 else { cout << endl <<
"cwb_report_loudest.C : Error - "
94 <<
"the option --nevt value is not a number !!!"
95 << endl << endl;
exit(1);}
97 if(cwb_loudest_nevt==0) cwb_loudest_nevt=100000;
100 if(option!=
"") cwb_loudest_ufile = option;
103 if(option!=
"") cwb_loudest_veto = option;
104 cwb_loudest_veto.ToUpper();
107 if(option!=
"") cwb_loudest_ced = option;
108 cwb_loudest_ced.ToUpper();
112 if(option.IsFloat()) cwb_loudest_rho = option.Atof();
113 else { cout << endl <<
"cwb_report_loudest.C : Error - "
114 <<
"the option --rho value is not a number !!!"
115 << endl << endl;
exit(1);}
128 for(
int i=0;
i<jobList.size();
i++)
if(jobList[
i]>max_jobs) max_jobs=jobList[
i];
138 float icc,
icc2,
icc3,
irho,
iacor,
ilag,
islag,
ilik,
ipen,
icHH,
ivHH,
ivED;
152 vector<TString>
JTAG;
153 ifstream
f_ev(events_sorted);
154 while(ievt<cwb_loudest_nevt) {
155 f_ev>>pm>>c3>>irho>>icc>>icc2>>icc3>>iacor>>ilag>>islag>>
ilik;
156 f_ev>>ipen>>icHH>>ifreq>>ilow>>ihigh>>idur>>isize>>irate>>
irun;
157 for(
int i=0;i<nIFO;i++) f_ev>>itime[
i];
158 for(
int i=0;i<nIFO;i++) f_ev>>iSNR[
i];
159 for(
int i=0;i<nIFO;i++) f_ev>>ihrss[
i];
161 if (!
f_ev.good())
break;
163 if (!
TString(pm).Contains(
"+"))
continue;
164 if ((cwb_loudest_veto==
"TRUE")&&(strcmp(pm,
"+")||strcmp(c3,
"-")))
continue;
165 if (cwb_loudest_idmin&&(iline<cwb_loudest_idmin))
continue;
166 if (cwb_loudest_idmax&&(iline>cwb_loudest_idmax))
continue;
167 if (irho<cwb_loudest_rho)
continue;
171 char jtag[1024];
sprintf(jtag,
"%i_%i_%i",irun,(
int)islag,(
int)ilag);
172 bool bjtag=
false;
for(
int j=0;
j<JTAG.size();
j++)
if(JTAG[
j]==jtag) bjtag=
true;
173 if(!bjtag) JTAG.push_back(jtag);
else continue;
174 lagLoudest[irun-1].push_back(ilag);
183 cout << endl <<
"cwb_report_loudest.C : Warning - "
184 <<
"no events has been selected !!!" << endl << endl;
194 for (
int i=0;
i<jobList.size();
i++) jobStage[jobList[
i]-1]=0;
199 for(
int i=0;
i<fileList.size();
i++) {
202 TObjString* sloudestID = (TObjString*)token->At(token->GetEntries()-1);
203 if(sloudestID->GetString().IsDigit()) {
204 cout <<
i <<
" " << fileList[
i].Data() << endl;
205 int loudestID = sloudestID->GetString().Atoi();
206 if(iversion<loudestID) iversion=loudestID;
216 int estat = gSystem->GetPathInfo(ofile,&
id,&size,&flags,&mt);
221 cout <<
"File \"" << ofile <<
"\" already exist" << endl;
222 cout <<
"Do you want to overwrite the file ? (y/n) ";
224 cout << endl << endl;
225 }
while ((strcmp(answer,
"y")!=0)&&(strcmp(answer,
"n")!=0));
226 if (strcmp(answer,
"n")==0) {
233 if(gSystem->Getenv(
"CWB_STAGE_INPUT")!=NULL) {
234 cwb_stage_input=
TString(gSystem->Getenv(
"CWB_STAGE_INPUT"));
241 cout <<
"Starting reading output directory ..." << endl;
245 if(cwb_loudest_stage==
"AUTO")
for(
int n=0;
n<fileList.size();
n++) {
250 if(fileList[n].BeginsWith(cwb_stage_input+
"/init_"))
253 if(fileList[n].BeginsWith(cwb_stage_input+
"/strain_"))
256 if(fileList[n].BeginsWith(cwb_stage_input+
"/cstrain_"))
259 if(fileList[n].BeginsWith(cwb_stage_input+
"/coherence_"))
262 if(fileList[n].BeginsWith(cwb_stage_input+
"/supercluster_"))
272 if(cwb_loudest_ufile!=cwb_uparameters_file) {
281 cout <<
"No loudest events to be processed !!!" << endl;
285 cout <<
"New Loudest File " << endl;
286 cout << ofile << endl;
295 char full_condor_dir[1024];
302 for (
int j=0;
j<lagLoudest[
i].size();
j++) {
306 char jtag[1024];
sprintf(jtag,
"%i_%i",jobID,lagLoudest[
i][
j]);
307 sprintf(ostring,
"JOB A%i_%s %s/%s.sub.loudest.%d",jID,jtag,full_condor_dir,
data_label,iversion);
308 out << ostring << endl;
309 sprintf(ostring,
"VARS A%i_%s PID=\"%i\" CWB_UFILE=\"%s\" CWB_STAGE=\"%s\" ",
310 jID,jtag,jobID,
jobFiles[
i].Data(),cwb_stage_name.Data());
312 sprintf(ostring,
"CWB_MDC_FACTOR=\"0\" CWB_JOB_LAG=\"%i\" CWB_CED_DIR=\"%s\" ",
313 lagLoudest[
i][
j],pp_loudest_dir.Data());
315 sprintf(ostring,
"CWB_INET_OPTIONS=\"%s\" CWB_UPARAMETERS_FILE=\"%s\" CWB_BATCH=\"true\"",
316 cwb_loudest_ced.Data(),cwb_loudest_ufile.Data());
317 out << ostring << endl;
318 sprintf(ostring,
"RETRY A%i_%s 3000",jID,jtag);
319 out << ostring << endl;
352 int estat = gSystem->GetPathInfo(
TString(
condor_dir)+
"/loudest.sh",&
id,&size,&flags,&mt);
355 sprintf(cmd,
"ln -sf %s/cwb_loudest.sh %s/loudest.sh",cwb_scripts.Data(),
condor_dir);
362 sprintf(ofile_condor_sub,
"%s/%s.sub.loudest.%d",full_condor_dir,
data_label,iversion);
365 if((fP = fopen(ofile_condor_sub,
"w")) == NULL) {
366 cout <<
"cwb_report_loudest.C : Error - cannot open file " << ofile_condor_sub << endl;
369 cout << ofile_condor_sub << endl;
371 fprintf(fP,
"universe = vanilla\n");
373 fprintf(fP,
"priority = $(PRI)\n");
374 fprintf(fP,
"on_exit_hold = ( ExitCode != 0 )\n");
375 fprintf(fP,
"request_memory = 2000\n");
376 fprintf(fP,
"executable = loudest.sh\n");
377 fprintf(fP,
"job_machine_attrs = Machine\n");
378 fprintf(fP,
"job_machine_attrs_history_length = 5\n");
379 fprintf(fP,
"requirements = target.machine =!= MachineAttrMachine1 && target.machine =!= MachineAttrMachine2 && target.machine =!= MachineAttrMachine3 && target.machine =!= MachineAttrMachine4 && target.machine =!= MachineAttrMachine5\n");
380 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");
381 if(
TString(condor_tag)!=
"")
fprintf(fP,
"accounting_group = %s\n",condor_tag);
382 fprintf(fP,
"output = %s/$(PID)_$(CWB_JOB_LAG)_%s_%s.out\n",full_condor_out_dir,
data_label,cwb_loudest_odir.Data());
383 fprintf(fP,
"error = %s/$(PID)_$(CWB_JOB_LAG)_%s_%s.err\n",full_condor_err_dir,
data_label,cwb_loudest_odir.Data());
385 fprintf(fP,
"notification = never\n");
391 cout <<
"Number of Jobs : " << jID <<
"/" << jobList.size() << endl;
393 cout <<
"To submit condor recovered jobs type :" << endl;
395 cout <<
"cwb_condor submit " << ofile << endl;
fprintf(stdout,"start=%f duration=%f rate=%f\n", x.start(), x.size()/x.rate(), x.rate())
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)
CWB_STAGE jobStage[max_jobs]
TString cwb_report_options
ifstream f_ev(events_sorted)
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\n");fprintf(fP,"getenv = true\n");fprintf(fP,"priority = $(PRI)\n");fprintf(fP,"on_exit_hold = ( ExitCode != 0 )\n");fprintf(fP,"request_memory = 2000\n");fprintf(fP,"executable = ced.sh\n");fprintf(fP,"job_machine_attrs = Machine\n");fprintf(fP,"job_machine_attrs_history_length = 5\n");fprintf(fP,"requirements = target.machine =!= MachineAttrMachine1 && target.machine =!= MachineAttrMachine2 && target.machine =!= MachineAttrMachine3 && target.machine =!= MachineAttrMachine4 && target.machine =!= MachineAttrMachine5\n");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)\n");if(TString(condor_tag)!="") fprintf(fP,"accounting_group = %s\n", condor_tag);fprintf(fP,"output = %s/$(PID)_$(CWB_JOB_LAG)_%s.out\n", full_condor_out_dir, condor_label);fprintf(fP,"error = %s/$(PID)_$(CWB_JOB_LAG)_%s.err\n", full_condor_err_dir, condor_label);fprintf(fP,"log = %s/%s.log\n", condor_log, condor_label);fprintf(fP,"notification = never\n");fprintf(fP,"rank=memory\n");fprintf(fP,"queue\n");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)
char full_condor_out_dir[512]
TString cwb_loudest_ufile
char full_condor_err_dir[512]