23 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
24 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
25 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
31 if(
search==
'b' ||
search==
'B') cout<<
"\n un-modeled search (single stream): "<<
SEARCH()<<endl;
32 if(
search==
'r' ||
search==
'R') cout<<
"\n un-modeled search (dual stream): "<<
SEARCH()<<endl;
41 cout <<
"------> cWB in Sigle Detector Mode !!!" << endl;
65 for(i=0; i<
nIFO; i++) cout<<
ifo[i]<<
" ";
66 cout<<
" detectors\n\n";
88 for(i=0; i<
nIFO; i++) NET.
add(pD[i]);
103 cout<<
"maximum time delay between detectors: "<<mTau<<endl;
104 cout<<
" maximum time delay difference: "<<dTau<<endl;
105 cout<<
" skymap search mode: "<<
mode<<endl;
106 cout<<
" skymap angular resolution: "<<
angle<<endl;
107 cout<<
" skymap size in polar angle: "<<
Theta1<<
", "<<
Theta2<<endl;
108 cout<<
" skymap size in azimuthal angle: "<<
Phi1<<
", "<<
Phi2<<endl;
109 cout<<
" netRHO and netCC: "<<
netRHO<<
", "<<
netCC<<endl;
110 cout<<
" regulator delta, local: "<<
delta<<
" "<<NET.
local<<endl<<endl;
118 gSystem->Exec(
"/bin/date");
119 gSystem->Exec(
"/bin/hostname");
124 int dump_infos_and_exit =
TString(gSystem->Getenv(
"CWB_DUMP_INFOS_AND_EXIT")).Atoi();
125 int dump_sensitivity_and_exit =
TString(gSystem->Getenv(
"CWB_DUMP_SENSITIVITY_AND_EXIT")).Atoi();
128 runID = srunID.Atoi();
130 cout<<
"job ID: "<<runID<<endl;
142 else sprintf(job_stage,
"PRODUCTION");
145 if(cwbBuffer!=NULL) {
155 for(
int i=0;i<gApplication->Argc();i++)
sprintf(cmd_line,
"%s %s",cmd_line,gApplication->Argv(i));
159 if(rootlogonBuffer!=NULL) {
166 for(
int i=0;i<gApplication->Argc()-1;i++) {
167 if(
TString(gApplication->Argv(i)).Contains(
".C")) {
168 char* parametersBuffer = histTB.
readFile(gApplication->Argv(i));
169 if(parametersBuffer!=NULL) {
170 if(
TString(gApplication->Argv(i))==cwb_parameters_name) {
176 delete [] parametersBuffer;
197 vector<TString>
ifos(nIFO);
201 cout <<
"Error : slagSize<=1 & lagSize==1 in simulation mode !!!" << endl;
exit(1);
206 cout << endl <<
"START SLAG Init ..." << endl << endl;
221 if(SLAG.
jobId!=runID) {cout <<
"jobID " << runID <<
" not found in the slag list !!!" << endl;
exit(1);}
224 for(n=0; n<
nIFO; n++) segID[n]=SLAG.
segId[n];
225 cout <<
"SuperLag=" << slagID <<
" jobID=" << jobID;
226 for(n=0; n<nIFO; n++) cout <<
" segID[" <<
ifo[
n] <<
"]=" << segID[
n];cout << endl;
237 cout <<
"Slag Segments" << endl;
239 cout << endl <<
"END SLAG Init ..." << endl << endl;
245 for(
int n=0;n<
nIFO;n++) segID[n]=0;
252 cout <<
"Standard Segments" << endl;
257 for(n=0; n<
nIFO; n++) slagShift[n]=(segID[n]-segID[0])*
segLen;
259 netburst.setSLags(slagShift);
263 for(
int i=0;i<
nIFO;i++) {
264 cout <<
"detSegs_dq1[" <<
ifo[
i] <<
"] Range : " << detSegs[
i].start <<
"-" << detSegs[
i].stop << endl;
266 if(detSegs.size()==0) {cout <<
"no segments found for this job, job terminated !!!" << endl;
exit(1);}
270 for(n=0; n<
nIFO; n++) {
271 nfrFiles[
n]=frTB[
n].frl2FrTree(
frFiles[n]);
272 cout <<
ifo[
n] <<
" -> nfrFiles : " << nfrFiles[
n] << endl;
278 cout <<
"MDC " <<
" -> nfrFiles : " << nfrFiles[
nIFO] << endl;
282 cout <<
"mdc_range : " << mdc_range.
start <<
" " << mdc_range.
stop << endl;
287 cout <<
"mdcShift : " << mdcShift << endl;
288 FRF[
nIFO] = frTB[
nIFO].getFrList(detSegs[0].start-mdcShift, detSegs[0].
stop-mdcShift,
segEdge);
298 detSegs_dq2.push_back(detSegs[0]);
300 for(
int i=0;i<detSegs_dq2.size();i++) {
301 cout <<
"detSegs_dq2[" << i <<
"] Range : " << detSegs_dq2[
i].start <<
"-" << detSegs_dq2[
i].stop << endl;
304 cout <<
"live time after cat 2 : " << detSegs_ctime << endl;
305 if(detSegs_ctime<
segTHR) {cout <<
"job segment live time after cat2 < " <<
segTHR <<
" sec, job terminated !!!" << endl;
exit(1);}
307 double Tb=detSegs[0].start;
308 double Te=detSegs[0].stop;
313 char file[512],
tdf00[512],
tdf90[512], buFFer[1024];
314 int rnID =
int(gRandom->Rndm(13)*1.e9);
318 printf(
"GPS: %16.6f saved, injections: %d\n",
double(
long(Tb)),i);
323 vector<waveSegment> mdcSegs(NET.
mdcTime.size());
325 vector<waveSegment> mdcSegs_dq2 = slagTB.
mergeSegLists(detSegs_dq2,mdcSegs);
327 cout <<
"live time in zero lag after cat2+inj : " << mdcSegs_ctime << endl;
328 if(mdcSegs_ctime==0) {cout <<
"job segment with zero cat2+inj live time in zero lag, job terminated !!!" << endl;
exit(1);}
331 if(dump_infos_and_exit)
exit(0);
335 for(i=0; i<
nIFO; i++) {
340 sprintf(file,
"%s/%s_%d_%s_%d_%d.dat",
342 if(dump_sensitivity_and_exit) {
344 cout << endl <<
"Dump Sensitivity : " << file << endl << endl;
359 fprintf(stdout,
"start=%f duration=%f rate=%f\n",
362 cout <<
"net.C - Error : data not synchronized" << endl;
363 cout <<
ifo[
i] <<
" " << x.
start() <<
" != " <<
ifo[0] <<
" " << pTF[0]->
start() << endl;
367 cout <<
"net.C - Error : data have different rates" << endl;
368 cout <<
ifo[
i] <<
" " << x.
rate() <<
" != " <<
ifo[0] <<
" " << pTF[0]->
rate() << endl;
375 sprintf(file,
"%s/mdc%s_%d_%s_%d_%d.dat",
387 fprintf(stdout,
"start=%f duration=%f rate=%f\n",
393 if(singleDetector)
break;
395 if(dump_sensitivity_and_exit)
exit(0);
418 for(
int iii=0; iii<
nfactor; iii++) {
422 cout<<
"factor="<<factor<<endl;
434 if(!gSystem->GetPathInfo(endFile,fstemp)) {
435 printf(
"The file %s already exists - skip\n",endFile);
438 if(!rf.IsZombie())
continue;
443 char prod_label[512];
444 sprintf(prod_label,
"%d_%d_%s_slag%d_lag%d_%d_job%d",
456 cout<<
"output file on the node: "<<outFile<<endl;
457 cout<<
"final output file name : "<<endFile<<endl;
458 cout<<
"temporary output file : "<<tmpFile<<endl;
466 for(i=0; i<
nIFO; i++) {
467 sprintf(file,
"%s/%s_%d_%s_%d_%d.dat",
473 sprintf(file,
"%s/mdc%s_%d_%s_%d_%d.dat",
483 pD[
i]->
white(60.,1,8.,20.);
492 cout<<
"After "<<
ifo[
i]<<
" data conditioning"<<endl;
495 if(singleDetector) {*pD[1]=*pD[0];
break;}
513 TFile *
froot =
new TFile(tmpFile,
"RECREATE");
514 TTree*
net_tree = netburst.setTree();
515 TTree* live_tree= live.
setTree();
518 TTree* mdc_tree =
mdc.setTree();
521 TTree* var_tree = wavevar.
setTree();
522 TTree* noise_tree = noiserms.
setTree();
531 Long_t xid,xsize,xflags,xmt;
532 int xestat = gSystem->GetPathInfo(outDump,&xid,&xsize,&xflags,&xmt);
534 sprintf(command,
"/bin/rm %s",outDump);
535 gSystem->Exec(command);
543 for(
int mlag=mlagOff;mlag<mlagSize;mlag+=
mlagStep) {
547 if(lagSize==0)
continue;
549 cout <<
"lagSize : " << lagSize <<
" lagOff : " << lagOff << endl;
554 cout<<
"lag step: "<<
lagStep<<endl;
555 cout<<
"number of time lags: "<<lags<<endl;
560 cout<<
"live time in zero lag: "<<TL<<endl<<endl;
561 if(TL <= 0.)
exit(1);
569 cout<<
"Start coherent search: "; gSystem->Exec(
"/bin/date");
584 cout<<
"pixel threshold in units of noise rms: "<<Ao<<endl;
585 cout<<
"2 OR threshold in units of noise var: "<<
x2or*Ao*Ao<<endl;
587 cout<<
"total pixels: "<<NET.
coherence(Ao)<<
" ";
589 n = size_t(2.*
Tgap*pD[0]->
getTFmap()->resolution(0)+0.1);
590 m = size_t(
Fgap/pD[0]->
getTFmap()->resolution(0)+0.0001);
592 cout<<
"clusters: "<<NET.
cluster(n,m)<<
" ";
595 for(j=0; j<NET.
nLag; j++) {
596 sprintf(file,
"%s/pix_%d_%s_%d_%d_%d.lag",
598 wc = *(NET.
getwc(j));
599 if(!append)
np.data[
j] = wc.
write(file,0);
600 else np.data[
j] += wc.
write(file,1);
616 for(j=0; j<lags; j++){
617 sprintf(file,
"%s/pix_%d_%s_%d_%d_%d.lag",
621 pwc = NET.
getwc(j); pwc->
cpf(wc,
true);
622 cout<<m<<
"|"<<pwc->
size()<<
" ";
623 sprintf(command,
"/bin/rm %s",file);
624 gSystem->Exec(command);
627 cout<<
"events in the buffer: "<<NET.
events()<<
"\n";
646 cout<<
"rejected weak pixels: "<<NET.
netcut(
netRHO,
'r',0,1)<<
"\n";
647 cout<<
"rejected loud pixels: "<<NET.
netcut(
netCC,
'c',0,1)<<
"\n";
648 cout<<
"events in the buffer: "<<NET.
events()<<
"\n";
651 cout<<
"dump ced into "<<out_CED<<
"\n";
654 CWB::ced ced(&NET,&netburst,out_CED);
657 bool fullCED = singleDetector ? false :
true;
658 if(ced.Write(factor,fullCED)) ceddir = 1;
664 gSystem->Exec(
"/bin/date");
666 cout<<
"\nSearch done\n";
667 cout<<
"reconstructed events: "<<NET.
events()<<
"\n";
675 if(
dump) netburst.dopen(outDump,
"w");
678 live.
output(live_tree,&NET,slagShift);
681 netburst.output(net_tree,&NET,factor);
682 mdc.output(mdc_tree,&NET,factor);
685 netburst.output(net_tree,&NET);
686 for(i=0; i<
nIFO; i++) {
688 noiserms.
output(noise_tree,&pD[i].nRMS,i+1,R/2);
696 if(
dump) netburst.dclose();
702 sprintf(command,
"/bin/mv %s %s", tmpFile, outFile);
703 if(!
cedDump) gSystem->Exec(command);
704 sprintf(command,
"/bin/mv %s %s",outFile,endFile);
705 if(!
cedDump) gSystem->Exec(command);
706 sprintf(command,
"/bin/mv %s %s",outDump,endDump);
708 xestat = gSystem->GetPathInfo(end_CED,&xid,&xsize,&xflags,&xmt);
710 sprintf(command,
"/bin/mv %s/* %s/.",out_CED,end_CED);
712 sprintf(command,
"/bin/mv %s %s",out_CED,end_CED);
714 if(
cedDump && ceddir) gSystem->Exec(command);
720 for(i=0; i<
nIFO; i++) {
722 sprintf(command,
"/bin/rm %s",file);
723 gSystem->Exec(command);
727 sprintf(command,
"/bin/rm %s",file);
728 gSystem->Exec(command);
730 if(singleDetector)
break;
732 cout<<
"Stopping the job "<<runID<<endl;
733 gSystem->Exec(
"/bin/date");
743 printf(
"Job Elapsed Time - %02d:%02d:%02d (hh:mm:ss)\n",job_elapsed_hour,job_elapsed_min,job_elapsed_sec);
744 printf(
"Job Speed Factor - %2.1fX\n",job_speed_factor);
size_t write(const char *file, int app=0)
void white(double dT=0, int wtype=1, double offset=0., double stride=0.)
what it does: see algorithm description in wseries.hh
size_t add(detector *)
param: detector structure return number of detectors in the network
void set2or(double p)
param: threshold
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)
std::vector< double > * getmdcTime()
char channelNamesMDC[NIFO_MAX][50]
virtual void rate(double r)
WSeries< double > * pTF[nIFO]
char channelNamesRaw[NIFO_MAX][50]
virtual WSeries< float > variability(double=0., double=-1., double=-1.)
param: first - time window to calculate normalization constants second - low frequency boundary for c...
char * watversion(char c='s')
size_t setIndexMode(size_t=0)
void add(const wavearray< DataType_t > &, int=0, int=0, int=0)
virtual void ReadBinary(const char *, int=0)
char frFiles[NIFO_MAX+1][256]
size_t setSkyMask(double f, char *fname)
CWB::Toolbox frTB[nIFO+1]
virtual size_t supercluster(char atype, double S, bool core)
param: statistic: E - excess power, L - likelihood param: selection threshold T for likelihood cluste...
virtual void start(double s)
vector< waveSegment > detSegs_dq2
std::vector< double > mdcTime
long coherence(double, double=0., double=0.)
param: threshold on lognormal pixel energy (in units of noise rms) param: threshold on total pixel en...
size_t cluster(int kt, int kf)
param: time gap in pixels return: number of reconstructed clusters
void setRunID(size_t n)
param: run
fprintf(stdout,"start=%f duration=%f rate=%f\, x.start(), x.size()/x.rate(), x.rate())
void constraint(double d=1., double g=0.0001)
param: constraint parameter, p=0 - no constraint
virtual size_t size() const
void Forward(size_t k)
param: number of steps
double setVeto(double=5.)
param: time window around injections
void setDelayIndex(double rate)
param: MDC log file
std::vector< std::string > mdcList
double dataShift[NIFO_MAX]
double getDelay(const char *c="")
int getLayer(wavearray< DataType_t > &w, double n)
param: n - layer number
printf("total live time: non-zero lags = %10.1f \, liveTot)
std::vector< waveSegment > segList
size_t cpf(const netcluster &, bool=false, int=0)
void output(TTree *waveTree, network *net, float *slag=NULL, vector< waveSegment > detSegs=DEFAULT_WAVESEGMENT)
void setDelay(const char *="L1")
void bandPass(double f1, double f2, double a=0.)
long likelihood(char='E', double=sqrt(2.), int=0, size_t=0, int=-1, bool=false)
void output(TTree *, WSeries< double > *, int=0, double=1.)
virtual void DumpBinary(const char *, int=0)
vector< waveSegment > detSegs
cout<<" network of ";for(i=0;i< nIFO;i++) cout<< ifo[i]<<" ";cout<<" detectors\\";Meyer< double > B(1024)
WSeries< double > * getTFmap()
param: no parameters
TString cwb_parameters_name
virtual void lprFilter(double, int=0, double=0., double=0.)
void AddLog(char *Stage, char *Log, TDatime *Time=NULL)
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
vector< TString > ifos(nIFO)
strcpy(RunLabel, RUN_LABEL)
Meyer< double > S(1024, 2)
netcluster * getwc(size_t n)
param: delay index
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
vector< waveSegment > cat2List
void setDelayFilters(detector *=NULL)
size_t netcut(double, char='L', size_t=0, int=1)
param: threshold param: minimum cluster size processed by the corrcut param: cluster type return: num...
cout<< "live time after cat 2 : "<< detSegs_ctime<< endl;if(detSegs_ctime< segTHR) {cout<< "job segment live time after cat2 < "<< segTHR<< " sec, job terminated !!!"<< endl;exit(1);} double Tb=detSegs[0].start;double Te=detSegs[0].stop;double dT=Te-Tb;char file[512], tdf00[512], tdf90[512], buFFer[1024];int rnID=int(gRandom->Rndm(13) *1.e9);if(simulation) { i=NET.readMDClog(injectionList, double(long(Tb)) -mdcShift);printf("GPS: %16.6f saved, injections: %d\", double(long(Tb)), i);frTB[nIFO].shiftBurstMDCLog(NET.mdcList, ifos, mdcShift);for(int i=0;i< NET.mdcTime.size();i++) NET.mdcTime[i]+=mdcShift;vector< waveSegment > mdcSegs(NET.mdcTime.size());for(int k=0;k< NET.mdcTime.size();k++) {mdcSegs[k].start=NET.mdcTime[k]-gap;mdcSegs[k].stop=NET.mdcTime[k]+gap;} vector< waveSegment > mdcSegs_dq2=slagTB.mergeSegLists(detSegs_dq2, mdcSegs);double mdcSegs_ctime=slagTB.getTimeSegList(mdcSegs_dq2);cout<< "live time in zero lag after cat2+inj : "<< mdcSegs_ctime<< endl;if(mdcSegs_ctime==0) {cout<< "job segment with zero cat2+inj live time in zero lag, job terminated !!!"<< endl;exit(1);} } if(dump_infos_and_exit) exit(0);if(mask >0.) NET.setSkyMask(mask, skyMaskFile);for(i=0;i< nIFO;i++) { frTB[i].readFrames(FRF[i], channelNamesRaw[i], x);x.start(x.start()+dataShift[i]);x.start(x.start() -segLen *(segID[i]-segID[0]));if(singleDetector) TB.resampleToPowerOfTwo(x);sprintf(file,"%s/%s_%d_%s_%d_%d.dat", nodedir, ifo[i], int(Tb), data_label, runID, rnID);if(dump_sensitivity_and_exit) { sprintf(file,"%s/sensitivity_%s_%d_%s_job%d.txt", dump_dir, ifo[i], int(Tb), data_label, runID);cout<< endl<< "Dump Sensitivity : "<< file<< endl<< endl;TB.makeSpectrum(file, x);continue;} if(dcCal[i]>0.) x *=dcCal[i];if(fResample >0) { x.FFT(1);x.resize(fResample/x.rate() *x.size());x.FFT(-1);x.rate(fResample);} pTF[i]=pD[i]-> getTFmap()
size_t read(const char *)
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 Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
size_t setsim(WSeries< double > &, std::vector< double > *, double=5., double=8., bool saveWF=false)
void AddHistory(char *Stage, char *Type, char *History, TDatime *Time=NULL)
void setSkyMaps(double, double=0., double=180., double=0., double=360.)
param: sky map granularity step, degrees param: theta begin, degrees param: theta end...
double threshold(double, double)
param: selected fraction of LTF pixels assuming Gaussian noise param: maximum time delay between dete...
vector< waveSegment > cat1List