Logo coherent WaveBurst  
Library Reference Guide
Logo
DrawTimeSkySegmentation.C
Go to the documentation of this file.
1 //
2 // Draw Time Sky Segmentation
3 // Author : Gabriele Vedovato
4 
5 
6 #define ODIR_NAME "plots"
7 #define OFILE_EXT "png"
8 //#define OFILE_EXT "root"
9 //#define WRITE_PLOT
10 
11 #define SAMPLE_RATE 8192.
12 //#define SAMPLE_RATE 16384.
13 
14 #define RESOLUTION 2
15 //#define RESOLUTION 4
16 
17 //#define COORDINATES "cWB"
18 #define COORDINATES "Geographic"
19 
20 #define PROJECTION ""
21 //#define PROJECTION "hammer"
22 //#define PROJECTION "sinusoidal"
23 
24 //#define DISPLAY_WORLD_MAP
25 #define WORLD_MAP_DIR "$WB_GWAT/data/"
26 
27 // polarization=0 -> |Fx| DPF
28 // polarization=1 -> |F+| DPF
29 // polarization=2 -> |Fx|/|F+| DPF
30 // polarization=3 -> sqrt(|F+|^2+|Fx|^2) DPF
31 // polarization=4 -> |Fx|^2 DPF
32 // polarization=5 -> |F+|^2 DPF
33 // polarization=6 -> Fx only with 1 detector
34 // polarization=7 -> F+ only with 1 detector
35 // polarization=8 -> F1x/F2x only with 2 detectors
36 // polarization=9 -> F1+/F2+ only with 2 detectors
37 // polarization=10 -> sqrt(|F1+|^2+|F1x|^2)/sqrt(|F2+|^2+|F2x|^2) only with 2 detectors
38 // polarization=11 -> The same as (10) but averaged over psi only with 2 detectors
39 
40 using namespace CWB;
41 using namespace ROOT::Math;
42 
43 void DrawTimeSkySegmentation(TString network="L1H1V1", int polarization = 1, int palette = 0, bool btitle = true) {
44 
45  if (!gROOT->GetClass("XYZVector")) gSystem->Load("libMathCore");
46 
47  int nIFO=0;
48  TString ifo[10];
49  if(network.Contains("V1")) ifo[nIFO++]="V1"; // VIRGO
50  if(network.Contains("H1")) ifo[nIFO++]="H1"; // LHO1
51  if(network.Contains("L1")) ifo[nIFO++]="L1"; // LLO
52  if(network.Contains("G1")) ifo[nIFO++]="G1"; // GEO
53  if(network.Contains("T1")) ifo[nIFO++]="T1"; // TAMA
54  if(network.Contains("H2")) ifo[nIFO++]="H2"; // LHO2
55  if(network.Contains("A1")) ifo[nIFO++]="A1"; // AIGO
56  if(network.Contains("O1")) ifo[nIFO++]="O1"; // AURIGA
57  if(network.Contains("N1")) ifo[nIFO++]="N1"; // NAUTILUS
58  if(network.Contains("E1")) ifo[nIFO++]="E1"; // EXPLORER
59  if(network.Contains("A2")) ifo[nIFO++]="A2"; // AUSTRALIAN 90°
60  if(network.Contains("J1")) ifo[nIFO++]="J1"; // JAPANESE
61 
62  if(nIFO==0) {cout << "No detectors defined !!! " << endl;exit(1);}
63 
64  char ifostr[32]="";
65  for(int n=0; n<nIFO; n++) {
66  sprintf(ifostr,"%s %s",ifostr,ifo[n].Data());
67  }
68  cout << "Network : " << ifostr << endl;
69 
70  TString title;
71 
72  gnetwork* gNET = new gnetwork(nIFO,ifo);
73  gskymap* gSM = gNET->GetGskymap();
75 // gSM->SetOptions("LVC experiment", 300,40, 1200, 670);
76 
77  gNET->setSkyMaps(0.4,0,180,0,360);
78  gNET->setAntenna();
79  gNET->setDelay(const_cast<char*>(ifo[0].Data()));
80 
81 #ifdef DISPLAY_WORLD_MAP
82  gSM->SetWorldMap();
83 #endif
84 
85  TH2D* h2 = (TH2D*)gSM->GetHistogram();
86  h2->GetXaxis()->SetTitleSize(0.05);
87  h2->GetXaxis()->SetLabelSize(0.05);
88  h2->GetYaxis()->SetTitleSize(0.05);
89  h2->GetYaxis()->SetLabelSize(0.05);
90 // For CHRIS
91  h2->GetYaxis()->SetLabelFont(42);
92  h2->GetYaxis()->SetLabelFont(42);
93  h2->GetXaxis()->SetTitleFont(42);
94  h2->GetYaxis()->SetTitleFont(42);
95 
96  if(polarization==3) {
97  //if(nIFO>1) h2->GetZaxis()->SetRangeUser(0,1.7);
98  if(nIFO>1) h2->GetZaxis()->SetRangeUser(0,1.0);
99  else h2->GetZaxis()->SetRangeUser(0,1.0);
100  }
101  if(polarization==2) h2->GetZaxis()->SetRangeUser(0,1.0);
102 
104 
105  double mTau=gNET->getDelay("MAX"); // maximum time delay
106  double ph1,ph2,th1,th2;
107  double dt = 1./SAMPLE_RATE;
108  int sTau=mTau/dt;
109  for (int k=-sTau;k<sTau;k++) {
110  for (int h=-sTau;h<sTau;h++) {
111  gNET->Delay2Coordinates(0,k*dt,h*dt,ph1,th1,ph2,th2);
112 // cout << ph1 << " " << th1 << " " << ph2 << " " << th2 << endl;
113  if(COORDINATES=="Geographic") {
114  CwbToGeographic(ph1,th1,ph1,th1);
115  gSM->DrawMarker(ph1,th1, 1, 0.1, kBlack); // Geographic
116  CwbToGeographic(ph2,th2,ph2,th2);
117  gSM->DrawMarker(ph2,th2, 1, 0.1, kBlack); // Geographic
118  }
119  }
120 //exit(0);
121  }
122 
123 #ifdef DRAW_EQUATORIAL
124  double phi,theta;
125  CwbToGeographic(EQUATORIAL_PHI,EQUATORIAL_THETA,phi,theta);
126 cout << phi << " " << theta << endl;
127  gSM->DrawMarker(phi,theta, 4, 3.0, kRed); // Geographic
128 #endif
129 
130 #ifdef WRITE_PLOT
131  char ofileName[128]=ODIR_NAME;
132  sprintf(ofileName,"%s/",ofileName);
133  for(int n=0; n<nIFO; n++) {
134  sprintf(ofileName,"%s%s",ofileName,ifo[n].Data());
135  }
136  if(polarization==0) sprintf(ofileName,"%s%s.%s",ofileName,"_Fc",OFILE_EXT);
137  if(polarization==1) sprintf(ofileName,"%s%s.%s",ofileName,"_Fp",OFILE_EXT);
138  if(polarization==2) sprintf(ofileName,"%s%s.%s",ofileName,"_Fc_over_Fp",OFILE_EXT);
139  if(polarization==3) sprintf(ofileName,"%s%s.%s",ofileName,"_Sqrt_Fp2_plus_Fc2",OFILE_EXT);
140 
141  cout << "Write : " << ofileName << endl;
142  gSM->Print(ofileName);
143  exit(0);
144 #endif
145 }
146 
TH2D * GetHistogram()
Definition: gskymap.hh:138
gskymap * gSM
#define SAMPLE_RATE
#define RESOLUTION
gnetwork * gNET
void setAntenna(detector *)
param: detector (use theta, phi index array)
Definition: network.cc:2846
Definition: ced.hh:42
void DrawAntennaPattern(int polarization=-1, int dpaletteId=0, bool btitle=true, int order=6)
Definition: gnetwork.cc:674
int n
Definition: cwb_net.C:28
TString("c")
int Delay2Coordinates(double t1, double t2, double t3, double &ph1, double &th1, double &ph2, double &th2)
Definition: gnetwork.cc:1028
int palette
Definition: DrawGnetwork2.C:17
float theta
void DrawMarker(double phi, double theta, int marker, Size_t msize=1, Color_t tcolor=1)
Definition: gskymap.cc:742
char ifostr[64]
int polarization
char ifo[NIFO_MAX][8]
#define nIFO
float phi
void setSkyMaps(double sms, double t1, double t2, double p1, double p2)
Definition: gnetwork.hh:47
wavearray< double > h
Definition: Regression_H1.C:25
#define OFILE_EXT
double getDelay(const char *c="")
Definition: network.cc:2818
int k
void setDelay(const char *="L1")
Definition: network.cc:2767
TString ofileName
Definition: MergeTrees.C:37
#define ODIR_NAME
double dt
#define COORDINATES
gskymap * GetGskymap()
Definition: gnetwork.hh:44
char title[256]
Definition: SSeriesExample.C:1
void SetWorldMap(bool drawWorldMap=true)
Definition: gskymap.hh:154
double mTau
void DrawTimeSkySegmentation(TString network="L1H1V1", int polarization=1, int palette=0, bool btitle=true)
void CwbToGeographic(double ilongitude, double ilatitude, double &olongitude, double &olatitude)
Definition: skycoord.hh:414
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
bool btitle
Definition: DrawGnetwork2.C:16
#define PROJECTION
void Print(TString pname)
Definition: gskymap.cc:1122
void SetOptions(TString projection="hammer", TString coordinate="Geographic", double resolution=1, bool goff=false)
Definition: gskymap.cc:84
exit(0)