Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawProbabilityFromFits.C
Go to the documentation of this file.
1 //
2 // This example show how to display skymapcc probability from fits file
3 // Author : Gabriele Vedovato
4 
5 
6 //#define COORDINATES "cWB"
7 //#define COORDINATES "Geographic"
8 #define COORDINATES "Celestial"
9 
10 #define PROJECTION ""
11 //#define PROJECTION "hammer"
12 //#define PROJECTION "sinusoidal"
13 
14 #define RESOLUTION 2
15 
16 #define DRAW_SKYMAP
17 //#define DUMP_SKYMAP
18 //#define SAVE_SKYMAP
19 
21 
22  gskymap* gSM = new gskymap(fitsName.Data());
24 
25  int order=gSM->getOrder(); // Get HEALPix order
26  int L=gSM->size(); // number of pixels in the sphere
27 
28  // get pixel area
29  double pi = TMath::Pi();
30  double S = 4*pi*pow(180/pi,2); // solid angle of a sphere
31  double dS = S/L; // solid angle of a pixel
32  cout << "solid angle of a pixel : " << dS << endl;
33 
34  // normalize probability
35  for(int l=0;l<L;l++) { // loop over the sky grid
36  double prob = gSM->get(l); // get probability per pixel
37  prob/=dS; // normalize probability to prob per deg^2
38  if(prob==0) gSM->set(l,1e-40); // set !=0 to force dark blue background
39  }
40 
41 #ifdef DRAW_SKYMAP
42  TGaxis::SetMaxDigits(3);
43  gSM->SetZaxisTitle("prob. per deg^{2}");
44 
45  gSM->Draw(1);
46 
47  TH2D* h2 = gSM->GetHistogram();
48  h2->GetZaxis()->SetTitleOffset(0.85);
49  h2->GetZaxis()->SetTitleSize(0.03);
50 #endif
51 
52 #ifdef DUMP_SKYMAP
53  double cumulative=0;
54  int L=gSM->size();
55  int* index = new int[L]; // sorted index
56  double* prob = new double[L]; // probability array
57  for(int l=0;l<L;l++) { // loop over the sky grid
58  prob[l] = gSM->get(l); // get skymap prob
59  }
60 
61  TMath::Sort(L,prob,index,true); // sort prob
62  cumulative=0;
63  for(int l=0;l<L;l++) { // loop over the sky grid
64  int m=index[l]; // sorted index
65  double dec = gSM->getTheta(m); // get dec
66  double ra = gSM->getPhi(m); // get ra
67  cumulative+=prob[m];
68  if(prob[index[l]]>0) {
69  cout << m << "\tdec : " << dec << "\tra : " << ra << "\tprob : "
70  << value[m] << "\tcumulative prob : " << cumulative << endl;
71  }
72  }
73 #endif
74 
75 #ifdef SAVE_SKYMAP
76  gSM->Print("skyprobcc.png");
77 #endif
78 
79 }
TH2D * GetHistogram()
Definition: gskymap.hh:120
gskymap * gSM
par[0] value
#define PROJECTION
TString("c")
void set(size_t i, double a)
Definition: gskymap.hh:110
double getTheta(size_t i)
Definition: skymap.hh:206
int m
Definition: cwb_net.C:10
void Draw(int dpaletteId=0, Option_t *option="colfz")
Definition: gskymap.cc:442
double pi
Definition: TestChirp.C:18
double ra
Definition: ConvertGWGC.C:46
double Pi
int getOrder()
Definition: skymap.hh:296
#define RESOLUTION
double e
double getPhi(size_t i)
Definition: skymap.hh:146
wavearray< int > index
Meyer< double > S(1024, 2)
int l
Definition: cbc_plots.C:434
void DrawProbabilityFromFits(TString fitsName)
double get(size_t i)
param: sky index
Definition: skymap.cc:681
size_t size()
Definition: skymap.hh:118
void Print(TString pname)
Definition: gskymap.cc:1104
void SetOptions(TString projection="hammer", TString coordinate="Geographic", double resolution=1, bool goff=false)
Definition: gskymap.cc:66
void SetZaxisTitle(TString zAxisTitle)
Definition: gskymap.hh:132
#define COORDINATES