40 unsigned int Pid = gSystem->GetPid();
45 if(gSystem->Getenv(
"SITE_CLUSTER")!=NULL) {
46 site_cluster=
TString(gSystem->Getenv(
"SITE_CLUSTER"));
53 if(cwb_eced_opts!=
"") {
54 if(cwb_eced_opts.IsFloat()) {
55 xgps_event=cwb_eced_opts.Atoi();
61 gROOT->Macro(gSystem->ExpandPathName(ECED_CFG.Data()));
66 if(ECED_GPS.IsFloat()) xgps_event=ECED_GPS.Atoi();
69 if(ECED_FACTOR.IsFloat())
factors[0]=ECED_FACTOR.Atof();
72 if(ECED_SEARCH.Sizeof()==2)
SEARCH()=ECED_SEARCH[0];
75 if(ECED_SIM.IsFloat()) {
76 int sim = ECED_SIM.Atoi();
77 if((sim<0)&&(sim>2)) {
78 cout <<
"Error : bad --sim value [0/1/2] !!!" << endl;
84 if(ECED_TAG!=
"")
strcpy(tag,ECED_TAG.Data());
88 cout <<
"cwb_eced - Error : gps_event must be > 0, check config/user_parameters.C" << endl;
91 char sgps_event[16];
sprintf(sgps_event,
"%d",xgps_event);
92 gSystem->Setenv(
"CWB_GPS_EVENT",sgps_event);
96 if(gSystem->Getenv(
"CWB_ECED_NDET")!=NULL) {
97 if(
TString(gSystem->Getenv(
"CWB_ECED_NDET")).IsDigit()) {
98 nIFO=
TString(gSystem->Getenv(
"CWB_ECED_NDET")).Atoi();
100 cout <<
"cwb_eced - Error : ifos are not defined" << endl;
104 cout <<
"Error : environment CWB_ECED_NDET is not defined!!!" << endl;
112 char cwb_eced_det[64];
sprintf(cwb_eced_det,
"CWB_ECED_DET%d",
n+1);
113 if(gSystem->Getenv(cwb_eced_det)!=NULL) {
114 ecedOptions=
TString(gSystem->Getenv(cwb_eced_det));
117 if(ecedOptions.Sizeof()==3) {
122 if(ECED_IFO!=
"")
strcpy(
ifo[
n],ECED_IFO.Data());
123 else {cout <<
"Error : Inline param --ifo is not defined!!!" << endl;
exit(1);}
127 if(ECED_TYPE!=
"")
strcpy(channelTypesRaw[
n],ECED_TYPE.Data());
129 for(
int i=0;i<
_nIFO;i++)
if(_ifo[i]==
ifo[n])
strcpy(channelTypesRaw[n],_frFiles[i].Data());
130 for(
int i=0;i<
_nIFO;i++)
if(_ifo[i]==
ifo[n])
strcpy(channelTypesRaw[n+nIFO],_frFiles[i+_nIFO].Data());
147 if(ECED_SHIFT.IsFloat()) {
150 {cout <<
"Error : shift parameter is not an integer number!!! " << ECED_SHIFT << endl;gSystem->Exit(1);}
151 for(
int i=0;i<
nDQF;i++)
DQF[i].
shift+=ECED_SHIFT.Atof();
152 }
else {cout <<
"Error : shift parameter is not a number!!! " << ECED_SHIFT << endl;gSystem->Exit(1);}
160 cout << n <<
" ifo " << ifo[
n] <<
" type " << channelTypesRaw[
n]
164 for(
int i=0;i<
nDQF;i++) cout <<
"DQF : " << i <<
" " <<
DQF[i].
ifo <<
" " <<
DQF[i].file << endl;
190 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"L1_LDAS_C02_L2");
194 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"H1_LDAS_C02_L2");
198 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"H2_LDAS_C02_L2");
202 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"HrecV2");
206 if(
TString(channelTypesRaw[n])==
"")
sprintf(channelTypesRaw[n],
"G1_RDS_C01_L3");
214 sprintf(eced_dir,
"%s_TAG%s",eced_dir,tag);
215 if(cwb_inet_opts==
"ced") {
216 sprintf(eced_dir,
"%s_GPS%d",eced_dir,xgps_event);
219 int estat = gSystem->GetPathInfo(eced_dir,&
id,&size,&flags,&mt);
221 cout <<
"cwb_eced - Error : directory " << eced_dir <<
" already exist " << endl;
238 if(cwb_inet_opts==
"ced") {
249 for(
int i=0;i<
NIFO_MAX;i++) {
strcpy(ldf_command[i],
"");ldf_check[
i]=
true;}
250 for(
int n=0;n<
nIFO;n++) {
252 if(
TString(channelTypesRaw[n]).Contains(
".")) {
260 if((site_cluster!=
"CIT")&&(site_cluster!=
"ATLAS")) {
261 cout <<
"cwb_eced error : gw_data_find can be used only in CIT or ATLAS cluster" << endl;
267 if(strcmp(
ifo[n],
"L1")&&strcmp(
ifo[n],
"H1")&&strcmp(
ifo[n],
"H2")&&strcmp(
ifo[n],
"V1")&&strcmp(
ifo[n],
"G1")) {
268 cout <<
"cwb_eced - Error : declared ifo " <<
ifo[
n]
269 <<
" not enabled for eced (must be L1 or H1 or H2 or V1 or G1)" << endl;
275 strcpy(ldf_command[n],
"gw_data_find");
278 char observatory[4]=
"";
279 if(ECED_IFO==
"L1")
strcpy(observatory,
"L");
280 if(ECED_IFO==
"H1")
strcpy(observatory,
"H");
281 if(ECED_IFO==
"H2")
strcpy(observatory,
"H");
282 if(ECED_IFO==
"V1")
strcpy(observatory,
"V");
283 if(ECED_IFO==
"G1")
strcpy(observatory,
"G");
285 sprintf(ldf_command[n],
"%s --observatory=%s",ldf_command[n],observatory);
289 cout <<
"cwb_eced - Error : strain channel name for ifo " <<
ifo[
n]
290 <<
" not defined, check parameter channelNamesRaw[" << n <<
"] in config/user_parameters.C" << endl;
296 FILE* fp = gSystem->TempFileName(base);
300 sprintf(ldf_command[n],
"%s --type=%s",ldf_command[n],channelTypesRaw[n]);
301 sprintf(ldf_command[n],
"%s --gps-start-time=%f --gps-end-time=%f",
303 sprintf(cmd,
"%s --url-type=file > %s",ldf_command[n],tmpFile.Data());
305 sprintf(ldf_command[n],
"%s --url-type=file > %s",ldf_command[n],
frFiles[n]);
313 int ret = gSystem->Exec(cmd);
315 cout <<
"cwb_eced - gw_data_find error" << endl;
321 gSystem->GetPathInfo(tmpFile, &
id, &size, &flags, &modtime);
324 sprintf(cmd,
"rm %s",tmpFile.Data());
328 if(size==0) {ldf_check[
n]=
false;ldf_gcheck=
false;}
332 for(
int n=0;n<
nIFO;n++) {
333 if(!ldf_check[n]) cout <<
ifo[
n] <<
" cwb_eced - no data found !!!" << endl;
334 else cout <<
ifo[
n] <<
" cwb_eced - data found" << endl;
337 cout << endl <<
"check types : gw_data_find --show-types" << endl << endl;
342 bool check = (cwb_inet_opts==
"ced") ?
true :
false;
343 bool bremove = (cwb_inet_opts==
"ced") ?
true :
false;
349 for(
int n=0;n<
nIFO;n++) {
351 cout << ldf_command[
n] << endl;
352 int ret = gSystem->Exec(ldf_command[n]);
354 cout <<
"cwb_eced - gw_data_find error" << endl;
363 for(
int n=0;n<
nIFO;n++) {
365 gSystem->GetPathInfo(
frFiles[n], &
id, &size, &flags, &modtime);
367 cout <<
"cwb_eced - Error : frame file list \"" <<
frFiles[
n] <<
"\" with size=0" << endl;
381 gSystem->Setenv(
"CWB_UPARAMETERS_FILE",uparameter);
384 gSystem->Setenv(
"CWB_CED_DIR",
ced_dir);
386 if(cwb_inet_opts==
"ced") {
397 for(
int n=0;n<
nIFO;n++) {
402 if (!out.good()) {cout <<
"cwb_eced - Error : Error Opening File : " << cat1_file << endl;
exit(1);}
403 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]
double dataShift[NIFO_MAX]
TString _channelNamesMDC[NIFO_MAX]
char ldf_command[NIFO_MAX][1024]
sprintf(sgps_event,"%d", xgps_event)
strcpy(RunLabel, RUN_LABEL)