Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_fCuts.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 "config.hh"
7 #include "network.hh"
8 #include "wavearray.hh"
9 #include "TString.h"
10 #include "TObjArray.h"
11 #include "TObjString.h"
12 #include "TRandom.h"
13 #include "Toolbox.hh"
14 
15 //!DATA_CONDITIONING
16 
17 // Implements the 2G frequency cuts in pixel selection stage
18 
19 inline bool CheckRange(int i, double df, double flow, double fhigh)
20  {
21  double iflow=i*df-df/2.;
22  double ifhigh=(i+1)*df-df/2.;
23  if((iflow>=flow)&&(iflow<fhigh)) return true;
24  if((ifhigh>flow)&&(ifhigh<=fhigh)) return true;
25  return false;
26  }
27 
28 // fcut structure used to define the frequency cuts
29 #define _FCUT_MAX 100
30 
32 
33 struct fcut {
34  char ifo[32];
35  float flow;
36  float fhigh;
37  char levels[1024];
38 };
39 
40 
41 void
43 
44  cout << endl;
45  cout << "-----> CWB_Plugin_fCuts.C" << endl;
46  cout << "ifo " << ifo.Data() << endl;
47  cout << "type " << type << endl;
48  cout << endl;
49 
50  if(type==CWB_PLUGIN_XCOHERENCE) {
51 
52  // WSeries contains energy (it is stored in the 0 phase amplitudes)
53 
54  // frequency cuts declaration
55  fcut FCUT[_FCUT_MAX];
56 
57  // export to CINT
58  char cmd[128];
59  sprintf(cmd,"fcut* FCUT = (fcut*)%p;",FCUT);
60  gROOT->ProcessLine(cmd);
61 
62  // read plugin config
63  cfg->configPlugin.Exec();
64  // import resolution level
65  int nFCUT=-1; IMPORT(int,nFCUT)
66  // transform level list { 2, 6, 8} to {,2,6,8,}
67  for(int i=0;i<nFCUT;i++) {
68  TString Levels = FCUT[i].levels;
69  Levels = ","+Levels+",";
70  Levels.ReplaceAll(" ","");
71  strcpy(FCUT[i].levels,Levels.Data());
72  }
73 
74  // import resolution level
75  size_t gILEVEL=-1; IMPORT(size_t,gILEVEL)
76  char slevel[256];sprintf(slevel,",%d,",gILEVEL);
77 
78  int nIFO = net->ifoListSize();
79  detector* pD[NIFO_MAX]; // pointers to detectors
80  for(int n=0;n<nIFO;n++) pD[n] = net->getifo(n);
81 
82  for(int n=0; n<nIFO; n++) { // produce TF maps with max over the sky energy
83 
84  WSeries<double>* WS = pD[n]->getTFmap();
85  ifo = net->ifoName[n];
86 
87  if(WS->pWavelet->m_WaveType!=WDMT) {
88  cout << "CWB_Plugin_fCuts.C - Error : works only for WDMT wavelet types" << endl;
89  gSystem->Exit(1);
90  }
91 
92 
93  int layers = WS->maxLayer()+1; // numbers of frequency bins (first & last bins have df/2)
94  int slices = WS->sizeZero(); // number of time bins
95 
96  float df = WS->resolution(); // frequency bin resolution (hz)
97  float dt = 1./(2*df); // time bin resolution (sec)
98 
99  int rate = int(1./dt);
100 
101  if(n==0) cout << "layers : " << layers << "\t slices : " << slices << "\t rate : " << rate
102  << "\t dt : " << dt << "\t df : " << df << endl;
103 
104  for(int i=0;i<slices;i++) {
105  for(int j=0;j<layers;j++) {
106  for(int k=0;k<nFCUT;k++) {
107  if(FCUT[k].ifo==ifo && TString(FCUT[k].levels).Contains(slevel)) {
108  if(CheckRange(j,df,FCUT[k].flow,FCUT[k].fhigh)) {
109  WS->putSample(0,i,j); // set to 0 the energy
110  }
111  }
112  }
113  }
114  }
115  }
116  }
117  return;
118 }
std::vector< char * > ifoName
Definition: network.hh:591
detector * getifo(size_t n)
param: detector index
Definition: network.hh:418
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
int slices
TMacro configPlugin
Definition: config.hh:344
char cmd[1024]
int n
Definition: cwb_net.C:10
TString("c")
int FCUT_MAX
void putSample(DataType_t a, int n, double m)
Definition: wseries.hh:177
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
int layers
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.
int j
Definition: cwb_net.C:10
i drho i
bool CheckRange(int i, double df, double flow, double fhigh)
DATA_CONDITIONING.
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
size_t ifoListSize()
Definition: network.hh:413
#define nIFO
jfile
Definition: cwb_job_obj.C:25
#define IMPORT(TYPE, VAR)
Definition: cwb.hh:51
i() int(T_cor *100))
const int NIFO_MAX
Definition: wat.hh:4
double fhigh
Definition: Wavelet.hh:31
int k
double dt
#define _FCUT_MAX
double flow
WSeries< double > * getTFmap()
param: no parameters
Definition: detector.hh:161
double resolution(int=0)
Definition: wseries.hh:137
strcpy(RunLabel, RUN_LABEL)
double df
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
enum WAVETYPE m_WaveType
Definition: Wavelet.hh:88
WaveDWT< DataType_t > * pWavelet
Definition: wseries.hh:438
size_t sizeZero()
Definition: wseries.hh:126
int maxLayer()
Definition: wseries.hh:121
detector ** pD