3 #pragma GCC system_header
10 #include "TObjArray.h"
11 #include "TObjString.h"
37 cout <<
"-----> CWB_Plugin_Qveto.C" << endl;
38 cout <<
"ifo " << ifo.Data() << endl;
39 cout <<
"type " << type << endl;
54 TList *
files = (TList*)gROOT->GetListOfFiles();
63 while ((file=(TSystemFile*)
next())) {
64 fname = file->GetName();
66 if(fname.Contains(
"wave_")) {
67 froot=(TFile*)file;froot->cd();
69 outDump.ReplaceAll(
".root.tmp",
".txt");
74 cout <<
"CWB_Plugin_Qveto.C : Error - output root file not found" << endl;
78 cout <<
"CWB_Plugin_Qveto.C : Error - output root file not found" << endl;
82 TTree*
net_tree = (TTree *) froot->Get(
"waveburst");
86 net_tree->Branch(
"Qveto",Qveto,TString::Format(
"Qveto[%i]/F",cfg->
nIFO));
87 net_tree->Branch(
"Lveto",Lveto,TString::Format(
"Lveto[%i]/F",3));
94 cout <<
"CWB_Plugin_Qveto.C -> "
95 <<
"CWB_PLUGIN_OLIKELIHOOD implemented only for 2G" << endl;
101 cout <<
"-----> CWB_Plugin_Qveto.C -> "
102 <<
" gIFACTOR : " << gIFACTOR << endl;
105 float* gSLAGSHIFT=NULL;
IMPORT(
float*,gSLAGSHIFT)
117 TList *
files = (TList*)gROOT->GetListOfFiles();
124 while ((file=(TSystemFile*)
next())) {
125 fname = file->GetName();
127 if(fname.Contains(
"wave_")) {
128 froot=(TFile*)file;froot->cd();
130 outDump.ReplaceAll(
".root.tmp",
".txt");
135 cout <<
"CWB_Plugin_Qveto.C : Error - output root file not found" << endl;
139 cout <<
"CWB_Plugin_Qveto.C : Error - output root file not found" << endl;
143 TTree*
net_tree = (TTree *) froot->Get(
"waveburst");
146 net_tree->SetBranchAddress(
"Qveto",Qveto);
147 net_tree->SetBranchAddress(
"Lveto",Lveto);
151 net_tree->Branch(
"Qveto",Qveto,TString::Format(
"Qveto[%i]/F",cfg->
nIFO));
152 net_tree->Branch(
"Lveto",Lveto,TString::Format(
"Lveto[%i]/F",3));
156 for(
int k=0;
k<
K;
k++) {
162 int ID = size_t(
id.data[
j]+0.5);
175 int idSize = pd->
RWFID.size();
178 for (
int mm=0; mm<idSize; mm++)
if (pd->
RWFID[mm]==ID) wfIndex=mm;
179 if(wfIndex==-1)
continue;
182 cout << endl <<
"----------------------------------------------------------------" << endl;
184 cout <<
"Lveto : " <<
"fmean : " << Lveto[0] <<
" frms : " << Lveto[1]
185 <<
" Energy Ratio : " << Lveto[2] << endl << endl;
192 pwfREC[
n] = pd->
RWFP[wfIndex];
195 #ifdef PLOT_WHITENED_WAVEFORMS
201 cout <<
"Qveto : " << pd->
Name <<
" Qveto = " << Qveto[
n] << endl;
203 cout <<
"----------------------------------------------------------------" << endl;
213 if(cfg->
dump) EVT->
dopen(outDump.Data(),
const_cast<char*
>(
"a"),
false);
214 EVT->
output2G(net_tree,NET,ID,
k,ofactor);
222 for(
int i=0; i<3; i++)
fprintf(EVT->
fP,
"%f ",Lveto[i]);
246 for(
int j=xsize;
j<x.
size();
j++) x[
j]=0;
269 if(
a[
i]>amax) {amax=
a[
i];imax=
i;}
286 if(abs(imax-
i)<=
NTHR) {
294 float Qveto = ein>0 ? eout/ein : 0.;
313 Lveto[0] = Lveto[1] = Lveto[2] = 0;
315 std::vector<int>* vint = &(pwc->
cList[cid-1]);
316 int V = vint->size();
327 for(
int n=0;
n<V;
n++) {
330 cout <<
"CWB_Plugin_Qveto.C - Error : is enabled only for WDM (2G)" << endl;
333 if(!pix->
core)
continue;
337 likePix += pow(pix->
getdata(
'S',
m),2);
338 likePix += pow(pix->
getdata(
'P',
m),2);
345 if(likePix>likeMax) {likeMax=likePix;freqMax=freq;dfreqMax=
df;}
357 for(
int n=0;
n<V;
n++) {
359 if(!pix->
core)
continue;
363 likePix += pow(pix->
getdata(
'S',
m),2);
364 likePix += pow(pix->
getdata(
'P',
m),2);
370 if(
fabs(freq-freqMax)<=dfreqMax) {
372 fmean += likePix*freq;
373 frms += likePix*freq*freq;
377 fmean = fmean/likeLin;
378 frms = frms/likeLin-fmean*fmean;
379 frms = frms>0 ? sqrt(frms) : 0.;
381 if(frms<dfreqMax/2.) frms=dfreqMax/2.;
389 Lveto[2] = likeTot>0. ? likeLin/likeTot : 0.;
395 #if defined PLOT_LIKELIHOOD
398 WTS.
canvas->Print(
"l_tfmap_scalogram.png");
411 double tmin = wfREC->
start();
418 PTS.
graph[0]->SetLineWidth(1);
422 if(fft)
sprintf(label,
"%s",
"fft");
423 else sprintf(label,
"%s",
"time");
424 if(strain)
sprintf(label,
"%s_%s",label,
"strain");
425 else sprintf(label,
"%s_%s",label,
"white");
431 cout <<
"write : " << fname << endl;
std::vector< char * > ifoName
detector * getifo(size_t n)
param: detector index
virtual size_t size() const
void setSLags(float *slag)
fprintf(stdout,"start=%f duration=%f rate=%f\n", x.start(), x.size()/x.rate(), x.rate())
virtual void rate(double r)
wavearray< double > a(hp.size())
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
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
wavearray< double > get(char *name, size_t index=0, char atype='R', int type=1, bool=true)
param: string with parameter name param: index in the amplitude array, which define detector param: c...
void PlotWaveform(TString ifo, wavearray< double > *wfREC, CWB::config *cfg, bool fft=false, bool strain=false)
std::vector< wavearray< double > * > RWFP
std::vector< TGraph * > graph
std::vector< vector_int > cList
virtual void start(double s)
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
void dopen(const char *fname, char *mode, bool header=true)
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *NET, WSeries< double > *x, TString ifo, int type)
COHERENCE.
void output2G(TTree *, network *, size_t, int, double)
#define IMPORT(TYPE, VAR)
TIter next(twave->GetListOfBranches())
netpixel * getPixel(size_t n, size_t i)
FILE * fP
injected reconstructed xcor waveform
netevent EVT(itree, nifo)
double fabs(const Complex &x)
netcluster * getwc(size_t n)
param: delay index
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
float GetQveto(wavearray< double > *wf)
double factors[FACTORS_MAX]
double getdata(char type='R', size_t n=0)
void GetLveto(netcluster *pwc, int cid, int nifo, float *Lveto)
virtual void resize(unsigned int)