Logo coherent WaveBurst  
Library Reference Guide
Logo
Draw_LAL_vs_CWB_from_XMLFILE.C
Go to the documentation of this file.
1 //
2 // Show comparison between SGE/WNB CWB vs LAL waveforms
3 // The waveform parameters are loaded from LAL XML file
4 //
5 // MDC_SGE_LAL use CG instead of SG !!!
6 // MDC_WNB_LAL has a gaussian envelope also in frequency
7 //
8 // Author : Gabriele Vedovato
9 //
10 
11 /*
12 // SGE
13 #define XMLFILE_NAME "SG_LAL.xml"
14 // defines the gps range used to fill the MDC pool
15 #define GPS_START 968386896
16 #define GPS_STOP 968387096
17 */
18 
19 
20 // WNB
21 #define XMLFILE_NAME "WNB_LAL.xml"
22 // defines the gps range used to fill the MDC pool
23 #define GPS_START 966769371
24 #define GPS_STOP 966769571
25 
26 
27 //#define PLOT_TIME
28 #define PLOT_FFT
29 
30 // defines the ID used to extract the waveform from the MDC pool
31 // see ID from the MDC->Print() list
32 #define MDC_ID 1
33 
34 // defines the MDC engine used to generate the waveforms
35 // the parameters are read from XMLFILE_NAME
36 #define MDC_ENGINE 0 // 0/1 -> LAL/CWB
37 
38 //#define SAVE_PLOT
39 
41 
43 
44  MDC = new CWB::mdc();
45 
46  vector<mdcpar> par;
47 
48  // --------------------------------------------------------
49  // define sky distribution
50  // --------------------------------------------------------
51  par.resize(4);
52  par[0].name="start"; par[0].value=GPS_START;
53  par[1].name="stop"; par[1].value=GPS_STOP;
54  par[2].name="engine"; par[2].value=MDC_ENGINE;
55  par[3].name="auto"; par[3].value=1;
56 
57  TString xmlfile = XMLFILE_NAME;
58 
59  // fill the MDC waveform pool
60  MDC->SetSkyDistribution(MDC_XMLFILE,xmlfile,par,0);
61  // print the MDC waveform pool
62  MDC->Print();
63  // Get the MDC_ID waveform hp,hx components from the MDC pool
64  waveform wf = MDC->GetWaveform(MDC_ID,0);
65 
66  if(wf.status==false) {
67  cout << "Error : ID is not presents in the MDC pool !!!" << endl << endl;
68  gSystem->Exit(1);
69  }
70 
71  cout << "size : " << wf.hp.size() << " rate : " << wf.hp.rate()
72  << " start : " << (int)wf.hp.start() << endl;
73 
74  wf.hp.start(0); // set start to 0 (needed by draw Method)
75  wf.hx.start(0);
76 
77  watplot* plot = NULL;
78 
79 #ifdef PLOT_TIME
80  plot=MDC->Draw(wf.hp,MDC_TIME,"ALP ZOOM");
81  MDC->Draw(wf.hx,MDC_TIME,"same",kRed);
82 #endif
83 
84 #ifdef PLOT_FFT
85  plot = MDC->Draw(wf.hp,MDC_FFT,"ALP ZOOM NOLOGX"); // draw hp in frequency domain
86  MDC->Draw(wf.hx,MDC_FFT,"same NOLOGX",kRed);
87  plot->graph[0]->GetHistogram()->GetXaxis()->SetRangeUser(0,1100);
88 #endif
89 
90  if(plot) plot->graph[0]->SetTitle(wf.name);
91 
92 #ifdef SAVE_PLOT
93  if(plot) plot->canvas->SaveAs("Plot_LAL_vs_CWB_from_XMLFILE.png");
94 #endif
95 
96 }
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
void Draw_LAL_vs_CWB_from_XMLFILE()
#define MDC_ID
Definition: mdc.hh:203
TString("c")
TString mdc[4]
std::vector< TGraph * > graph
Definition: watplot.hh:194
wavearray< double > hp
Definition: mdc.hh:226
waveform wf
#define GPS_STOP
virtual void start(double s)
Definition: wavearray.hh:137
void Print(int level=0)
Definition: mdc.cc:2736
void SetSkyDistribution(MDC_DISTRIBUTION sky_distribution, vector< mdcpar > par, int seed=0, bool add=false)
Definition: mdc.cc:3444
virtual size_t size() const
Definition: wavearray.hh:145
TCanvas * canvas
Definition: watplot.hh:192
CWB::mdc * MDC
TString name
Definition: mdc.hh:222
x plot
Definition: mdc.hh:248
i() int(T_cor *100))
#define XMLFILE_NAME
vector< mdcpar > par
wavearray< double > hx
Definition: mdc.hh:227
#define GPS_START
waveform GetWaveform(int ID, int id=0)
Definition: mdc.cc:2541
#define MDC_ENGINE