23 unsigned int Pid = gSystem->GetPid();
28 if(gSystem->Getenv(
"SITE_CLUSTER")!=NULL) {
29 site_cluster=
TString(gSystem->Getenv(
"SITE_CLUSTER"));
36 if(cwb_eced_opts!=
"") {
37 if(cwb_eced_opts.IsFloat()) {
38 gps_event=cwb_eced_opts.Atoi();
43 TB.
checkFile(gSystem->ExpandPathName(ECED_CFG.Data()));
44 gROOT->Macro(gSystem->ExpandPathName(ECED_CFG.Data()));
49 if(ECED_GPS.IsFloat()) gps_event=ECED_GPS.Atoi();
52 if(ECED_FACTOR.IsFloat())
factor[0]=ECED_FACTOR.Atof();
55 if(ECED_SEARCH.Sizeof()==2)
SEARCH()=ECED_SEARCH[0];
58 if(ECED_SIM.IsFloat()) {
59 int sim = ECED_SIM.Atoi();
60 if((sim<0)&&(sim>2)) {
61 cout <<
"Error : bad --sim value [0/1/2] !!!" << endl;
67 if(ECED_TAG!=
"")
strcpy(tag,ECED_TAG.Data());
71 cout <<
"cwb_eced - Error : gps_event must be > 0, check config/user_parameters.C" << endl;
74 char sgps_event[16];
sprintf(sgps_event,
"%f",gps_event);
75 gSystem->Setenv(
"CWB_GPS_EVENT",sgps_event);
79 if(gSystem->Getenv(
"CWB_ECED_NDET")!=NULL) {
80 if(
TString(gSystem->Getenv(
"CWB_ECED_NDET")).IsDigit()) {
81 nIFO=
TString(gSystem->Getenv(
"CWB_ECED_NDET")).Atoi();
83 cout <<
"cwb_eced - Error : ifos are not defined" << endl;
87 cout <<
"Error : environment CWB_ECED_NDET is not defined!!!" << endl;
95 char cwb_eced_det[64];
sprintf(cwb_eced_det,
"CWB_ECED_DET%d",
n+1);
96 if(gSystem->Getenv(cwb_eced_det)!=NULL) {
97 ecedOptions=
TString(gSystem->Getenv(cwb_eced_det));
100 if(ecedOptions.Sizeof()==3) {
105 if(ECED_IFO!=
"")
strcpy(
ifo[
n],ECED_IFO.Data());
106 else {cout <<
"Error : Inline param --ifo is not defined!!!" << endl;
exit(1);}
110 if(ECED_TYPE!=
"")
strcpy(channelTypesRaw[
n],ECED_TYPE.Data());
112 for(
int i=0;i<
_nIFO;i++)
if(_ifo[i]==
ifo[n])
strcpy(channelTypesRaw[n],_frFiles[i].Data());
113 for(
int i=0;i<
_nIFO;i++)
if(_ifo[i]==
ifo[n])
strcpy(channelTypesRaw[n+nIFO],_frFiles[i+_nIFO].Data());
130 if(ECED_SHIFT.IsFloat()) {
133 {cout <<
"Error : shift parameter is not an integer number!!! " << ECED_SHIFT << endl;gSystem->Exit(1);}
134 for(
int i=0;i<
nDQF;i++)
DQF[i].
shift+=ECED_SHIFT.Atof();
135 }
else {cout <<
"Error : shift parameter is not a number!!! " << ECED_SHIFT << endl;gSystem->Exit(1);}
143 cout << n <<
" ifo " << ifo[
n] <<
" type " << channelTypesRaw[
n]
147 for(
int i=0;i<
nDQF;i++) cout <<
"DQF : " << i <<
" " <<
DQF[i].
ifo <<
" " <<
DQF[i].
file << endl;
173 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"L1_LDAS_C02_L2");
177 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"H1_LDAS_C02_L2");
181 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"H2_LDAS_C02_L2");
185 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"HrecV2");
189 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"G1_RDS_C01_L3");
197 sprintf(eced_dir,
"%s_TAG%s",eced_dir,tag);
198 if(cwb_inet_opts==
"ced") {
199 sprintf(eced_dir,
"%s_GPS%d",eced_dir,gps_event);
202 int estat = gSystem->GetPathInfo(eced_dir,&
id,&size,&flags,&mt);
204 cout <<
"cwb_eced - Error : directory " << eced_dir <<
" already exist " << endl;
221 if(cwb_inet_opts==
"ced") {
232 for(
int i=0;i<
NIFO_MAX;i++) {
strcpy(ldf_command[i],
"");ldf_check[
i]=
true;}
233 for(
int n=0;n<
nIFO;n++) {
235 if(
TString(channelTypesRaw[n]).Contains(
".")) {
243 if((site_cluster!=
"CIT")&&(site_cluster!=
"ATLAS")) {
244 cout <<
"cwb_eced error : gw_data_find can be used only in CIT or ATLAS cluster" << endl;
250 if(strcmp(
ifo[n],
"L1")&&strcmp(
ifo[n],
"H1")&&strcmp(
ifo[n],
"H2")&&strcmp(
ifo[n],
"V1")&&strcmp(
ifo[n],
"G1")) {
251 cout <<
"cwb_eced - Error : declared ifo " <<
ifo[
n]
252 <<
" not enabled for eced (must be L1 or H1 or H2 or V1 or G1)" << endl;
258 strcpy(ldf_command[n],
"gw_data_find");
261 char observatory[4]=
"";
262 if(ECED_IFO==
"L1")
strcpy(observatory,
"L");
263 if(ECED_IFO==
"H1")
strcpy(observatory,
"H");
264 if(ECED_IFO==
"H2")
strcpy(observatory,
"H");
265 if(ECED_IFO==
"V1")
strcpy(observatory,
"V");
266 if(ECED_IFO==
"G1")
strcpy(observatory,
"G");
268 sprintf(ldf_command[n],
"%s --observatory=%s",ldf_command[n],observatory);
272 cout <<
"cwb_eced - Error : strain channel name for ifo " <<
ifo[
n]
273 <<
" not defined, check parameter channelNamesRaw[" << n <<
"] in config/user_parameters.C" << endl;
278 FILE* fp = gSystem->TempFileName(
"eced");
282 sprintf(ldf_command[n],
"%s --type=%s",ldf_command[n],channelTypesRaw[n]);
283 sprintf(ldf_command[n],
"%s --gps-start-time=%d --gps-end-time=%d",
285 sprintf(cmd,
"%s --url-type=file > %s",ldf_command[n],tmpFile.Data());
287 sprintf(ldf_command[n],
"%s --url-type=file > %s",ldf_command[n],
frFiles[n]);
295 int ret = gSystem->Exec(cmd);
297 cout <<
"cwb_eced - gw_data_find error" << endl;
303 gSystem->GetPathInfo(tmpFile, &
id, &size, &flags, &modtime);
306 sprintf(cmd,
"rm %s",tmpFile.Data());
310 if(size==0) {ldf_check[
n]=
false;ldf_gcheck=
false;}
314 for(
int n=0;n<
nIFO;n++) {
315 if(!ldf_check[n]) cout <<
ifo[
n] <<
" cwb_eced - no data found !!!" << endl;
316 else cout <<
ifo[
n] <<
" cwb_eced - data found" << endl;
319 cout << endl <<
"check types : gw_data_find --show-types" << endl << endl;
324 bool check = (cwb_inet_opts==
"ced") ?
true :
false;
325 bool remove = (cwb_inet_opts==
"ced") ?
true :
false;
326 TB.
mkDir(eced_dir,check,
remove);
331 for(
int n=0;n<
nIFO;n++) {
333 cout << ldf_command[
n] << endl;
334 int ret = gSystem->Exec(ldf_command[n]);
336 cout <<
"cwb_eced - gw_data_find error" << endl;
345 for(
int n=0;n<
nIFO;n++) {
347 gSystem->GetPathInfo(
frFiles[n], &
id, &size, &flags, &modtime);
349 cout <<
"cwb_eced - Error : frame file list \"" <<
frFiles[
n] <<
"\" with size=0" << endl;
363 gSystem->Setenv(
"CWB_UPARAMETERS_FILE",uparameter);
366 gSystem->Setenv(
"CWB_CED_DIR",
ced_dir);
368 if(cwb_inet_opts==
"ced") {
379 for(
int n=0;n<
nIFO;n++) {
384 if (!out.good()) {cout <<
"cwb_eced - Error : Error Opening File : " << cat1_file << endl;
exit(1);}
385 out << gps_start <<
" " << gps_stop << endl;
char channelNamesMDC[NIFO_MAX][50]
char channelNamesRaw[NIFO_MAX][50]
TString _frFiles[2 *NIFO_MAX]
char frFiles[NIFO_MAX+1][256]
char channelTypesRaw[NIFO_MAX][1024]
TString _channelNamesRaw[NIFO_MAX]
sprintf(sgps_event,"%f", gps_event)
double dataShift[NIFO_MAX]
TString _channelNamesMDC[NIFO_MAX]
char ldf_command[NIFO_MAX][1024]
strcpy(RunLabel, RUN_LABEL)