Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawHEALPix.C
Go to the documentation of this file.
1 //
2 // Draw HEALPix skymap
3 // Author : Gabriele Vedovato
4 
5 #define RESOLUTION 2
6 
7 char COORDINATES[256]="cWB";
8 //char COORDINATES[256]="Geographic";
9 
10 char PROJECTION[256]="";
11 //char PROJECTION[256]="hammer";
12 //char PROJECTION[256]="sinusoidal";
13 
14 void DrawHEALPix(int order=3, bool save=false) {
15 
16  double grad2rad = TMath::Pi()/180.;
17  double rad2grad = 180./TMath::Pi();
18 
19  gskymap* gSM = new gskymap(order);
20  int L = gSM->size();
21  cout << "Sky Patches : " << L << endl;
22 
23 /*
24  for(int l=0;l<L;l++) {
25  double ph = gSM->getPhi(l);
26  double th = gSM->getTheta(l);
27  double sph = gSM->getPhiStep(l);
28  double sth = gSM->getThetaStep(l);
29  cout << "th : " << th << " ph : " << ph << " " << sth << " " << sph << endl;
30  }
31 */
32 /*
33  int ring=0; int startpix; int ringpix; double costheta; double sintheta; bool shifted=false;
34  for(int i=1;i<=20;i++) {
35  ring=i;
36  gSM->healpix->get_ring_info(ring, startpix, ringpix, costheta, sintheta, shifted);
37  cout << "ring : " << ring << " startpix : " << startpix << " ringpix : " << ringpix << endl;
38  }
39 */
40 
42 
43  TH2D* h2 = (TH2D*)gSM->GetHistogram();
44 
45  int resolution = RESOLUTION;
46 
47  int size=2*180*resolution*2*360*resolution;
48 
49  double* phi = new double[size];
50  double* theta = new double[size];
51  double* binc = new double[size];
52 
53  int k=0;
54  for(int i=0;i<2*180*resolution;i++) {
55  for(int j=0;j<2*360*resolution;j++) {
56  phi[k]=(double)j/(2*resolution);
57  theta[k]=(double)i/(2*resolution);
58  int l = gSM->getSkyIndex(theta[k],phi[k]);
59  binc[k]=l%4+1;
60  k++;
61  }
62  }
63 /*
64  if (coordinate.CompareTo("GEOGRAPHIC")==0) {
65  for (int i=0;i<k;i++) CwbToGeographic(phi[i],theta[i],phi[i],theta[i]);
66  }
67 */
68  gSM->FillData(k, phi, theta, binc);
69  char title[256];
70  sprintf(title,"HEALPix skymap order = %d : Sky Patches = %d",order,L);
71  gSM->SetTitle(title);
72 
73  delete [] phi;
74  delete [] theta;
75  delete [] binc;
76 
77  gSM->Draw();
78 
79  for(int l=0;l<L;l++) {
80  double ph = gSM->getPhi(l);
81  double th = gSM->getTheta(l);
82  gSM->DrawMarker(ph,th, 20, 0.5, kBlack);
83  }
84 
85  char ofileName[256];
86  sprintf(ofileName,"HEALPix_skymap_order_%d.png",order);
87  if(save) gSM->Print(ofileName);
88 }
89 
TH2D * GetHistogram()
Definition: gskymap.hh:120
gskymap * gSM
float theta
void DrawMarker(double phi, double theta, int marker, Size_t msize=1, Color_t tcolor=1)
Definition: gskymap.cc:724
TH2F * ph
double getTheta(size_t i)
Definition: skymap.hh:206
Long_t size
int j
Definition: cwb_net.C:10
i drho i
void Draw(int dpaletteId=0, Option_t *option="colfz")
Definition: gskymap.cc:442
char PROJECTION[256]
Definition: DrawHEALPix.C:10
void DrawHEALPix(int order=3, bool save=false)
Definition: DrawHEALPix.C:14
size_t getSkyIndex(double th, double ph)
param: theta param: phi
Definition: skymap.cc:702
void FillData(int size, double *phi, double *theta, double *binc)
Definition: gskymap.cc:376
float phi
double Pi
double rad2grad
double grad2rad
int k
TString ofileName
Definition: MergeTrees.C:37
void SetTitle(TString title)
Definition: gskymap.hh:134
double getPhi(size_t i)
Definition: skymap.hh:146
char title[256]
Definition: SSeriesExample.C:1
int l
Definition: cbc_plots.C:434
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
bool save
size_t size()
Definition: skymap.hh:118
void Print(TString pname)
Definition: gskymap.cc:1104
#define RESOLUTION
Definition: DrawHEALPix.C:5
void SetOptions(TString projection="hammer", TString coordinate="Geographic", double resolution=1, bool goff=false)
Definition: gskymap.cc:66
char COORDINATES[256]
Definition: DrawHEALPix.C:7