14 std::vector<TString>
ifo;
55 gROOT->SetBatch(
true);
79 TFile*
froot =
new TFile(ifile,
"READ");
80 if(froot==NULL) {cout <<
"ReadDataFromROOT - Error opening file " << ifile << endl;
return 1;}
81 TTree*
itree = (TTree*)froot->Get(
"waveburst");
82 if(itree==NULL) {cout <<
"ReadDataFromROOT - Error : no waveburst present in the file" << endl;
return 1;}
85 TList*
list = itree->GetUserInfo();
87 if (
nIFO==0) {cout <<
"ReadDataFromROOT - Error : no ifo present in the tree" << endl;
return 1;}
88 for (
int n=0;
n<list->GetSize();
n++) {
91 xparms->ifo.push_back(pDetector->
Name);
96 itree->SetBranchAddress(
"ndim",&
nIFO);
103 std::vector<netpixel>*
cluster;
105 cluster =
new std::vector<netpixel>;
107 itree->SetBranchAddress(
"iSNR",iSNR);
108 itree->SetBranchAddress(
"oSNR",oSNR);
110 itree->SetBranchAddress(
"seggps",&seggps);
111 itree->SetBranchAddress(
"crate",&crate);
112 itree->SetBranchAddress(
"cluster",&cluster);
117 for(
int n=0;
n<
nIFO;
n++) xparms->isnr += iSNR[
n];
118 xparms->isnr = sqrt(xparms->isnr);
120 for(
int n=0;
n<
nIFO;
n++) xparms->osnr += oSNR[
n];
121 xparms->osnr = sqrt(xparms->osnr);
123 xparms->seggps=seggps;
125 cout <<
"segment start time " <<
int(seggps) << endl;
126 cout <<
"cluster rate " << crate << endl;
127 cout <<
"cluster size " << cluster->size() << endl;
129 if(cluster->size()==0) {cout <<
"ReadDataFromROOT - Error : no clusters in the root file !!!" << endl;
return 1;}
131 xparms->nc.rate=crate;
132 std::vector<int> pList;
133 for(
int i=0;
i<cluster->size();
i++) {
134 xparms->nc.pList.push_back((*cluster)[
i]);
137 xparms->nc.cList.push_back(pList);
139 xparms->nc.cData.push_back(cd);
142 if(itree)
delete itree;
143 if(froot)
delete froot;
154 if(WTS==NULL) WTS =
new watplot(const_cast<char*>(
"wtswrc"));
160 TString xtitle = TString::Format(
"Time (sec) : GPS OFFSET = %.3f",seggps);
163 sprintf(fname,
"%s/l_tfmap_scalogram.%s", odir.Data(),
"png");
164 WTS->
plot(pwc, 1,
nIFO,
'L', 0, const_cast<char*>(
"COLZ"),256,
true);
165 WTS->
hist2D->GetXaxis()->SetTitle(xtitle);
166 WTS->
canvas->Print(fname);
170 sprintf(fname,
"%s/n_tfmap_scalogram.%s", odir.Data(),
"png");
171 WTS->
plot(pwc, 1,
nIFO,
'N', 0, const_cast<char*>(
"COLZ"),256,
true);
172 WTS->
hist2D->GetXaxis()->SetTitle(xtitle);
173 WTS->
canvas->Print(fname);
187 sprintf(ofname,
"%s/tfmap_dump.%s", odir.Data(),
"txt");
190 if((fp = fopen(ofname,
"w")) == NULL ) {
191 cout <<
"DumpNetCluster error: cannot open file " << ofname <<
". \n";
194 cout << endl <<
"ofile name = " << ofname << endl << endl;
198 std::vector<int>* vint = &(pwc->
cList[cid-1]);
200 int V = vint->size();
205 for(
int n=0;
n<V;
n++) {
207 if(!pix->
core)
continue;
210 double null = pix->
null>0. ? pix->
null : 0.;
217 double df = 1./(2.*
dt);
220 sprintf(sout,
"pixel %*d\ttime = %*.3f (sec) \tfreq = %*.3f (Hz) \tnull = %*.3f \tlikelihood = %*.3f \tRes = %*.3f x %*.3f (sec,Hz)\n",7,
n,7,time,7,freq,7,null,7,like,7,dt,7,df);
detectorParams getDetectorParams()
void ReadNetCluster(TString ifroot, TString odir=".", int entry=0)
std::vector< pixel > cluster
void PlotNetCluster(watplot *WTS, netcluster *pwc, double seggps, TString odir)
std::vector< double > oSNR[NIFO_MAX]
std::vector< vector_int > cList
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
fprintf(stdout,"start=%f duration=%f rate=%f\, x.start(), x.size()/x.rate(), x.rate())
int ReadDataFromROOT(TString ifile, XPARMS *xparms)
std::vector< double > iSNR[NIFO_MAX]
netpixel * getPixel(size_t n, size_t i)
void DumpNetCluster(netcluster *pwc, int cid, int nifo, TString odir)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)