Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_nRMS.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 "gwavearray.hh"
11 #include "TString.h"
12 #include "TObjArray.h"
13 #include "TObjString.h"
14 #include "TRandom.h"
15 #include "TComplex.h"
16 #include "TMath.h"
17 #include "mdc.hh"
18 #include <vector>
19 
20 //!DATA_CONDITIONING
21 
22 // This plugin is used to save the nRMS wseries into the job root file
23 // nRMS contains the estimated noise rms used to whitening the strain data
24 // Must be used with lagSize=1, slagSize=1, simulation=0 and input stage = CSTRAIN
25 //
26 // To use in interactive mode do :
27 // cwb_inet2G config/user_parameters.C CSTRAIN #job
28 // the cstrain job file is saved under the data directory
29 //
30 // To use in batch mode do :
31 // cwb_condor create CSTRAIN
32 // cwb_condor submit
33 // the cstrain job files are saved under the output directory
34 //
35 
36 void
38 
39  if(type==CWB_PLUGIN_CONFIG) {
40 
41  // import istage,jstage
42  int gISTAGE=-1; IMPORT(int,gISTAGE)
43  int gJSTAGE=-1; IMPORT(int,gJSTAGE)
44 
45  if(gJSTAGE!=CWB_STAGE_CSTRAIN)
46  {cout << "CWB_Plugin_nRMS - Error : input stage must be CSTRAIN" << endl;gSystem->Exit(1);}
47 
48  if(cfg->simulation!=0)
49  {cout << "CWB_Plugin_nRMS - Error : simulation must be 0" << endl;gSystem->Exit(1);}
50 
51  if(cfg->lagSize!=1)
52  {cout << "CWB_Plugin_nRMS - Error : lagSize must be 1" << endl;gSystem->Exit(1);}
53 
54  if(cfg->slagSize!=1)
55  {cout << "CWB_Plugin_nRMS - Error : slagSize must be 1" << endl;gSystem->Exit(1);}
56  }
57 
58  if(type==CWB_PLUGIN_OREADDATA) {
59 
60  // import pointer to object cwb2G
61  cwb2G* gCWB2G; IMPORT(cwb2G*,gCWB2G)
62 
63  // disable the builtin save cstrain & rms
65  }
66 
68 
69  // get ifo ID
70  int ifoID =0; for(int n=0;n<cfg->nIFO;n++) if(ifo==net->getifo(n)->Name) {ifoID=n;break;}
71  // get detector pointer
72  detector* pD = net->getifo(ifoID);
73  // import factor
74  int gIFACTOR=-1; IMPORT(int,gIFACTOR)
75 
76  // create the rms directory in root file
77  jfile->cd();
78  TDirectory* drms = (TDirectory*)jfile->Get("rms");
79  if(drms==NULL) drms=jfile->mkdir("rms");
80  drms->cd();
81  char cdrms_name[32];sprintf(cdrms_name,"rms-f%d",gIFACTOR);
82  TDirectory* cdrms = (TDirectory*)drms->Get(cdrms_name);
83  if(cdrms==NULL) cdrms=drms->mkdir(cdrms_name);
84 
85  // save nRMS
86  cdrms->cd();pD->nRMS.Write(pD->Name);
87  }
88 
89 }
detector * getifo(size_t n)
param: detector index
Definition: network.hh:418
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
int n
Definition: cwb_net.C:10
TString("c")
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
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
DATA_CONDITIONING.
char ifo[NIFO_MAX][8]
Definition: cwb2G.hh:15
network ** net
NOISE_MDC_SIMULATION.
jfile
Definition: cwb_job_obj.C:25
int simulation
Definition: config.hh:181
#define IMPORT(TYPE, VAR)
Definition: cwb.hh:51
WSeries< double > nRMS
Definition: detector.hh:340
int gIFACTOR
int slagSize
Definition: config.hh:163
size_t lagSize
Definition: config.hh:150
char Name[16]
Definition: detector.hh:309
unsigned int jobfOptions
history object
Definition: cwb.hh:264
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
int nIFO
Definition: config.hh:102
detector ** pD