4 #include "Math/Polar3D.h"
7 #define EXIT(ERR) gSystem->Exit(ERR) // better exit handling for ROOT stuff
24 this->lagBuffer.Set(0);
52 this->lagBuffer.Set(0);
54 if(fName.EndsWith(
".root")) {
55 TFile*
ifile =
new TFile(fName);
56 if(!ifile->IsOpen()) {
57 cout <<
"cwb::cwb - Error opening root file : " << fName.Data() << endl;
61 if(ifile->Get(
"config")!=NULL) {
68 cout <<
"cwb::cwb - Error : cwb is not contained in root file " << fName.Data() << endl;
72 this->runID = CWB->
runID;
76 this->istage = CWB->
jstage;
78 cout <<
"cwb::cwb - Error : the stage(job file) " << GetStageString(istage).Data() <<
" >= "
79 <<
" input stage " << GetStageString(jstage).Data() << endl;
EXIT(1);
90 lagBuffer.Set(lagBuffer.GetSize()+1);
91 lagBuffer[lagBuffer.GetSize()-1]=0;
98 if(gSystem->Getenv(
"HOME_WAT_FILTERS")==NULL) {
99 cout <<
"cwb::cwb - Error : environment HOME_WAT_FILTERS is not defined!!!" << endl;
EXIT(1);
116 cout <<
"cwb::cwb - Error : aux simulation " <<
cfg.
simulation
119 cout <<
"cwb::cwb - Error : aux nfactor " <<
cfg.
nfactor
120 <<
" != in cfg nfactor " << icfg.
nfactor << endl;
EXIT(1);
123 cout <<
"cwb::cwb - Error : aux factors["<<
i<<
"]="<<
cfg.
factors[
i]
124 <<
" != in cfg factors["<<
i<<
"]=="<<icfg.
factors[
i]<<endl;
EXIT(1);}
127 cout <<
"cwb::cwb - Error : aux l_low " <<
cfg.
l_low
128 <<
" != in cfg l_low " << icfg.
l_low << endl;
EXIT(1);}
130 cout <<
"cwb::cwb - Error : aux l_high " <<
cfg.
l_high
131 <<
" != in cfg l_high " << icfg.
l_high << endl;
EXIT(1);}
133 cout <<
"cwb::cwb - Error : aux fLow " <<
cfg.
fLow
134 <<
" != in cfg fLow " << icfg.
fLow << endl;
EXIT(1);}
136 cout <<
"cwb::cwb - Error : aux fHigh " <<
cfg.
fHigh
137 <<
" != in cfg fHigh " << icfg.
fHigh << endl;
EXIT(1);}
139 cout <<
"cwb::cwb - Error : aux healpix " <<
cfg.
healpix
140 <<
" != in cfg healpix " << icfg.
healpix << endl;
EXIT(1);}
143 cout <<
"cwb::cwb - Error : config is not contained in root file " << fName.Data() << endl;
148 }
else if(fName.EndsWith(
".C")) {
149 if(gSystem->Getenv(
"CWB_PARAMETERS_FILE")==NULL) {
150 cout <<
"cwb::cwb - Error : environment CWB_PARAMETERS_FILE is not defined!!!" << endl;
158 }
else if(fName==
"") {
159 if(gSystem->Getenv(
"CWB_PARAMETERS_FILE")==NULL) {
160 cout <<
"cwb::cwb - Error : environment CWB_PARAMETERS_FILE is not defined!!!" << endl;
168 cout <<
"cwb::cwb - Error : bad input file extension [.C, .root] " << fName.Data() << endl;
191 this->lagBuffer.Set(0);
221 cout <<
"cwb::Init - Warning !!! : This is a testing version for ROOT6" << endl;
223 if(gROOT->GetVersionInt()>53204 && gROOT->GetVersionInt()<53400) {
224 cout <<
"cwb::Init - Error : cWB analysis don't works with ROOT version > 5.32.04 && version < 5.34.00" << endl;
225 cout <<
"You are running version : ROOT " << gROOT->GetVersion() << endl << endl;
231 cout <<
"cwb::Init - Error : stage STRAIN not implemented with simulation=4" << endl;
236 cout<<
"cwb::Init - Error : jobfOptions=CWB_JOBF_SAVE_TRGFILE is allowed only with CWB_STAGE_FULL!!!"<<endl;
248 cout <<
"cwb::Init - Error : data rate : " <<
rateANA
249 <<
" is not a multiple of 2^l_high : " << (1<<
cfg.
l_high) << endl;
294 unsigned int Pid = gSystem->GetPid();
296 double DATA_RATE = 0.;
310 if(
cfg.
nIFO==0) {cout <<
"cwb::cwb - Error : no detector is presents in the configuration" << endl;
EXIT(1);}
323 this->runID = srunID.Atoi();
330 cout<<
"job ID : "<<this->runID<<endl;
334 cout<<
"Pid : "<<Pid<<endl;
358 iname==
"" ? InitNetwork() : InitNetwork(iname);
372 double mdcShift = iname==
"" ? InitJob() : InitJob(iname);
376 cout<<
"temporary job file : " <<
jname<<endl;
385 DATA_RATE = ReadData(mdcShift,0);
410 cout<<endl<<
"---> Start processing factor["<<
ifactor<<
"]="<<factor<<endl<< endl;
414 if(factor==0)
sprintf(sfactor,
"z%g",factor);
415 if(factor>0)
sprintf(sfactor,
"p%g",factor);
416 }
else sprintf(sfactor,
"%g",factor);
428 if(!gSystem->GetPathInfo(endFile,fstemp)) {
429 printf(
"The file %s already exists - skip\n",endFile);
432 if(!rf.IsZombie())
continue;
436 char prod_label[512];
437 sprintf(prod_label,
"%d_%d_%s_slag%d_lag%lu_%lu_job%d",
452 if (!gSystem->GetPathInfo(out_CED,&
id,&size,&
flags,&mt)) {
453 cout <<
"cwb::run - Warning !!! - Dir \"" << out_CED <<
"\" already exist" << endl;
456 if (!gSystem->GetPathInfo(end_CED,&
id,&size,&
flags,&mt)) {
457 cout <<
"cwb::run - Warning !!! - Dir \"" << end_CED <<
"\" already exist" << endl;
463 Long_t xid,xsize,xflags,xmt;
464 int xestat = gSystem->GetPathInfo(outDump,&xid,&xsize,&xflags,&xmt);
466 sprintf(command,
"/bin/rm %s",outDump);
467 ecommand=gSystem->Exec(command);
468 if(ecommand) {cout <<
"cwb::cwb - Warning -> " << command << endl;}
471 cout<<
"output file on the node : "<<outFile<<endl;
472 cout<<
"final output file name : "<<endFile<<endl;
473 cout<<
"temporary output file : "<<tmpFile<<endl;
480 DATA_RATE = ReadData(mdcShift,
ifactor);
497 froot =
new TFile(tmpFile,
"RECREATE");
498 if(
froot==NULL) {cout <<
"cwb::cwb - Error opening root file : " << tmpFile << endl;
EXIT(1);}
500 TTree* live_tree=
live.setTree();
501 TTree* mdc_tree=NULL;
502 TTree* var_tree=NULL;
503 TTree* noise_tree=NULL;
506 mdc_tree =
mdc->setTree();
508 var_tree = wavevar.setTree();
509 noise_tree = noiserms.setTree();
522 for(
size_t mlag=mlagOff;mlag<mlagSize;mlag+=
mlagStep) {
530 std::vector<double> livTime;
536 cout<<
"number of time lags: "<<lags<<endl;
561 ceddir=Likelihood(
ifactor, out_CED, netburst, net_tree, outDump);
562 cout<<
"\nSearch done\n";
582 netburst->output(net_tree,&
NET,ofactor);
583 if(
cfg.
dump) netburst->dclose();
585 mdc->output(mdc_tree,&
NET,ofactor);
589 netburst->output(net_tree,&
NET);
590 if(
cfg.
dump) netburst->dclose();
596 noiserms.output(noise_tree,&
pD[i]->nRMS,i+1,DATA_RATE/2);
617 sprintf(command,
"/bin/rm %s", tmpFile);
618 ecommand=gSystem->Exec(command);
619 if(ecommand) {cout <<
"cwb::cwb - Warning -> " << command << endl;}
622 sprintf(command,
"/bin/mv %s %s", tmpFile, outFile);
625 else sprintf(command,
"/bin/mv %s %s",outFile,endFile);
628 else sprintf(command,
"/bin/mv %s %s",outDump,endDump);
631 if(!gSystem->GetPathInfo(outDump,&xid,&xsize,&xflags,&xmt))
Exec(command);
633 xestat = gSystem->GetPathInfo(end_CED,&xid,&xsize,&xflags,&xmt);
635 sprintf(command,
"/bin/mv %s/* %s/.",out_CED,end_CED);
637 sprintf(command,
"/bin/mv %s %s",out_CED,end_CED);
656 NET. nSensitivity=0;
NET. nAlignment=0;
NET. nCorrelation=0;
657 NET. nLikelihood=0;
NET. nNullEnergy=0;
NET. nPenalty=0;
658 NET. nCorrEnergy=0;
NET. nNetIndex=0;
NET. nDisbalance=0;
659 NET. nSkyStat=0;
NET. nEllipticity=0;
NET. nPolarisation=0;
665 {cout <<
"cwb::cwb - Error opening root file : " <<
jname << endl;
EXIT(1);}
671 TObjString* objn =
cfg.
configPlugin.GetLineWith(
"//#?CONFIG_PLUGIN_NAME ");
672 TString origName = objn ? objn->GetString() :
"";
673 cfg.
configPlugin.SetName(origName.ReplaceAll(
"//#?CONFIG_PLUGIN_NAME ",
""));
675 TObjString* objt =
cfg.
configPlugin.GetLineWith(
"//#?CONFIG_PLUGIN_TITLE ");
676 TString origTitle = objt ? objt->GetString() :
"";
677 cfg.
configPlugin.SetTitle(origTitle.ReplaceAll(
"//#?CONFIG_PLUGIN_TITLE ",
""));
694 TString cwb_jnet_name = gSystem->ExpandPathName(
"$CWB_MACROS/cwb_jnet.C");
697 cwb_jnet.Write(
"cwb_jnet");
719 TFile *
f = TFile::Open(
jname,
"UPDATE");
724 if(pwc==NULL)
continue;
726 char trName[64];
sprintf(trName,
"clusters-cycle:%d;2",cycle);
727 d = (TDirectory*)f->Get(
"coherence;1");
728 if(d!=NULL)
if(d->Get(trName)!=NULL) d->Delete(trName);
729 d = (TDirectory*)f->Get(
"supercluster;1");
730 if(d!=NULL)
if(d->Get(trName)!=NULL) d->Delete(trName);
731 d = (TDirectory*)f->Get(
"likelihood;1");
732 if(d!=NULL)
if(d->Get(trName)!=NULL) d->Delete(trName);
739 char wlabel[512];
sprintf(wlabel,
"wave_%s",jlabel);
761 if(ojname.BeginsWith(
"/")) {
762 sprintf(command,
"/bin/ln -sf %s %s",ojname.Data(),olname.Data());
764 sprintf(command,
"/bin/ln -sf ../%s %s",ojname.Data(),olname.Data());
766 cout << command << endl;
767 ecommand=gSystem->Exec(command);
768 if(ecommand) {cout <<
"cwb::cwb - Warning -> " << command << endl;}
771 sprintf(endFile,
"%s",ojname.Data());
775 ecommand=gSystem->Exec(command);
776 if(ecommand) {cout <<
"cwb::cwb - Warning -> " << command << endl;}
782 ecommand=gSystem->Exec(command);
783 if(ecommand) {cout <<
"cwb::cwb - Warning -> " << command << endl;}
794 cout << endl << endl;
797 double job_speed_factor = double(job_data_size_sec)/double(watchJob.RealTime());
799 printf(
"Job Speed Factor - %2.2fX\n",job_speed_factor);
802 watchJob.Stop();watchJob.Reset();
807 gSystem->Exec(command);
824 TFile*
ifile =
new TFile(fName);
825 if(ifile==NULL) {cout <<
"cwb::InitNetwork - Error opening root file : " << fName.Data() << endl;
EXIT(1);}
832 cout <<
"cwb::InitNetwork - Error : net is not contained in root file " << fName.Data() << endl;
885 gSystem->Exec(
"/bin/date");
886 gSystem->Exec(
"/bin/hostname");
924 cout <<
"cwb::InitNetwork - Error : user detector name at position "
925 <<
i <<
" is not defined (detParms)" << endl;
978 gSystem->Exec(
"/bin/date");
979 gSystem->Exec(
"/bin/hostname");
1019 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
1022 const char* STAGE_NAMES[7] = {
"FULL",
"INIT",
"STRAIN",
"CSTRAIN",
"COHERENCE",
"SUPERCLUSTER",
"LIKELIHOOD"};
1024 const char* TYPE_NAMES[22] = {
"CWB_ENV",
"WATVERSION",
"XIFO",
"SVNVERSION",
"SVNBRANCH",
"WORKDIR",
1025 "FRLIBVERSION",
"ROOTVERSION",
"LALVERSION",
1026 "DATALABEL",
"CMDLINE",
"ROOTLOGON",
"PARAMETERS",
1027 "CWB_ENV_MD5",
"ROOTLOGON_MD5",
"PARAMETERS_MD5",
1028 "CWB_CONFIG_URL",
"CWB_CONFIG_PATH",
"CWB_CONFIG_BRANCH",
"CWB_CONFIG_TAG",
"CWB_CONFIG_HASH",
"CWB_CONFIG_DIFF"};
1030 history =
new CWB::History(const_cast<char**>(STAGE_NAMES), 7, const_cast<char**>(TYPE_NAMES), 22);
1035 TFile*
ifile =
new TFile(iname);
1036 if(ifile==NULL) {cout <<
"cwb::InitHistory - Error opening root file : " << iname.Data() << endl;
EXIT(1);}
1038 if(ifile->Get(
"history")!=NULL) {
1043 for(
int i=0;
i<stageList->GetSize();
i++) {
1044 TObjString* stageString = (TObjString*)stageList->At(
i);
1045 for(
int j=0;
j<typeList->GetSize();
j++) {
1046 TObjString* typeString = (TObjString*)typeList->At(
j);
1049 if(histData!=NULL) {
1060 for(
int i=0;
i<log_size;
i++) {
1063 char stg_label[16];
sprintf(stg_label,
"STG:%d",jstage);
1064 if(log.Contains(
"STG:8")) log.ReplaceAll(
"STG:8",stg_label);
1070 cout <<
"cwb::InitHistory - Error : history is not contained in root file " << iname.Data() << endl;
1077 TString jStageString = GetStageString(jstage).ReplaceAll(
"CWB_STAGE_",
"");
1078 char jStage[256];
sprintf(jStage,jStageString.Data());
1082 if(cwbBuffer!=NULL) {
1084 TMD5 md5;md5.Update((UChar_t*)cwbBuffer,strlen(cwbBuffer));md5.Final();
1086 delete [] cwbBuffer;
1091 char framelib_version[32];
sprintf(framelib_version,
"%f",FRAMELIB_VERSION);
1107 for(
int i=0;
i<gApplication->Argc();
i++) cmd_line_len+=strlen(gApplication->Argv(
i));
1108 if(cmd_line_len>2047)
1109 {cout <<
"cwb::InitHistory - command line too long : " << cmd_line_len << endl;
EXIT(1);}
1110 for(
int i=0;
i<gApplication->Argc();
i++)
sprintf(cmd_line,
"%s %s",cmd_line,gApplication->Argv(
i));
1115 if(rootlogonBuffer!=NULL) {
1117 TMD5 md5;md5.Update((UChar_t*)rootlogonBuffer,strlen(rootlogonBuffer));md5.Final();
1132 unsigned int Pid = gSystem->GetPid();
1134 if(mkstemp(tmpFile)==-1) {
1135 cout <<
"cwb::InitHistory - mkstemp error in creating tmp file : " << tmpFile << endl;
1142 TObjString* objt =
cfg.
configPlugin.GetLineWith(
"//#?CONFIG_PLUGIN_TITLE ");
1143 TString origTitle = objt ? objt->GetString() :
"";
1144 cfg.
configPlugin.SetTitle(origTitle.ReplaceAll(
"//#?CONFIG_PLUGIN_TITLE ",
""));
1148 char* parametersBuffer =
TB.
readFile(tmpFile);
1150 if(parametersBuffer!=NULL) {
1152 TMD5 md5;md5.Update((UChar_t*)parametersBuffer,strlen(parametersBuffer));md5.Final();
1154 delete [] parametersBuffer;
1175 TFile*
ifile =
new TFile(fName);
1176 if(ifile==NULL||!ifile->IsOpen())
1177 {cout <<
"cwb::InitJob - Error opening root file : " << fName.Data() << endl;
EXIT(1);}
1181 cout <<
"cwb::InitJob - Error : cwb is not contained in root file " << fName.Data() << endl;
1193 netburst->setSLags(slagShift);
1215 cout<<
"cwb::InitJob : when simulation=4 factors[0] is the offset and must be integer>=0"<<endl;
1219 cout<<
"cwb::InitJob : when simulation=4 factors[0] is the offset and must be integer>=0"<<endl;
1263 cout <<
"Error : slagSize<=1 & lagSize==1 in simulation mode !!!" << endl;
EXIT(1);
1280 cout << endl <<
"START SLAG Init ..." << endl << endl;
1300 if(SLAG.
jobId!=runID) {cout <<
"jobID " << runID <<
" not found in the slag list !!!" << endl;
EXIT(1);}
1304 cout <<
"SuperLag=" <<
slagID <<
" jobID=" <<
jobID;
1305 for(
int n=0;
n<nIFO;
n++) cout <<
" segID[" <<
ifo[
n] <<
"]=" <<
segID[
n];cout << endl;
1319 cout << endl <<
"Segment type = SLAG" << endl;
1321 cout << endl <<
"END SLAG Init ..." << endl << endl;
1337 cout <<
"Segment type = LAG" << endl;
1339 cout <<
"segLen = " <<
cfg.
segLen <<
" sec" << endl;
1340 cout <<
"segMLS = " <<
cfg.
segMLS <<
" sec" << endl;
1341 cout <<
"segOverlap = " <<
cfg.
segOverlap <<
" sec" << endl;
1347 netburst->setSLags(slagShift);
1367 cout <<
"detSegs_dq1[" <<
ifo[
i] <<
"] GPS range : "
1371 if(
detSegs.size()==0) {cout <<
"no segments found for this job, job terminated !!!" << endl;
EXIT(1);}
1383 cout <<
"cwb::InitJob - Error : noise frame files list name is not defined" << endl;
1405 for(
int n=nIFO;
n<2*
nIFO;
n++) {
1413 cout <<
"cwb::InitJob - Error : MDC frame files list name is not defined" << endl;
1424 cout <<
"MDC " <<
" -> nfrFiles : " <<
nfrFiles[
n] << endl;
1428 cout <<
"mdc_range : " << mdc_range.
start <<
" " << mdc_range.
stop << endl;
1433 cout <<
"mdcShift : " << mdcShift << endl;
1445 cout<<
"cwb::InitJob : when simulation=4 factors[0] is the offset and must be integer>=0"<<endl;
1449 cout<<
"cwb::InitJob : when simulation=4 factors[0] is the offset and must be integer>=0"<<endl;
1469 detSegs_dq2.push_back(
detSegs[0]);
1471 for(
int i=0;
i<(
int)detSegs_dq2.size();
i++) {
1472 cout <<
"detSegs_dq2[" <<
i <<
"] GPS range : "
1473 << detSegs_dq2[
i].start <<
"-" << detSegs_dq2[
i].stop << endl;
1477 cout <<
"live time after cat 2 : " << detSegs_ctime <<
" sec" << endl;
1479 cout <<
"cwb::InitJob : job segment live time after cat2 < segTHR="
1480 <<
cfg.
segTHR <<
" sec, job terminated !!!" << endl;
1481 cout << endl <<
"To remove this check set segTHR=0 in the parameter file" << endl << endl;
1494 printf(
"GPS: %16.6f saved, injections: %d\n",
double(
long(Tb)),i);
1499 vector<waveSegment> mdcSegs(
NET.
mdcTime.size());
1504 vector<waveSegment> mdcSegs_dq2 =
TB.
mergeSegLists(detSegs_dq2,mdcSegs);
1506 cout <<
"live time in zero lag after cat2+inj : " << mdcSegs_ctime << endl;
1507 if(mdcSegs_ctime==0) {
1508 cout <<
"cwb::InitJob : job segment with zero cat2+inj "
1509 <<
"live time in zero lag, job terminated !!!" << endl;
1510 cout <<
"Warning : MDC data frames could be zero !!!" << endl;
1526 cout <<
"cwb::InitJob : Error Opening File : " <<
cfg.
lagFile << endl;
1530 in.seekg (0, in.end);
1531 int len = in.tellg();
1532 in.seekg (0, in.beg);
1534 in.read(lagBuffer.GetArray(),len);
1537 cout <<
"cwb::InitJob : Error Reading File : " <<
cfg.
lagFile << endl;
1542 lagBuffer.Set(lagBuffer.GetSize()+1);
1543 lagBuffer[lagBuffer.GetSize()-1]=0;
1575 {cout <<
"cwb::ReadData - Error opening root file : " <<
jname << endl;
EXIT(1);}
1576 TDirectory* cdstrain = (TDirectory*)
jfile->Get(
"strain");
1577 if(cdstrain==NULL) cdstrain =
jfile->mkdir(
"strain");
1581 TFile*
ifile =
new TFile(fName);
1582 if(ifile==NULL) {cout <<
"cwb::ReadData - Error opening root file : " << fName << endl;
EXIT(1);}
1590 {cout <<
"cwb::ReadData - Error : data not present in file : " << fName << endl;
EXIT(1);}
1593 cdstrain->cd();pws->Write(
ifo[
i]);
1599 {cout <<
"cwb::ReadData - Error : mdc not present in file : " << fName << endl;
EXIT(1);}
1601 TDirectory* cdmdc = (TDirectory*)
jfile->Get(
"mdc");
1602 if(cdmdc==NULL) cdmdc =
jfile->mkdir(
"mdc");
1603 cdmdc->cd();pws->Write(
ifo[i]);
1623 char cdcstrain_name[32];
sprintf(cdcstrain_name,
"cstrain-f%d",ifactor);
1627 TDirectory* jcdcstrain = NULL;
1631 {cout <<
"cwb::DataConditioning - Error opening root file : " <<
jname << endl;
EXIT(1);}
1632 jcdcstrain=
jfile->mkdir(cdcstrain_name);
1637 TFile*
ifile =
new TFile(fName);
1639 {cout <<
"cwb::DataConditioning - Error opening root file : " << fName << endl;
EXIT(1);}
1647 {cout <<
"cwb::DataConditioning - Error : data not present, job terminated!!!" << endl;
EXIT(1);}
1649 if(
jfile!=NULL) {
jfile->cd();jcdcstrain->cd();pws->Write(
ifo[
i]);}
1715 if(stageInfos) PrintStageInfo(
CWB_STAGE_INIT,
"cwb::PrintAnalysis");
1717 cout <<
" jobID : " << runID << endl;
1720 cout <<
" stage : ";
1732 cout <<
"\n detectors : ";
1736 cout <<
" search : ";
1744 cout <<
"(" <<
cfg.
search <<
")" << endl;
1746 char _search = std::tolower(
cfg.
search);
1747 if(_search==
'r') cout<<
"un-modeled";
1748 if(_search==
'i') cout<<
"iota-wave";
1749 if(_search==
'p') cout<<
"psi-wave";
1750 if(_search==
'l' || _search==
's') cout<<
"linear polarisation";
1751 if(_search==
'c' || _search==
'g') cout<<
"circular polarisation";
1752 if(_search==
'e' || _search==
'b') cout<<
"elliptical polarisation";
1761 cout<<
"\n unavailable analysis type !!!"<<endl;
EXIT(1);
1767 cout<<
"maximum time delay between detectors : "<<
mTau<<endl;
1768 cout<<
" maximum time delay difference : "<<dTau<<endl;
1770 cout<<
" HEALPix order : "<<
cfg.
healpix<<endl;
1772 cout<<
" skymap angular resolution : "<<
cfg.
angle<<endl;
1774 cout<<
" skymap size in azimuthal angle : "<<
cfg.
Phi1<<
", "<<
cfg.
Phi2<<endl;
1787 if(pattern== 0) cout<<
"('*' single pixel standard)"<<endl;
1788 if(pattern== 1) cout<<
"('3|' packet)"<<endl;
1789 if(pattern== 2) cout<<
"('3-' packet)"<<endl;
1790 if(pattern== 3) cout<<
"('3/' packet - chirp)"<<endl;
1791 if(pattern== 4) cout<<
"('3\\' packet - ringdown)"<<endl;
1792 if(pattern== 5) cout<<
"('5/' packet - chirp)"<<endl;
1793 if(pattern== 6) cout<<
"('5\\' packet - ringdown)"<<endl;
1794 if(pattern== 7) cout<<
"('3+' packet)"<<endl;
1795 if(pattern== 8) cout<<
"('3x' cross packet)"<<endl;
1796 if(pattern== 9) cout<<
"('9p' 9-pixel square packet)"<<endl;
1797 if(pattern > 9) cout<<
"('*' single pixel packet)"<<endl;
1804 int csize = precision%65536;
1805 int order = (precision-csize)/65536;
1806 cout<<
" precision csize, order : "<<csize<<
", "<<order<<endl;
1810 cout<<
" mask ; "<<
cfg.
mask<<endl;
1843 gSystem->GetProcInfo(&info);
1845 cout <<
"Memory - virtual : " << info.fMemVirtual / 1024
1846 <<
" (mb) rss : " << info.fMemResident / 1024 <<
" (mb)" << endl;
1847 return mvirtual ? info.fMemVirtual/1024 : info.fMemResident/1024;
1863 if(
TString(plugin.GetName())==
"")
return;
1865 unsigned int Pid = gSystem->GetPid();
1867 TString pluginPath = plugin.GetTitle();
1872 if(
TString(configPlugin.GetName())!=
"") {
1874 configPlugin.AddLine(TString::Format(
"//#?CONFIG_PLUGIN_NAME %s",configPlugin.GetName()));
1875 configPlugin.AddLine(TString::Format(
"//#?CONFIG_PLUGIN_TITLE %s",configPlugin.GetTitle()));
1880 char configPluginName[1024];
1881 if((gROOT->GetVersionInt()>=53400)&&(gROOT->GetVersionInt()<=53407)) {
1884 sprintf(configPluginName,
"CWB_Plugin_Config_%s_%d_job%d.XXXXXX",
1888 sprintf(configPluginName,
"%s/CWB_Plugin_Config_%s_%d_job%d.XXXXXX",
1891 if(mkstemp(configPluginName)==-1) {
1892 cout <<
"cwb::LoadPlugin - Error : mkstemp error in creating tmp file : " << configPluginName << endl;
1895 configPlugin.SetName(
"CWB_PluginConfig");
1896 configPlugin.SetTitle(configPluginName);
1901 if(pluginPath.EndsWith(
".so")) {
1905 int estat = gSystem->GetPathInfo(pluginPath.Data(),fStatus);
1907 wat::Time plugin_comp_date(
double(fStatus.fMtime));
1911 TString pluginSrc = pluginPath;
1912 pluginSrc.ReplaceAll(
"_C.so",
".C");
1914 cout <<
"cwb::LoadPlugin : The plugin compilation date is not up to date !!! " << endl;
1915 cout <<
" plugin compilation date : " << plugin_comp_date.
GetDateString() << endl;
1916 cout <<
" wat compilation date : " << wat_comp_date.
GetDateString() << endl;
1918 cout <<
"Recompile the plugin : " << endl;
1919 cout <<
"root -l -b -q " << pluginSrc <<
"++" << endl << endl;
1923 cout << endl <<
"cwb::LoadPlugin - Load pre-compiled plugin ..." << endl << endl;
1924 check = gROOT->LoadMacro(pluginPath.Data(),&error);
1926 cout <<
"cwb::LoadPlugin : Load pre-compiled Plugin Failed !!! " << endl;
1927 cout <<
"cwb::LoadPlugin : The plugin is compiled 'On-The-Fly'!!! " << endl;
1933 if(!(pluginPath.EndsWith(
".so"))||(check!=0)) {
1934 cout << endl <<
"cwb::LoadPlugin - compile and load plugin ..." << endl << endl;
1936 char tmpFile[1024]=
"";
1938 if(mkstemp(tmpFile)==-1) {
1939 cout <<
"cwb::LoadPlugin - mkstemp error in creating tmp file : " << tmpFile << endl;
1942 char pluginSrc[1024]=
"";
1943 sprintf(pluginSrc,
"%s.C",tmpFile);
1944 plugin.SaveSource(pluginSrc);
1947 int success = gSystem->CompileMacro(
TString(pluginSrc).Data(),
"f");
1948 gSystem->Exec(
TString(
"/bin/rm ")+tmpFile);
1950 cout <<
"cwb::LoadPlugin : Plugin Compilation Failed !!! " << endl;
1955 TString pluginShr = pluginSrc;
1956 pluginShr.ReplaceAll(
".C",
"_C.so");
1957 check = gROOT->LoadMacro(pluginShr.Data(),&error,
true);
1959 cout <<
"cwb::LoadPlugin : Plugin Compilation Failed !!! " << endl;
1964 TString pluginTmp = pluginSrc;
1967 sprintf(tmpStr,
"/bin/rm -f %s", pluginTmp.Data());
1969 pluginTmp.ReplaceAll(
".C",
"_C.so");
1970 sprintf(tmpStr,
"/bin/rm -f %s", pluginTmp.Data());
1972 pluginTmp.ReplaceAll(
"_C.so",
"_C.d");
1973 sprintf(tmpStr,
"/bin/rm -f %s", pluginTmp.Data());
1992 int job_elapsed_sec =
int(job_elapsed_time-3600*job_elapsed_hour-60*job_elapsed_min);
2012 TString info = GetStageInfo(stage,comment,fname);
2014 if(out) cout << info.Data() << endl;
2068 std::stringstream buffer;
2069 std::streambuf * old = std::cout.rdbuf(buffer.rdbuf());
2073 cout <<
"--------------------------------------------------------------------" << endl;
2074 cout << comment.Data();
2076 cout <<
" - factor[" << FCT <<
"]=" <<
cfg.
factors[FCT] << endl;
2078 cout <<
"--------------------------------------------------------------------" << endl;
2079 cout <<
"UTC - "; cout.flush();
2082 JET = watchJob.RealTime();
2084 watchJob.Continue();
2086 SET = watchStage.RealTime();
2091 Long_t xid,xsize,xflags,xmt;
2093 int xestat = gSystem->GetPathInfo(xname.Data(),&xid,&xsize,&xflags,&xmt);
2094 if(xestat==0) JFS=xsize;
else JFS=0;
2095 cout <<
"Job File Size - " << JFS <<
" (bytes) : "
2096 <<
int(JFS/1024.) <<
" (kb) : " <<
int(JFS/1024./1024) <<
" (mb)" << endl;
2097 cout <<
"--------------------------------------------------------------------" << endl;
2098 cout <<
"GPS:" << GPS <<
"-JOB:" << JOB <<
"-STG:" << STG <<
"-FCT:" << FCT
2099 <<
"-JET:" << JET <<
"-SET:" << SET <<
"-MEM:" << MEM <<
"-JFS:" << JFS << endl;
2100 cout <<
"--------------------------------------------------------------------" << endl;
2104 std::cout.rdbuf(old);
2106 return buffer.str();
2121 TString ainfo = GetAnalysisInfo(stage,comment,info);
2123 if(out) cout << ainfo.Data() << endl;
2161 TGlobal*
global = gROOT->GetGlobal(
"gIFACTOR",
true);
2162 if(global!=NULL) FCT = *(
int*)global->GetAddress();
else FCT=-1;
2165 std::stringstream buffer;
2166 std::streambuf * old = std::cout.rdbuf(buffer.rdbuf());
2170 cout <<
"--------------------------------------------------------------------" << endl;
2171 cout << comment.Data();
2173 cout <<
" - factor[" << FCT <<
"]=" <<
cfg.
factors[FCT] << endl;
2175 cout <<
"--------------------------------------------------------------------" << endl;
2176 cout <<
"GPS:" << GPS <<
"-JOB:" << JOB <<
"-STG:" << STG <<
"-FCT:" << FCT << info << endl;
2177 cout <<
"--------------------------------------------------------------------" << endl;
2181 std::cout.rdbuf(old);
2183 return buffer.str();
2196 return(
"CWB_STAGE_FULL");
2199 return(
"CWB_STAGE_INIT");
2202 return(
"CWB_STAGE_STRAIN");
2205 return(
"CWB_STAGE_CSTRAIN");
2208 return(
"CWB_STAGE_COHERENCE");
2211 return(
"CWB_STAGE_SUPERCLUSTER");
2214 return(
"CWB_STAGE_LIKELIHOOD");
2302 while(ecommand&&(ntry<maxtry)) {
2303 ecommand=gSystem->Exec(command);
2304 if(ecommand) gSystem->Sleep(
int(gRandom->Uniform(10000,30000)));
2308 cout << command << endl;
2309 cout <<
"cwb::Exec - NTRY " << ntry << endl;
2314 if(ecommand) {cout <<
"cwb::Exec - Error -> " << command << endl;
EXIT(1);}
2334 bool replace =
false;
2337 ofName.ReplaceAll(
".root",
"_tmp.root");
2341 if(delObjList.size()==0) {
2344 sprintf(command,
"/bin/mv %s %s",ofName.Data(),ifName.Data());
2345 gSystem->Exec(command);
2349 if(gROOT->GetVersionInt()<53405) {
2351 TFile* kfile =
new TFile(ifName,
"UPDATE");
2352 for(
int i=0;
i<delObjList.size();
i++) kfile->Delete(delObjList[
i]+
";1");
2356 gErrorIgnoreLevel=kBreak;
2357 TFileMerger
M(
false);
2358 M.AddFile(ifName,
false);
2359 M.OutputFile(ofName);
2360 if(gROOT->GetVersionInt()<53400) {
2363 cout <<
"cwb::FileGarbageCollector : Error - Merge failed !!!" << endl;
EXIT(1);
2366 if(gROOT->GetVersionInt()>=53400 && gROOT->GetVersionInt()<53405) {
2369 if(!M.PartialMerge(TFileMerger::kAllIncremental | TFileMerger::kRegular)) {
2370 cout <<
"cwb::FileGarbageCollector : Error - Merge failed !!!" << endl;
EXIT(1);
2373 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,34,5)
2374 if(gROOT->GetVersionInt()>=53405) {
2376 for(
int i=0;
i<delObjList.size();
i++) M.AddObjectNames(delObjList[
i]);
2378 Int_t default_mode = TFileMerger::kAll | TFileMerger::kIncremental;
2379 Int_t
mode = default_mode | TFileMerger::kSkipListed;
2380 if(!M.PartialMerge(mode)) {
2381 cout <<
"cwb::FileGarbageCollector : Error - Merge failed !!!" << endl;
EXIT(1);
2386 gErrorIgnoreLevel=kUnset;
2390 sprintf(command,
"/bin/mv %s %s",ofName.Data(),ifName.Data());
2391 gSystem->Exec(command);
2411 int L = SkyMask.
size();
2414 if(
fabs(theta)>90 || (phi<0 || phi>360) || radius<=0 || L<=0) {
2415 cout <<
"cwb::MakeSkyMask : wrong input parameters !!! " << endl;
2416 if(
fabs(theta)>90) cout << theta <<
" theta must be in the range [-90,90]" << endl;
2417 if(phi<0 || phi>360) cout << phi <<
" phi must be in the range [0,360]" << endl;
2418 if(radius<=0) cout << radius <<
" radius must be > 0" << endl;
2419 if(L<=0) cout << L <<
" SkyMask size must be > 0" << endl;
2423 if (!gROOT->GetClass(
"Polar3DVector")) gSystem->Load(
"libMathCore");
2430 double skyres = sphere_solid_angle/
npix;
2431 if(radius < sqrt(skyres)) radius = sqrt(skyres);
2433 if(radius < SkyMask.
sms) radius = SkyMask.
sms;
2442 for (
int l=0;
l<
L;
l++) {
2443 double phi = SkyMask.
getPhi(
l);
2447 double Dot = ov1.Dot(ov2);
2448 double dOmega = 180.*TMath::ACos(Dot)/
TMath::Pi();
2451 if(dOmega<=radius) {SkyMask.
set(
l,1);nset++;}
else SkyMask.
set(
l,0);
2455 cout <<
"cwb::MakeSkyMask : no sky positions setted !!! " << endl;
2456 cout <<
"check input mask parameters : theta = "
2457 << theta <<
" phi = " << phi <<
" radius : " << radius << endl << endl;
2493 if(skycoord!=
'e' && skycoord!=
'c') {
2494 cout <<
"cwb::SetSkyMask - Error : wrong input sky coordinates "
2495 <<
" must be 'e'/'c' earth/celestial" << endl;;
2499 if(strlen(options)>0) {
2500 if(!
TString(options).Contains(
"--")) {
2501 if(skyres>=0)
return 1;
2505 cout <<
"cwb::SetSkyMask - Error : skyMask file"
2506 <<
" not exist or it has a wrong format" << endl;
2508 cout <<
" format : two columns ascii file -> [sky_index value]" << endl;
2509 cout <<
" sky_index : is the sky grid index" << endl;
2510 cout <<
" value : if !=0 the index sky location is used for the analysis" << endl;
2520 if(THETA.IsFloat()) theta=THETA.Atof();
2523 if(PHI.IsFloat()) phi=PHI.Atof();
2526 if(RADIUS.IsFloat()) radius=RADIUS.Atof();
2528 if(theta==-1000 || phi==-1000 || radius==-1000) {
2529 cout << endl <<
"cwb::SetSkyMask - Error : wrong input skyMask params" << endl << endl;
2530 cout <<
"wrong input options : " << options << endl;
2532 cout<<
"options must be : --theta THETA --phi PHI --radius RADIUS"<<endl<<endl;
2534 cout<<
"options must be : --theta DEC --phi AR --radius RADIUS"<<endl<<endl;
2535 if(
fabs(theta)>90) cout << theta <<
" theta must be in the range [-90,90]" << endl;
2536 if(phi<0 || phi>360) cout << phi <<
" phi must be in the range [0,360]" << endl;
2537 if(radius<=0) cout << radius <<
" radius must be > 0" << endl;
2545 MakeSkyMask(*SkyMask, theta, phi, radius);
2548 if(SkyMask!=NULL)
delete SkyMask;
2565 if((ifoID==-1)||(
i==ifoID)||(
i==(ifoID+nIFO))) frlist.push_back(
FRF[
i]);
2580 for(
int n=0;
n<
nIFO;
n++)
if(ifo.CompareTo(this->ifo[
n])==0) {ifoID=
n;
break;}
2583 cout <<
"cwb::GetFrList - Error : requested ifo " << ifo
2584 <<
" not present !!!" << endl;;
2588 return GetFrList(ifoID);
std::vector< char * > ifoName
CWB_JOBF_OPTIONS jobfOptions
detector * getifo(size_t n)
param: detector index
int jobID
category 2 data quality list
virtual void resize(unsigned int)
CWB::frame fr[2 *NIFO_MAX]
void PrintElapsedTime(int job_elapsed_time, TString info)
TString GetAnalysisInfo(CWB_STAGE stage, TString comment, TString info)
cwb(CWB_STAGE jstage=CWB_STAGE_FULL)
static size_t GetProcInfo(bool mvirtual=true)
WSeries< double > pixeLHood
void Export(TString fname="")
void cwb_jnet(TString jName="", TString uName="")
void FileGarbageCollector(TString ifName, TString ofName="", vector< TString > delObjList=vector< TString >())
void Print(Option_t *option="")
size_t add(detector *)
param: detector structure return number of detectors in the network
printf("total live time: non-zero lags = %10.1f \n", liveTot)
bool singleDetector
used for the stage stuff
size_t readMDClog(char *, double=0., int=11, int=12)
param: MDC log file param: approximate gps time
void setAntenna(detector *)
param: detector (use theta, phi index array)
int nfrFiles[2 *NIFO_MAX]
virtual void rate(double r)
void CWB_Plugin(TFile *jfile, CWB::config *, network *, WSeries< double > *, TString, int)
COHERENCE.
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
vector< frfile > GetFrList(int ifoID=-1)
char * watversion(char c='s')
size_t setIndexMode(size_t=0)
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1)*itime+ifreq;double time=itime *dT;double freq=(ifreq >0)?ifreq *dF:dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
std::vector< wavearray< double > * > RWFP
CWB::frame fr(FRLIST_NAME)
size_t setSkyMask(double f, char *fname)
CWB_JOBF_OPTIONS jobfOptions
TString GetStageInfo(CWB_STAGE stage, TString comment, TString fname="")
virtual double ReadData(double mdcShift, int ifactor)
double getTheta(size_t i)
virtual void start(double s)
vector< waveSegment > detSegs_dq2
std::vector< double > mdcTime
void Import(TString umacro="")
void setRunID(size_t n)
param: run
network ** net
NOISE_MDC_SIMULATION.
void constraint(double d=1., double g=0.0001)
param: constraint parameter, p=0 - no constraint
vector< waveSegment > detSegs
time delay difference
void setTimeRange(int xstart=0, int xstop=0)
detectorParams detParms[NIFO_MAX]
std::vector< double > livTime
static TString GetStageString(CWB_STAGE jstage)
void PrintAnalysisInfo(CWB_STAGE stage, TString comment, TString info, bool out=true, bool log=true)
void SetupStage(CWB_STAGE jstage)
CWB_OUTF_OPTIONS outfOptions
#define IMPORT(TYPE, VAR)
char * GetLog(char *Stage, int index)
int GetLogSize(char *Stage)
virtual void run(int runID=0)
std::vector< std::string > mdcList
double getDelay(const char *c="")
WSeries< double > pTF[nRES]
double dataShift[NIFO_MAX]
void setVerbose(bool verbose=true)
void PrintStageInfo(CWB_STAGE stage, TString comment, bool out=true, bool log=true, TString fname="")
void Exec(char *command, int maxtry=3, bool verbose=true)
CWB SetSkyMask(net, cfg, cfg->skyMaskCCFile,'c')
std::vector< waveSegment > segList
virtual void DataConditioning(int ifactor)
std::vector< wavearray< double > * > IWFP
void PrintElapsedTime(int job_elapsed_time, double cpu_time, TString info)
vector< waveSegment > cat1List
void setSRIndex(int srIndex)
void setDelay(const char *="L1")
cout<< endl;cout<< "Unfinished Jobs : "<< cnt<< "/"<< jobList.size()<< endl;cout<< endl;sprintf(dagfile,"%s/%s.dag.recovery.%d", condor_dir, data_label, iversion);cout<< "To submit condor recovered jobs, type :"<< endl;cout<< "cwb_condor submit "<< dagfile<< endl;}cout<< endl;if(gSystem->Getenv("_USE_LSF")!=NULL){TString cwb_stage_label="supercluster_";if(cwb_stage_input=="FULL") cwb_stage_label="wave_";if(cwb_stage_input=="INIT") cwb_stage_label="init_";if(cwb_stage_input=="STRAIN") cwb_stage_label="strain_";if(cwb_stage_input=="CSTRAIN") cwb_stage_label="cstrain_";if(cwb_stage_input=="COHERENCE") cwb_stage_label="coherence_";if(cwb_stage_input=="SUPERCLUSTER") cwb_stage_label="supercluster_";if(cwb_stage_input=="LIKELIHOOD") cwb_stage_label="wave_";TString exec_cmd=TString::Format("export file_n_st=""$(ls %s*_job%i.root)""", cwb_stage_label.Data(), jobID);gSystem-> Exec(exec_cmd)
vector< waveSegment > detSegs
#define EXPORT(TYPE, VAR, CMD)
void PrintAnalysis(bool stageInfos=true)
WSeries< double > * getTFmap()
param: no parameters
static void MakeSkyMask(skymap &SkyMask, double theta, double phi, double radius)
virtual void InitHistory()
double fabs(const Complex &x)
int SetSkyMask(network *net, CWB::config *cfg, char *options, char skycoord, double skyres=-1)
void AddLog(char *Stage, char *Log, TDatime *Time=NULL)
void LoadPlugin(TMacro &plugin, TMacro &configPlugin)
strcpy(RunLabel, RUN_LABEL)
cout<< "total cat1 livetime : "<< int(cat1_time)<< " sec "<< cat1_time/3600.<< " h "<< cat1_time/86400.<< " day"<< endl;cout<< endl;vector< waveSegment > cat2List
netcluster * getwc(size_t n)
param: delay index
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
frfile getFrList(int istart, int istop, int segEdge)
void set(size_t i, double a)
param: sky index param: value to set
SortOrderType SetSortOrder(SortOrderType SortOrder)
double factors[FACTORS_MAX]
WaveDWT< DataType_t > * pWavelet
void GeographicToCwb(double ilongitude, double ilatitude, double &olongitude, double &olatitude)
char * GetHistory(char *StageName, char *Type)
void setRetryTime(int frRetryTime=60)
cout<< fr.getNfiles()<< endl;std::vector< frfile > frlist
virtual void SuperCluster(int ifactor)
void open(TString ioFile, TString chName="", Option_t *option="", bool onDisk=false, TString label=".gwf", unsigned int mode=0)
virtual void Coherence(int ifactor)
virtual void resize(unsigned int)
int setTimeShifts(size_t=1, double=1., size_t=0, size_t=0, const char *=NULL, const char *="w", size_t *=NULL)
param number of time lags param time shift step in seconds param first lag ID param maximum lag ID pa...
void AddHistory(char *Stage, char *Type, char *History, TDatime *Time=NULL)
char frFiles[2 *NIFO_MAX][1024]
virtual void InitNetwork()
void SetSingleDetectorMode()
void setSkyMaps(double, double=0., double=180., double=0., double=360.)
param: sky map granularity step, degrees param: theta begin, degrees param: theta end...