Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawPSD.C
Go to the documentation of this file.
1 {
2  #define ADV_LIGO_PSD "$HOME_WAT/tools/cwb/plugins/strains/advLIGO_NSNS_Opt_8khz_one_side.txt"
3  #define BANDWIDTH 8192. // Hz
4  #define DELTA_FREQ 0.125 // Hz
5 
6  //
7  // generate Read PSD from file & display
8  // Author : Gabriele Vedovato
9 
10  #include <vector>
11 
12  TString psdName = gSystem->ExpandPathName(ADV_LIGO_PSD);
13 
15 
16  double fWidth = BANDWIDTH; // bandwidth
17  double dFreq = DELTA_FREQ; // frequency resolution
18  wavearray<double> psd = TB.GetDetectorPSD(psdName,fWidth,dFreq);
19  double df=psd.rate()/psd.size();
20  cout << "PSD : " << " rate : " << psd.rate() << " size : " << psd.size() << " df " << df << endl;
21 
22  // define frequency array
24  for(int i=0;i<f.size();i++) f[i]=i*df;
25 
26 
27  TObjArray* token = TString(psdName).Tokenize(TString('/'));
28  TObjString* sname = (TObjString*)token->At(token->GetEntries()-1);
29  TString Title = sname->GetString();
30 
31  // display PSD
32  TCanvas canvas;
33  canvas.SetLogx();
34  canvas.SetLogy();
35  canvas.SetGridx();
36  canvas.SetGridy();
37  TGraph gr(psd.size(),f.data,psd.data);
38  gr.SetTitle(Title);
39  gr.SetMarkerColor(kRed);
40  gr.SetLineColor(kRed);
41  gr.GetHistogram()->GetXaxis()->SetRangeUser(8,8192);
42  gr.GetHistogram()->GetYaxis()->SetRangeUser(1e-24,1e-21);
43  gr.GetHistogram()->GetXaxis()->SetTitle("Hz");
44  gr.GetHistogram()->GetYaxis()->SetTitle("PSD");
45  gr.GetHistogram()->GetYaxis()->SetTitleOffset(1.2);
46 
47  gr.Draw("ALP");
48 }
49 
double df
Definition: DrawPSD.C:19
virtual size_t size() const
Definition: wavearray.hh:127
virtual void rate(double r)
Definition: wavearray.hh:123
TString("c")
return wmap canvas
#define BANDWIDTH
i drho i
double fWidth
Definition: DrawPSD.C:16
cout<< "PSD : "<< " rate : "<< psd.rate()<< " size : "<< psd.size()<< " df "<< df<< endl;wavearray< double > f
Definition: DrawPSD.C:23
TGraph * gr
CWB::Toolbox TB
Definition: DrawPSD.C:1
#define ADV_LIGO_PSD
TObjArray * token
double e
static wavearray< double > GetDetectorPSD(TString fName, double fWidth=8192., double dFreq=1.)
Definition: Toolbox.cc:4986
wavearray< double > psd
Definition: DrawPSD.C:18
DataType_t * data
Definition: wavearray.hh:301
double dFreq
Definition: DrawPSD.C:17
#define DELTA_FREQ