36 if(gtype!=
"nre" && gtype!=
"prc" && gtype!=
"fre") {
37 cout <<
"DrawCoverageVsPercentagePRC : Error - wrong input gtype (prc/nre/fre)" << endl;
42 char wave_file_name[1024];
43 sprintf(wave_file_name,
"merge/wave_%s.%s.root",data_label.Data(),merge_label.Data());
46 TObjString* sfile = (TObjString*)token->At(token->GetEntries()-1);
48 ofile.ReplaceAll(
".root",
".txt");
52 if(gtype==
"prc") TITLE =
"pp-plot-prc";
53 if(gtype==
"nre") TITLE =
"pp-plot-nre";
54 if(gtype==
"fre") TITLE =
"pp-plot-fre";
58 if(gtype==
"prc")
sprintf(ofname,
"%s/pp_plot_prc.txt",odir.Data());
59 if(gtype==
"nre")
sprintf(ofname,
"%s/pp_plot_nre.txt",odir.Data());
60 if(gtype==
"fre")
sprintf(ofname,
"%s/pp_plot_fre.txt",odir.Data());
63 if (!out.good()) {cout <<
"Error Opening File : " << ofname << endl;
exit(1);}
64 cout <<
"Create file : " << ofname << endl;
70 double coverage[
NMDC][11];
74 for (
int j=1;
j<10;
j++) {
75 coverage[
i][
j]=
GetPercentage(gtype,
j,wave_file_name, nIFO, T_win, pp_inetcc,
76 T_cor, pp_irho, T_cut, T_vED, T_pen, T_ifar);
77 if(coverage[
i][
j]<0)
return;
79 out <<
j*10 <<
" " << coverage[
i][
j] << endl;
81 cout <<
j*10 <<
" " << coverage[
i][
j] << endl;
88 TCanvas*
canvas =
new TCanvas(
"fom",
"PRC", 300,40, 600, 600);
90 canvas->ToggleEventStatus();
91 canvas->SetFillColor(0);
94 canvas->SetLogy(
false);
95 canvas->SetLogx(
false);
97 gStyle->SetTitleH(0.062);
98 gStyle->SetTitleW(0.98);
99 gStyle->SetTitleY(0.98);
100 gStyle->SetTitleFont(72);
101 gStyle->SetLineColor(kWhite);
102 gStyle->SetPalette(1,0);
103 gStyle->SetNumberContours(256);
105 Style_t markers[32]= {20,21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,
106 21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20 };
108 Color_t
colors[32] = { 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
109 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7 };
111 double perc[11]={0,10,20,30,40,50,60,70,80,90,100};
114 gr[
i] =
new TGraph(11,perc,coverage[
i]);
115 gr[
i]->SetLineColor(colors[i]);
116 gr[
i]->SetLineWidth(1);
117 gr[
i]->SetMarkerSize(1);
118 gr[
i]->SetMarkerColor(colors[i]);
119 gr[
i]->SetMarkerStyle(markers[i]);
123 gr[NMDC+1] =
new TGraph(2,x,y);
124 gr[NMDC+1]->SetLineColor(1);
125 gr[NMDC+1]->SetLineWidth(2);
126 gr[NMDC+1]->SetLineStyle(2);
128 TMultiGraph*
mg =
new TMultiGraph();
129 for(
int i=0;
i<
NMDC;
i++) mg->Add(gr[
i],
"lp");
130 mg->Add(gr[NMDC+1],
"lp");
133 sprintf(title,
"%s",TITLE.Data());
134 mg->GetHistogram()->SetTitle(title);
135 mg->GetHistogram()->GetXaxis()->SetTitle(
"Percentage");
136 mg->GetHistogram()->GetYaxis()->SetTitle(
"Coverage");
137 mg->GetHistogram()->GetXaxis()->SetRangeUser(0,100);
138 mg->GetHistogram()->GetYaxis()->SetRangeUser(0,100);
139 mg->GetHistogram()->GetXaxis()->SetTitleOffset(1.3);
140 mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);
141 mg->GetHistogram()->GetXaxis()->CenterTitle(
true);
142 mg->GetHistogram()->GetYaxis()->CenterTitle(
true);
143 mg->GetHistogram()->GetXaxis()->SetLabelFont(42);
144 mg->GetHistogram()->GetXaxis()->SetTitleFont(42);
145 mg->GetHistogram()->GetYaxis()->SetLabelFont(42);
146 mg->GetHistogram()->GetYaxis()->SetTitleFont(42);
147 mg->GetHistogram()->GetXaxis()->SetNdivisions(511);
151 double hleg = 0.8-NMDC*0.05;
152 leg =
new TLegend(0.1291513,hleg,0.6244966,0.8738739,NULL,
"brNDC");
154 leg->SetBorderSize(1);
155 leg->SetTextAlign(22);
156 leg->SetTextFont(12);
157 leg->SetLineColor(1);
158 leg->SetLineStyle(1);
159 leg->SetLineWidth(1);
160 leg->SetFillColor(0);
161 leg->SetFillStyle(1001);
162 leg->SetTextSize(0.04);
163 leg->SetLineColor(kBlack);
164 leg->SetFillColor(kWhite);
167 for(
int i=0;i<
NMDC;i++) {
168 sprintf(label,
"%s ",data_label.Data());
169 leg->AddEntry(gr[i],label,
"lp");
174 if(gtype==
"prc")
sprintf(ofname,
"%s/pp_plot_prc.gif",odir.Data());
175 if(gtype==
"nre")
sprintf(ofname,
"%s/pp_plot_nre.gif",odir.Data());
176 if(gtype==
"fre")
sprintf(ofname,
"%s/pp_plot_fre.gif",odir.Data());
178 canvas->Print(gfileName);
180 pfileName.ReplaceAll(
".gif",
".png");
182 sprintf(cmd,
"convert %s %s",gfileName.Data(),pfileName.Data());
185 sprintf(cmd,
"rm %s",gfileName.Data());
194 TFile *
ifile = TFile::Open(fname.Data());
195 TTree*
itree = (TTree *) gROOT->FindObject(
"waveburst");
196 itree->SetEstimate(itree->GetEntries());
202 bool nre_exist=
false;
203 TIter
next(itree->GetListOfBranches());
204 while ((branch=(TBranch*)
next())) {
205 if (nre_name.CompareTo(branch->GetName())==0) nre_exist=
true;
207 if(!nre_exist)
return -1;
214 bool fre_exist=
false;
215 TIter
next(itree->GetListOfBranches());
216 while ((branch=(TBranch*)
next())) {
217 if (fre_name.CompareTo(branch->GetName())==0) fre_exist=
true;
219 if(!fre_exist)
return -1;
222 char selection[1024];
225 sprintf(cut,
"abs(time[0]-time[%d])<%f && netcc[%d]>%f && rho[%d]>%f",
226 nIFO,T_win,pp_inetcc,T_cor,pp_irho,T_cut);
227 if(T_vED>0) {
strcpy(tmp,cut);
sprintf(cut,
"%s && neted[0]/ecor<%f",tmp,T_vED);}
228 if(T_pen>0) {
strcpy(tmp,cut);
sprintf(cut,
"%s && penalty>%f",tmp,T_pen);}
229 if(T_ifar>0) {
strcpy(tmp,cut);
sprintf(cut,
"%s && ifar>(24.*3600.*365.)*%f",tmp,T_ifar);}
232 if(gtype==
"prc")
sprintf(selection,
"erA[0]-erA[%d]>>hist_cumulative_erA1(2000,-100,100)",iderA);
233 if(gtype==
"nre")
sprintf(selection,
"erR[0]-erR[%d]>>hist_cumulative_erA1(2000,-1,1)",iderA);
234 if(gtype==
"fre")
sprintf(selection,
"erF[0]-erF[%d]>>hist_cumulative_erA1(2000,-1,1)",iderA);
236 itree->Draw(selection,cut,
"goff");
237 TH1F *hist_cumulative_erA1 = (TH1F*)gDirectory->Get(
"hist_cumulative_erA1");
238 int size = itree->GetSelectedRows();
241 delete hist_cumulative_erA1;
247 double integral = hist_cumulative_erA1->ComputeIntegral();
248 if (integral==0) {cout <<
"Empty histogram !!!" << endl;
exit(0);}
249 double* cumulative = hist_cumulative_erA1->GetIntegral();
250 for (
int i=0;
i<hist_cumulative_erA1->GetNbinsX();
i++) hist_cumulative_erA1->SetBinContent(
i,cumulative[
i]/integral);
254 double perc = 100.*hist_cumulative_erA1->GetBinContent(1001);
255 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<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ 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)