Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawFileStrainObjects.C
Go to the documentation of this file.
1 //
2 // Read/Display Objects from strain job root file
3 // Author : Gabriele Vedovato
4 
5 {
6 
7  #define IFILE "strain_931158216_184_ADV_SIM_NSNS_L1H1V1_2G_run3_job1.root";
8 
9  #define DRAW_IFO
10  #define DRAW_FFT
11  //#define SAVE_PLOT
12 
13  //#define DATA_TYPE "mdc/L1" // read mdc L1 data
14  #define DATA_TYPE "strain/L1" // read strain L1 data
15 
16  //#define PRINT_CFG
17  //#define PRINT_HISTORY
18  //#define PRINT_NETWORK
19 
20  TFile* ifile = new TFile(IFILE);
21  if(ifile==NULL) {cout << "Error : file " << IFILE << " not found" << endl;exit(1);}
22  ifile->ls();
23 
24  // read config object
25  CWB::config* cfg = (CWB::config*)ifile->Get("config");
26 #ifdef PRINT_CFG
27  if(cfg) cfg->Print();
28 #endif
29 
30  // read history object
31  CWB::History* history = (CWB::History*)ifile->Get("history");
32 #ifdef PRINT_HISTORY
33  if(history) history->Print();
34 #endif
35 
36  // read network object
37  network* net = (network*)ifile->Get("network");
38 #ifdef PRINT_NETWORK
39  if(net) net->print();
40 #endif
41 
42 #ifdef DRAW_IFO
44  if(x==NULL) {cout << "Error : wavearray not found" << endl;exit(1);}
45  cout.precision(14);
46  cout << "start : " << x->start() << " (sec)" << endl;
47  cout << "len : " << x->size()/x->rate() << " (sec)" << endl;
48  x->start(0);
49 
51 
52 #ifdef DRAW_FFT
53  gx.Draw(GWAT_FFT);
54 #else
55  gx.Draw(GWAT_TIME);
56 #endif
57  watplot* plot = gx.GetWATPLOT();
58 
59 #ifdef SAVE_PLOT
60  plot->gtitle(IFILE,"time(sec)","amplitude");
61 
62  // save plot to file
63  TString gfile="gwavearray_plot.png";
64  (*plot) >> gfile;
65 
66  exit(0);
67 #endif
68 #endif
69 
70 }
virtual size_t size() const
Definition: wavearray.hh:127
void gtitle(TString title="", TString xtitle="", TString ytitle="")
Definition: watplot.cc:1237
void Print(Option_t *option="")
Definition: config.cc:719
virtual void rate(double r)
Definition: wavearray.hh:123
wavearray< double > * x
TString("c")
CWB::History * history
virtual void start(double s)
Definition: wavearray.hh:119
x plot
void Print()
Definition: History.cc:297
gwavearray< double > * gx
network * net
TFile * ifile
void print()
Definition: network.cc:8150
Definition: gwat.hh:12
CWB::config * cfg
#define DATA_TYPE
TString gfile
#define IFILE
exit(0)