Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gskymap.hh
Go to the documentation of this file.
1 /**********************************************************
2  * Package: graphic wat Class Library
3  * File name: gskymap.hh
4  * Author: Gabriele Vedovato (vedovato@lnl.infn.it)
5  **********************************************************/
6 
7 
8 #ifndef GSKYMAP_HH
9 #define GSKYMAP_HH
10 
11 #include "TCanvas.h"
12 #include "TH2F.h"
13 #include "TPolyLine.h"
14 #include "TStyle.h"
15 #include "TColor.h"
16 #include "TObjString.h"
17 #include "TObjArray.h"
18 #include "TString.h"
19 #include "TMarker.h"
20 #include "TROOT.h"
21 #include "TMath.h"
22 #include "TPaveText.h"
23 #include "TVector3.h"
24 #include "TRotation.h"
25 #include "TPolyLine.h"
26 #include "Math/Rotation3D.h"
27 #include "Math/Vector3Dfwd.h"
28 #include "TSystem.h"
29 #include "TLatex.h"
30 #include "TRandom.h"
31 #include "TGaxis.h"
32 
33 #include <iostream>
34 #include <fstream>
35 #include <stdlib.h>
36 #include "skymap.hh"
37 #include "network.hh"
38 #include "detector.hh"
39 #include "wavecomplex.hh"
40 #include "watversion.hh"
41 #include "skycoord.hh"
42 
43 #include "gwat.hh"
44 
45 #define WorlMapCoastLine "WorlMapCoastLine.txt"
46 #define WM_ENTRIES 426345
47 #define DUMMY_PALETTE_ID 1000000000
48 
49 #define GSKYMAP_INIT canvas(NULL), h2(NULL), changed(false), isGridx(true), colorGridx(kBlack), \
50  isGridy(true), colorGridy(kBlack), isLogz(false), title(""), \
51  drawWorldMap(false), goff(0), wm_size(0), paletteId(1), gpsGalacticDisk(-1.), \
52  colorGalacticDisk(kBlack), zAxisTitle("")
53 
54 using namespace ROOT::Math;
55 
56 class gskymap : public skymap
57 {
58 
59 public:
60 
61  // Constructors
63  gskymap(double sms,double t1=0.,double t2=180.,double p1=0.,double p2=360.) :
64  skymap(sms,t1,t2,p1,p2),GSKYMAP_INIT {SetOptions();}
65  gskymap(char* ifile) : skymap(ifile),GSKYMAP_INIT {SetOptions();changed=true;}
66  gskymap(int healpix_order) : skymap(healpix_order),GSKYMAP_INIT {SetOptions();}
67  gskymap(TString ifile, TString name="gskymap") :
68  skymap(ifile,name),GSKYMAP_INIT {SetOptions();changed=true;}
69  gskymap(const skymap& sm) : skymap(sm),GSKYMAP_INIT {SetOptions();changed=true;}
70  virtual ~gskymap();
71 
72  // operators
73  gskymap& operator = (const gskymap& sm) {
75  isGridx=sm.isGridx;
76  colorGridx=sm.colorGridx;
77  isGridy=sm.isGridy;
78  colorGridy=sm.colorGridy;
79  isLogz=sm.isLogz;
80  title=sm.title;
81  drawWorldMap=sm.drawWorldMap;
82  resolution=sm.resolution;
83  goff=sm.goff;
84  wm_size=0;
85  worldMapPath=sm.worldMapPath;
86  paletteId=sm.paletteId;
87  coordinate=sm.coordinate;
88  projection=sm.projection;
89  gpsGalacticDisk=sm.gpsGalacticDisk;
90  colorGalacticDisk=sm.colorGalacticDisk;
91  zAxisTitle=sm.zAxisTitle;
92  name="";
93  wtopx=sm.wtopx;
94  wtopy=sm.wtopy;
95  ww=sm.ww;
96  wh=sm.wh;
97  canvas = NULL;
98  h2 = new TH2D(*sm.h2);
99  return *this;
100  }
101  gskymap& operator = (const skymap& sm) {skymap::operator=(sm);changed=true;return *this;}
102  gskymap& operator += (const skymap& sm) {skymap::operator+=(sm);changed=true;return *this;}
103  gskymap& operator -= (const skymap& sm) {skymap::operator-=(sm);changed=true;return *this;}
104  gskymap& operator *= (const skymap& sm) {skymap::operator*=(sm);changed=true;return *this;}
105  gskymap& operator /= (const skymap& sm) {skymap::operator/=(sm);changed=true;return *this;}
106  gskymap& operator = (const double a) {skymap::operator =(a);changed=true;return *this;}
107  gskymap& operator *= (const double a) {skymap::operator*=(a);changed=true;return *this;}
108  gskymap& operator += (const double a) {skymap::operator+=(a);changed=true;return *this;}
109 
110  void set(size_t i, double a) {skymap::set(i,a);changed=true;}
111 
112  void SetOptions(TString projection = "hammer", TString coordinate = "Geographic",
113  double resolution = 1, bool goff = false);
114  void SetOptions(const char* name, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh) {
115  char sname[64];sprintf(sname,"%s-%d",name,int(gRandom->Rndm(13)*1.e9));
116  this->name=sname;this->wtopx=wtopx;this->wtopy=wtopy;this->ww=ww;this->wh=wh;
117  if(canvas!=NULL) Draw();}
118 
119  TCanvas* GetCanvas() {return canvas;}
120  TH2D* GetHistogram() {return h2;}
121 
122  void SetGridx(bool isGridx=true) {this->isGridx=isGridx;}
123  bool GetGridx() {return isGridx;}
124  void SetGridxColor(Color_t colorGridx = kBlack) {this->colorGridx=colorGridx;}
125  bool GetGridxColor() {return colorGridx;}
126  void SetGridy(bool isGridy=true) {this->isGridy=isGridy;}
127  bool GetGridy() {return isGridy;}
128  void SetGridyColor(Color_t colorGridy = kBlack) {this->colorGridy=colorGridy;}
129  bool GetGridyColor() {return colorGridy;}
130  void SetLogz(bool isLogz=true) {this->isLogz=isLogz;}
131  bool GetLogz() {return isLogz;}
132  void SetZaxisTitle(TString zAxisTitle) {h2->GetZaxis()->SetTitle(zAxisTitle);this->zAxisTitle=zAxisTitle;}
133  TString GetZaxisTitle() {return zAxisTitle;}
134  void SetTitle(TString title) {h2->SetTitle(title);this->title=title;}
135  TString GetTitle() {return title;}
136  void SetWorldMap(bool drawWorldMap=true) {this->drawWorldMap=drawWorldMap;}
137  bool GetWorldMap() {return drawWorldMap;}
138  void SetWorldMapPath(TString worldMapPath) {this->worldMapPath=worldMapPath;}
139  TString GetWorldMapPath() {return worldMapPath;}
140  double GetResolution() {return resolution;}
141  void SetPalette(int paletteId=1) {this->paletteId=paletteId;}
142  int GetPaletteId() {return paletteId;}
143  TString GetProjection() {return projection;}
144  TString GetCoordinate() {return coordinate;}
145  void SetGalacticDisk(double gpsGalacticDisk=0.0) {this->gpsGalacticDisk=gpsGalacticDisk;}
146  double GetGalacticDisk() {return gpsGalacticDisk;}
147  void SetGalacticDiskColor(Color_t colorGalacticDisk = kBlack) {this->colorGalacticDisk=colorGalacticDisk;}
148  bool GetGalacticDiskColor() {return colorGalacticDisk;}
149 
150  void FillData(int size, double* phi, double* theta, double* binc);
151  void FillData(char* fname);
152 
153  void Plot(); // *MENU*
154  void Draw(int dpaletteId = 0, Option_t* option = "colfz");
155  void Print(TString pname); // *MENU*
156 
157  void ProjectHammer(Double_t l,Double_t b,Double_t &Al,Double_t &Ab);
158  void ProjectSinusoidal(Double_t l, Double_t b, Double_t &Al, Double_t &Ab);
159  void ProjectParabolic(Double_t l, Double_t b, Double_t &Al, Double_t &Ab);
160 
161  void DrawMarker(double phi, double theta, int marker, Size_t msize = 1, Color_t tcolor = 1);
162  void DrawText(double phi, double theta, TString text, double tsize = 0.04, Color_t tcolor = 1);
163 
164  void DrawMarker(double ra, double dec, double gps, int marker, Size_t msize = 1, Color_t tcolor = 1);
165  void DrawText(double ra, double dec, double gps, TString text, double tsize = 0.04, Color_t tcolor = 1);
166 
167  virtual void Browse(TBrowser *b) {Plot();}
168 
169  void ClearAxisLabel();
170  void ClearGalacticDisk();
171  void ClearWorldMap();
172  void ClearGridx();
173  void ClearGridy();
174 
175  //: dump to ascii file
176  void DumpSkyMap(char* fname);
177 
178  //: dump skymap into root file
179  void DumpObject(const char* file, const char* name="gskymap");
180  //: load gnetwork object from root file
181  void LoadObject(const char* file, const char* name="gskymap");
182 
183  friend class gnetwork;
184 
185 private:
186 
187  void SetPlotStyle(int paletteId = 1);
188  int ReadWorlMapCoastLine(double*& wm_lon, double*& wm_lat);
189  void HeapSort( double* data, double lenght);
190  void ReverseXAxis(TH2D *h2);
191  void FillData();
192  void CreateCanvas();
193 
194  TCanvas* canvas; //!`
195  TH2D* h2; //!
196 
197  bool changed;
198 
199  bool isGridx;
200  Color_t colorGridx;
201  bool isGridy;
202  Color_t colorGridy;
203  bool isLogz;
206  double resolution;
207  bool goff;
208  int wm_size;
216 
217  // canvas parameters
219  Int_t wtopx, wtopy, ww, wh;
220 
221  std::vector<TPolyLine*> gridxL; //!
222  std::vector<TPolyLine*> gridyL; //!
223  std::vector<TPolyLine*> gdL; //!
224  std::vector<TMarker*> wmM; //!
225  std::vector<TText*> axisT; //!
226 
227  double *wm_lon; //!
228  double *wm_lat; //!
229 
230  ClassDef(gskymap,1)
231 };
232 
233 #endif
TH2D * GetHistogram()
Definition: gskymap.hh:120
TText * text
Definition: cbc_plots.C:717
double GetGalacticDisk()
Definition: gskymap.hh:146
#define GSKYMAP_INIT
Definition: gskymap.hh:49
Color_t colorGridy
Definition: gskymap.hh:202
double * wm_lon
Definition: gskymap.hh:227
TGraphErrors * Plot(int mtype, TString ptitle, TString xtitle, TString ytitle, bool save=true)
Definition: cwb_mkfad.C:726
virtual void Browse(TBrowser *b)
Definition: gskymap.hh:167
TString GetWorldMapPath()
Definition: gskymap.hh:139
std::vector< TPolyLine * > gdL
Definition: gskymap.hh:223
std::vector< TPolyLine * > gridxL
Definition: gskymap.hh:221
wavearray< double > a(hp.size())
Color_t colorGridx
Definition: gskymap.hh:200
double gpsGalacticDisk
Definition: gskymap.hh:213
skymap & operator-=(const skymap &)
Definition: skymap.cc:299
gx Draw(GWAT_TIME)
par[0] name
bool GetGalacticDiskColor()
Definition: gskymap.hh:148
TString("c")
void set(size_t i, double a)
Definition: gskymap.hh:110
void SetGridx(bool isGridx=true)
Definition: gskymap.hh:122
Int_t ww
Definition: gskymap.hh:219
TString GetProjection()
Definition: gskymap.hh:143
bool GetGridyColor()
Definition: gskymap.hh:129
float theta
double GetResolution()
Definition: gskymap.hh:140
TString coordinate
Definition: gskymap.hh:211
skymap & operator*=(const skymap &)
Definition: skymap.cc:328
return wmap canvas
int GetPaletteId()
Definition: gskymap.hh:142
bool GetWorldMap()
Definition: gskymap.hh:137
bool GetGridx()
Definition: gskymap.hh:123
Long_t size
void SetOptions(const char *name, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
Definition: gskymap.hh:114
TCanvas * canvas
Definition: gskymap.hh:194
watplot p1(const_cast< char * >("TFMap1"))
bool isGridx
Definition: gskymap.hh:199
i drho i
int wm_size
Definition: gskymap.hh:208
void SetGridxColor(Color_t colorGridx=kBlack)
Definition: gskymap.hh:124
TH2D * h2
`
Definition: gskymap.hh:195
bool GetGridxColor()
Definition: gskymap.hh:125
TString zAxisTitle
Definition: gskymap.hh:215
float phi
double ra
Definition: ConvertGWGC.C:46
TString title
Definition: gskymap.hh:204
void SetGridy(bool isGridy=true)
Definition: gskymap.hh:126
MDC Print()
TString GetCoordinate()
Definition: gskymap.hh:144
bool isGridy
Definition: gskymap.hh:201
skymap & operator+=(const skymap &)
Definition: skymap.cc:270
gSM SetOptions(cwb_antpat_projection, COORDINATES, RESOLUTION/2)
void SetGalacticDiskColor(Color_t colorGalacticDisk=kBlack)
Definition: gskymap.hh:147
Int_t wtopy
Definition: gskymap.hh:219
std::vector< TText * > axisT
Definition: gskymap.hh:225
TCanvas * GetCanvas()
Definition: gskymap.hh:119
void SetWorldMapPath(TString worldMapPath)
Definition: gskymap.hh:138
char fname[1024]
void SetGalacticDisk(double gpsGalacticDisk=0.0)
Definition: gskymap.hh:145
double * wm_lat
Definition: gskymap.hh:228
void SetPalette(int paletteId=1)
Definition: gskymap.hh:141
TString GetZaxisTitle()
Definition: gskymap.hh:133
bool GetLogz()
Definition: gskymap.hh:131
Definition: skymap.hh:45
void SetGridyColor(Color_t colorGridy=kBlack)
Definition: gskymap.hh:128
TFile * ifile
bool isLogz
Definition: gskymap.hh:203
WSeries< double > ww
Definition: Regression_H1.C:33
void SetTitle(TString title)
Definition: gskymap.hh:134
int paletteId
Definition: gskymap.hh:210
double resolution
Definition: gskymap.hh:206
bool GetGridy()
Definition: gskymap.hh:127
char title[256]
Definition: SSeriesExample.C:1
double gps
TString worldMapPath
Definition: gskymap.hh:209
Int_t wtopx
Definition: gskymap.hh:219
void SetWorldMap(bool drawWorldMap=true)
Definition: gskymap.hh:136
watplot p2(const_cast< char * >("TFMap2"))
bool changed
Definition: gskymap.hh:197
string file
Definition: cwb_online.py:385
skymap & operator=(const skymap &)
Definition: skymap.cc:238
TString GetTitle()
Definition: gskymap.hh:135
void SetLogz(bool isLogz=true)
Definition: gskymap.hh:130
void HeapSort(double *data, double length)
Definition: skycoord.hh:240
int l
Definition: cbc_plots.C:434
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void set(size_t i, double a)
param: sky index param: value to set
Definition: skymap.hh:104
TH1 * t1
TString name
Definition: gskymap.hh:218
bool goff
Definition: gskymap.hh:207
Color_t colorGalacticDisk
Definition: gskymap.hh:214
std::vector< TPolyLine * > gridyL
Definition: gskymap.hh:222
std::vector< TMarker * > wmM
Definition: gskymap.hh:224
TString projection
Definition: gskymap.hh:212
skymap & operator/=(const skymap &)
Definition: skymap.cc:355
iNET LoadObject(const_cast< char * >(ROOT_FILE))
void SetZaxisTitle(TString zAxisTitle)
Definition: gskymap.hh:132
bool drawWorldMap
Definition: gskymap.hh:205
Int_t wh
Definition: gskymap.hh:219