Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DrawEventsToAntennaPattern.C
Go to the documentation of this file.
1 //
2 // Draw Events & Antenna Pattern
3 // Author : Gabriele Vedovato
4 
5 
6 #define RESOLUTION 2
7 //#define RESOLUTION 4
8 
9 //#define COORDINATES "cWB"
10 #define COORDINATES "Geographic"
11 
12 #define PROJECTION ""
13 //#define PROJECTION "hammer"
14 //#define PROJECTION "sinusoidal"
15 
16 #define WRITE_PLOT
17 
18 
19 #define IFILE_NAME "merge/wave_ADV_SIM_BRST_LF_L1H1V1_2GM_run51.M1.root"
20 #define DRAW_EVENTS
21 
22 using namespace CWB;
23 
25 
26  int nIFO=3;
27  TString ifo[3]={"L1","H1","V1"};
28 
29  gnetwork* gNET = new gnetwork;
30 
31  detector* pD[3];
32  for(int i=0; i<nIFO; i++) pD[i] = new detector((char*)ifo[i].Data()); // built in detector
33  for(int i=0; i<nIFO; i++) gNET->add(pD[i]);
34 
35  gskymap* gSM = gNET->GetGskymap();
37 
38 
39  TH2D* h2 = (TH2D*)gSM->GetHistogram();
40  h2->GetXaxis()->SetTitleSize(0.05);
41  h2->GetXaxis()->SetLabelSize(0.05);
42  h2->GetYaxis()->SetTitleSize(0.05);
43  h2->GetYaxis()->SetLabelSize(0.05);
44  h2->GetYaxis()->SetLabelFont(42);
45  h2->GetYaxis()->SetLabelFont(42);
46  h2->GetXaxis()->SetTitleFont(42);
47  h2->GetYaxis()->SetTitleFont(42);
48 
49  h2->GetZaxis()->SetRangeUser(0,1.0);
50 
51  gNET->DrawAntennaPattern(0);
52 
53 #ifdef DRAW_EVENTS
54  TFile *ifile = TFile::Open(IFILE_NAME);
55  if(ifile==NULL) {cout<<"Error opening file : "<<IFILE_NAME<<endl;exit(1);}
56  TTree* itree = (TTree *) gROOT->FindObject("waveburst");
57  if(itree==NULL) {cout<<"Error opening tree : "<<"waveburst"<<endl;exit(1);}
58  itree->Draw("theta[1]:phi[1]","erA[0]>60","goff");
59  int isize=itree->GetSelectedRows();
60  cout << "isize : " << isize << endl;
61  double* itheta = itree->GetV1();
62  double* iphi = itree->GetV2();
63 
64  for (int i=0;i<isize;i++) {
65  if(COORDINATES=="cWB") {
66  gSM->DrawMarker(iphi[i], itheta[i], 20, 0.1, kBlack); // cWB
67  }
68  if(COORDINATES=="Geographic") {
69  double phi,theta;
70  CwbToGeographic(iphi[i],itheta[i],phi,theta);
71  gSM->DrawMarker(phi,theta, 20, 0.5, kBlack); // Geographic
72  }
73  }
74 #endif
75 
76  gSM->GetCanvas()->Update();
77 
78 #ifdef WRITE_PLOT
79 
80  TObjArray* token = TString(IFILE_NAME).Tokenize(TString('/'));
81  TObjString* sfile = (TObjString*)token->At(token->GetEntries()-1);
82  TString TITLE = sfile->GetString();
83  TString ofile = sfile->GetString();
84  ofile.ReplaceAll(".root","_EventsVsAntPat.png");
85 
86  cout << "Write : " << ofile << endl;
87  gSM->Print(ofile);
88  exit(0);
89 #endif
90 }
91 
TH2D * GetHistogram()
Definition: gskymap.hh:120
gskymap * gSM
gnetwork * gNET
size_t add(detector *)
param: detector structure return number of detectors in the network
Definition: network.cc:2528
Definition: ced.hh:24
void DrawAntennaPattern(int polarization=-1, int dpaletteId=0, bool btitle=true, int order=6)
Definition: gnetwork.cc:655
TString("c")
#define TITLE
Definition: TestSiteJ1.C:44
float theta
void DrawMarker(double phi, double theta, int marker, Size_t msize=1, Color_t tcolor=1)
Definition: gskymap.cc:724
#define COORDINATES
char ofile[512]
i drho i
int isize
char ifo[NIFO_MAX][8]
#define nIFO
float phi
#define PROJECTION
#define RESOLUTION
TCanvas * GetCanvas()
Definition: gskymap.hh:119
#define IFILE_NAME
TObjArray * token
void DrawEventsToAntennaPattern()
TFile * ifile
gskymap * GetGskymap()
Definition: gnetwork.hh:26
void CwbToGeographic(double ilongitude, double ilatitude, double &olongitude, double &olatitude)
Definition: skycoord.hh:396
TTree * itree
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
detector ** pD
exit(0)