Logo coherent WaveBurst  
Library Reference Guide
Logo
DrawRadiusIFARplots.C
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Francesco Salemi
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 //
20 // Draw Radius vs IFAR
21 // Note : this macro is used to generate the CBC report
22 // Author : Francesco Salemi
23 
24 #define MINIFAR 1
25 #define MAXIFAR 10000.
26 #define MINRADIUS 0
27 #define MAXRADIUS 1000
28 #define MINRHO 5
29 #define MAXRHO 100
30 
31 // This line is to load the library
32 // R__LOAD_LIBRARY($HOME_CWB/macros/cbcTool.CreateGraphRadiusIFAR_C.so)
33 
35  char* mdc_file_name,
36  float shell_volume,
37  TString opt) {
38  TCanvas* co_canvas = new TCanvas("sd2", "SD2", 3, 47, 1000, 802);
39  co_canvas->SetGridx();
40  co_canvas->SetGridy();
41  co_canvas->SetLogx();
42 
43  std::array<float, 5> BBH_MTotBins = {4.0, 27.25, 51.50, 75.75, 100.0};
44  std::array<float, 5> IMBHB_MTotBins = {100.0, 200.0, 400.0, 600.0, 800.0};
45  std::array<float, 5> MTotBins = {0.0, 0.0, 0.0, 0.0, 0.0};
46  std::array<float, 5> MChirpBins = {0.0, 0.0, 0.0, 0.0, 0.0};
47  std::array<float, 5> BBH_MChirpBins = {1.74, 8.07, 14.92, 21.77, 100.0};
48  std::array<float, 5> IMBHB_MChirpBins = {
49  1.74, 100.0, 149.2, 217.7, 500.0}; // TODO find more rational binning
50  std::array<float, 4> ChieffBins = {-1.0, -0.4, 0.4, 1.0};
51  std::array<float, 4> ChipBins = {0.0, 0.3333, 0.6666, 1.0};
52  std::array<float, 4> CosiBins = {-1.0, -0.86602540, 0.86602540, 1.0};
53  TString CosiBinsT[4] = {"-1", "-#sqrt{3}/2", "#sqrt{3}/2", "1"};
54  std::array<float, 5> EtaBins = {0.25, 0.24, 0.22, 0.18, 0.0};
55 
56  // Colors array
57  Color_t col_arr[4] = {kBlue, kCyan, kGreen - 9, kOrange};
58  Color_t col_arr2[3] = {kViolet - 1, kGreen - 9, kRed};
59 
60  if (opt.Contains("IMBHB")) {
61  MTotBins = IMBHB_MTotBins;
62  MChirpBins = IMBHB_MChirpBins;
63  } else {
64  MTotBins = BBH_MTotBins;
65  MChirpBins = BBH_MChirpBins;
66  }
68  CWB::CBCTool cbcTool;
69 
70  //========== Sensitive Distance vs IFAR for varius Mtot bins
71  //================
72  cout << "Sensitive Distance vs IFAR ROC plot: Mtot" << endl;
73  TMultiGraph* mg = new TMultiGraph();
74  TString sel;
75  int bin_count = 0;
76  // TGraphErrors *co_gr = new TGraphErrors[4];
77  std::vector<TGraphErrors*> co_gr(4);
78  TLegend* leg = new TLegend(0.6, 0.7, 0.9, 0.9, "", "brNDC");
79 
80  while (bin_count < 4) {
81  sel.Form("(mass[0]+mass[1] >= %f) && (mass[0]+mass[1] < %f)",
82  MTotBins[bin_count], MTotBins[bin_count + 1]);
83  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
84  sim_file_name, mdc_file_name, sel, shell_volume, col_arr[bin_count],
85  opt, liveTot, T_ifar, T_win, TRIALS, nIFO, VT, Tscale);
86  if (co_gr[bin_count]->GetN() > 1) {
87  mg->Add(co_gr[bin_count]);
88  sel.Form("M_{total} #in [%3.2f, %3.2f] M_{#odot}",
89  MTotBins[bin_count], MTotBins[bin_count + 1]);
90  leg->AddEntry(co_gr[bin_count], sel, "l");
91  }
92  bin_count++;
93  }
94  mg->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
95  mg->GetXaxis()->SetTitle("Inverse False Alarm Rate [yr]");
96  mg->GetXaxis()->SetLimits(MINIFAR, MAXIFAR);
97  // mg->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
98  mg->GetXaxis()->SetTitleOffset(1.3);
99  mg->GetYaxis()->SetTitleOffset(1.25);
100  mg->GetXaxis()->SetTickLength(0.01);
101  mg->GetYaxis()->SetTickLength(0.01);
102  mg->GetXaxis()->CenterTitle(kTRUE);
103  mg->GetYaxis()->CenterTitle(kTRUE);
104  mg->GetXaxis()->SetTitleFont(42);
105  mg->GetXaxis()->SetLabelFont(42);
106  mg->GetYaxis()->SetTitleFont(42);
107  mg->GetYaxis()->SetLabelFont(42);
108 
109  mg->Draw("aple3");
110 
111  leg->SetFillColorAlpha(0, 0.7);
112  leg->Draw();
113 
114  char fname[1024];
115  sprintf(fname, "%s/ROC_IFAR_Mtot.png", netdir);
116  co_canvas->Update();
117  co_canvas->SaveAs(fname);
118 
119  //========== Sensitive Distance vs rho[1] for varius Mtot bins
120  //================
121  cout << "Sensitive Distance vs rho[1] ROC plot: Mtot" << endl;
122  TMultiGraph* mgr = new TMultiGraph();
123  bin_count = 0;
124  while (bin_count < 4) {
125  sel.Form("(mass[0]+mass[1] >= %f) && (mass[0]+mass[1] < %f)",
126  MTotBins[bin_count], MTotBins[bin_count + 1]);
127  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
128  sim_file_name, mdc_file_name, sel, shell_volume, col_arr[bin_count],
129  opt + " rho", liveTot, T_ifar, T_win, TRIALS, nIFO, VT, Tscale);
130  if (co_gr[bin_count]->GetN() > 1) {
131  mgr->Add(co_gr[bin_count]);
132  }
133  // sel.Form("M_{total} #in [%3.2f, %3.2f]
134  // M_{#odot}",MTotBins[bin_count],MTotBins[bin_count+1]);
135  // leg->AddEntry(co_gr[bin_count], sel, "l");
136  bin_count++;
137  }
138 
139  mgr->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
140  mgr->GetXaxis()->SetTitle("Magnitude Test Statistic (rho[1])");
141  mgr->GetXaxis()->SetLimits(MINRHO, MAXRHO);
142  // mgr->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
143  mgr->GetXaxis()->SetTitleOffset(1.3);
144  mgr->GetYaxis()->SetTitleOffset(1.25);
145  mgr->GetXaxis()->SetTickLength(0.01);
146  mgr->GetYaxis()->SetTickLength(0.01);
147  mgr->GetXaxis()->CenterTitle(kTRUE);
148  mgr->GetYaxis()->CenterTitle(kTRUE);
149  mgr->GetXaxis()->SetTitleFont(42);
150  mgr->GetXaxis()->SetLabelFont(42);
151  mgr->GetYaxis()->SetTitleFont(42);
152  mgr->GetYaxis()->SetLabelFont(42);
153 
154  mgr->Draw("aple3");
155  leg->SetFillColorAlpha(0, 1.0);
156  leg->Draw();
157 
158  sprintf(fname, "%s/ROC_rho1_Mtot.png", netdir);
159  co_canvas->SetLogy();
160  co_canvas->Update();
161  co_canvas->SaveAs(fname);
162  co_canvas->SetLogy(0);
163 
164  //========== Sensitive Distance vs IFAR for varius Xeff bins
165  //================
166  cout << "Sensitive Distance vs IFAR ROC plot: Chieff" << endl;
167  TMultiGraph* mg2 = new TMultiGraph();
168  TLegend* leg2 = new TLegend(0.6, 0.8, 0.9, 0.9, "", "tlNDC");
169  bin_count = 0;
170  while (bin_count < 3) {
171  sel.Form(
172  "(spin[2]*mass[0]+spin[5]*mass[1])/(mass[1]+mass[0])>= %f && "
173  "(spin[2]*mass[0]+spin[5]*mass[1])/(mass[1]+mass[0])< %f",
174  ChieffBins[bin_count], ChieffBins[bin_count + 1]);
175  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
176  sim_file_name, mdc_file_name, sel, shell_volume,
177  col_arr2[bin_count], opt, liveTot, T_ifar, T_win, TRIALS, nIFO, VT,
178  Tscale);
179  if (co_gr[bin_count]->GetN() > 1) {
180  mg2->Add(co_gr[bin_count]);
181  sel.Form("#chi_{eff} #in [%3.1f, %3.1f]", ChieffBins[bin_count],
182  ChieffBins[bin_count + 1]);
183  leg2->AddEntry(co_gr[bin_count], sel, "l");
184  }
185  bin_count++;
186  }
187 
188  mg2->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
189  mg2->GetXaxis()->SetTitle("Inverse False Alarm Rate [yr]");
190  mg2->GetXaxis()->SetLimits(MINIFAR, MAXIFAR);
191  // mg2->GetYaxis()->SetRangeUser(200,MAXRADIUS);
192  mg2->GetXaxis()->SetTitleOffset(1.3);
193  mg2->GetYaxis()->SetTitleOffset(1.25);
194  mg2->GetXaxis()->SetTickLength(0.01);
195  mg2->GetYaxis()->SetTickLength(0.01);
196  mg2->GetXaxis()->CenterTitle(kTRUE);
197  mg2->GetYaxis()->CenterTitle(kTRUE);
198  mg2->GetXaxis()->SetTitleFont(42);
199  mg2->GetXaxis()->SetLabelFont(42);
200  mg2->GetYaxis()->SetTitleFont(42);
201  mg2->GetYaxis()->SetLabelFont(42);
202 
203  mg2->Draw("aple3");
204 
205  // char lab[256];
206  leg2->SetFillColor(0);
207  leg2->SetFillColorAlpha(0, 0.7);
208  leg2->Draw();
209 
210  sprintf(fname, "%s/ROC_IFAR_chieff.png", netdir);
211  co_canvas->Update();
212  co_canvas->SaveAs(fname);
213 
214  //========== Sensitive Distance vs IFAR for varius Xp bins
215  //================
216  cout << "Sensitive Distance vs IFAR ROC plot: Chip" << endl;
217  TMultiGraph* mg4 = new TMultiGraph();
218  TLegend* leg4 = new TLegend(0.6, 0.8, 0.9, 0.9, "", "tlNDC");
219  bin_count = 0;
220  while (bin_count < 3) {
221  sel.Form("chip >= %f && chip < %f", ChipBins[bin_count],
222  ChipBins[bin_count + 1]);
223  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
224  sim_file_name, mdc_file_name, sel, shell_volume,
225  col_arr2[bin_count], opt, liveTot, T_ifar, T_win, TRIALS, nIFO, VT,
226  Tscale);
227  if (co_gr[bin_count]->GetN() > 1) {
228  mg4->Add(co_gr[bin_count]);
229  sel.Form("#chi_{p} #in [%3.1f, %3.1f]", ChipBins[bin_count],
230  ChipBins[bin_count + 1]);
231  leg4->AddEntry(co_gr[bin_count], sel, "l");
232  }
233  bin_count++;
234  }
235 
236  mg4->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
237  mg4->GetXaxis()->SetTitle("Inverse False Alarm Rate [yr]");
238  mg4->GetXaxis()->SetLimits(MINIFAR, MAXIFAR);
239  // mg2->GetYaxis()->SetRangeUser(200,MAXRADIUS);
240  mg4->GetXaxis()->SetTitleOffset(1.3);
241  mg4->GetYaxis()->SetTitleOffset(1.25);
242  mg4->GetXaxis()->SetTickLength(0.01);
243  mg4->GetYaxis()->SetTickLength(0.01);
244  mg4->GetXaxis()->CenterTitle(kTRUE);
245  mg4->GetYaxis()->CenterTitle(kTRUE);
246  mg4->GetXaxis()->SetTitleFont(42);
247  mg4->GetXaxis()->SetLabelFont(42);
248  mg4->GetYaxis()->SetTitleFont(42);
249  mg4->GetYaxis()->SetLabelFont(42);
250 
251  mg4->Draw("aple3");
252 
253  // char lab[256];
254  leg4->SetFillColor(0);
255  leg4->SetFillColorAlpha(0, 0.7);
256  leg4->Draw();
257 
258  sprintf(fname, "%s/ROC_IFAR_chip.png", netdir);
259  co_canvas->Update();
260  co_canvas->SaveAs(fname);
261 
262  //========== Sensitive Distance vs IFAR for varius Cos(iota) bins
263  //================
264  cout << "Sensitive Distance vs IFAR ROC plot: Inclination" << endl;
265  TMultiGraph* mg6 = new TMultiGraph();
266  TLegend* leg6 = new TLegend(0.6, 0.8, 0.9, 0.9, "", "tlNDC");
267  bin_count = 0;
268  while (bin_count < 3) {
269  sel.Form("iota[1] >= %f && iota[1] < %f", CosiBins[bin_count],
270  CosiBins[bin_count + 1]);
271  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
272  sim_file_name, mdc_file_name, sel, shell_volume,
273  col_arr2[bin_count], opt, liveTot, T_ifar, T_win, TRIALS, nIFO, VT,
274  Tscale);
275  if (co_gr[bin_count]->GetN() > 1) {
276  mg6->Add(co_gr[bin_count]);
277  sel.Form("#Cos(#iota) #in [%s, %s]", CosiBinsT[bin_count].Data(),
278  CosiBinsT[bin_count + 1].Data());
279  leg6->AddEntry(co_gr[bin_count], sel, "l");
280  }
281  bin_count++;
282  }
283 
284  mg6->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
285  mg6->GetXaxis()->SetTitle("Inverse False Alarm Rate [yr]");
286  mg6->GetXaxis()->SetLimits(MINIFAR, MAXIFAR);
287  // mg2->GetYaxis()->SetRangeUser(200,MAXRADIUS);
288  mg6->GetXaxis()->SetTitleOffset(1.3);
289  mg6->GetYaxis()->SetTitleOffset(1.25);
290  mg6->GetXaxis()->SetTickLength(0.01);
291  mg6->GetYaxis()->SetTickLength(0.01);
292  mg6->GetXaxis()->CenterTitle(kTRUE);
293  mg6->GetYaxis()->CenterTitle(kTRUE);
294  mg6->GetXaxis()->SetTitleFont(42);
295  mg6->GetXaxis()->SetLabelFont(42);
296  mg6->GetYaxis()->SetTitleFont(42);
297  mg6->GetYaxis()->SetLabelFont(42);
298 
299  mg6->Draw("aple3");
300 
301  // char lab[256];
302  leg6->SetFillColor(0);
303  leg6->SetFillColorAlpha(0, 0.7);
304  leg6->Draw();
305 
306  sprintf(fname, "%s/ROC_IFAR_iota.png", netdir);
307  co_canvas->Update();
308  co_canvas->SaveAs(fname);
309 
310  //========== Sensitive Distance vs rho[1] for varius Xeff bins
311  //================
312  cout << "Sensitive Distance vs rho[1] ROC plot: Chieff" << endl;
313  TMultiGraph* mg2r = new TMultiGraph();
314  bin_count = 0;
315  while (bin_count < 3) {
316  sel.Form(
317  "(spin[2]*mass[0]+spin[5]*mass[1])/(mass[1]+mass[0])>= %f && "
318  "(spin[2]*mass[0]+spin[5]*mass[1])/(mass[1]+mass[0])< %f",
319  ChieffBins[bin_count], ChieffBins[bin_count + 1]);
320  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
321  sim_file_name, mdc_file_name, sel, shell_volume,
322  col_arr2[bin_count], opt + " rho", liveTot, T_ifar, T_win, TRIALS,
323  nIFO, VT, Tscale);
324  if (co_gr[bin_count]->GetN() > 1) {
325  mg2r->Add(co_gr[bin_count]);
326  // sel.Form("#chi_{eff} #in [%3.1f, %3.1f]", ChieffBins[bin_count],
327  // ChieffBins[bin_count+1]); leg2->AddEntry(co_gr[bin_count], sel,
328  // "l");
329  }
330  bin_count++;
331  }
332  mg2r->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
333  mg2r->GetXaxis()->SetTitle("Magnitude Test Statistic (rho[1])");
334  mg2r->GetXaxis()->SetLimits(MINRHO, MAXRHO);
335  // mg2r->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
336  mg2r->GetXaxis()->SetTitleOffset(1.3);
337  mg2r->GetYaxis()->SetTitleOffset(1.25);
338  mg2r->GetXaxis()->SetTickLength(0.01);
339  mg2r->GetYaxis()->SetTickLength(0.01);
340  mg2r->GetXaxis()->CenterTitle(kTRUE);
341  mg2r->GetYaxis()->CenterTitle(kTRUE);
342  mg2r->GetXaxis()->SetTitleFont(42);
343  mg2r->GetXaxis()->SetLabelFont(42);
344  mg2r->GetYaxis()->SetTitleFont(42);
345  mg2r->GetYaxis()->SetLabelFont(42);
346 
347  mg2r->Draw("aple3");
348  leg2->SetFillColorAlpha(0, 1.0);
349  leg2->Draw();
350 
351  sprintf(fname, "%s/ROC_rho1_chieff.png", netdir);
352  co_canvas->SetLogy();
353  co_canvas->Update();
354  co_canvas->SaveAs(fname);
355  co_canvas->SetLogy(0);
356 
357  //========== Sensitive Distance vs rho[1] for varius Xp bins
358  //================
359  cout << "Sensitive Distance vs rho[1] ROC plot: Chip" << endl;
360  TMultiGraph* mg4r = new TMultiGraph();
361  bin_count = 0;
362  while (bin_count < 3) {
363  sel.Form("chip >= %f && chip < %f", ChipBins[bin_count],
364  ChipBins[bin_count + 1]);
365  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
366  sim_file_name, mdc_file_name, sel, shell_volume,
367  col_arr2[bin_count], opt + " rho", liveTot, T_ifar, T_win, TRIALS,
368  nIFO, VT, Tscale);
369  if (co_gr[bin_count]->GetN() > 1) {
370  mg4r->Add(co_gr[bin_count]);
371  // sel.Form("#chi_{p} #in [%3.1f, %3.1f]", ChipBins[bin_count],
372  // ChipBins[bin_count+1]); leg4->AddEntry(co_gr[bin_count], sel,
373  // "l");
374  }
375  bin_count++;
376  }
377 
378  mg4r->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
379  mg4r->GetXaxis()->SetTitle("Magnitude Test Statistic (rho[1])");
380  mg4r->GetXaxis()->SetLimits(MINRHO, MAXRHO);
381  // mg2r->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
382  mg4r->GetXaxis()->SetTitleOffset(1.3);
383  mg4r->GetYaxis()->SetTitleOffset(1.25);
384  mg4r->GetXaxis()->SetTickLength(0.01);
385  mg4r->GetYaxis()->SetTickLength(0.01);
386  mg4r->GetXaxis()->CenterTitle(kTRUE);
387  mg4r->GetYaxis()->CenterTitle(kTRUE);
388  mg4r->GetXaxis()->SetTitleFont(42);
389  mg4r->GetXaxis()->SetLabelFont(42);
390  mg4r->GetYaxis()->SetTitleFont(42);
391  mg4r->GetYaxis()->SetLabelFont(42);
392 
393  mg4r->Draw("aple3");
394  leg4->SetFillColorAlpha(0, 1.0);
395  leg4->Draw();
396 
397  sprintf(fname, "%s/ROC_rho1_chip.png", netdir);
398  co_canvas->SetLogy();
399  co_canvas->Update();
400  co_canvas->SaveAs(fname);
401  co_canvas->SetLogy(0);
402 
403  //========== Sensitive Distance vs rho[1] for varius Cos iota bins
404  //================
405  cout << "Sensitive Distance vs rho[1] ROC plot: Inclination" << endl;
406  TMultiGraph* mg6r = new TMultiGraph();
407  bin_count = 0;
408  while (bin_count < 3) {
409  sel.Form("iota[1] >= %f && iota[1] < %f", CosiBins[bin_count],
410  CosiBins[bin_count + 1]);
411  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
412  sim_file_name, mdc_file_name, sel, shell_volume,
413  col_arr2[bin_count], opt + " rho", liveTot, T_ifar, T_win, TRIALS,
414  nIFO, VT, Tscale);
415  if (co_gr[bin_count]->GetN() > 1) {
416  mg6r->Add(co_gr[bin_count]);
417  // sel.Form("#Cos(#iota) #in [%s, %s]", CosiBinsT[bin_count],
418  // CosiBinsT[bin_count+1]); leg6->AddEntry(co_gr[bin_count], sel,
419  // "l");
420  }
421  bin_count++;
422  }
423 
424  mg6r->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
425  mg6r->GetXaxis()->SetTitle("Magnitude Test Statistic (rho[1])");
426  mg6r->GetXaxis()->SetLimits(MINRHO, MAXRHO);
427  // mg2r->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
428  mg6r->GetXaxis()->SetTitleOffset(1.3);
429  mg6r->GetYaxis()->SetTitleOffset(1.25);
430  mg6r->GetXaxis()->SetTickLength(0.01);
431  mg6r->GetYaxis()->SetTickLength(0.01);
432  mg6r->GetXaxis()->CenterTitle(kTRUE);
433  mg6r->GetYaxis()->CenterTitle(kTRUE);
434  mg6r->GetXaxis()->SetTitleFont(42);
435  mg6r->GetXaxis()->SetLabelFont(42);
436  mg6r->GetYaxis()->SetTitleFont(42);
437  mg6r->GetYaxis()->SetLabelFont(42);
438 
439  mg6r->Draw("aple3");
440  leg6->SetFillColorAlpha(0, 1.0);
441  leg6->Draw();
442 
443  sprintf(fname, "%s/ROC_rho1_iota.png", netdir);
444  co_canvas->SetLogy();
445  co_canvas->Update();
446  co_canvas->SaveAs(fname);
447  co_canvas->SetLogy(0);
448 
449  //========== Sensitive Distance vs IFAR for varius Mchirp bins
450  //================
451  cout << "Sensitive Distance vs IFAR ROC plot: Mchirp" << endl;
452  TMultiGraph* mg3 = new TMultiGraph();
453  TLegend* leg3 = new TLegend(0.6, 0.7, 0.9, 0.9, "", "brNDC");
454  bin_count = 0;
455  while (bin_count < 4) {
456  sel.Form("(chirp[0] >= %f) && (chirp[0] < %f)", MChirpBins[bin_count],
457  MChirpBins[bin_count + 1]);
458  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
459  sim_file_name, mdc_file_name, sel, shell_volume, col_arr[bin_count],
460  opt, liveTot, T_ifar, T_win, TRIALS, nIFO, VT, Tscale);
461  if (co_gr[bin_count]->GetN() > 1) {
462  mg3->Add(co_gr[bin_count]);
463  sel.Form("M_{chirp} #in [%3.2f, %3.2f] M_{#odot}",
464  MTotBins[bin_count], MTotBins[bin_count + 1]);
465  leg3->AddEntry(co_gr[bin_count], sel, "l");
466  }
467  bin_count++;
468  }
469 
470  mg3->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
471  mg3->GetXaxis()->SetTitle("Inverse False Alarm Rate [yr]");
472  mg3->GetXaxis()->SetLimits(MINIFAR, MAXIFAR);
473  // mg3->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
474  mg3->GetXaxis()->SetTitleOffset(1.3);
475  mg3->GetYaxis()->SetTitleOffset(1.25);
476  mg3->GetXaxis()->SetTickLength(0.01);
477  mg3->GetYaxis()->SetTickLength(0.01);
478  mg3->GetXaxis()->CenterTitle(kTRUE);
479  mg3->GetYaxis()->CenterTitle(kTRUE);
480  mg3->GetXaxis()->SetTitleFont(42);
481  mg3->GetXaxis()->SetLabelFont(42);
482  mg3->GetYaxis()->SetTitleFont(42);
483  mg3->GetYaxis()->SetLabelFont(42);
484 
485  mg3->Draw("aple3");
486 
487  // char lab[256];
488  leg3->SetFillColor(0);
489  leg3->SetFillColorAlpha(0, 0.7);
490  leg3->Draw();
491 
492  sprintf(fname, "%s/ROC_IFAR_chirp.png", netdir);
493  co_canvas->Update();
494  co_canvas->SaveAs(fname);
495 
496  //========== Sensitive Distance vs rho[1] for varius Mchirp bins
497  //================
498  cout << "Sensitive Distance vs rho[1] ROC plot: Mchirp" << endl;
499  TMultiGraph* mg3r = new TMultiGraph();
500  bin_count = 0;
501  while (bin_count < 4) {
502  sel.Form("(chirp[0] >= %f) && (chirp[0] < %f)", MChirpBins[bin_count],
503  MChirpBins[bin_count + 1]);
504  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
505  sim_file_name, mdc_file_name, sel, shell_volume, col_arr[bin_count],
506  opt + " rho", liveTot, T_ifar, T_win, TRIALS, nIFO, VT, Tscale);
507  if (co_gr[bin_count]->GetN() > 1) {
508  mg3r->Add(co_gr[bin_count]);
509  // sel.Form("M_{chirp} #in [%3.2f, %3.2f]
510  // M_{#odot}",MTotBins[bin_count],MTotBins[bin_count+1]);
511  // leg->AddEntry(co_gr[bin_count], sel, "l");
512  }
513  bin_count++;
514  }
515 
516  mg3r->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
517  mg3r->GetXaxis()->SetTitle("Magnitude Test Statistic (rho[1])");
518  mg3r->GetXaxis()->SetLimits(MINRHO, MAXRHO);
519  // mg3r->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
520  mg3r->GetXaxis()->SetTitleOffset(1.3);
521  mg3r->GetYaxis()->SetTitleOffset(1.25);
522  mg3r->GetXaxis()->SetTickLength(0.01);
523  mg3r->GetYaxis()->SetTickLength(0.01);
524  mg3r->GetXaxis()->CenterTitle(kTRUE);
525  mg3r->GetYaxis()->CenterTitle(kTRUE);
526  mg3r->GetXaxis()->SetTitleFont(42);
527  mg3r->GetXaxis()->SetLabelFont(42);
528  mg3r->GetYaxis()->SetTitleFont(42);
529  mg3r->GetYaxis()->SetLabelFont(42);
530 
531  mg3r->Draw("aple3");
532  leg3->SetFillColorAlpha(0, 1.0);
533  leg3->Draw();
534 
535  sprintf(fname, "%s/ROC_rho1_chirp.png", netdir);
536  co_canvas->SetLogy();
537  co_canvas->Update();
538  co_canvas->SaveAs(fname);
539 
540  //========== Sensitive Distance vs IFAR for varius Mass Ratio bins
541  //================
542  cout << "Sensitive Distance vs IFAR ROC plot: Symmetric Mass Ratio" << endl;
543  TMultiGraph* mg5 = new TMultiGraph();
544  TLegend* leg5 = new TLegend(0.6, 0.7, 0.9, 0.9, "", "brNDC");
545  bin_count = 0;
546  while (bin_count < 4) {
547  sel.Form(
548  "(mass[0]*mass[1]/pow(mass[0]+mass[1],2.0) <= %f) && "
549  "(mass[0]*mass[1]/pow(mass[0]+mass[1],2.0) > %f)",
550  EtaBins[bin_count], EtaBins[bin_count + 1]);
551  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
552  sim_file_name, mdc_file_name, sel, shell_volume, col_arr[bin_count],
553  opt, liveTot, T_ifar, T_win, TRIALS, nIFO, VT, Tscale);
554  if (co_gr[bin_count]->GetN() > 1) {
555  mg5->Add(co_gr[bin_count]);
556  sel.Form("#eta #in [%3.3f, %3.3f]", EtaBins[bin_count + 1],
557  EtaBins[bin_count]);
558  leg5->AddEntry(co_gr[bin_count], sel, "l");
559  }
560  bin_count++;
561  }
562 
563  mg5->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
564  mg5->GetXaxis()->SetTitle("Inverse False Alarm Rate [yr]");
565  mg5->GetXaxis()->SetLimits(MINIFAR, MAXIFAR);
566  // mg->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
567  mg5->GetXaxis()->SetTitleOffset(1.3);
568  mg5->GetYaxis()->SetTitleOffset(1.25);
569  mg5->GetXaxis()->SetTickLength(0.01);
570  mg5->GetYaxis()->SetTickLength(0.01);
571  mg5->GetXaxis()->CenterTitle(kTRUE);
572  mg5->GetYaxis()->CenterTitle(kTRUE);
573  mg5->GetXaxis()->SetTitleFont(42);
574  mg5->GetXaxis()->SetLabelFont(42);
575  mg5->GetYaxis()->SetTitleFont(42);
576  mg5->GetYaxis()->SetLabelFont(42);
577 
578  mg5->Draw("aple3");
579 
580  // char lab[256];
581  // leg5->SetFillColor(0);
582  leg5->SetFillColorAlpha(0, 0.9);
583  leg5->Draw();
584 
585  sprintf(fname, "%s/ROC_IFAR_eta.png", netdir);
586  co_canvas->SetLogy(0);
587  co_canvas->Update();
588  co_canvas->SaveAs(fname);
589 
590  //========== Sensitive Distance vs rho[1] for varius mass ratio bins
591  //================
592  cout << "Sensitive Distance vs rho[1] ROC plot: Symmetric Mass Ratio"
593  << endl;
594  TMultiGraph* mg5r = new TMultiGraph();
595  bin_count = 0;
596  while (bin_count < 4) {
597  sel.Form(
598  "(mass[0]*mass[1]/pow(mass[0]+mass[1],2.0) <= %f) && "
599  "(mass[0]*mass[1]/pow(mass[0]+mass[1],2.0) > %f)",
600  EtaBins[bin_count], EtaBins[bin_count + 1]);
601  co_gr[bin_count] = cbcTool.CreateGraphRadiusIFAR(
602  sim_file_name, mdc_file_name, sel, shell_volume, col_arr[bin_count],
603  opt + " rho", liveTot, T_ifar, T_win, TRIALS, nIFO, VT, Tscale);
604  if (co_gr[bin_count]->GetN() > 1) {
605  mg5r->Add(co_gr[bin_count]);
606  // sel.Form("#eta #in [%3.2f,
607  // %3.2f]",EtaBins[bin_count],EtaBins[bin_count+1]);
608  // leg5->AddEntry(co_gr[bin_count], sel, "l");
609  }
610  bin_count++;
611  }
612 
613  mg5r->GetYaxis()->SetTitle("Sensitive Distance [Mpc]");
614  mg5r->GetXaxis()->SetTitle("Magnitude Test Statistic (rho[1])");
615  mg5r->GetXaxis()->SetLimits(MINRHO, MAXRHO);
616  // mg3r->GetYaxis()->SetRangeUser(MINRADIUS,MAXRADIUS);
617  mg5r->GetXaxis()->SetTitleOffset(1.3);
618  mg5r->GetYaxis()->SetTitleOffset(1.25);
619  mg5r->GetXaxis()->SetTickLength(0.01);
620  mg5r->GetYaxis()->SetTickLength(0.01);
621  mg5r->GetXaxis()->CenterTitle(kTRUE);
622  mg5r->GetYaxis()->CenterTitle(kTRUE);
623  mg5r->GetXaxis()->SetTitleFont(42);
624  mg5r->GetXaxis()->SetLabelFont(42);
625  mg5r->GetYaxis()->SetTitleFont(42);
626  mg5r->GetYaxis()->SetLabelFont(42);
627 
628  mg5r->Draw("aple3");
629  leg5->SetFillColorAlpha(0, 1.0);
630  leg5->Draw();
631 
632  sprintf(fname, "%s/ROC_rho1_eta.png", netdir);
633  co_canvas->SetLogy(1);
634  co_canvas->Update();
635  co_canvas->SaveAs(fname);
636 
637  delete co_canvas;
638  // delete mg,mgr,mg2,mg2r,mg3,mg3r;
639  delete mg, mgr, mg2, mg2r, mg3, mg3r, mg4, mg4r, mg5, mg5r, mg6, mg6r;
640  delete leg, leg2, leg3, leg4, leg5, leg6;
641  // delete co_gr1, co_gr2, co_gr3, co_gr4;
642  // delete[] co_gr;
643  // exit(0);
644 }
float Tscale
double T_ifar
TString opt
static TGraphErrors * CreateGraphRadiusIFAR(char *sim_file_name, char *mdc_file_name, TString SEL, float shell_volume, Color_t color, TString opt, double liveTot, float T_ifar, float T_win, int TRIALS, int nIFO, float VT, float Tscale)
Definition: CBCTool.cc:1592
TString("c")
CWB::Toolbox TB
#define MAXIFAR
#define nIFO
char netdir[1024]
#define MINRHO
char fname[1024]
double liveTot
TString sel("slag[1]:slag[2]")
double VT
char sim_file_name[1024]
double T_win
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void DrawRadiusIFARplots(char *sim_file_name, char *mdc_file_name, float shell_volume, TString opt)
float * shell_volume
#define MAXRHO
char mdc_file_name[1024]
#define MINIFAR
TMultiGraph * mg
TCanvas * co_canvas
int TRIALS