Logo coherent WaveBurst  
Library Reference Guide
Logo
Make_BRST_O1_HF.C
Go to the documentation of this file.
1 //
2 // Make BRST HF [512:5120] Hz Set for O1 (proposal)
3 // How to use it :
4 // root -b Make_BRST_O1_HF.C
5 //
6 // 1) TIME & FFT plots are generated for each waveform and saved under the ODIR/plots directory
7 // 2) A texi file html_index.texi is created under ODIR
8 // 3) texi file is converted into ODIR/html_index/index.html
9 //
10 // Author : Gabriele Vedovato
11 //
12 
13 #define ODIR "brst_o1_hf" // output plot directory
14 
16 
18 
19  gROOT->SetBatch(true);
20 
21  MDC = new CWB::mdc();
22 
23  vector<mdcpar> par;
24 
25  // -------------------------------------------
26  // SGQ3
27  // -------------------------------------------
28 
29  par.resize(2);
30  double F_Q3[5] = {849,1615,2000,2477,3067};
31  for(int n=0;n<5;n++) {
32  par[0].name="frequency"; par[0].value=F_Q3[n];
33  par[1].name="Q"; par[1].value=3.;
34  MDC->AddWaveform(MDC_SGE, par);
35  }
36 
37  // -------------------------------------------
38  // SGQ9
39  // -------------------------------------------
40 
41  par.resize(2);
42  double F_Q9[15] = {849,1053,1304,1415,1615,1797,2000,2226,2477,2756,3067,3413,3799,4225,5000};
43  double Q_Q9[15] = {8.9,9,9,9,9,9,9,9,9,9,9,9,9,9,9};
44  for(int n=0;n<15;n++) {
45  par[0].name="frequency"; par[0].value=F_Q9[n];
46  par[1].name="Q"; par[1].value=Q_Q9[n];
47  if((F_Q9[n]==1053)||(F_Q9[n]==2000)||(F_Q9[n]==3067)||(F_Q9[n]==5000)) {
48  MDC->AddWaveform(MDC_SGL, par); // linear polarized for back compatibility
49  } else {
50  MDC->AddWaveform(MDC_SGE, par);
51  }
52  }
53 
54  // -------------------------------------------
55  // SGQ100
56  // -------------------------------------------
57 
58  par.resize(2);
59  double F_Q100[6] = {849,1615,2000,2477,3067,5000};
60  for(int n=0;n<6;n++) {
61  par[0].name="frequency"; par[0].value=F_Q100[n];
62  par[1].name="Q"; par[1].value=100.;
63  MDC->AddWaveform(MDC_SGE, par);
64  }
65 
66  // -------------------------------------------
67  // WNB
68  // -------------------------------------------
69 
70  par.resize(6);
71  double F_WNB[7] = {1000,2000,3500,1000,1000,2000,3500};
72  double B_WNB[7] = {10,100,100,1000,1000,1000,1000};
73  double D_WNB[7] = {0.1,0.1,0.1,0.1,0.01,0.01,0.01};
74  for(int n=0;n<7;n++) {
75  par[0].name="frequency"; par[0].value=F_WNB[n];
76  par[1].name="bandwidth"; par[1].value=B_WNB[n];
77  par[2].name="duration"; par[2].value=D_WNB[n];
78  for(int m=0;m<30;m++) {
79  par[3].name="pseed"; par[3].value=100000+n*100+m;
80  par[4].name="xseed"; par[4].value=100001+n*100+m;
81  par[5].name="mode"; par[5].value=0; // asymmetric
82  MDC->AddWaveform(MDC_WNB, par);
83  }
84  }
85 
86  // -------------------------------------------
87  // RDET200
88  // -------------------------------------------
89 
90  par.resize(2);
91  double F_T200[3] = {1590,2090,2590};
92  for(int n=0;n<3;n++) {
93  par[0].name="frequency"; par[0].value=F_T200[n];
94  par[1].name="tau"; par[1].value=0.2;
95  MDC->AddWaveform(MDC_RDE, par);
96  }
97 
98  // -------------------------------------------
99  // RDEQ9
100  // -------------------------------------------
101 
102  char wf_name[128];
103  par.resize(2);
104  double F2_Q9[3] = {2000,3067,5000};
105  for(int n=0;n<3;n++) {
106  par[0].name="frequency"; par[0].value=F2_Q9[n];
107  par[1].name="tau"; par[1].value=9./(TMath::TwoPi()*F2_Q9[n]);
108  sprintf(wf_name,"RDE%.0fQ9",F2_Q9[n]);
109  MDC->AddWaveform(MDC_RDE, par, wf_name);
110  }
111 
112  MDC->Print();
113 
114  vector<waveform> wfList = MDC->GetWaveformList();
115 
116  // loop over the waveform list
117  for(int n=0;n<wfList.size();n++) {
118 
119  // Get the first waveform hp,hx components
120  waveform wf = MDC->GetWaveform(wfList[n].name,0);
121 
122  if(wf.status==false) {
123  cout << "Error : Waveform " << wf.name << " not exist in the MDC pool !!!" << endl << endl;
124  gSystem->Exit(1);
125  }
126 
127  cout << n << " " << wf.name << " size : " << wf.hp.size() << " rate : " << wf.hp.rate()
128  << " start : " << (int)wf.hp.start() << endl;
129 
130  wf.hp.start(0); // set start to 0 (needed by draw Method)
131  wf.hx.start(0);
132 
133  watplot* plot = NULL;
134 
135  gSystem->mkdir(TString::Format("%s",ODIR));
136  gSystem->mkdir(TString::Format("%s/plots",ODIR));
137 
138  // draw hp,hx in time domain
139  plot=MDC->Draw(wf.hp,MDC_TIME,"ALP ZOOM");
140  MDC->Draw(wf.hx,MDC_TIME,"same",kRed);
141  if(plot) plot->graph[0]->SetTitle(TString::Format("%s : h+(black), hx(red))",wf.name.Data()));
142  if(plot) plot->canvas->SaveAs(TString::Format("%s/plots/%s_TIME.png",ODIR,wf.name.Data()));
143 
144  // draw hp,hx in frequency domain
145  plot = MDC->Draw(wf.hp,MDC_FFT,"ALP NOLOGX"); // draw hp in frequency domain
146  MDC->Draw(wf.hx,MDC_FFT,"same NOLOGX",kRed);
147  plot->graph[0]->GetHistogram()->GetXaxis()->SetRangeUser(512,5120);
148  if(plot) plot->graph[0]->SetTitle(TString::Format("%s : h+(black), hx(red))",wf.name.Data()));
149  if(plot) plot->canvas->SaveAs(TString::Format("%s/plots/%s_FFT.png",ODIR,wf.name.Data()));
150  }
151 
152  TString texiName=TString::Format("%s/html_index.texi",ODIR);
153  bool overwrite=CWB::Toolbox::checkFile(texiName,true);
154  if(!overwrite) gSystem->Exit(0);
155  ofstream out;
156  out.open(texiName,ios::out);
157  out << "@c include texi macros" << endl;
158  out << "@include macros.texi" << endl;
159  out << "@include mathjax.texi" << endl << endl;
160  for(int i=0;i<wfList.size();i++) {
161  out << "@center @txtfont{"<<wfList[i].name<<", red, h1}" << endl;
162  out << "@multitable @columnfractions .5 .5" << endl;
163  out << "@item @center @displayimage{../plots,"<<TString::Format("%s_TIME",wfList[i].name.Data())<<",480}"<<endl;
164  out << "@tab @center @displayimage{../plots,"<<TString::Format("%s_FFT",wfList[i].name.Data())<<",480}"<<endl;
165  out << "@end multitable" << endl;
166  }
167  out.close();
168 
169  // convert texi into html
170  TString cwb_scripts = TString(gSystem->Getenv("CWB_SCRIPTS"));
171  //TString exec_cmd = TString::Format("%s/cwb_mkhtml.csh %s wheader;rm %s",
172  // cwb_scripts.Data(),texiName.Data(),texiName.Data());
173  TString exec_cmd = TString::Format("%s/cwb_mkhtml.csh %s wheader",
174  cwb_scripts.Data(),texiName.Data());
175  int ret=gSystem->Exec(exec_cmd);
176  if(ret) {
177  cout << "Make_BRST_O1_HF.C : Error while executing cwb_mkhtml html_index.texi !!!" << endl;
178  gSystem->Exit(1);
179  }
180  cout << endl << "New html file created : " << ODIR << "/html_index/index.html" << endl << endl;
181 
182  gSystem->Exit(0);
183 }
TString cwb_scripts
Definition: mdc.hh:202
watplot * Draw(TString name, int id=0, TString polarization="hp", MDC_DRAW type=MDC_TIME, TString options="ALP", Color_t color=kBlack)
Definition: mdc.cc:2317
Definition: mdc.hh:219
bool status
Definition: mdc.hh:221
virtual void rate(double r)
Definition: wavearray.hh:141
double F_Q3[4]
par [0] name
int n
Definition: cwb_net.C:28
Definition: mdc.hh:203
TString("c")
double B_WNB[5]
ofstream out
Definition: cwb_merge.C:214
TString mdc[4]
std::vector< TGraph * > graph
Definition: watplot.hh:194
wavearray< double > hp
Definition: mdc.hh:226
waveform wf
void Make_BRST_O1_HF()
vector< waveform > GetWaveformList()
Definition: mdc.hh:385
int m
Definition: cwb_net.C:28
virtual void start(double s)
Definition: wavearray.hh:137
i drho i
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:4670
mdcid AddWaveform(MDC_TYPE mdc_type, vector< mdcpar > par, TString uname="")
Definition: mdc.cc:472
void Print(int level=0)
Definition: mdc.cc:2736
Definition: mdc.hh:156
virtual size_t size() const
Definition: wavearray.hh:145
TCanvas * canvas
Definition: watplot.hh:192
#define ODIR
TString name
Definition: mdc.hh:222
x plot
Definition: mdc.hh:248
double F_WNB[5]
i() int(T_cor *100))
double F_Q100[4]
double D_WNB[5]
Definition: mdc.hh:150
Definition: mdc.hh:152
vector< mdcpar > par
double F_Q9[4]
wavearray< double > hx
Definition: mdc.hh:227
waveform GetWaveform(int ID, int id=0)
Definition: mdc.cc:2541
CWB::mdc * MDC
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
char wf_name[256]
bool overwrite
Definition: cwb_dump_inj.C:100
Definition: mdc.hh:157
TString name
Definition: mdc.hh:208