Logo coherent WaveBurst  
Library Reference Guide
Logo
DrawPvaluesPE.C
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Gabriele Vedovato
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 #define MAX_EVT 100 // max number of events
20 
21 #define NLOOP 100000 // used to compute the multiple trial p-value
22 
23 //#define SHOW_OFFSOURCE_DISTRIBUTION
24 
25 //#define CHANGE_LABELS
26 
27 #define DRAW_SIGMA_MEDIAN
28 
29 #define DRAW_NAMES 4 // max number of displayed names
30 
31 #define YMIN 0.001 // minimum y-axis p-value
32 
33 #define SIGMA1 0.682689492137
34 #define SIGMA2 0.954499736104
35 #define SIGMA3 0.997300203937
36 
37 double GetProbability(int N, int k, double p);
38 double InverseProbability(int N, int k, double p);
39 
40 double InverseProbabilityBH(int N, int k, double p);
41 TGraph* DrawProbabilityBH(int N, double p, Color_t color, int style=9);
42 TGraph* DrawStepGraph(int N, double* x, double* y, Color_t color=kBlack);
43 TGraphAsymmErrors* DrawBelt(int N, double pinf, double psup, Color_t color);
44 
45 
46 void DrawPvaluesPE(TString ifname, TString odir, TString side, TString label="", bool title=true, double FDR=0) {
47 
48  if(FDR>0) {
49  if(FDR>1) {cout << endl << "DrawPvaluesPE Error, FDR must be [0,1]" << endl << endl;exit(1);}
50  if(fmod(10*FDR,1)!=0) {cout << endl << "DrawPvaluesPE Error, FDR must be a multiple of 0.1" << endl << endl;exit(1);}
51  }
52 
53  gRandom->SetSeed(150914);
54 
55  // init blind colors
56  Color_t color[4];
57  color[0] = CWB::Toolbox::getTableau10BlindColor("DarkOrange1");
58  color[1] = CWB::Toolbox::getTableau10BlindColor("DeepSkyBlue4");
59  color[2] = CWB::Toolbox::getTableau10BlindColor("DarkGray");
60  color[3] = CWB::Toolbox::getTableau10BlindColor("SandyBrown");
61 
62 // -----------------------------> READ P-VALUES
63 
64  // read values from ifname file
65  ifstream in;
66  in.open(ifname.Data(),ios::in);
67  if (!in.good()) {cout << "DrawPvaluesPE Error Opening File : " << ifname.Data() << endl;exit(1);}
68  int NEVT=0;
69  char gw_name[MAX_EVT][256];
70  double median[MAX_EVT],l99[MAX_EVT],l90[MAX_EVT],l50[MAX_EVT],u50[MAX_EVT],u90[MAX_EVT],u99[MAX_EVT];
71  double match[MAX_EVT],pvalue[MAX_EVT];
72  char dummy[256];
73  cout << endl;
74  cout << "READ EVENTS" << endl;
75  cout << endl;
76  while(1) {
77  in >> gw_name[NEVT] >> dummy >> dummy >> match[NEVT] >> dummy >> pvalue[NEVT] >> dummy >> median[NEVT]
78  >> dummy >> l99[NEVT] >> dummy >> l90[NEVT] >> dummy >> l50[NEVT] >> dummy >> u50[NEVT] >> dummy >> u90[NEVT] >> dummy >> u99[NEVT];
79  if(!in.good()) break;
80  cout << NEVT <<" "<< gw_name[NEVT] <<" "<< match[NEVT] <<" "<< pvalue[NEVT] << endl;
81  NEVT++;
82  }
83  cout << endl;
84  in.close();
85 
86 // -----------------------------> SORT P-VALUES
87 
88  // sort pvalues
89  int index[MAX_EVT];
90  TMath::Sort(NEVT,pvalue,index,false);
91 
92  double pval_min=1e20;
93  TString sside[MAX_EVT];
94  double sindex[MAX_EVT];
95  double spvalue[MAX_EVT];
96  TString sgw_name[MAX_EVT];
97  cout << endl;
98  for(int n=0;n<NEVT;n++) {
99  int k=index[n];
100  sindex[n]=n+1;
101  spvalue[n]=pvalue[k];
102  sgw_name[n]=gw_name[k];
103  }
104  cout << endl;
105  cout << "SORT EVENTS" << endl;
106  cout << endl;
107  for(int n=0;n<NEVT;n++) cout << n << "\t" << sindex[n] << "\t" << sgw_name[n] << "\t" << spvalue[n] << endl;;
108  cout << endl;
109 
110 // -----------------------------> DRAW P-VALUES
111 
112  // create plots
113  gStyle->SetFrameBorderMode(0); // remove the red box around canvas
114  gROOT->ForceStyle();
115  gStyle->SetTitleFont(12,"D");
116  TCanvas *canvas = new TCanvas("pvalue", "pvalue", 300,40, 1000, 600);
117  canvas->Clear();
118  canvas->SetLogx();
119  canvas->SetLogy();
120  canvas->SetGridx();
121  canvas->SetGridy();
122  canvas->SetFillColor(kWhite);
123 
124  // draw pvalues
125  TGraph* gr = new TGraph(NEVT,sindex,spvalue);
126  if(title) gr->SetTitle("p-values distribution ("+label+")"); else gr->SetTitle("");
127  //gr->GetXaxis()->SetRangeUser(1,double(NEVT));
128  //double xMAX = (1+NEVT/int(pow(10,int(log10(NEVT)))))*int(pow(10,int(log10(NEVT))));
129  double xMAX = NEVT;
130  gr->GetHistogram()->GetXaxis()->SetLimits(1,xMAX);
131  gr->GetYaxis()->SetRangeUser(spvalue[0],1.0);
132  if(spvalue[0]<YMIN) gr->GetYaxis()->SetRangeUser(YMIN,1.0);
133  gr->GetXaxis()->SetTitle("Cumulative number of events");
134  gr->GetYaxis()->SetTitle("p-value");
135  gr->GetYaxis()->SetRangeUser(0,1);
136  gr->GetXaxis()->SetTitleOffset(0.80);
137  gr->GetYaxis()->SetTitleOffset(0.80);
138  gr->GetXaxis()->CenterTitle(kTRUE);
139  gr->GetYaxis()->CenterTitle(kTRUE);
140  gr->GetXaxis()->SetTitleFont(132);
141  gr->GetXaxis()->SetLabelFont(132);
142  gr->GetYaxis()->SetTitleFont(132);
143  gr->GetYaxis()->SetLabelFont(132);
144  gr->GetXaxis()->SetTitleSize(0.045);
145  gr->GetXaxis()->SetLabelSize(0.045);
146  gr->GetYaxis()->SetTitleSize(0.045);
147  gr->GetYaxis()->SetLabelSize(0.045);
148  gr->GetYaxis()->SetLabelOffset(0.01);
149  gr->GetYaxis()->SetNdivisions(3);
150 
151  if(NEVT<10) {
152  gr->GetXaxis()->SetMoreLogLabels();
153  gr->GetXaxis()->SetNoExponent();
154  }
155  gr->SetLineColor(kGray+1);
156  gr->SetLineWidth(1);
157  gr->SetMarkerSize(1.3);
158  gr->SetMarkerColor(kGreen+2);
159 // gr->SetMarkerColor(color[0]);
160  gr->SetMarkerStyle(20);
161  gr->Draw("APL");
162 
163 // -----------------------------> SET GRID COLOR
164 
165 #ifdef SET_GRID_COLOR
166  // set grid color
167  gr->GetXaxis()->SetAxisColor(16);
168  gr->GetYaxis()->SetAxisColor(16);
169 
170  // fix frame lines color
171  double xmin = gr->GetHistogram()->GetXaxis()->GetXmin();
172  double xmax = gr->GetHistogram()->GetXaxis()->GetXmax();
173  //double ymin = pow(10,gPad->GetUymin());
174  double ymin = 0.0;
175  double ymax = gPad->GetUymax();
176  cout << "xmin=" << xmin << " xmax=" << xmax << endl;
177  cout << "ymin=" << ymin << " ymax=" << ymax << endl;
178 
179  TLine* frameLine[4];
180  frameLine[0] = new TLine(xmin,ymin,xmax,ymin);
181  frameLine[1] = new TLine(xmin,ymin,xmin,ymax);
182  frameLine[2] = new TLine(xmax,ymin,xmax,ymax);
183  frameLine[3] = new TLine(0.,ymax,xmax,ymax);
184  for(int i=0;i<2;i++) frameLine[i]->Draw();
185 #endif
186 
187 // -----------------------------> CHANGE X LABELS
188 
189 #ifdef CHANGE_LABELS
190  canvas->SetBottomMargin(0.15);
191  //gr->GetHistogram()->GetXaxis()->SetNdivisions(-221);
192  gr->GetHistogram()->SetMinimum(YMIN);
193  gr->GetXaxis()->SetNdivisions(120);
194  gr->GetXaxis()->SetTitle("");
195  gr->GetXaxis()->SetLabelOffset(.05);
196  gr->GetXaxis()->SetLabelSize(0.03);
197  gr->GetXaxis()->CenterLabels();
198  for(int n=0;n<NEVT;n++) gr->GetXaxis()->ChangeLabel(n+1,45,-1,-1,-1,-1,sgw_name[n]);
199  gr->GetXaxis()->ChangeLabel(NEVT+1,45,-1,-1,-1,-1," ");
200 #endif
201 
202 // -----------------------------> DRAW MEDIAN AND CONFIDENCE REGION
203 
204 #ifdef DRAW_SIGMA_MEDIAN
205  TGraph* gmean = DrawProbabilityBH(NEVT, 0.5, kRed, 9);
206 // TGraph* gmean = DrawProbabilityBH(NEVT, 0.5, color[0], 9);
207 // TGraph* glsigma1 = DrawProbabilityBH(NEVT, (1-SIGMA1)/2, 14);
208 // TGraph* gusigma1 = DrawProbabilityBH(NEVT, (1+SIGMA1)/2, 14);
209 // TGraph* glsigma2 = DrawProbabilityBH(NEVT, (1-SIGMA2)/2, 16);
210 // TGraph* gusigma2 = DrawProbabilityBH(NEVT, (1+SIGMA2)/2, 16);
211 // TGraph* glsigma3 = DrawProbabilityBH(NEVT, (1-SIGMA3)/2, 18);
212 // TGraph* gusigma3 = DrawProbabilityBH(NEVT, (1+SIGMA3)/2, 18);
213 
214  // draw 90% confidence
215  TGraph* gcl90inf = DrawProbabilityBH(NEVT, 0.05, kBlue);
216  TGraph* gcl90sup = DrawProbabilityBH(NEVT, 0.95, kBlue);
217 
218 /*
219  TGraphAsymmErrors* gbelt3 = DrawBelt(NEVT, (1-SIGMA3)/2, (1+SIGMA3)/2, 18);
220  TGraphAsymmErrors* gbelt2 = DrawBelt(NEVT, (1-SIGMA2)/2, (1+SIGMA2)/2, 17);
221  TGraphAsymmErrors* gbelt1 = DrawBelt(NEVT, (1-SIGMA1)/1, (1+SIGMA1)/2, 16);
222 */
223 
224  // draw again events marker, must be in first level
225  gr->Draw("P");
226 #endif
227 
228 // -----------------------------> FDR
229 
230  TF1 *fdr[30];
231  int fdr_id=-1;
232  if(FDR>0) {
233  gr->GetYaxis()->SetNdivisions(10);
234  for(int n=1;n<=30;n++) {
235  double alpha;
236  if(n>1 && n<=10) alpha=n*YMIN;
237  if(n>10 && n<=20) alpha=(n-10)*0.01;
238  if(n>20 && n<=30) alpha=(n-20)*0.1;
239 
240  fdr[n-1] = new TF1("func", "[0]*x", 1,MAX_EVT);
241  fdr[n-1]->SetNpx(10000);
242  fdr[n-1]->SetParameter(0,alpha/NEVT);
243  fdr[n-1]->SetLineWidth(1);
244  fdr[n-1]->SetLineColor(kGray);
245  fdr[n-1]->SetLineStyle(1);
246  //cout << n << " ALPHA " << alpha << endl;
247  //if((alpha==0.01)||(alpha==0.1)) fdr[n-1]->Draw("SAME"); // draw main FRD lines
248  if(fabs(alpha-FDR)<1.e-6) { // draw main FRD threshold
249  //fdr->SetLineColor(kBlack);
250  fdr[n-1]->SetLineStyle(1);
251  fdr[n-1]->Draw("SAME");
252  fdr_id=n-1;
253  }
254  }
255 
256  // find events below the FDR threshold
257  int nmin;
258  int nfdr=0;
259  double prob_min=1e20;
260  double cl1[MAX_EVT];
261  double prob[MAX_EVT];
262  cout << endl;
263  cout << "FDR EVENTS" << endl;
264  cout << endl;
265  for(int n=0;n<NEVT;n++) {
266  if(spvalue[n]>=fdr[fdr_id]->Eval(n+1)) continue;
267  prob[n] = GetProbability(NEVT,n+1,spvalue[n]);
268  cl1[n] = InverseProbability(NEVT,n+1,0.01);
269  cout << n << "\t" << sgw_name[n] << "\tpvalue = " << spvalue[n] << "\tprob = " << prob[n] << "\tcl1 = " << cl1[n] << endl;
270  if(prob[n]<prob_min) {prob_min=prob[n];nmin=n;}
271  nfdr++;
272  }
273 
274  if(nfdr>0) {
275 
276  cout << endl;
277  cout << nmin << " " << sgw_name[nmin] << "\tpvalue = " << spvalue[nmin]
278  << "\tprob = " << prob_min << "\tlog10(prob_min) " << log10(prob_min) << endl;
279  cout << endl;
280 
281  double pmin[NLOOP];
282  for(int l=0;l<NLOOP;l++) { // repeat the generation of NEVT
283 
284  // generate NEVT pvalues
285  for(int i=0;i<NEVT;i++) pvalue[i]=gRandom->Uniform(0,1);
286 
287  // sort pvalues
288  TMath::Sort(NEVT,pvalue,index,false);
289 
290  pmin[l]=1e20;
291  for(int n=0;n<NEVT;n++) {
292  int k=index[n];
293  if(pvalue[k]>=fdr[fdr_id]->Eval(n+1)) continue;
294  prob[n] = GetProbability(NEVT,n+1,pvalue[k]);
295  if(prob[n]<pmin[l]) pmin[l]=prob[n];
296  }
297  }
298 
299  // compute ntrials p-value
300  double PVALUE=0;
301  for(int l=0;l<NLOOP;l++) { // repeat the generation of NtRIALS
302  if(pmin[l]<prob_min) PVALUE+=1;
303  }
304  PVALUE/=NLOOP;
305  cout << endl;
306  cout << "PVALUE " << PVALUE << endl;
307  cout << endl;
308 
309  if(title) gr->SetTitle(TString(gr->GetTitle())+TString::Format(" - significance (#alpha=%.1f): %.4f",FDR,PVALUE)); else gr->SetTitle("");
310 
311 #ifdef SHOW_OFFSOURCE_DISTRIBUTION
312  TH1F* hist = new TH1F("hist","hist",100,1e-5,0);
313  for(int l=0;l<NLOOP;l++) { // repeat the generation of NtRIALS
314  hist->Fill(log10(pmin[l]));
315  }
316  hist->Draw();
317 
318  double xline[2]={log10(prob_min),log10(prob_min)};
319  double yline[2]={0,NLOOP};
320  TGraph* line = new TGraph(2,xline,yline);
321  line->SetLineColor(kRed);
322  line->Draw("same");
323 
324  gStyle->SetLineColor(kBlack);
325  canvas->SetLogx(false);
326  return;
327 #endif
328  }
329 
330  // draw alpha lbels
331  TF1 *f3 = new TF1("f3","log10(x)",YMIN,0.999);
332  TGaxis *A3 = new TGaxis(double(NEVT),0.0,double(NEVT),1.0,"f3",505,"=SG");
333  A3->SetTitle("#alpha");
334  A3->CenterTitle(kTRUE);
335  A3->SetTitleFont(132);
336  A3->SetLabelFont(132);
337  A3->SetLabelSize(0.045);
338  A3->SetTickSize(0.02);
339  A3->SetLabelOffset(0.03);
340  A3->SetTitleSize(0.045);
341  A3->SetTitleOffset(0.4);
342  A3->Draw();
343  canvas->Update();
344  }
345 
346 // -----------------------------> DRAW GW NAMES
347 
348 #ifdef DRAW_NAMES
349  float xrange = NEVT;
350  float yrange = spvalue[0]==0 ? YMIN : spvalue[0];
351 
352  TBox* box;
353  TLatex* latex;
354  TArrow* arrow;
355  cout << endl;
356  for(int n=0;n<DRAW_NAMES;n++) {
357 
358  float xfactor = 1 + (0.05 * 10./xrange);
359  float yfactor =1 - (0.30 * log10(yrange)/-3.0);
360  double xpos = sindex[n]*xfactor;
361  double ypos = spvalue[n]*yfactor;
362  if(ypos<YMIN) ypos=1.1*(2-yfactor)*YMIN;
363  //cout << n << " " << sindex[n] << " " << sgw_name[n] << "\t" << spvalue[n] << "\t" << xpos << "\t" << ypos << endl;
364 
365  // draw white box
366  box = new TBox(xpos, ypos*(2-yfactor), xpos*1.33*xfactor, ypos*(2-yfactor)*yfactor);
367  box->Draw();
368  box->SetFillColor(kWhite);
369 
370  // draw label
371  latex = new TLatex(xpos, ypos, sgw_name[n].Data());
372  latex->SetTextFont(132);
373  latex->SetTextSize(0.035);
374  latex->SetTextColor(kBlack);
375  latex->Draw();
376 
377  // draw arrow for events with pvalue<YMIN
378  ypos = spvalue[n]*yfactor;
379  if(ypos<YMIN) {
380  xpos = xpos*1.14*xfactor;
381  ypos = YMIN;
382  arrow = new TArrow(xpos,ypos*(2-yfactor),xpos,ypos,0.05,"|>");
383  arrow->SetAngle(60);
384  arrow->SetLineWidth(2);
385  arrow->SetLineColor(kBlue);
386  arrow->SetFillColor(kBlue);
387  arrow->SetArrowSize(0.012);
388  arrow->Draw();
389  }
390  }
391  cout << endl;
392 #endif
393 
394 // -----------------------------> LEGEND
395 
396  // draw legend
397  TLegend *leg = new TLegend(0.501002,0.1184669,0.8897796,0.3501742,NULL,"brNDC");
398  leg->SetBorderSize(1);
399  leg->SetTextAlign(22);
400  leg->SetTextFont(12);
401  leg->SetLineColor(1);
402  leg->SetLineStyle(1);
403  leg->SetLineWidth(1);
404  leg->SetFillColor(0);
405  leg->SetFillStyle(1001);
406  leg->SetTextSize(0.04);
407  leg->SetLineColor(kBlack);
408  leg->SetFillColor(kWhite);
409  leg->AddEntry(gr,"observed","lp");
410  leg->AddEntry(gmean,"null hypothesis","lp");
411 // leg->AddEntry(glsigma1,"1 sigma","lp");
412 // leg->AddEntry(glsigma2,"2 sigma","lp");
413  //leg->AddEntry(gcl,"1% confidence","lp");
414  leg->AddEntry(gcl90inf,"90% confidence region","lp");
415  if(fdr_id>=0) leg->AddEntry(fdr[fdr_id],TString::Format("FDR (#alpha = %.1f)",FDR),"lp");
416  leg->Draw();
417 
418  // dump pvalue plot
419  if(odir!="") odir=odir+"/";
420  TString ofname=odir+"/"+gSystem->BaseName(ifname);
421  TString tag = TString::Format("_pvalue.png");
422  ofname.ReplaceAll(".txt",tag);
423  cout << ofname << endl;
424 
425  canvas->Print(ofname);
426 
427 // exit(0);
428 }
429 
430 double GetProbability(int N, int k, double p) {
431 
432  double prob=1;
433  for(int i=0;i<k;i++) {
434  prob-=TMath::Binomial(N,i)*pow(p,i)*pow(1-p,N-i);
435  }
436  return prob;
437 }
438 
439 double InverseProbability(int N, int k, double p) {
440 
441 #define LMAX 100
442 #define PRECISION 1.e-6
443 
444  int L=100;
445 
446  double x;
447  double xmin=0;
448  double xmax=1;
449 
450  double a=0.;
451  for(int i=0;i<LMAX;i++) {
452  x = gRandom->Uniform(xmin,xmax);
453  //cout << i << "\txmin " << xmin << "\txmax " << xmax << "\tx " << x << endl;
454  a=GetProbability(N, k, x);
455  if(a<p) xmin=x; else xmax=x;
456  if(fabs(a-p)<PRECISION) break;
457  }
458  return x;
459 }
460 
461 double InverseProbabilityBH(int N, int k, double p) {
462 
463 #define LMAX 100
464 #define PRECISION 1.e-6
465 
466  int L=100;
467 
468  double x;
469  double xmin=0;
470  double xmax=1;
471 
472  double a=0.;
473  for(int i=0;i<LMAX;i++) {
474  x = gRandom->Uniform(xmin,xmax);
475  //cout << i << "\txmin " << xmin << "\txmax " << xmax << "\tx " << x << endl;
476  a=ROOT::Math::inc_beta(x, k, N-k+1);
477  if(a<p) xmin=x; else xmax=x;
478  if(fabs(a-p)<PRECISION) break;
479  }
480  return x;
481 }
482 
483 TGraph* DrawProbabilityBH(int N, double p, Color_t color, int style=9) {
484 // BENJAMINI-HOCHBERG
485 
486  double* x = new double[N];
487  for(int i=0;i<N;i++) x[i]=i+1;
488 
489  double* prob = new double[N];
490  for(int k=1;k<=N;k++) prob[k-1]=InverseProbabilityBH(N, k, p);
491 
492  TGraph* gprob = new TGraph(N,x,prob);
493  gprob->SetLineColor(color);
494 // gprob->SetLineWidth(2);
495  gprob->SetLineStyle(style);
496  gprob->Draw("same");
497  gprob->GetXaxis()->SetRangeUser(1,N);
498  gprob->GetYaxis()->SetRangeUser(0,1);
499 
500  return gprob;
501 }
502 
503 TGraph* DrawStepGraph(int N, double* x, double* y, Color_t color) {
504 
505  int M=N-N%2;
506 
507  double* X = new double[2*M+N%2];
508  double* Y = new double[2*M+N%2];
509 
510  for(int i=0;i<M;i++) {
511  X[2*i+0]=x[i+0]; Y[2*i+0]=y[i];
512  X[2*i+1]=x[i+1]; Y[2*i+1]=y[i];
513  }
514  if(N%2) X[2*M]=x[N-1]; Y[2*M]=y[N-1];
515 
516  TGraph* gprob = new TGraph(2*M+N%2,X,Y);
517  gprob->SetLineColor(color);
518  gprob->SetLineWidth(2);
519  gprob->Draw("same");
520 
521  return gprob;
522 }
523 
524 TGraphAsymmErrors* DrawBelt(int N, double pinf, double psup, Color_t color) {
525 
526  double* x = new double[N];
527  for(int i=0;i<N;i++) x[i]=i+1;
528  double* ex = new double[N];
529  for(int i=0;i<N;i++) ex[i]=0;
530 
531  double* y = new double[N];
532  for(int k=1;k<=N;k++) y[k-1]=InverseProbabilityBH(N, k, 0.5);
533 
534  double* yinf = new double[N];
535  for(int k=1;k<=N;k++) yinf[k-1]=y[k-1]-InverseProbabilityBH(N, k, pinf);
536 
537  double* ysup = new double[N];
538  for(int k=1;k<=N;k++) ysup[k-1]=InverseProbabilityBH(N, k, psup)-y[k-1];
539 
540  TGraphAsymmErrors* egr;
541  egr = new TGraphAsymmErrors(N,x,y,ex,ex,yinf,ysup);
542  egr->SetMarkerStyle(20);
543  egr->SetMarkerSize(0);
544  egr->SetLineColor(15);
545  egr->SetFillColorAlpha(color, 0.1);
546 // egr->SetFillStyle(1001);
547 // egr->SetFillColor(color);
548  egr->Draw("3SAME");
549 
550  return egr;
551 }
552 
double GetProbability(int N, int k, double p)
double M
Definition: DrawEBHH.C:13
wavearray< double > a(hp.size())
gx Draw(GWAT_TIME)
int n
Definition: cwb_net.C:28
#define YMIN
Definition: DrawPvaluesPE.C:31
#define A3
TString("c")
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
#define NLOOP
Definition: DrawPvaluesPE.C:21
char odir[1024]
double median(std::vector< double > &vec)
Definition: wavegraph.cc:485
return wmap canvas
i drho i
#define N
#define MAX_EVT
Definition: DrawPvaluesPE.C:19
double InverseProbability(int N, int k, double p)
double InverseProbabilityBH(int N, int k, double p)
TGraph * DrawStepGraph(int N, double *x, double *y, Color_t color=kBlack)
TGraph * gr
TString label
Definition: MergeTrees.C:21
#define LMAX
int l
TGraph * DrawProbabilityBH(int N, double p, Color_t color, int style=9)
int k
double e
char tag[256]
Definition: cwb_merge.C:92
TGraphAsymmErrors * DrawBelt(int N, double pinf, double psup, Color_t color)
char title[256]
Definition: SSeriesExample.C:1
#define DRAW_NAMES
Definition: DrawPvaluesPE.C:29
ifstream in
wavearray< int > index
double fabs(const Complex &x)
Definition: numpy.cc:55
char line[1024]
static Int_t getTableau10BlindColor(Int_t index)
Definition: Toolbox.cc:7275
wavearray< double > y
Definition: Test10.C:31
#define PRECISION
void DrawPvaluesPE(TString ifname, TString odir, TString side, TString label="", bool title=true, double FDR=0)
Definition: DrawPvaluesPE.C:46
exit(0)