18 if(gtype!=
"nre" && gtype!=
"prc" && gtype!=
"fre") {
19 cout <<
"DrawCoverageVsPercentagePRC : Error - wrong input gtype (prc/nre/fre)" << endl;
24 char wave_file_name[1024];
25 sprintf(wave_file_name,
"merge/wave_%s.%s.root",data_label.Data(),merge_label.Data());
28 TObjString* sfile = (TObjString*)token->At(token->GetEntries()-1);
30 ofile.ReplaceAll(
".root",
".txt");
34 if(gtype==
"prc") TITLE =
"pp-plot-prc";
35 if(gtype==
"nre") TITLE =
"pp-plot-nre";
36 if(gtype==
"fre") TITLE =
"pp-plot-fre";
40 if(gtype==
"prc")
sprintf(ofname,
"%s/pp_plot_prc.txt",odir.Data());
41 if(gtype==
"nre")
sprintf(ofname,
"%s/pp_plot_nre.txt",odir.Data());
42 if(gtype==
"fre")
sprintf(ofname,
"%s/pp_plot_fre.txt",odir.Data());
45 if (!out.good()) {cout <<
"Error Opening File : " << ofname << endl;
exit(1);}
46 cout <<
"Create file : " << ofname << endl;
52 double coverage[
NMDC][11];
56 for (
int j=1;
j<10;
j++) {
57 coverage[
i][
j]=
GetPercentage(gtype,
j,wave_file_name, nIFO, T_win, pp_inetcc,
58 T_cor, pp_irho, T_cut, T_vED, T_pen, T_ifar);
59 if(coverage[
i][
j]<0)
return;
61 out <<
j*10 <<
" " << coverage[
i][
j] << endl;
63 cout <<
j*10 <<
" " << coverage[
i][
j] << endl;
70 TCanvas*
canvas =
new TCanvas(
"fom",
"PRC", 300,40, 600, 600);
72 canvas->ToggleEventStatus();
73 canvas->SetFillColor(0);
76 canvas->SetLogy(
false);
77 canvas->SetLogx(
false);
79 gStyle->SetTitleH(0.062);
80 gStyle->SetTitleW(0.98);
81 gStyle->SetTitleY(0.98);
82 gStyle->SetTitleFont(72);
83 gStyle->SetLineColor(kWhite);
84 gStyle->SetPalette(1,0);
85 gStyle->SetNumberContours(256);
87 Style_t markers[32]= {20,21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,
88 21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20 };
90 Color_t
colors[32] = { 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
91 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7 };
93 double perc[11]={0,10,20,30,40,50,60,70,80,90,100};
96 gr[
i] =
new TGraph(11,perc,coverage[
i]);
97 gr[
i]->SetLineColor(colors[i]);
98 gr[
i]->SetLineWidth(1);
99 gr[
i]->SetMarkerSize(1);
100 gr[
i]->SetMarkerColor(colors[i]);
101 gr[
i]->SetMarkerStyle(markers[i]);
105 gr[NMDC+1] =
new TGraph(2,x,y);
106 gr[NMDC+1]->SetLineColor(1);
107 gr[NMDC+1]->SetLineWidth(2);
108 gr[NMDC+1]->SetLineStyle(2);
110 TMultiGraph*
mg =
new TMultiGraph();
111 for(
int i=0;
i<
NMDC;
i++) mg->Add(gr[
i],
"lp");
112 mg->Add(gr[NMDC+1],
"lp");
115 sprintf(title,
"%s",TITLE.Data());
116 mg->GetHistogram()->SetTitle(title);
117 mg->GetHistogram()->GetXaxis()->SetTitle(
"Percentage");
118 mg->GetHistogram()->GetYaxis()->SetTitle(
"Coverage");
119 mg->GetHistogram()->GetXaxis()->SetRangeUser(0,100);
120 mg->GetHistogram()->GetYaxis()->SetRangeUser(0,100);
121 mg->GetHistogram()->GetXaxis()->SetTitleOffset(1.3);
122 mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);
123 mg->GetHistogram()->GetXaxis()->CenterTitle(
true);
124 mg->GetHistogram()->GetYaxis()->CenterTitle(
true);
125 mg->GetHistogram()->GetXaxis()->SetLabelFont(42);
126 mg->GetHistogram()->GetXaxis()->SetTitleFont(42);
127 mg->GetHistogram()->GetYaxis()->SetLabelFont(42);
128 mg->GetHistogram()->GetYaxis()->SetTitleFont(42);
129 mg->GetHistogram()->GetXaxis()->SetNdivisions(511);
133 double hleg = 0.8-NMDC*0.05;
134 leg =
new TLegend(0.1291513,hleg,0.6244966,0.8738739,NULL,
"brNDC");
136 leg->SetBorderSize(1);
137 leg->SetTextAlign(22);
138 leg->SetTextFont(12);
139 leg->SetLineColor(1);
140 leg->SetLineStyle(1);
141 leg->SetLineWidth(1);
142 leg->SetFillColor(0);
143 leg->SetFillStyle(1001);
144 leg->SetTextSize(0.04);
145 leg->SetLineColor(kBlack);
146 leg->SetFillColor(kWhite);
149 for(
int i=0;i<
NMDC;i++) {
150 sprintf(label,
"%s ",data_label.Data());
151 leg->AddEntry(gr[i],label,
"lp");
156 if(gtype==
"prc")
sprintf(ofname,
"%s/pp_plot_prc.gif",odir.Data());
157 if(gtype==
"nre")
sprintf(ofname,
"%s/pp_plot_nre.gif",odir.Data());
158 if(gtype==
"fre")
sprintf(ofname,
"%s/pp_plot_fre.gif",odir.Data());
160 canvas->Print(gfileName);
162 pfileName.ReplaceAll(
".gif",
".png");
164 sprintf(cmd,
"convert %s %s",gfileName.Data(),pfileName.Data());
167 sprintf(cmd,
"rm %s",gfileName.Data());
176 TFile *
ifile = TFile::Open(fname.Data());
177 TTree*
itree = (TTree *) gROOT->FindObject(
"waveburst");
178 itree->SetEstimate(itree->GetEntries());
184 bool nre_exist=
false;
185 TIter
next(itree->GetListOfBranches());
186 while ((branch=(TBranch*)
next())) {
187 if (nre_name.CompareTo(branch->GetName())==0) nre_exist=
true;
189 if(!nre_exist)
return -1;
196 bool fre_exist=
false;
197 TIter
next(itree->GetListOfBranches());
198 while ((branch=(TBranch*)
next())) {
199 if (fre_name.CompareTo(branch->GetName())==0) fre_exist=
true;
201 if(!fre_exist)
return -1;
204 char selection[1024];
207 sprintf(cut,
"abs(time[0]-time[%d])<%f && netcc[%d]>%f && rho[%d]>%f",
208 nIFO,T_win,pp_inetcc,T_cor,pp_irho,T_cut);
209 if(T_vED>0) {
strcpy(tmp,cut);
sprintf(cut,
"%s && neted[0]/ecor<%f",tmp,T_vED);}
210 if(T_pen>0) {
strcpy(tmp,cut);
sprintf(cut,
"%s && penalty>%f",tmp,T_pen);}
211 if(T_ifar>0) {
strcpy(tmp,cut);
sprintf(cut,
"%s && ifar>(24.*3600.*365.)*%f",tmp,T_ifar);}
214 if(gtype==
"prc")
sprintf(selection,
"erA[0]-erA[%d]>>hist_cumulative_erA1(2000,-100,100)",iderA);
215 if(gtype==
"nre")
sprintf(selection,
"erR[0]-erR[%d]>>hist_cumulative_erA1(2000,-1,1)",iderA);
216 if(gtype==
"fre")
sprintf(selection,
"erF[0]-erF[%d]>>hist_cumulative_erA1(2000,-1,1)",iderA);
218 itree->Draw(selection,cut,
"goff");
219 TH1F *hist_cumulative_erA1 = (TH1F*)gDirectory->Get(
"hist_cumulative_erA1");
220 int size = itree->GetSelectedRows();
223 delete hist_cumulative_erA1;
229 double integral = hist_cumulative_erA1->ComputeIntegral();
230 if (integral==0) {cout <<
"Empty histogram !!!" << endl;
exit(0);}
231 double* cumulative = hist_cumulative_erA1->GetIntegral();
232 for (
int i=0;
i<hist_cumulative_erA1->GetNbinsX();
i++) hist_cumulative_erA1->SetBinContent(
i,cumulative[
i]/integral);
236 double perc = 100.*hist_cumulative_erA1->GetBinContent(1001);
237 delete hist_cumulative_erA1;
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1)*itime+ifreq;double time=itime *dT;double freq=(ifreq >0)?ifreq *dF:dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
void DrawCoverageVsPercentagePRC(TString gtype, TString data_label, TString odir, TString merge_label, int nIFO, float T_win, int pp_inetcc, float T_cor, int pp_irho, float T_cut, float T_vED, float T_pen, float T_ifar)
TIter next(twave->GetListOfBranches())
double GetPercentage(TString gtype, int iderA, TString fname, int nIFO, float T_win, int pp_inetcc, float T_cor, int pp_irho, float T_cut, float T_vED, float T_pen, float T_ifar)
strcpy(RunLabel, RUN_LABEL)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)