Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawOnlineProbability.C
Go to the documentation of this file.
1 //
2 // Read event probability skymap from the online cWB probability and draw
3 // Author : Gabriele Vedovato
4 //
5 // root -l 'DrawOnlineProbability.C("error_region_1058523803.4934.txt",true)'
6 //
7 // online probability file format
8 //
9 // sid skyID theta DEC step phi R.A step probability cumulative
10 //
11 
12 #define PROJECTION ""
13 //#define PROJECTION "hammer"
14 #define RESOLUTION 2
15 #define COORDINATES "Geographic"
16 
17 #define HEALPix 7
18 
20 
21  gskymap* gSM = new gskymap(int(HEALPix));
23 
24  int sid, skyid;
25  double theta, DEC, step_DEC, phi, RA, step_RA, probability, cumulative;
26 
27  // Read probability file
28  ifstream in;
29  in.open(fName.Data(),ios::in);
30  if (!in.good()) {cout << "Error Opening File : " << fName.Data() << endl;exit(1);}
31 
32  char str[1024];
33  int fpos=0;
34 
35  while(true) {
36  fpos=in.tellg();
37  in.getline(str,1024);
38  if(str[0] == '#') continue;
39  in.seekg(fpos, ios::beg);
40  fpos=in.tellg();
41  in >> sid >> skyid >> theta >> DEC >> step_DEC >> phi >> RA >> step_RA >> probability >> cumulative;
42  if(!in.good()) break;
43  gSM->set(skyid, probability); // fill skymap
44  }
45  in.close();
46 
47  TString title = TString("Probability SkyMap");
48  gSM->SetTitle(title);
49  gSM->Draw(0);
50 
51  if(save) { // save skymap
53  ofName.ReplaceAll(".txt",".png");
54  cout << "Write : " << ofName.Data() << endl;
55  gSM->Print(ofName.Data());
56  exit(0);
57  }
58 }
gskymap * gSM
TString ofName
TString("c")
void set(size_t i, double a)
Definition: gskymap.hh:110
float theta
void Draw(int dpaletteId=0, Option_t *option="colfz")
Definition: gskymap.cc:442
void DrawOnlineProbability(TString fName, bool save=false)
float phi
char str[1024]
#define PROJECTION
#define COORDINATES
#define RESOLUTION
void SetTitle(TString title)
Definition: gskymap.hh:134
char title[256]
Definition: SSeriesExample.C:1
ifstream in
#define HEALPix
bool save
char fName[256]
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
exit(0)