36 int readParameters(TString
fname, wavearray<double>& RHO, wavearray<double>& eRHO, wavearray<double>& FAR, wavearray<double>& eFAR);
38 void PlotFAR(
int nfar, TString far_plot_name,
double rho_min=-1,
double rho_max=-1);
46 Style_t markers[32]= {20,21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,
47 21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20 };
49 Color_t colors[32] = { 8, 0, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
50 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7 };
71 void PlotFAR(
int nfar, TString far_plot_name,
double rho_min,
double rho_max) {
74 gStyle->SetFrameBorderMode(0);
77 gStyle->SetTitleFont(72);
78 gStyle->SetMarkerColor(50);
79 gStyle->SetLineColor(kWhite);
80 gStyle->SetTitleW(0.98);
81 gStyle->SetTitleH(0.05);
82 gStyle->SetTitleY(0.98);
83 gStyle->SetFillColor(kWhite);
84 gStyle->SetLineColor(kWhite);
85 gStyle->SetTitleFont(12,
"D");
87 TCanvas *
canvas =
new TCanvas(
"roc",
"roc", 300,40, 800, 600);
89 canvas->ToggleEventStatus();
93 canvas->SetFillColor(kWhite);
107 cout <<
n <<
" OBS_TIME : " <<
OBS_TIME[
n] << endl;
109 vector<double> rho_far;
113 cout <<
"rate_threshold : " <<
fname << endl;
114 wavearray<double> RHO;
115 wavearray<double> FAR;
116 wavearray<double> eRHO;
117 wavearray<double> eFAR;
120 if(far_size==0)
continue;
121 if(rmin<RHO[0]) rmin=RHO[0];
122 if(rmax<RHO[far_size-1]) rmax=RHO[far_size-1];
123 sigma_lines[nGR] =
false;
128 gr[nGR++] =
new TGraphErrors(far_size,RHO.data,FAR.data,eRHO.data,eFAR.data);
129 gr[nGR-1]->SetMarkerStyle(20);
131 gr[nGR-1]->SetMarkerSize(0.55);
132 if(
n==0)
gr[nGR-1]->SetMarkerColor(kBlack);
134 gr[nGR-1]->SetMarkerColor(kRed);
135 gr[nGR-1]->SetMarkerStyle(22);
136 gr[nGR-1]->SetMarkerSize(1.3);
138 if(
n==2)
gr[nGR-1]->SetMarkerColor(kRed);
139 gr[nGR-1]->SetName(TString::Format(
"gr%d",nGR-1));
142 TMultiGraph* mg =
new TMultiGraph();
145 else sprintf(gTitle,
"FAR Comparison");
147 else sprintf(gTitle,
"FAR vs Rank (fake lag)");
149 mg->SetTitle(gTitle);
150 for(
int n=0;
n<nGR;
n++)
if(
gr[
n]!=NULL) mg->Add(
gr[
n]);
155 mg->GetHistogram()->GetXaxis()->SetLabelSize(0.03);
156 mg->GetHistogram()->GetYaxis()->SetLabelSize(0.03);
157 mg->GetHistogram()->GetXaxis()->SetTitleSize(0.03);
158 mg->GetHistogram()->GetYaxis()->SetTitleSize(0.03);
159 mg->GetHistogram()->GetXaxis()->SetLabelFont(42);
160 mg->GetHistogram()->GetYaxis()->SetLabelFont(42);
161 mg->GetHistogram()->GetYaxis()->SetLabelOffset(0.01);
162 mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.5);
169 if(rho_min>=0) rmin=rho_min;
170 if(rho_max>=0) rmax=rho_max;
174 mg->GetXaxis()->SetTitle(
gr[0]->GetXaxis()->GetTitle());
175 mg->GetXaxis()->SetLabelFont(42);
176 mg->GetYaxis()->SetLabelFont(42);
177 mg->GetXaxis()->SetTitleFont(42);
178 mg->GetYaxis()->SetTitleFont(42);
179 mg->GetXaxis()->SetTitleOffset(1.20);
180 mg->GetYaxis()->SetTitleOffset(1.20);
181 mg->GetXaxis()->SetTitleSize(0.03);
182 mg->GetYaxis()->SetTitleSize(0.03);
183 mg->GetXaxis()->CenterTitle(
true);
184 mg->GetYaxis()->CenterTitle(
true);
185 mg->GetXaxis()->SetTitle(
"Coherent Network SNR ( #rho )");
187 mg->GetYaxis()->SetTitle(
"FAR ( yr^{-1} )");
196 leg =
new TLegend(0.72,0.87,1.0,1.0,NULL,
"brNDC");
198 leg->SetBorderSize(1);
199 leg->SetTextAlign(22);
200 leg->SetTextFont(12);
201 leg->SetLineColor(1);
202 leg->SetLineStyle(1);
203 leg->SetLineWidth(1);
204 leg->SetFillColor(0);
205 leg->SetFillStyle(1001);
206 leg->SetTextSize(0.03);
207 leg->SetLineColor(kBlack);
208 leg->SetFillColor(kWhite);
211 for(
int n=0;
n<nGR;
n++) {
212 if(
n==0)
strcpy(legLabel,
"Background");
213 if(
n==1)
strcpy(legLabel,
"Foreground");
214 if(
gr[
n]!=NULL) TLegendEntry* eleg =
leg->AddEntry(
gr[
n],legLabel,
"lp");
216 leg->SetBorderSize(1);
217 leg->SetTextAlign(22);
218 leg->SetTextFont(12);
219 leg->SetLineColor(1);
220 leg->SetLineStyle(1);
221 leg->SetLineWidth(1);
222 leg->SetFillColor(0);
223 leg->SetFillStyle(1001);
224 leg->SetTextSize(0.05);
225 leg->SetLineColor(kBlack);
229 if(far_plot_name!=
"") {
230 char gfileName[1024];
231 sprintf(gfileName,
"%s.gif",far_plot_name.Data());
233 TString pfileName=gfileName;
234 pfileName.ReplaceAll(
".gif",
".png");
236 sprintf(
cmd,
"convert %s %s",gfileName,pfileName.Data());
251 out.open(
fname.Data(),ios::out);
252 if (!out.good()) {cout <<
"Error Opening File : " <<
fname.Data() << endl;
exit(1);}
254 for(
int i=0;i<RHO.size();i++) {
255 out << RHO[i] <<
"\t" << FAR[i] << endl;
263 int readParameters(TString
fname, wavearray<double>& RHO, wavearray<double>& eRHO, wavearray<double>& FAR, wavearray<double>& eFAR) {
265 double year = (24.*3600.*365.);
268 eRHO.resize(1000000);
270 eFAR.resize(1000000);
276 in.open(
fname.Data(),ios::in);
277 if (!in.good()) {cout <<
"Error Opening File : " <<
fname.Data() << endl;
exit(1);}
278 cout <<
fname.Data() << endl;
280 wavearray<double> rho(1000000);
281 wavearray<double> far(1000000);
284 in >> rho[
m] >> far[
m];
285 if (!in.good())
break;
300 double pifar=far[rho.size()-1];
301 RHO[0] = rho[rho.size()-1];
303 FAR[0] = far[rho.size()-1];
306 for(
int i=rho.size()-2;i>=0;i--) {
322 wavearray<double> xRHO=RHO;
323 wavearray<double>
xFAR=FAR;
324 for(
int i=0;i<RHO.size();i++) {
325 RHO[i]=xRHO[RHO.size()-i-1];
326 FAR[i]=
xFAR[FAR.size()-i-1];
329 for(
int i=0;i<RHO.size();i++) {
int LINE_MARKER[nFAR_MAX]
void Draw_FARvsRHO(TString ifile_bkg, TString ifile_fgd, TString ofile="")
double ZERO_LAG_TIME[nFAR_MAX]
void writeParameters(TString fname, wavearray< double > &RHO, wavearray< double > &FAR)
void PlotFAR(int nfar, TString far_plot_name, double rho_min=-1, double rho_max=-1)
TString FAR_NAME[nFAR_MAX]
double OBS_TIME[nFAR_MAX]
TString FAR_PATH[nFAR_MAX]
int readParameters(TString fname, wavearray< double > &RHO, wavearray< double > &eRHO, wavearray< double > &FAR, wavearray< double > &eFAR)
sprintf(tag,"wave_%s", data_label)