22 #define RHO_NBINS 5000 31 gStyle->SetPalette(57);
46 #ifndef MIN_plot_mass1 49 #ifndef MIN_plot_mass2 52 #ifndef MAX_plot_mass1 55 #ifndef MAX_plot_mass2 58 #ifndef MAX_EFFECTIVE_RADIUS 107 cout <<
"cwb_report_cbc starts..." << endl;
110 TString SearchType = gSystem->Getenv(
"CBC_SEARCH_TYPE");
111 cout <<
"CBC Search type: " << gSystem->Getenv(
"CBC_SEARCH_TYPE") <<endl;
114 cout <<
"Mass1 : [" << min_mass1 <<
"," << max_mass1 <<
"] with " 115 << NBINS_mass1 <<
" bins" << endl;
116 cout <<
"Mass2 : [" << min_mass2 <<
"," << max_mass2 <<
"] with " 117 << NBINS_mass2 <<
" bins" << endl;
122 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
123 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
124 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
125 TB.
checkFile(gSystem->Getenv(
"CWB_PPARAMETERS_FILE"));
126 TB.
checkFile(gSystem->Getenv(
"CWB_UPPARAMETERS_FILE"));
127 TB.
checkFile(gSystem->Getenv(
"CWB_EPPARAMETERS_FILE"));
138 gStyle->SetTitleFillColor(kWhite);
140 gStyle->SetNumberContours(256);
141 gStyle->SetCanvasColor(kWhite);
142 gStyle->SetStatBorderSize(1);
143 gStyle->SetOptStat(kFALSE);
146 gStyle->SetFrameBorderMode(0);
149 char networkname[256];
150 if (strlen(
ifo[0]) > 0)
154 for (
int i = 1;
i <
nIFO;
i++) {
155 if (strlen(
ifo[
i]) > 0)
156 sprintf(networkname,
"%s-%s", networkname,
159 sprintf(networkname,
"%s-%s", networkname,
204 cout << "Number of Factors:" << nfactor << endl;
205 for (
int l = 0; l < nfactor; l++) {
210 if (
MDC.GetInspiralOption(
"--waveform") !=
"") {
211 waveforms[gIFACTOR - 1] =
MDC.GetInspiralOption(
"--waveform");
213 if (
MDC.GetInspiralOption(
"--min-mtotal") !=
"") {
215 (float)
MDC.GetInspiralOption(
"--min-mtotal").Atof();
218 if (
MDC.GetInspiralOption(
"--max-mtotal") !=
"") {
220 (float)
MDC.GetInspiralOption(
"--max-mtotal").Atof();
224 if (
MDC.GetInspiralOption(
"--min-distance") !=
"") {
226 (float)
MDC.GetInspiralOption(
"--min-distance").Atof();
232 if (
MDC.GetInspiralOption(
"--max-distance") !=
"") {
234 (float)
MDC.GetInspiralOption(
"--max-distance").Atof();
241 if (
MDC.GetInspiralOption(
"--min-mratio") !=
"") {
243 (float)
MDC.GetInspiralOption(
"--min-mratio").Atof();
246 if ((
MDC.GetInspiralOption(
"--min-mass1") !=
"") &&
247 (
MDC.GetInspiralOption(
"--min-mass2") !=
"")) {
249 (float)
MDC.GetInspiralOption(
"--min-mass1").Atof() /
250 MDC.GetInspiralOption(
"--min-mass2").Atof();
253 if (
MDC.GetInspiralOption(
"--max-mratio") !=
"") {
255 (float)
MDC.GetInspiralOption(
"--max-mratio").Atof();
258 if ((
MDC.GetInspiralOption(
"--min-mass1") !=
"") &&
259 (
MDC.GetInspiralOption(
"--max-mass2") !=
"")) {
261 (float)
MDC.GetInspiralOption(
"--min-mass1").Atof() /
262 (float)
MDC.GetInspiralOption(
"--max-mass2").Atof();
267 if ((
MDC.GetInspiralOption(
"--max-mass1") !=
"") &&
268 (
MDC.GetInspiralOption(
"--min-mass2") !=
"")) {
270 (float)
MDC.GetInspiralOption(
"--max-mass1").Atof() /
271 (float)
MDC.GetInspiralOption(
"--min-mass2").Atof();
276 if (
MDC.GetInspiralOption(
"--d-distr") !=
"") {
277 if (
MDC.GetInspiralOption(
"--d-distr").CompareTo(
"uniform") == 0) {
279 opt =
"DDistrUniform";
280 cout <<
"Uniform distribution in linear distance" << endl;
285 }
else if (
MDC.GetInspiralOption(
"--d-distr").CompareTo(
"volume") ==
288 opt =
"DDistrVolume";
289 cout <<
"Uniform distribution in volume" << endl;
296 cout <<
"No defined distance distribution? " 297 "Or different from uniform and volume?" 302 cout <<
"Shell volume: " <<
shell_volume[gIFACTOR - 1] << endl;
304 if (
MDC.GetInspiralOption(
"--dchirp-distr") !=
"") {
305 if (
MDC.GetInspiralOption(
"--dchirp-distr").CompareTo(
"uniform") ==
308 opt =
"DDistrChirpMass";
315 pow(
minRatio[gIFACTOR - 1], 3. / 5.) /
316 pow(1 +
minRatio[gIFACTOR - 1], 6. / 5.);
319 pow(
maxRatio[gIFACTOR - 1], 3. / 5.) /
320 pow(1 +
maxRatio[gIFACTOR - 1], 6. / 5.);
327 if (ShellmaxDistance <
maxDistance[gIFACTOR - 1]) {
332 pow(
minMChirp[gIFACTOR - 1] / 1.22, 5. / 6.);
333 cout <<
"Uniform distribution in Chirp Mass " 336 cout <<
"MaxDistance: " <<
maxDistance[gIFACTOR - 1] << endl;
338 cout <<
"No defined distance " 339 "distribution? Or different from " 340 "uniform in distance?" 345 cout <<
"MDC set: " << gIFACTOR << endl;
346 cout <<
"xml conf: waveform=" <<
waveforms[gIFACTOR - 1]
347 <<
" minMtot=" <<
minMtot[gIFACTOR - 1]
348 <<
" maxMtot=" <<
maxMtot[gIFACTOR - 1]
351 <<
" minRatio=" <<
minRatio[gIFACTOR - 1]
352 <<
" maxRatio=" <<
maxRatio[gIFACTOR - 1] << endl;
357 #ifdef FIXMAXDISTANCE 366 minRatio[gIFACTOR - 1] = FIXMINRATIO;
378 maxRatio[gIFACTOR - 1] = FIXMAXRATIO;
389 minMtot[gIFACTOR - 1] = FIXMINTOT;
394 maxMtot[gIFACTOR - 1] = FIXMAXTOT;
402 cout <<
"Undefined VT! When using the \"REDSHIFT\" option, VT has " 403 "to be initialized to the proper fiducial volume times time" 404 " for the simulation which has been injected." 406 cout <<
" Add something like: VT = XY; in your user pp file," 407 " where XY is a double in [Gpc^3*years]." 412 cout <<
"Undefined TMC! When using the \"REDSHIFT\" option, TMC has " 413 "to be initialized to the proper MonteCarlo time " 414 "for the simulation which has been injected." 416 cout <<
"Add something like: TMC = XY; in your user pp file, " 417 "where XY is an int in [s]." 433 float MINMtot = 0.99 *
minMtot[gIFACTOR - 1];
436 float MAXMtot = 100.0;
443 NBINS_MTOT = TMath::FloorNint((MAX_MASS - MIN_MASS) / MASS_BIN / 2.);
444 cout <<
"NBINS_MTOT: " << NBINS_MTOT << endl;
448 cout <<
"Undefined maximal total mass!! Using default, i.e. " 454 float MINDISTANCE = 0.0;
457 cout <<
"MINDISTANCE = " << MINDISTANCE << endl;
459 cout <<
"Undefined minimal distance!! Using default, i.e. 0" << endl;
462 float MAXDISTANCE = 5000000;
467 cout <<
"MAXDISTANCE = " << MAXDISTANCE << endl;
469 cout <<
"Undefined maximal distance !! Using default, i.e. 5 " 471 "You can define a MAXDISTANCE in pp par file, e.g. " 472 "#define FIXMINDISTANCE 5000000" 476 float MINCHIRP = 100.0;
477 float MAXCHIRP = 0.0;
478 float MINRATIO = 1.0;
479 float MAXRATIO = 10.0;
480 if ((bminRatio) && (bmaxRatio)) {
484 cout <<
"Undefined min/max Ratio.. Using default [1; 10] " << endl;
486 MINCHIRP = MINMtot * pow(MAXRATIO, 3. / 5.) / pow(1 + MAXRATIO, 6. / 5.);
489 MAXCHIRP = MAXMtot / pow(2, 6. / 5.);
513 for (
int l = 0; l < nfactor - 1; l++) {
516 FixedFiducialVolume = 1;
519 FixedFiducialVolume = 1;
520 cout <<
"Beware: different fiducial volumes for " 521 "different factors!!" 543 TCanvas*
c1 =
new TCanvas(
"c1",
"c1", 3, 47, 1000, 802);
554 TCanvas*
c2 =
new TCanvas(
"c2",
"c2", 3, 47, 1000, 802);
555 c2->Range(-1.216392, -477.6306, 508.8988, 2814.609);
561 c2->SetRightMargin(0.154618);
562 c2->SetTopMargin(0.07642487);
563 c2->SetBottomMargin(0.1450777);
565 TH2F*
inj_events =
new TH2F(
"inj_events",
"D_Minj", NBINS_mass, MIN_MASS,
566 MAX_MASS, NBINS_mass2, min_mass2, max_mass2);
567 inj_events->GetXaxis()->SetRangeUser(MIN_plot_mass1, MAX_plot_mass1);
568 inj_events->GetYaxis()->SetRangeUser(MIN_plot_mass2, MAX_plot_mass2);
569 inj_events->GetXaxis()->SetTitle(
"Mass 1 (M_{#odot})");
570 inj_events->GetYaxis()->SetTitle(
"Mass 2 (M_{#odot})");
571 inj_events->GetXaxis()->SetTitleOffset(1.3);
572 inj_events->GetYaxis()->SetTitleOffset(1.25);
573 inj_events->GetXaxis()->CenterTitle(kTRUE);
574 inj_events->GetYaxis()->CenterTitle(kTRUE);
575 inj_events->GetXaxis()->SetNdivisions(410);
576 inj_events->GetYaxis()->SetNdivisions(410);
577 inj_events->GetXaxis()->SetTickLength(0.01);
578 inj_events->GetYaxis()->SetTickLength(0.01);
579 inj_events->GetZaxis()->SetTickLength(0.01);
580 inj_events->GetXaxis()->SetTitleFont(42);
581 inj_events->GetXaxis()->SetLabelFont(42);
582 inj_events->GetYaxis()->SetTitleFont(42);
583 inj_events->GetYaxis()->SetLabelFont(42);
584 inj_events->GetZaxis()->SetLabelFont(42);
585 inj_events->GetZaxis()->SetLabelSize(0.03);
589 inj_events->SetTitle(
"");
591 inj_events->SetContour(
NCont);
593 TH2F*
rec_events =
new TH2F(
"rec_events",
"D_Mrec", NBINS_mass, MIN_MASS,
594 MAX_MASS, NBINS_mass2, min_mass2, max_mass2);
595 rec_events->GetXaxis()->SetRangeUser(MIN_plot_mass1, MAX_plot_mass1);
596 rec_events->GetYaxis()->SetRangeUser(MIN_plot_mass2, MAX_plot_mass2);
597 rec_events->GetXaxis()->SetTitle(
"Mass 1 (M_{#odot})");
598 rec_events->GetYaxis()->SetTitle(
"Mass 2 (M_{#odot})");
599 rec_events->GetXaxis()->SetTitleOffset(1.3);
600 rec_events->GetYaxis()->SetTitleOffset(1.25);
601 rec_events->GetXaxis()->CenterTitle(kTRUE);
602 rec_events->GetYaxis()->CenterTitle(kTRUE);
603 rec_events->GetXaxis()->SetNdivisions(410);
604 rec_events->GetYaxis()->SetNdivisions(410);
605 rec_events->GetXaxis()->SetTickLength(0.01);
606 rec_events->GetYaxis()->SetTickLength(0.01);
607 rec_events->GetZaxis()->SetTickLength(0.01);
608 rec_events->GetXaxis()->SetTitleFont(42);
609 rec_events->GetXaxis()->SetLabelFont(42);
610 rec_events->GetYaxis()->SetTitleFont(42);
611 rec_events->GetYaxis()->SetLabelFont(42);
612 rec_events->GetZaxis()->SetLabelFont(42);
613 rec_events->GetZaxis()->SetLabelSize(0.03);
614 rec_events->SetTitle(
"");
616 rec_events->SetContour(
NCont);
620 factor_events_inj[
i] =
622 TH2F(
"factor_events_inj",
"", NBINS_mass, MIN_MASS, MAX_MASS,
623 NBINS_mass2, min_mass2, max_mass2);
628 new TH2F(
"factor_events_rec",
"", NBINS_mass, MIN_MASS, MAX_MASS,
629 NBINS_mass2, min_mass2, max_mass2);
632 new TH2F(
"Distance vs Mtot inj.",
"", 1000, MINMtot, MAXMtot, 5000,
633 MINDISTANCE / 1000., MAXDISTANCE / 1000.);
635 D_Mtot_inj->GetXaxis()->SetTitle(
"Total mass (M_{#odot})");
636 D_Mtot_inj->GetYaxis()->SetTitle(
"Distance (Mpc)");
637 D_Mtot_inj->GetXaxis()->SetTitleOffset(1.3);
638 D_Mtot_inj->GetYaxis()->SetTitleOffset(1.3);
639 D_Mtot_inj->GetXaxis()->SetTickLength(0.01);
640 D_Mtot_inj->GetYaxis()->SetTickLength(0.01);
641 D_Mtot_inj->GetXaxis()->CenterTitle(kTRUE);
642 D_Mtot_inj->GetYaxis()->CenterTitle(kTRUE);
643 D_Mtot_inj->GetXaxis()->SetTitleFont(42);
644 D_Mtot_inj->GetXaxis()->SetLabelFont(42);
645 D_Mtot_inj->GetYaxis()->SetTitleFont(42);
646 D_Mtot_inj->GetYaxis()->SetLabelFont(42);
647 D_Mtot_inj->SetMarkerStyle(20);
648 D_Mtot_inj->SetMarkerSize(0.5);
649 D_Mtot_inj->SetMarkerColor(2);
650 D_Mtot_inj->SetTitle(
"");
652 D_Mtot_inj->SetName(
"D_Mtotinj");
655 cout <<
"NBINS_SPIN: " << NBINS_SPIN << endl;
656 TH2F* inj_events_spin_mtot =
657 new TH2F(
"inj_spin_Mtot",
"", NBINS_SPIN, MINCHI, MAXCHI, NBINS_MTOT,
659 TH2F* rec_events_spin_mtot =
660 new TH2F(
"rec_spin_Mtot",
"", NBINS_SPIN, MINCHI, MAXCHI, NBINS_MTOT,
662 TH2F* factor_events_spin_mtot_inj =
new TH2F[
nfactor];
664 factor_events_spin_mtot_inj[
i] =
666 TH2F(
"factor_events_spin_mtot_inj",
"", NBINS_SPIN, MINCHI, MAXCHI,
667 NBINS_MTOT, MIN_MASS, MAX_MASS);
670 TH1F* Dt =
new TH1F(
"Dt",
"", 1000, -0.5, 0.5);
671 Dt->SetMarkerStyle(20);
672 Dt->SetMarkerSize(0.5);
673 Dt->SetMarkerColor(4);
677 rhocc->SetTitle(
"0 < cc < 1");
678 rhocc->SetTitleOffset(1.3,
"Y");
679 rhocc->GetXaxis()->SetTitle(
"network correlation");
680 rhocc->GetYaxis()->SetTitle(
"#rho");
681 rhocc->SetStats(kFALSE);
682 rhocc->SetMarkerStyle(20);
683 rhocc->SetMarkerSize(0.5);
684 rhocc->SetMarkerColor(1);
688 rho_pf->SetTitle(
"chi2");
689 rho_pf->GetXaxis()->SetTitle(
"log10(chi2)");
690 rho_pf->SetTitleOffset(1.3,
"Y");
691 rho_pf->GetYaxis()->SetTitle(
"#rho");
692 rho_pf->SetMarkerStyle(20);
693 rho_pf->SetMarkerColor(1);
694 rho_pf->SetMarkerSize(0.5);
695 rho_pf->SetStats(kFALSE);
697 Float_t
xq[6] = {8.0, 15.0, 25.0, 35.0, 45.0, 55.0};
698 Float_t*
yq =
new Float_t[101];
699 for (
int i = 0;
i < 101;
i++) {
703 new TH2F(
"dchirp rec.",
"Chirp Mass estimate", 5, xq, 100, yq);
704 dchirp_rec->GetXaxis()->SetTitle(
"Chirp mass (M_{#odot})");
705 dchirp_rec->GetYaxis()->SetTitle(
706 "Chirp mass: injected-estimated (M_{#odot})");
707 dchirp_rec->GetXaxis()->SetTitleOffset(1.3);
708 dchirp_rec->GetYaxis()->SetTitleOffset(1.3);
709 dchirp_rec->GetXaxis()->SetTickLength(0.01);
710 dchirp_rec->GetYaxis()->SetTickLength(0.01);
711 dchirp_rec->GetXaxis()->CenterTitle(kTRUE);
712 dchirp_rec->GetYaxis()->CenterTitle(kTRUE);
713 dchirp_rec->GetXaxis()->SetTitleFont(42);
714 dchirp_rec->GetXaxis()->SetLabelFont(42);
715 dchirp_rec->GetYaxis()->SetTitleFont(42);
716 dchirp_rec->GetYaxis()->SetLabelFont(42);
717 dchirp_rec->SetMarkerStyle(20);
718 dchirp_rec->SetMarkerSize(0.5);
719 dchirp_rec->SetMarkerColor(2);
722 new TH3F(
"Distance vs dchirp rec.",
"", 5, 10.0, 50., 100, -50, 50.,
723 5000, MINDISTANCE / 1000., MAXDISTANCE / 1000);
726 D_dchirp_rec->GetXaxis()->SetTitle(
"Chirp mass (M_{#odot})");
727 D_dchirp_rec->GetYaxis()->SetTitle(
728 "Chirp mass: injected-estimated (M_{#odot})");
729 D_dchirp_rec->GetZaxis()->SetTitle(
"Distance (Mpc)");
730 D_dchirp_rec->GetXaxis()->SetTitleOffset(1.3);
731 D_dchirp_rec->GetYaxis()->SetTitleOffset(1.3);
732 D_dchirp_rec->GetXaxis()->SetTickLength(0.01);
733 D_dchirp_rec->GetYaxis()->SetTickLength(0.01);
734 D_dchirp_rec->GetXaxis()->CenterTitle(kTRUE);
735 D_dchirp_rec->GetYaxis()->CenterTitle(kTRUE);
736 D_dchirp_rec->GetXaxis()->SetTitleFont(42);
737 D_dchirp_rec->GetXaxis()->SetLabelFont(42);
738 D_dchirp_rec->GetYaxis()->SetTitleFont(42);
739 D_dchirp_rec->GetYaxis()->SetLabelFont(42);
740 D_dchirp_rec->SetMarkerStyle(20);
741 D_dchirp_rec->SetMarkerSize(0.5);
742 D_dchirp_rec->SetMarkerColor(2);
743 D_dchirp_rec->SetTitle(
"");
750 TChain
sim(
"waveburst");
756 if (
sim.GetListOfBranches()->FindObject(
"ifar")) {
757 MAXIFAR = TMath::CeilNint(
sim.GetMaximum(
"ifar") / CYS /
TRIALS);
758 cout <<
"Maximum empirically estimated IFAR : " << MAXIFAR <<
" [years]" 761 cout <<
"Missing ifar branch: either use cbc_plots or add it " 767 TH3F*
D_Mtot_rec3 =
new TH3F(
"Distance vs Mtot rec. vs ifar",
"", 100,
768 MINMtot, MAXMtot, 1000, MINDISTANCE / 1000.,
769 MAXDISTANCE / 1000., 1000, 0., MAXIFAR);
771 D_Mtot_rec3->SetMarkerStyle(20);
772 D_Mtot_rec3->SetMarkerSize(0.5);
773 D_Mtot_rec3->SetMarkerColor(4);
783 mdc.SetBranchAddress(
"time", mytime);
784 mdc.SetBranchAddress(
"mass", mass);
785 mdc.SetBranchAddress(
"factor", &factor);
786 mdc.SetBranchAddress(
"distance", &distance);
787 mdc.SetBranchAddress(
"mchirp", &mchirp);
788 mdc.SetBranchAddress(
"spin", spin);
798 liveZero = LIVE_ZERO;
800 cout <<
"ERROR! Missing zero lag livetime...Please add:" << endl;
801 cout <<
"\"#define LIVE_ZERO XXXXXXXXXX\" where XXXXXXXXXX is the " 802 "livetime in seconds to your config/user_pparameters.C file...." 812 "#GPS@L1 mass1 mass2 distance spinx1 spiny1 spinz1 " 813 "spinx2 spiny2 spinz2 \n");
814 finj << line << endl;
815 ofstream* finj_single =
new ofstream[
nfactor];
818 for (
int l = 0; l <
nfactor; l++) {
828 sprintf(fname3,
"%s/injected_signals_%d.txt",
netdir, l + 1);
832 finj_single[
l] << line << endl;
836 for (
int g = 0;
g < (
int)
mdc.GetEntries();
g++) {
838 ifactor = (
int)factor - 1;
841 mass[0] = SFmasses[
ifactor][0];
842 mass[1] = SFmasses[
ifactor][1];
844 mchirp = pow(mass[0] * mass[1], 3. / 5.) /
845 pow(mass[0] + mass[1], 1. / 5.);
848 inj_events->Fill(mass[0], mass[1]);
849 D_Mtot_inj->Fill(mass[1] + mass[0], distance);
852 for (
int i = 0;
i < 3;
i++) {
853 chi[
i] = (spin[
i] * mass[0] + spin[
i + 3] * mass[1]) /
857 inj_events_spin_mtot->Fill(chi[2], mass[1] + mass[0]);
864 if ((ifactor > nfactor - 1) || (ifactor < 0)) {
865 cout <<
"ifactor: " << ifactor << endl;
868 factor_events_inj[
ifactor].Fill(mass[0], mass[1]);
870 factor_events_spin_mtot_inj[
ifactor].Fill(chi[2],
879 "%10.3f %3.2f %3.2f %3.2f %3.2f %3.2f " 880 "%3.2f %3.2f %3.2f %3.2f\n",
881 mytime[0], mass[0], mass[1], distance, spin[0], spin[1],
882 spin[2], spin[3], spin[4], spin[5]);
883 finj << line << endl;
884 finj_single[
ifactor] << line << endl;
891 for (
int l = 0; l <
nfactor; l++) {
893 finj_single[
l].close();
897 NEVTS += factor_events_inj[
l].GetEntries();
900 cout <<
"Injected signals: " <<
mdc.GetEntries() << endl;
901 cout <<
"Injected signals in histogram factor_events_inj: " << NEVTS
905 float myifar,
ecor,
m1,
m2, netcc[3], neted, penalty;
911 float iSNR[3], sSNR[3];
912 sim.SetBranchAddress(
"mass", mass);
913 sim.SetBranchAddress(
"factor", &factor);
915 sim.SetBranchAddress(
"distance", &distance);
916 sim.SetBranchAddress(
"mchirp", &mchirp);
918 sim.SetBranchAddress(
"range", range);
919 sim.SetBranchAddress(
"chirp", chirp);
921 sim.SetBranchAddress(
"rho", rho);
922 sim.SetBranchAddress(
"netcc", netcc);
923 sim.SetBranchAddress(
"neted", &neted);
924 sim.SetBranchAddress(
"ifar", &myifar);
925 sim.SetBranchAddress(
"ecor", &ecor);
926 sim.SetBranchAddress(
"penalty", &penalty);
927 sim.SetBranchAddress(
"time", mytime);
928 sim.SetBranchAddress(
"iSNR", iSNR);
929 sim.SetBranchAddress(
"sSNR", sSNR);
930 sim.SetBranchAddress(
"spin", spin);
931 sim.SetBranchAddress(
"frequency", frequency);
934 cout <<
"Adding hveto flags.." << endl;
935 UChar_t veto_hveto_L1, veto_hveto_H1, veto_hveto_V1;
936 sim.SetBranchAddress(
"veto_hveto_L1", &veto_hveto_L1);
937 sim.SetBranchAddress(
"veto_hveto_H1", &veto_hveto_H1);
942 cout <<
"Adding cat3 flags.." << endl;
943 UChar_t veto_cat3_L1, veto_cat3_H1, veto_cat3_V1;
944 sim.SetBranchAddress(
"veto_cat3_L1", &veto_cat3_L1);
945 sim.SetBranchAddress(
"veto_cat3_H1", &veto_cat3_H1);
951 float** volume_first_shell =
new float*[
NBINS_mass1];
954 float** error_volume_first_shell =
new float*[
NBINS_mass1];
966 volume_first_shell[
i][
j] = 0.;
968 error_volume[
i][
j] = 0.;
969 error_volume_first_shell[
i][
j] = 0.;
970 error_radius[
i][
j] = 0.;
975 float** spin_mtot_volume =
976 new float*[NBINS_MTOT +
979 float** spin_mtot_radius =
new float*[NBINS_MTOT + 1];
980 float** error_spin_mtot_volume =
new float*[NBINS_MTOT + 1];
981 float** error_spin_mtot_radius =
new float*[NBINS_MTOT + 1];
983 for (
int i = 0;
i < NBINS_MTOT + 1;
i++) {
984 spin_mtot_volume[
i] =
new float[NBINS_SPIN + 1];
985 spin_mtot_radius[
i] =
new float[NBINS_SPIN + 1];
986 error_spin_mtot_volume[
i] =
new float[NBINS_SPIN + 1];
987 error_spin_mtot_radius[
i] =
new float[NBINS_SPIN + 1];
989 for (
int j = 0;
j < NBINS_SPIN + 1;
j++) {
990 spin_mtot_volume[
i][
j] = 0.;
991 error_spin_mtot_volume[
i][
j] = 0.;
994 spin_mtot_radius[
i][
j] = 0.;
995 error_spin_mtot_radius[
i][
j] = 0.;
1006 "#GPS@L1 FAR[Hz] eFAR[Hz] Pval " 1007 "ePval factor rho frequency iSNR sSNR \n");
1008 fev << line << endl;
1013 ofstream* fev_single =
new ofstream[
nfactor];
1014 for (
int l = 1; l < nfactor + 1; l++) {
1024 fev_single[l - 1] << line << endl;
1041 double dV, dV1, dV_spin_mtot, nevts, internal_volume;
1051 double BKG_LIVETIME_yr = liveTot /
CYS;
1052 double BKG_LIVETIME_Myr = BKG_LIVETIME_yr / (1.e6);
1055 cout <<
"Total live time ---> background: " << liveTot <<
" s" << endl;
1056 cout <<
"Total live time ---> background: " << BKG_LIVETIME_yr <<
" yr" 1058 cout <<
"Total live time ---> background: " << BKG_LIVETIME_Myr <<
" Myr" 1064 for (
int g = 0;
g < (
int)
sim.GetEntries();
g++) {
1066 ifactor = (
int)factor - 1;
1082 if (netcc[0] <=
T_cor) {
1087 if ((mytime[0] - mytime[nIFO]) < -
T_win ||
1088 (mytime[0] - mytime[
nIFO]) > 2 *
T_win) {
1093 if (neted / ecor >=
T_vED) {
1099 if (penalty <=
T_pen) {
1115 if (++cnt % 1000 == 0) {
1116 cout << cnt <<
" - ";
1118 Dt->Fill(mytime[0] - mytime[nIFO]);
1122 mass[0] = SFmasses[
ifactor][0];
1123 mass[1] = SFmasses[
ifactor][1];
1125 chirp[0] = pow(mass[0] * mass[1], 3. / 5.) /
1126 pow(mass[0] + mass[1], 1. / 5.);
1135 if (range[1] == 0.0) {
1139 D_Mtot_rec3->Fill(mass[1] + mass[0], range[1], myifar / TRIALS / CYS);
1143 rhocc->Fill(netcc[0], rho[
pp_irho]);
1145 float chi2 = penalty > 0 ? log10(penalty) : 0;
1146 rho_pf->Fill(chi2, rho[pp_irho]);
1150 l = TMath::FloorNint((m2 - min_mass2) / MASS_BIN);
1151 if ((l >= NBINS_mass2) || (l < 0)) {
1152 cout <<
"Underflow/Overflow => Enlarge mass range! l=" << l
1153 <<
" NBINS_mass=" << NBINS_mass2 <<
" m2=" << m2
1154 <<
" min_mass2=" << min_mass2 << endl;
1157 m = TMath::FloorNint((m1 - MIN_MASS) / MASS_BIN);
1158 if ((m >= NBINS_mass) || (m < 0)) {
1159 cout <<
"Underflow/Overflow => Enlarge mass range! m=" << m
1160 <<
" NBINS_mass=" << NBINS_mass <<
" m1=" << m1
1161 <<
" MIN_MASS=" << MIN_MASS << endl;
1164 rec_events->Fill(mass[0], mass[1]);
1165 D_dchirp_rec->Fill(chirp[0], chirp[0] - chirp[1],
1167 dchirp_rec->Fill(chirp[0], chirp[0] - chirp[1]);
1170 for (
int i = 0;
i < 3;
i++) {
1171 chi[
i] = (spin[
i] * mass[0] + spin[
i + 3] * mass[1]) /
1172 (mass[1] + mass[0]);
1175 mtt = TMath::FloorNint((m1 + m2 - MIN_MASS) / MASS_BIN / 2.);
1176 if ((mtt > NBINS_MTOT) || (mtt < 0)) {
1177 cout <<
"mt=" << mtt <<
" is larger than NBINS_MTOT=" << NBINS_MTOT
1178 <<
" Mtot=" << m1 + m2 <<
" minMtot=" << MIN_MASS << endl;
1181 cz = TMath::FloorNint((chi[2] - MINCHI) / CHI_BIN);
1182 if ((cz > NBINS_SPIN) || (cz < 0)) {
1183 cout <<
"cz=" << cz <<
" is larger than NBINS_SPIN=" << NBINS_SPIN
1184 <<
" chi[2]=" << chi[2] <<
" MINCHI=" << MINCHI << endl;
1187 rec_events_spin_mtot->Fill(chi[2], mass[1] + mass[0]);
1201 }
else if (DDistrUniform) {
1204 }
else if (DDistrChirpMass) {
1207 pow(chirp[0] / 1.22,
1214 else if (Redshift) {
1216 nevts = (double)NINJ[ifactor];
1221 cout <<
"No defined distance distribution? " 1222 "WARNING: Assuming uniform in volume" 1227 if (FixedFiducialVolume) {
1235 nevts = factor_events_inj[
ifactor].GetEntries();
1242 nevts = (double)NINJ[ifactor];
1243 #endif // vector is needed.... 1248 if (FixedFiducialVolume) {
1250 nevts += factor_events_spin_mtot_inj[
i].GetBinContent(
1254 nevts = factor_events_spin_mtot_inj[
ifactor].GetBinContent(
1258 nevts = (double)NINJ[ifactor];
1265 dV_spin_mtot = dV / nevts;
1269 nevts += factor_events_inj[
i].GetBinContent(m + 1, l + 1);
1272 nevts = (double)NINJ[ifactor];
1281 factor_events_rec->Fill(mass[0], mass[1]);
1287 nT = TMath::Min(TMath::Floor((rho[pp_irho] -
RHO_MIN) /
RHO_BIN),
1288 (
double)RHO_NBINS) +
1290 for (
int i = 0;
i < nT;
i++) {
1294 eVrho[
i] += pow(dV, 2);
1297 eVrho[
i] += pow(dV1, 2);
1306 vifar.push_back(myifar);
1309 "%10.3f %4.3e %4.3e %4.3e %4.3e %3.2f %3.2f " 1310 "%3.2f %3.2f %3.2f\n",
1311 mytime[2], 1. / myifar,
1312 TMath::Sqrt(TMath::Nint(liveTot / myifar)) / liveTot,
1314 TMath::Sqrt(TMath::Nint(liveTot / myifar)) / liveTot *
1316 factor, rho[pp_irho], frequency[0], sqrt(iSNR[0] + iSNR[1]),
1317 sqrt(sSNR[0] + sSNR[1]));
1320 fev << line << endl;
1321 fev_single[
ifactor] << line << endl;
1325 error_volume[
m][
l] += pow(dV, 2);
1327 spin_mtot_volume[
mtt][
cz] += dV_spin_mtot;
1330 error_spin_mtot_volume[
mtt][
cz] += TMath::Power(dV_spin_mtot, 2.0);
1336 for (
int l = 0; l <
nfactor; l++) {
1337 fev_single[
l].close();
1340 cout <<
"Recovered entries: " << cnt << endl;
1341 cout <<
"Recovered entries: " << cnt2 << endl;
1342 cout <<
"Recovered entries cut by frequency: " << cntfreq << endl;
1343 cout <<
"Recovered entries vetoed: " << countv << endl;
1344 cout <<
"dV : " << dV <<
" dV1 : " << dV1 << endl;
1349 for (
int i = 0;
i < vdv.size();
i++) {
1351 vdv[
i] += internal_volume;
1355 if (Vrho[
i] > 0.0) {
1356 Vrho[
i] += internal_volume;
1360 for (
int i = 0;
i < NBINS_MTOT + 1;
i++) {
1361 for (
int j = 0;
j < NBINS_SPIN + 1;
j++) {
1362 if (spin_mtot_volume[
i][
j] > 0.0) {
1363 spin_mtot_volume[
i][
j] += internal_volume;
1370 if (volume[
i][
j] > 0.0) {
1371 volume[
i][
j] += internal_volume;
1377 Int_t* mindex =
new Int_t[vdv.size()];
1378 TMath::Sort((
int)vdv.size(), &vifar[0], mindex,
true);
1386 vV.push_back(vdv[mindex[0]]);
1387 veV.push_back(pow(vdv[mindex[0]], 2));
1388 vsifar.push_back(vifar[mindex[0]]);
1389 vfar.push_back(1. / vifar[mindex[0]]);
1390 vefar.push_back(TMath::Sqrt(TMath::Nint(liveTot / vifar[mindex[0]])) /
1394 for (
int i = 1;
i < vdv.size();
i++) {
1395 if (vifar[mindex[
i]] == 0) {
1398 if (vifar[mindex[
i]] == vsifar[mcount]) {
1400 veV[
mcount] += pow(vdv[mindex[
i]], 2);
1402 vsifar.push_back(vifar[mindex[
i]]);
1403 vfar.push_back(1. / vifar[mindex[i]]);
1405 TMath::Sqrt(TMath::Nint(liveTot / vifar[mindex[i]])) / liveTot);
1407 TMath::Sqrt(TMath::Nint(liveTot * vifar[mindex[i]])));
1408 vV.push_back(vV[mcount] + vdv[mindex[i]]);
1409 veV.push_back(veV[mcount] + pow(vdv[mindex[i]], 2));
1413 cout <<
"Length of ifar/volume vector: " << vV.size() << endl;
1414 for (
int i = 0;
i < vV.size();
i++) {
1415 veV[
i] = TMath::Sqrt(veV[
i]);
1426 new TGraphErrors(vV.size(), &vfar[0], &vV[0], &vefar[0], &veV[0]);
1427 gr->GetYaxis()->SetTitle(
"Volume [Mpc^{3}]");
1429 gr->GetYaxis()->SetTitle(
"Volume*Time [Gpc^{3}*yr]");
1431 gr->GetXaxis()->SetTitle(
"FAR [yr^{-1}]");
1432 gr->GetXaxis()->SetTitleOffset(1.3);
1433 gr->GetYaxis()->SetTitleOffset(1.25);
1434 gr->GetXaxis()->SetTickLength(0.01);
1435 gr->GetYaxis()->SetTickLength(0.01);
1436 gr->GetXaxis()->CenterTitle(kTRUE);
1437 gr->GetYaxis()->CenterTitle(kTRUE);
1438 gr->GetXaxis()->SetTitleFont(42);
1439 gr->GetXaxis()->SetLabelFont(42);
1440 gr->GetYaxis()->SetTitleFont(42);
1441 gr->GetYaxis()->SetLabelFont(42);
1442 gr->SetMarkerStyle(20);
1443 gr->SetMarkerSize(1.0);
1444 gr->SetMarkerColor(1);
1445 gr->SetLineColor(kBlue);
1462 FMC += factor_events_inj[
i].GetEntries() / NINJ[
i];
1463 if (factor_events_inj[
i].GetEntries() > 0) {
1467 Tscale =
TMC * FMC / actual_nfactor /
1472 for (
int i = 0;
i < vV.size();
i++) {
1473 vR.push_back(pow(3. / (4. *
TMath::Pi() * Tscale) * vV[
i], 1. / 3.));
1474 veR.push_back(pow(3. / (4 *
TMath::Pi() * Tscale), 1. / 3.) * 1. / 3 *
1475 pow(vV[i], -2. / 3.) * veV[i]);
1477 cout <<
"Zero-lag livetime: " << Tscale * 365.25 <<
" [days]" << endl;
1481 new TGraphErrors(vR.size(), &vfar[0], &vR[0], &vefar[0], &veR[0]);
1482 gr2->GetYaxis()->SetTitle(
"Sensitive Range [Mpc]");
1484 gr2->GetYaxis()->SetTitle(
"Sensitive Range [Gpc]");
1486 gr2->GetXaxis()->SetTitle(
"FAR [yr^{-1}]");
1487 gr2->GetXaxis()->SetTitleOffset(1.3);
1488 gr2->GetYaxis()->SetTitleOffset(1.25);
1489 gr2->GetXaxis()->SetTickLength(0.01);
1490 gr2->GetYaxis()->SetTickLength(0.01);
1491 gr2->GetXaxis()->CenterTitle(kTRUE);
1492 gr2->GetYaxis()->CenterTitle(kTRUE);
1493 gr2->GetXaxis()->SetTitleFont(42);
1494 gr2->GetXaxis()->SetLabelFont(42);
1495 gr2->GetYaxis()->SetTitleFont(42);
1496 gr2->GetYaxis()->SetLabelFont(42);
1497 gr2->SetMarkerStyle(20);
1498 gr2->SetMarkerSize(1.0);
1499 gr2->SetMarkerColor(1);
1500 gr2->SetLineColor(kBlue);
1510 FILE* frange = fopen(fname,
"w");
1511 fprintf(frange,
"#rho FAR[year^{-1}] eFAR range[Gpc] erange\n");
1512 for (
int i = 0;
i < vR.size();
i++) {
1513 fprintf(frange,
"%3.3g %4.3g %4.3g %4.4g %4.4g\n", 0.0, vfar[
i],
1514 vefar[i], vR[i], veR[i]);
1524 gSystem->ExpandPathName(
"$HOME_CWB/macros/DrawRadiusIFARplots.C"));
1529 cout <<
"Volume Density distribution passed as an option: " <<
opt.Data()
1533 MINMtot, MAXMtot, MAXDISTANCE / 1000, 10,
1536 "mchirp", MINCHIRP, MAXCHIRP,
1539 0.1, 0.25, MAXDISTANCE / 1000, 10,
T_ifar,
1544 -1., 1., MAXDISTANCE / 1000, 10,
T_ifar,
1547 "chieff", -1.0, 1.0, MAXDISTANCE / 1000, 10,
1550 0.0, 1.0, MAXDISTANCE / 1000, 10,
T_ifar,
1554 MAXDISTANCE / 1000, MAXDISTANCE / 1000, 30,
T_ifar,
T_win, nIFO);
1560 eVrho[
i] = TMath::Sqrt(eVrho[
i]);
1562 cout <<
"Vrho[0] = " << Vrho[0] <<
" +/- " << eVrho[0] << endl;
1563 cout <<
"Vrho[RHO_NBINS-1] = " << Vrho[RHO_NBINS - 1] <<
" +/- " 1564 << eVrho[RHO_NBINS - 1] << endl;
1567 inj_events->Draw(
"colz");
1569 int MAX_AXIS_Z = inj_events->GetBinContent(inj_events->GetMaximumBin()) + 1;
1570 inj_events->GetZaxis()->SetRangeUser(0, MAX_AXIS_Z);
1573 sprintf(inj_title,
"Injected events");
1576 new TPaveText(0.325301, 0.926166, 0.767068, 0.997409,
"blNDC");
1577 p_inj->SetBorderSize(0);
1578 p_inj->SetFillColor(0);
1579 p_inj->SetTextColor(1);
1580 p_inj->SetTextFont(32);
1581 p_inj->SetTextSize(0.045);
1582 TText*
text = p_inj->AddText(inj_title);
1598 hcandle->SetMarkerSize(0.5);
1599 hcandle->Draw(
"CANDLE");
1604 dchirp_rec->SetMarkerSize(0.5);
1605 dchirp_rec->Draw(
"CANDLE");
1627 c1->SetLogy(kFALSE);
1628 rhocc->Draw(
"colz");
1634 c1->SetLogx(kFALSE);
1638 c1->SetLogy(kFALSE);
1639 rho_pf->Draw(
"colz");
1647 char sel[1024] =
"";
1648 char newcut[2048] =
"";
1649 char newcut2[2048] =
"";
1657 myptitle =
"Number of reconstructed events as a function of injected SNR";
1658 gStyle->SetOptStat(0);
1660 myxtitle =
"Injected network snr";
1664 myytitle =
"counts";
1668 sprintf(sel,
"sqrt(pow(snr[%d],2)", 0);
1669 for (
int i = 1;
i <
nIFO;
i++) {
1670 sprintf(sel,
"%s + pow(snr[%d],2)", sel,
i);
1673 sprintf(sel,
"%s)>>hist(500)", sel);
1677 cout <<
"nmdc : " << nmdc << endl;
1679 TH2F* htemp = (TH2F*)gPad->GetPrimitive(
"hist");
1680 htemp->GetXaxis()->SetTitleOffset(1.35);
1681 htemp->GetYaxis()->SetTitleOffset(1.50);
1682 htemp->GetXaxis()->CenterTitle(
true);
1683 htemp->GetYaxis()->CenterTitle(
true);
1684 htemp->GetXaxis()->SetLabelFont(42);
1685 htemp->GetXaxis()->SetTitleFont(42);
1686 htemp->GetYaxis()->SetLabelFont(42);
1687 htemp->GetYaxis()->SetTitleFont(42);
1688 htemp->GetXaxis()->SetTitle(myxtitle);
1689 htemp->GetYaxis()->SetTitle(myytitle);
1692 htemp->GetXaxis()->SetRangeUser(
1693 1, pow(10., TMath::Ceil(TMath::Log10(htemp->GetMaximum()))));
1694 htemp->GetYaxis()->SetRangeUser(
1695 1, pow(10., TMath::Ceil(TMath::Log10(htemp->GetMaximum()))));
1696 htemp->SetLineColor(kBlack);
1697 htemp->SetLineWidth(3);
1699 "(((time[0]-time[%d])>-%g) || (time[0]-time[%d])<%g) " 1704 sprintf(sel,
"sqrt(iSNR[%d]", 0);
1705 for (
int i = 1;
i <
nIFO;
i++) {
1706 sprintf(sel,
"%s + iSNR[%d]", sel,
i);
1708 sprintf(sel,
"%s)>>hist2(500)", sel);
1709 cout <<
"cut " << newcut << endl;
1713 sim.Draw(sel, newcut,
"same");
1714 TH2F* htemp2 = (TH2F*)gPad->GetPrimitive(
"hist2");
1715 htemp2->SetFillColor(kRed);
1716 htemp2->SetFillStyle(3017);
1717 htemp2->SetLineColor(kRed);
1718 htemp2->SetLineWidth(2);
1721 cout <<
"nwave : " << nwave << endl;
1726 cout <<
"final cut " << newcut2 << endl;
1728 sel_fin.ReplaceAll(
"hist2",
"hist3");
1732 sim.Draw(sel_fin, newcut2,
"same");
1733 TH2F* htemp3 = (TH2F*)gPad->GetPrimitive(
"hist3");
1734 htemp3->SetFillColor(kBlue);
1735 htemp3->SetFillStyle(3017);
1736 htemp3->SetLineColor(kBlue);
1737 htemp3->SetLineWidth(2);
1739 cout <<
"nwave_final : " << nwave_final << endl;
1743 htemp->SetTitle(
title);
1745 leg_snr =
new TLegend(0.53,0.70,0.95,0.92,
"",
"brNDC");
1746 sprintf(lab,
"Injections Average SNR: %g", htemp->GetMean());
1747 leg_snr->AddEntry(
"", lab,
"a");
1748 sprintf(lab,
"Injected: %i", nmdc);
1749 leg_snr->AddEntry(htemp, lab,
"l");
1750 sprintf(lab,
"Found(minimal cuts): %i", nwave);
1751 leg_snr->AddEntry(htemp2, lab,
"l");
1752 sprintf(lab,
"Found(final cuts): %i", nwave_final);
1753 leg_snr->AddEntry(htemp3, lab,
"l");
1757 sprintf(fname,
"%s/Injected_snr_distributions.png",
netdir);
1762 sim.SetMarkerStyle(20);
1763 sim.SetMarkerSize(0.5);
1764 sim.SetMarkerColor(kRed);
1766 sprintf(sel,
"sqrt(sSNR[%d]", 0);
1767 for (
int i = 1;
i <
nIFO;
i++) {
1768 sprintf(sel,
"%s + sSNR[%d]", sel,
i);
1770 sprintf(sel,
"%s):sqrt(iSNR[%d]", sel, 0);
1771 for (
int i = 1;
i <
nIFO;
i++) {
1772 sprintf(sel,
"%s + iSNR[%d]", sel,
i);
1774 sprintf(sel,
"%s)>>hist4(500)", sel);
1775 sim.Draw(sel, newcut,
"");
1776 TH2F*
htemp4 = (TH2F*)gPad->GetPrimitive(
"hist4");
1777 htemp4->SetTitle(
"Estimated vs Injected network SNR");
1778 htemp4->GetXaxis()->SetTitleOffset(1.35);
1779 htemp4->GetYaxis()->SetTitleOffset(1.50);
1780 htemp4->GetXaxis()->CenterTitle(
true);
1781 htemp4->GetYaxis()->CenterTitle(
true);
1782 htemp4->GetXaxis()->SetLabelFont(42);
1783 htemp4->GetXaxis()->SetTitleFont(42);
1784 htemp4->GetYaxis()->SetLabelFont(42);
1785 htemp4->GetYaxis()->SetTitleFont(42);
1786 htemp4->GetXaxis()->SetTitle(
"Injected network SNR");
1787 htemp4->GetYaxis()->SetTitle(
"Estimated network SNR");
1788 htemp4->GetXaxis()->SetRangeUser(
1789 5, pow(10., TMath::Ceil(TMath::Log10(htemp4->GetMaximum()))));
1790 htemp4->GetYaxis()->SetRangeUser(
1791 5, pow(10., TMath::Ceil(TMath::Log10(htemp4->GetMaximum()))));
1796 sim.SetMarkerColor(kBlue);
1797 sim.Draw(sel, newcut2,
"same");
1803 sprintf(fname,
"%s/Estimated_snr_vs_Injected_snr.eps",
netdir);
1809 sprintf(sel,
"(sqrt(sSNR[%d]", 0);
1810 for (
int i = 1;
i <
nIFO;
i++) {
1811 sprintf(sel,
"%s + sSNR[%d]", sel,
i);
1813 sprintf(sel,
"%s)-sqrt(iSNR[%d]", sel, 0);
1814 for (
int i = 1;
i <
nIFO;
i++) {
1815 sprintf(sel,
"%s + iSNR[%d]", sel,
i);
1817 sprintf(sel,
"%s))/sqrt(iSNR[%d]", sel, 0);
1818 for (
int i = 1;
i <
nIFO;
i++) {
1819 sprintf(sel,
"%s + iSNR[%d]", sel,
i);
1821 sprintf(sel,
"%s)>>hist5", sel);
1822 cout <<
"Selection: " << sel << endl;
1824 gStyle->SetOptStat(1);
1825 gStyle->SetOptFit(1);
1828 sim.Draw(sel, newcut2);
1829 TH2F*
htemp5 = (TH2F*)gPad->GetPrimitive(
"hist5");
1830 htemp5->SetTitle(
"");
1831 htemp5->GetXaxis()->SetTitleOffset(1.35);
1832 htemp5->GetYaxis()->SetTitleOffset(1.50);
1833 htemp5->GetXaxis()->CenterTitle(
true);
1834 htemp5->GetYaxis()->CenterTitle(
true);
1835 htemp5->GetXaxis()->SetLabelFont(42);
1836 htemp5->GetXaxis()->SetTitleFont(42);
1837 htemp5->GetYaxis()->SetLabelFont(42);
1838 htemp5->GetYaxis()->SetTitleFont(42);
1839 htemp5->GetXaxis()->SetTitle(
"(Estimated snr -Injected snr)/Injected snr");
1840 htemp5->GetYaxis()->SetTitle(
"Counts");
1841 sim.GetHistogram()->Fit(
"gaus");
1847 gStyle->SetOptStat(0);
1848 gStyle->SetOptFit(0);
1901 D_Mtot_inj->GetYaxis()->SetRangeUser(10., 3 * MAXDISTANCE);
1902 D_Mtot_inj->Draw(
"p");
1903 D_Mtot_rec3->GetZaxis()->SetRange(0, 1.);
1904 TH1*
t0 = D_Mtot_rec3->Project3D(
"yx_0");
1905 t0->SetMarkerColor(kBlue);
1907 D_Mtot_rec3->GetZaxis()->SetRange(1., 10.);
1908 TH1*
t1 = D_Mtot_rec3->Project3D(
"yx_1");
1909 t1->SetMarkerColor(kGreen + 2);
1911 D_Mtot_rec3->GetZaxis()->SetRange(10., 100.);
1912 TH1*
t10 = D_Mtot_rec3->Project3D(
"yx_10");
1913 t10->SetMarkerColor(kCyan);
1914 t10->Draw(
"p same");
1915 D_Mtot_rec3->GetZaxis()->SetRange(100., MAXIFAR);
1916 TH1*
t100 = D_Mtot_rec3->Project3D(
"yx_100");
1917 t100->SetMarkerColor(kOrange);
1918 t100->Draw(
"p same");
1920 new TLegend(0.579719, 0.156425, 0.85, 0.327409,
"",
"brNDC");
1921 leg_D2->AddEntry(t0,
"IFAR<1 yr",
"p");
1922 leg_D2->AddEntry(t1,
"1 yr < IFAR < 10 yr",
"p");
1923 leg_D2->AddEntry(t10,
"10 yr < IFAR < 100 yr",
"p");
1924 leg_D2->AddEntry(t100,
"IFAR > 100 yr",
"p");
1926 leg_D2->SetFillColor(0);
1929 sprintf(fname,
"%s/Distance_vs_total_mass_ifar.eps",
netdir);
1940 efficiency->SetName(
"efficiency");
1941 efficiency->Divide(inj_events);
1942 efficiency->GetZaxis()->SetRangeUser(0, 1.0);
1943 efficiency->SetTitle(
"");
1945 efficiency->Draw(
"colz text");
1947 TExec*
ex1 =
new TExec(
"ex1",
"gStyle->SetPaintTextFormat(\".2f\");");
1951 sprintf(eff_title,
"Efficiency");
1953 sprintf(eff_title,
"%s (%.1f < #chi < %.1f)", eff_title, MINCHI,
1958 new TPaveText(0.325301, 0.926166, 0.767068, 0.997409,
"blNDC");
1959 p_eff->SetBorderSize(0);
1960 p_eff->SetFillColor(0);
1961 p_eff->SetTextColor(1);
1962 p_eff->SetTextFont(32);
1963 p_eff->SetTextSize(0.045);
1964 text = p_eff->AddText(eff_title);
1968 sprintf(fname,
"%s/Efficiency_mass1_mass2_chi_%f_%f.png",
netdir,
1977 efficiency_first_shell->Divide(&factor_events_inj[nfactor - 1]);
1991 if (factor_events_rec->GetBinContent(
j + 1,
k + 1) != 0.) {
2001 if (error_volume[
j][
k] != 0.) {
2002 error_volume[
j][
k] = TMath::Sqrt(error_volume[
j][
k]);
2005 radius[
j][
k] = pow(3. * volume[
j][
k] / (4 *
TMath::Pi() * Tscale),
2009 if (volume[
j][
k] != 0.)
2010 error_radius[
j][
k] =
2011 (1. / 3) * pow(3. / (4 *
TMath::Pi() * Tscale), 1. / 3) *
2012 pow(1. / pow(volume[
j][
k], 2), 1. / 3) * error_volume[
j][k];
2015 cout <<
"Average Volume at threshold V0 = " << V0 / massbins <<
"on " 2016 << massbins <<
" mass bins" << endl;
2019 TH2F*
h_radius =
new TH2F(
"h_radius",
"", NBINS_mass, MIN_MASS, MAX_MASS,
2020 NBINS_mass2, min_mass2, max_mass2);
2021 h_radius->GetXaxis()->SetRangeUser(MIN_plot_mass1, MAX_plot_mass1);
2022 h_radius->GetYaxis()->SetRangeUser(MIN_plot_mass2, MAX_plot_mass2);
2023 h_radius->GetXaxis()->SetTitle(
"Mass 1 (M_{#odot})");
2024 h_radius->GetYaxis()->SetTitle(
"Mass 2 (M_{#odot})");
2025 h_radius->GetZaxis()->SetTitle(
"Sensitive Distance [Gpc]");
2026 h_radius->GetXaxis()->SetTitleOffset(1.3);
2027 h_radius->GetYaxis()->SetTitleOffset(1.25);
2028 h_radius->GetZaxis()->SetTitleOffset(1.5);
2029 h_radius->GetXaxis()->CenterTitle(kTRUE);
2030 h_radius->GetYaxis()->CenterTitle(kTRUE);
2031 h_radius->GetZaxis()->CenterTitle(kTRUE);
2032 h_radius->GetXaxis()->SetNdivisions(410);
2033 h_radius->GetYaxis()->SetNdivisions(410);
2034 h_radius->GetXaxis()->SetTickLength(0.01);
2035 h_radius->GetYaxis()->SetTickLength(0.01);
2036 h_radius->GetZaxis()->SetTickLength(0.01);
2037 h_radius->GetXaxis()->SetTitleFont(42);
2038 h_radius->GetXaxis()->SetLabelFont(42);
2039 h_radius->GetYaxis()->SetTitleFont(42);
2040 h_radius->GetYaxis()->SetLabelFont(42);
2041 h_radius->GetZaxis()->SetLabelFont(42);
2042 h_radius->GetZaxis()->SetLabelSize(0.03);
2043 h_radius->SetTitle(
"");
2044 h_radius->SetMarkerSize(1.5);
2045 h_radius->SetMarkerColor(kWhite);
2054 h_radius->SetBinContent(
i,
j, radius[
i-1][
j-1]*0.001);
2059 h_radius->SetBinError(
i,
j, error_radius[
i-1][
j-1]*0.001);
2063 h_radius->SetContour(
NCont);
2064 h_radius->SetEntries(1);
2067 h_radius->Draw(
"colz TEXT");
2071 h_radius->GetZaxis()->SetRangeUser(0, MAX_EFFECTIVE_RADIUS / 2./1000);
2073 gStyle->SetPaintTextFormat(
"4.2f");
2079 sprintf(radius_title,
"%s : Effective radius (Mpc)", networkname);
2081 p_radius =
new TPaveText(0.325301, 0.926166, 0.767068, 0.997409,
"blNDC");
2087 text =
p_radius->AddText(radius_title);
2100 TH2F* chirp_mass =
new TH2F(
2101 "Chirp_Mass",
"", NBINS_mass * 10, MIN_plot_mass1, MAX_plot_mass1 * 1.1,
2102 NBINS_mass2 * 10, MIN_plot_mass2, MAX_plot_mass2 * 1.1);
2103 for (Int_t
i = 0;
i < NBINS_mass * 10;
i++) {
2104 for (Int_t
j = 0;
j < NBINS_mass2 * 10;
j++) {
2105 M1 = MIN_plot_mass1 +
2106 i * (MAX_plot_mass1 - MIN_plot_mass1 * 1.1) / NBINS_mass / 10.;
2107 M2 = MIN_plot_mass2 +
2108 j * (MAX_plot_mass2 - MIN_plot_mass2 * 1.1) / NBINS_mass / 10.;
2109 chirp_mass->SetBinContent(
2111 (
float)TMath::Power(pow(M1 * M2, 3.) / (M1 + M2), 1. / 5));
2117 contours[
i] = TMath::Nint((
i + 1) * MAXCHIRP / CONTOURS);
2119 chirp_mass->GetZaxis()->SetRangeUser(0, MAXCHIRP);
2121 chirp_mass->SetContour(CONTOURS, contours);
2123 TCanvas* c1t =
new TCanvas(
"c1t",
"Contour List", 610, 0, 600, 600);
2124 c1t->SetTopMargin(0.15);
2127 chirp_mass->Draw(
"CONT Z LIST");
2132 (TObjArray*)gROOT->GetListOfSpecials()->FindObject(
"contours");
2133 TList* contLevel = NULL;
2134 TGraph* curv = NULL;
2139 if (conts == NULL) {
2140 printf(
"*** No Contours Were Extracted!\n");
2144 TotalConts = conts->GetSize();
2147 printf(
"TotalConts = %d\n", TotalConts);
2150 contLevel = (TList*)conts->At(
i);
2151 printf(
"Contour %d has %d Graphs\n",
i, contLevel->GetSize());
2152 nGraphs += contLevel->GetSize();
2157 Tl.SetTextSize(0.02);
2160 contLevel = (TList*)conts->At(
i);
2163 printf(
"Z-Level Passed in as: Z = %f\n", z0);
2166 curv = (TGraph*)contLevel->First();
2167 for (
int j = 0;
j < contLevel->GetSize();
j++) {
2168 point = curv->GetN() - 1;
2169 curv->GetPoint(point, x0, Y0);
2174 while (((x0 < MIN_plot_mass1) || (x0 > MAX_plot_mass1) ||
2175 (Y0 < MIN_plot_mass2) || (Y0 > MAX_plot_mass2)) &&
2177 curv->GetPoint(point, x0, Y0);
2182 curv->SetLineWidth(1);
2183 curv->SetLineStyle(3);
2186 printf(
"\tGraph: %d -- %d Elements\n", nGraphs, curv->GetN());
2187 printf(
"\tCoordinate Point # %d : x0 = %f y0 = %f \n", point, x0,
2193 gc = (TGraph*)curv->Clone();
2197 sprintf(val,
"#it{M_{c}}=%g", z0);
2199 Tl.DrawLatex(x0 - 1., Y0 + 0.5, val);
2211 #ifdef PLOT_MASS_RATIO 2212 TH2F* mass_ratio =
new TH2F(
2213 "Mass_Ratio",
"", NBINS_mass * 10, MIN_plot_mass1, MAX_plot_mass1 * 1.1,
2214 NBINS_mass2 * 10, MIN_plot_mass2, MAX_plot_mass2 * 1.1);
2216 for (
int i = 0;
i < NBINS_mass * 10;
i++) {
2217 for (
int j = 0;
j < NBINS_mass * 10;
j++) {
2219 i * (MAX_plot_mass1 - MIN_plot_mass1 * 1.1) / NBINS_mass / 10.;
2221 j * (MAX_plot_mass2 - MIN_plot_mass2 * 1.1) / NBINS_mass / 10.;
2223 mass_ratio->SetBinContent(
i,
j, (
float)M1 / M2);
2227 Double_t contours2[5];
2234 mass_ratio->SetContour(5, contours2);
2236 TCanvas* c1t2 =
new TCanvas(
"c1t2",
"Contour List2", 610, 0, 600, 600);
2237 c1t2->SetTopMargin(0.15);
2240 mass_ratio->Draw(
"CONT Z LIST");
2245 (TObjArray*)gROOT->GetListOfSpecials()->FindObject(
"contours");
2246 TList* contLevel2 = NULL;
2247 TGraph* curv2 = NULL;
2253 if (conts2 == NULL) {
2254 printf(
"*** No Contours Were Extracted!\n");
2258 TotalConts = conts2->GetSize();
2260 printf(
"TotalConts = %d\n", TotalConts);
2263 contLevel2 = (TList*)conts2->At(
i);
2264 printf(
"Contour %d has %d Graphs\n",
i, contLevel2->GetSize());
2265 nGraphs += contLevel2->GetSize();
2269 Tl2.SetTextSize(0.02);
2272 contLevel2 = (TList*)conts2->At(
i);
2275 printf(
"Z-Level Passed in as: Z = %f\n", z0);
2278 curv2 = (TGraph*)contLevel2->First();
2280 for (
int j = 0;
j < contLevel2->GetSize();
j++) {
2281 point = curv2->GetN() - 1;
2282 curv2->GetPoint(point, x0, Y0);
2284 printf(
"\tCoordinate Point # %d : x0 = %f y0 = %f \n", point, x0,
2287 while (((x0 < MIN_plot_mass1) || (x0 > MAX_plot_mass1 - 4.) ||
2288 (Y0 < MIN_plot_mass2) || (Y0 > MAX_plot_mass2 - 2)) &&
2290 curv2->GetPoint(point, x0, Y0);
2294 curv2->SetLineWidth(1);
2295 curv2->SetLineStyle(3);
2298 printf(
"\tGraph: %d -- %d Elements\n", nGraphs, curv2->GetN());
2299 printf(
"\tCoordinate Point # %d : x0 = %f y0 = %f \n", point, x0,
2305 gc2 = (TGraph*)curv2->Clone();
2308 sprintf(val,
"#it{q}=%.2g", z0);
2309 Tl2.DrawLatex(x0, Y0, val);
2330 int spin_mtot_bins = 0;
2331 double V0_spin_mtot = 0.0;
2332 for (
int j = 0;
j < NBINS_MTOT;
j++) {
2342 if (spin_mtot_volume[
j][
k] != 0.) {
2348 V0_spin_mtot += spin_mtot_volume[
j][
k];
2349 error_spin_mtot_volume[
j][
k] = TMath::Sqrt(
2350 error_spin_mtot_volume
2358 spin_mtot_radius[
j][
k] = pow(3. * spin_mtot_volume[
j][
k] /
2362 error_spin_mtot_radius[
j][
k] =
2364 pow(3. / (4 *
TMath::Pi() * Tscale), 1. / 3) *
2365 pow(1. / pow(spin_mtot_volume[
j][
k], 2), 1. / 3) *
2366 error_spin_mtot_volume[
j][k];
2374 cout <<
"Average Spin-Mtot Volume at threshold V0 = " 2375 << V0_spin_mtot / spin_mtot_bins << endl;
2378 TH2F* h_spin_mtot_radius =
2379 new TH2F(
"h_spin_mtot_radius",
"", NBINS_SPIN, MINCHI, MAXCHI,
2380 NBINS_MTOT, MIN_MASS, MAX_MASS);
2383 h_spin_mtot_radius->GetXaxis()->SetTitle(
"#chi_{z}");
2384 h_spin_mtot_radius->GetYaxis()->SetTitle(
"Total Mass (M_{#odot})");
2385 h_spin_mtot_radius->GetZaxis()->SetTitle(
"Sensitive Distance [Gpc]");
2386 h_spin_mtot_radius->GetXaxis()->SetTitleOffset(1.3);
2387 h_spin_mtot_radius->GetYaxis()->SetTitleOffset(1.25);
2388 h_spin_mtot_radius->GetZaxis()->SetTitleOffset(1.5);
2389 h_spin_mtot_radius->GetXaxis()->CenterTitle(kTRUE);
2390 h_spin_mtot_radius->GetYaxis()->CenterTitle(kTRUE);
2391 h_spin_mtot_radius->GetZaxis()->CenterTitle(kTRUE);
2392 h_spin_mtot_radius->GetXaxis()->SetNdivisions(410);
2393 h_spin_mtot_radius->GetYaxis()->SetNdivisions(410);
2394 h_spin_mtot_radius->GetXaxis()->SetTickLength(0.01);
2395 h_spin_mtot_radius->GetYaxis()->SetTickLength(0.01);
2396 h_spin_mtot_radius->GetZaxis()->SetTickLength(0.01);
2397 h_spin_mtot_radius->GetXaxis()->SetTitleFont(42);
2398 h_spin_mtot_radius->GetXaxis()->SetLabelFont(42);
2399 h_spin_mtot_radius->GetYaxis()->SetTitleFont(42);
2400 h_spin_mtot_radius->GetYaxis()->SetLabelFont(42);
2401 h_spin_mtot_radius->GetZaxis()->SetLabelFont(42);
2402 h_spin_mtot_radius->GetZaxis()->SetLabelSize(0.03);
2403 h_spin_mtot_radius->SetTitle(
"");
2404 h_spin_mtot_radius->SetMarkerColor(kWhite);
2405 h_spin_mtot_radius->SetMarkerSize(
2408 for (
int i = 1;
i <= NBINS_MTOT;
i++) {
2410 h_spin_mtot_radius->SetBinContent(
2411 j,
i, spin_mtot_radius[
i-1][
j-1]*0.001);
2412 h_spin_mtot_radius->SetBinError(
2413 j,
i, error_spin_mtot_radius[
i-1][
j-1]*0.001);
2414 cout <<
j <<
" " <<
i <<
" " 2415 << h_spin_mtot_radius->GetBinContent(
j,
i) << endl;
2419 h_spin_mtot_radius->SetContour(
NCont);
2420 h_spin_mtot_radius->SetEntries(1);
2425 h_spin_mtot_radius->Draw(
2429 h_spin_mtot_radius->GetZaxis()->SetRangeUser(0,
2430 MAX_EFFECTIVE_RADIUS / 2./1000);
2453 Rrho[
i] = pow(3. * Vrho[
i] / (4 *
TMath::Pi() * Tscale), 1. / 3);
2454 eRrho[
i] = pow(3. / (4 *
TMath::Pi() * Tscale), 1. / 3) * 1. / 3 *
2455 pow(Vrho[
i], -2. / 3) * eVrho[
i];
2464 c1, networkname,
netdir, write_ascii);
2470 cout <<
"Deletions..." << endl;
2492 delete[] volume_first_shell[
i];
2494 delete[] error_volume[
i];
2495 delete[] error_volume_first_shell[
i];
2496 delete[] error_radius[
i];
2499 delete[] volume_first_shell;
2501 delete[] error_volume;
2502 delete[] error_volume_first_shell;
2503 delete[] error_radius;
2505 for (
int i = 0;
i < NBINS_MTOT + 1;
i++) {
2506 delete[] spin_mtot_volume[
i];
2507 delete[] spin_mtot_radius[
i];
2508 delete[] error_spin_mtot_volume[
i];
2509 delete[] error_spin_mtot_radius[
i];
2511 delete[] spin_mtot_volume;
2512 delete[] spin_mtot_radius;
2513 delete[] error_spin_mtot_volume;
2514 delete[] error_spin_mtot_radius;
strcpy(cfg->tmp_dir, "tmp")
float MAX_EFFECTIVE_RADIUS
static double g(double e)
std::vector< double > vseifar
bool INCLUDE_INTERNAL_VOLUME
Complex Exp(double phase)
for(int i=0;i< nfactor;i++)
pointers to detectors
fprintf(stdout,"start=%f duration=%f rate=%f\, x.start(), x.size()/x.rate(), x.rate())
std::vector< double > vdv
std::vector< double > vfar
#define CWB_PLUGIN_EXPORT(VAR)
#define IMPORT(TYPE, VAR)
std::vector< double > vsifar
printf("total live time: non-zero lags = %10.1f \, liveTot)
std::vector< double > veR
std::vector< double > iSNR[NIFO_MAX]
std::vector< double > vifar
TString sel("slag[1]:slag[2]")
TH2F * efficiency_first_shell
std::vector< double > veV
cout<< endl;if(write_ascii) { fev.close();for(int l=0;l< nfactor;l++) { fev_single[l].close();} } cout<< "Recovered entries: "<< cnt<< endl;cout<< "Recovered entries: "<< cnt2<< endl;cout<< "Recovered entries cut by frequency: "<< cntfreq<< endl;cout<< "Recovered entries vetoed: "<< countv<< endl;cout<< "dV : "<< dV<< " dV1 : "<< dV1<< endl;internal_volume=4./3. *TMath::Pi() *pow(minDistance[0]/1000., 3.);if(INCLUDE_INTERNAL_VOLUME) { for(int i=0;i< vdv.size();i++) { if(vdv[i] > 0.0) { vdv[i]+=internal_volume;} } for(int i=0;i< RHO_NBINS;i++) { if(Vrho[i] > 0.0) { Vrho[i]+=internal_volume;} } for(int i=0;i< NBINS_MTOT+1;i++) { for(int j=0;j< NBINS_SPIN+1;j++) { if(spin_mtot_volume[i][j] > 0.0) { spin_mtot_volume[i][j]+=internal_volume;} } } for(int i=0;i< NBINS_mass;i++) { for(int j=0;j< NBINS_mass2;j++) { if(volume[i][j] > 0.0) { volume[i][j]+=internal_volume;} } } } Int_t *mindex=new Int_t[vdv.size()];TMath::Sort((int) vdv.size(), &vifar[0], mindex, true);std::vector< double > vV
sprintf(fname3, "%s/injected_signals.txt", netdir)
char veto_not_vetoed[1024]
void DrawRadiusIFARplots(char *sim_file_name, char *mdc_file_name, float shell_volume, TString opt)
detectorParams detParms[4]
std::vector< double > vefar