Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawProbEventDump.C
Go to the documentation of this file.
1 //
2 // Read event probability skymap from output cWB text file and draw
3 // Author : Gabriele Vedovato
4 
5 {
6  #define PROJECTION ""
7  //#define PROJECTION "hammer"
8  #define RESOLUTION 2
9  #define COORDINATES "Geographic"
10 
11  #define EVENT_DUMP "eventDump.txt"
12 
13  //#define OFILE_NAME "eventDump.png"
14 
15 
16  gskymap* gSM = new gskymap(int(6));
18 
19  ifstream in;
20  in.open(EVENT_DUMP);
21  if(!in.good()) {cout << "Error Opening File : " << EVENT_DUMP << endl;gSystem->Exit(1);}
22 
23  char istring[1024];
24  bool found=false;
25  while(1) {
26  in.getline(istring,1024);
27  if (!in.good()) break;
28  TObjArray* token = TString(istring).Tokenize(TString(' '));
29  TObjString* stoken =(TObjString*)token->At(0);
30  TString jobLabel = stoken->GetString();
31  if(jobLabel.CompareTo("#skyID")==0) {found=true;continue;}
32 
33  if(found) {
34  //cout << istring << endl;
35  stoken =(TObjString*)token->At(2);
36  TString sdec = stoken->GetString();
37  double DEC = sdec.Atof();
38  stoken =(TObjString*)token->At(5);
39  TString sra = stoken->GetString();
40  double RA = sra.Atof();
41  //cout << DEC << " " << RA << endl;
42 
43  stoken =(TObjString*)token->At(1);
44  TString sth = stoken->GetString();
45  double theta = sth.Atof();
46  stoken =(TObjString*)token->At(4);
47  TString sph = stoken->GetString();
48  double phi = sph.Atof();
49  //cout << theta << " " << phi << endl;
50 
51  stoken =(TObjString*)token->At(7);
52  TString sprob = stoken->GetString();
53  double prob = sprob.Atof();
54 
55  int l = gSM->getSkyIndex(theta,phi);
56  gSM->set(l,prob);
57 
58  }
59  }
60 
61  in.close();
62 
63  TString title = TString("Probability SkyMap");
64 
65  gSM->SetTitle(title);
66  gSM->Draw(0);
67 
68 #ifdef OFILE_NAME
69  cout << "Write : " << OFILE_NAME << endl;
70  gSM->Print(OFILE_NAME);
71  exit(0);
72 #endif
73 
74 }
gskymap * gSM
bool found
#define COORDINATES
TString title
ifstream in
TString("c")
void set(size_t i, double a)
Definition: gskymap.hh:110
#define EVENT_DUMP
float theta
void Draw(int dpaletteId=0, Option_t *option="colfz")
Definition: gskymap.cc:442
size_t getSkyIndex(double th, double ph)
param: theta param: phi
Definition: skymap.cc:702
float phi
#define OFILE_NAME
Definition: CreateSkyMask.C:8
TObjArray * token
#define PROJECTION
#define RESOLUTION
void SetTitle(TString title)
Definition: gskymap.hh:134
int l
Definition: cbc_plots.C:434
char istring[1024]
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)