Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_supercluster.C
Go to the documentation of this file.
1 #define XIFO 4
2 
3 #pragma GCC system_header
4 
5 #include "cwb.hh"
6 #include "cwb2G.hh"
7 #include "config.hh"
8 #include "network.hh"
9 #include "wavearray.hh"
10 #include "TString.h"
11 #include "TObjArray.h"
12 #include "TObjString.h"
13 #include "TRandom.h"
14 #include "TComplex.h"
15 
16 //!SUPERCLUSTER
17 
18 void
20 
21 // This plugin implements the standard supercluster stage (only 2G)
22 
23  cout << endl;
24  cout << "-----> CWB_Plugin_supercluster.C" << endl;
25  cout << "ifo " << ifo.Data() << endl;
26  cout << "type " << type << endl;
27  cout << endl;
28 
29  if(type==CWB_PLUGIN_CONFIG) {
30  cfg->scPlugin=true; // disable built-in supercluster function
31  }
32 
33  if(type==CWB_PLUGIN_ISUPERCLUSTER) {
34 
35  cout << "type==CWB_PLUGIN_ISUPERCLUSTER" << endl;
36 
37  // import ifile
38  void* gIFILE=NULL; IMPORT(void*,gIFILE)
39  cout << "-----> CWB_Plugin_wavegraph.C -> " << " gIFILE : " << gIFILE << endl;
40  TFile* ifile = (TFile*)gIFILE;
41 
42  // import ifactor
43  int gIFACTOR=-1; IMPORT(int,gIFACTOR)
44  cout << "-----> CWB_Plugin_wavegraph.C -> " << " gIFACTOR : " << gIFACTOR << endl;
45  int ifactor = gIFACTOR;
46 
47  int nIFO = net->ifoListSize(); // number of detectors
48  int rateANA=cfg->inRate>>cfg->levelR;
49  int nRES = net->wdmListSize(); // number of resolution levels
50  int lags = net->getifo(0)->lagShift.size();
51 
52  wavearray<double>* hot[NIFO_MAX]; // temporary time series
53  for(int i=0; i<nIFO; i++) hot[i] = net->getifo(i)->getHoT();
54 
55  int nevt = 0;
56  int nnn = 0;
57  int mmm = 0;
58  size_t count = 0;
59  netcluster wc;
60  netcluster* pwc;
61 
62  for(int j=0; j<(int)lags; j++) {
63 
64  int cycle = cfg->simulation ? ifactor : Long_t(net->wc_List[j].shift);
65 
66  // read cluster metadata
67  if(ifile!=NULL) wc.read(ifile,"coherence","clusters",0,cycle);
68  else wc.read(jfile,"coherence","clusters",0,cycle);
69  // read clusters from temporary job file, loop over TF resolutions
70  if(ifile!=NULL) {
71  for(int i=nRES-1; i>=0; i--) // reverse loop is faster loading cluster (?)
72  wc.read(ifile,"coherence","clusters",-1,cycle,rateANA>>(i+cfg->l_low));
73  } else {
74  for(int i=nRES-1; i>=0; i--) // reverse loop is faster loading cluster (?)
75  wc.read(jfile,"coherence","clusters",-1,cycle,rateANA>>(i+cfg->l_low));
76  }
77  if(!cfg->simulation) cout<<"process lag " <<cycle<<" ..."<<endl;
78  cout<<"loaded clusters|pixels: "<<wc.csize()<<"|"<<wc.size()<<endl;
79 
80  // supercluster analysis
81  wc.supercluster('L',net->e2or,cfg->TFgap,false); //likehood2G
82  cout<<"super clusters|pixels: "<<wc.esize(0)<<"|"<<wc.psize(0)<<endl;
83 
84  // release all pixels
85  pwc = net->getwc(j);
86  pwc->cpf(wc, false);
87 
88  net->setDelayIndex(hot[0]->rate());
89  pwc->setcore(false);
90 
91  // apply cuts
92  int psel = 0;
93  while(1) {
94  count = pwc->loadTDampSSE(*net, 'a', cfg->BATCH, cfg->LOUD);
95  psel += net->subNetCut((int)j,cfg->subnet,NULL);
96  int ptot = pwc->psize(1)+pwc->psize(-1);
97  double pfrac = ptot>0 ? double(psel)/double(ptot) : 0.;
98  cout<<"selected pixels: "<<psel<<", fraction: "<<pfrac<< endl;
99  if(count<10000) break;
100  }
101 
102  pwc->defragment(cfg->Tgap,cfg->Fgap); // SK added defragmentation
103 
104  nevt = net->events();
105  nnn += pwc->psize(-1);
106  mmm += pwc->psize(1)+pwc->psize(-1);
107 
108  if(mmm) cout<<"events in the buffer: "<<net->events()<<"|"<<nnn<<"|"<<nnn/double(mmm)<<"\n";
109  else cout<<"events in the buffer: "<<net->events()<<"\n";
110 
111  // store cluster into temporary job file [NEWSS]
112  pwc->write(jfile,"supercluster","clusters",0,cycle);
113  pwc->write(jfile,"supercluster","clusters",-1,cycle);
114  cout<<cycle<<"|"<<pwc->csize()<<"|"<<pwc->size()<<" ";cout.flush();
115 
116  pwc->clear();
117  cout<<endl;
118  }
119  }
120 
121  return;
122 }
123 
detector * getifo(size_t n)
param: detector index
Definition: network.hh:418
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
virtual size_t defragment(double T, double F, TH2F *=NULL)
T - maximum time gap in seconds F - maximum frequency gap in Hz.
Definition: netcluster.cc:1275
virtual size_t size() const
Definition: wavearray.hh:127
size_t write(const char *file, int app=0)
Definition: netcluster.cc:2989
std::vector< netcluster > wc_List
Definition: network.hh:592
TString("c")
int count
Definition: compare_bkg.C:373
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
netcluster * pwc
Definition: cwb_job_obj.C:20
size_t setcore(bool core, int id=0)
Definition: netcluster.cc:224
int nevt
virtual size_t supercluster(char atype, double S, bool core)
param: statistic: E - excess power, L - likelihood param: selection threshold T for likelihood cluste...
Definition: netcluster.cc:789
int j
Definition: cwb_net.C:10
i drho i
long subNetCut(int lag, float subnet=0.6, float subcut=0.33, TH2F *hist=NULL)
Definition: network.cc:983
size_t wdmListSize()
Definition: network.hh:428
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
size_t ifoListSize()
Definition: network.hh:413
#define nIFO
size_t esize(int k=2)
Definition: netcluster.hh:135
jfile
Definition: cwb_job_obj.C:25
int simulation
Definition: config.hh:181
double Fgap
Definition: config.hh:118
wavearray< double > hot[2]
#define IMPORT(TYPE, VAR)
Definition: cwb.hh:51
i() int(T_cor *100))
wavearray< double > * getHoT()
param: no parameters
Definition: detector.hh:157
void setDelayIndex(double rate)
param: MDC log file
Definition: network.cc:2865
const int NIFO_MAX
Definition: wat.hh:4
int BATCH
Definition: config.hh:227
int gIFACTOR
size_t cpf(const netcluster &, bool=false, int=0)
Definition: netcluster.cc:99
size_t loadTDampSSE(network &net, char c, size_t BATCH=10000, size_t LOUD=0)
Definition: netcluster.cc:3298
wavearray< double > lagShift
Definition: detector.hh:351
double e2or
Definition: network.hh:566
TFile * ifile
size_t rateANA
Definition: test_config1.C:21
size_t size()
Definition: netcluster.hh:129
double subnet
Definition: config.hh:229
size_t events()
Definition: network.hh:311
int l_low
Definition: config.hh:137
int LOUD
Definition: config.hh:228
size_t csize()
Definition: netcluster.hh:133
int ifactor
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
SUPERCLUSTER.
netcluster * getwc(size_t n)
param: delay index
Definition: network.hh:421
double Tgap
Definition: config.hh:116
netcluster wc
const int nRES
Definition: revMonster.cc:7
size_t read(const char *)
Definition: netcluster.cc:3096
double TFgap
Definition: config.hh:120
size_t psize(int k=2)
Definition: netcluster.hh:145
size_t inRate
Definition: config.hh:114
int levelR
Definition: config.hh:134
bool scPlugin
Definition: config.hh:350
void clear()
Definition: netcluster.hh:409