Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compare_bkg.C
Go to the documentation of this file.
1 
2 {
3 
4 #define NBINS 3000
5 #define BINMIN 5.
6 #define BINMAX 305.
7 #define REBIN_MIN_EVTS_PER_BIN 10.0
8  //CWB::Toolbox TB;
9  cout<<"Checking ENV "<<endl;
10  TB.checkFile(gSystem->Getenv("CWB_ROOTLOGON_FILE"));
11  TB.checkFile(gSystem->Getenv("CWB_PARAMETERS_FILE"));
12  TB.checkFile(gSystem->Getenv("CWB_UPARAMETERS_FILE"));
13  TB.checkFile(gSystem->Getenv("CWB_PPARAMETERS_FILE"));
14  TB.checkFile(gSystem->Getenv("CWB_UPPARAMETERS_FILE"));
15  TB.checkFile(gSystem->Getenv("CWB_EPPARAMETERS_FILE"));
16 
17 
18 #ifdef myBATCH
19 
20 
21  TCanvas *c0 = new TCanvas("c0","c0",0,0,800,600);
22 // c0->Range(-1.216392,-477.6306,508.8988,2814.609);
23  c0->SetFillColor(0);
24  c0->SetBorderMode(0);
25  c0->SetBorderSize(2);
26  c0->SetGridx();
27  c0->SetGridy();
28  c0->SetRightMargin(0.1154618);
29  c0->SetTopMargin(0.07642487);
30  c0->SetBottomMargin(0.1450777);
31 #else
32 cout << "Setting up the canvas and the pads..."<<endl;
33 TCanvas *canvas1 = new TCanvas("canvas1","C1",0,0,1200,800);
34 canvas1->Divide(2,3);
35 //TCanvas c1;
36 canvas1->GetPad(1)->SetGridx();
37 canvas1->GetPad(1)->SetGridy();
38 canvas1->GetPad(1)->SetLogy(kTRUE);
39 canvas1->GetPad(1)->SetLogx(kTRUE);
40 canvas1->GetPad(2)->SetLogx(kTRUE);
41 canvas1->GetPad(2)->SetLogy(kTRUE);
42 canvas1->GetPad(2)->SetGridx();
43 canvas1->GetPad(2)->SetGridy();
44 canvas1->GetPad(3)->SetGridx();
45 canvas1->GetPad(3)->SetGridy();
46 canvas1->GetPad(3)->SetLogx(kTRUE);
47 canvas1->GetPad(4)->SetGridx();
48 canvas1->GetPad(4)->SetGridy();
49 canvas1->GetPad(4)->SetLogx(kTRUE);
50 canvas1->GetPad(5)->SetLogy(kTRUE);
51 canvas1->GetPad(5)->SetGridx();
52 canvas1->GetPad(5)->SetGridy();
53 canvas1->GetPad(6)->SetLogy(kTRUE);
54 canvas1->GetPad(6)->SetGridx();
55 canvas1->GetPad(6)->SetGridy();
56 
57 TCanvas *canvas2 = new TCanvas("canvas2","C2",0,0,800,600);
58 
59 canvas2->SetGridx();
60 canvas2->SetGridy();
61 //canvas2->SetLogy(kTRUE);
62 //canvas2->SetLogx(kTRUE);
63 
64 TCanvas *canvas3 = new TCanvas("canvas3","C3",0,0,800,600);
65 
66 canvas3->SetGridx();
67 canvas3->SetGridy();
68 
69 #endif
70 
71 
72  //If not vetoes are defined, then the char string veto_not_vetoed is forced to be equal to ch2
73  if (strlen(veto_not_vetoed) == 0){sprintf(veto_not_vetoed,"%s",ch2);}
74 
75  gStyle->SetTitleFillColor(kWhite);
76  // gStyle->SetLineColor(kWhite);
77  gStyle->SetNumberContours(256);
78  gStyle->SetCanvasColor(kWhite);
79  gStyle->SetStatBorderSize(1);
80  // gStyle->SetOptStat(kFALSE);
81 
82  // remove the red box around canvas
83  gStyle->SetFrameBorderMode(0);
84  gROOT->ForceStyle();
85 
86  //If not vetoes are defined, then the char string veto_not_vetoed is forced to be equal to ch2
87  if (strlen(veto_not_vetoed) == 0){sprintf(veto_not_vetoed,"%s",ch2);}
88 
89 
90  TChain wave("waveburst");
91  TChain live("liveTime");
92 
93  wave.Add(net_file_name);
94  live.Add(liv_file_name);
95 
96  char cnet_file_name[1024];
97  char cliv_file_name[1024];
98 
100  if(gSystem->Getenv("CWB_COMPARE_TREE")==NULL) {
101  cout << "Error : environment CWB_COMPARE_TREE is not defined!!!" << endl;exit(1);
102  } else {
103  Compare_tree=TString(gSystem->Getenv("CWB_COMPARE_TREE"));
104  }
105 #ifdef myBATCH
106  // char cdata_label[1024];
107  TObjArray* token = TString(Compare_tree).Tokenize(TString("/"));
108  TString comp_tag =((TObjString *)(token->At(token->GetEntries()-1)))->String();
109  comp_tag.ReplaceAll("wave_","");
110  comp_tag.ReplaceAll(".root","");
111  //sprintf(cdata_label,((TObjString*)token->At(token->GetEntries()-1))->GetString().Data());
112  sprintf(netdir,"%s/bkgcomp_vs_%s",netdir,comp_tag.Data());
113  TB.mkDir(netdir,true);
114 
115 #endif
116 
118  Compare_live.ReplaceAll("wave_","live_");
119  sprintf(cnet_file_name,"%s",Compare_tree.Data());
120  sprintf(cnet_file_name,"%s",Compare_tree.Data());
121  sprintf(cliv_file_name,"%s",Compare_live.Data());
122  cout << cnet_file_name << endl;
123  cout << cliv_file_name << endl;
124 
125  // Check if files exist
126  TB.checkFile(cnet_file_name);
127  TB.checkFile(cliv_file_name);
128  TChain cnet("waveburst");
129  TChain cliv("liveTime");
130  cnet.Add(cnet_file_name);
131  cliv.Add(cliv_file_name);
132 
133 // TCut c2 ="netcc[0]>0.700000&&!(lag[3]==0&&slag[3]==0)&&neted[0]/ecor<0.400000&&penalty>0.600000&&(!veto_hveto_L1&&!veto_hveto_H1&&!veto_hveto_V1&&!veto_cat3_L1&&!veto_cat3_H1&&!veto_cat3_V1)";
134  Int_t bkg_size = (Int_t)wave.GetEntries();
135  cout << "bkg_size current dir : " << bkg_size << endl;
136  Int_t bkg_size2 = (Int_t)cnet.GetEntries();
137  cout << "bkg_size compare dir : " << bkg_size2 << endl;
138 
139 
140 
141  // float xlag;
142  // Int_t xrun, rUn;
143  // double xlive, sTARt, sTOp, gps;
144  double liveTot = 0.;
145  double cliveTot = 0.;
146  // double Live;
147 /*
148  wavearray<double> Trun(500000); Trun = 0.;
149  wavearray<double>* Wlag = new wavearray<double>[nIFO+1];
150  wavearray<double>* Wslag = new wavearray<double>[nIFO+1];
151  wavearray<double> Tdlag;
152  wavearray<double> Tlag;
153  // wavearray<double> Rlag;
154  // wavearray<double> Elag;
155  // wavearray<double> Olag;
156 
157  cout << "Start CWB::Toolbox::getLiveTime of current ntuple : " << endl;
158  liveTot=TB.getLiveTime(nIFO,live,Trun,Wlag,Wslag,Tlag,Tdlag,cwb_lag_number,cwb_slag_number);cout<<liveTot<<" s"<<endl;
159  cout << "Start CWB::Toolbox::getLiveTime of current ntuple : " << endl;
160  cliveTot=TB.getLiveTime(nIFO,cliv,Trun,Wlag,Wslag,Tlag,Tdlag,cwb_lag_number,cwb_slag_number);cout<<cliveTot<<" s"<<endl;
161 */
162 
163  CWB::CBCTool cbcTool;
164  cout << "Start CWB::CBCTool::getLiveTime2 of current ntuple : " << endl;
165  liveTot=cbcTool.getLiveTime2(live); //BEWARE!! getLiveTime2 returns bkg+zerolag time (usually a small error)
166  cout << "Start CWB::CBCTool::getLiveTime2 of current ntuple : " << endl;
167  cliveTot=cbcTool.getLiveTime2(cliv); //BEWARE!! getLiveTime2 returns bkg+zerolag time (usually a small error)
168 
169  double K = liveTot/cliveTot;
170  cout << "K (ratio of live times) : "<< K <<endl;
171  //int run;
172  //UChar_t v;
173  //float rho[2];
174  //trbkg->SetBranchAddress("rho",rho);
175 
176  TH1D* curh = new TH1D("curh","",NBINS,BINMIN,BINMAX);
177  TH1D* comph = new TH1D("comph","",NBINS,BINMIN,BINMAX);
178  TH1D* Sh = new TH1D("Sh","Significance vs rho bin",NBINS,BINMIN,BINMAX);
179  TH1D* Sh2 = new TH1D("Sh2","Distribution of significance",200,-10.,10.);
180 
181 //cout <<"1"<<endl;
182  char st[256];
184  sprintf(st,"rho[%d]>>hcomp(%d,%f,%f)",pp_irho,NBINS,BINMIN,BINMAX);
185  cout<<"Rho min: "<<T_cut<<endl;
186  mycut += "&& rho["+mycut.Itoa(pp_irho,10)+"]>";
187  mycut += T_cut;
188 
189  // cnet.Draw(st,veto_not_vetoed,"goff");
190  //TCut cut=c_veto_not_vetoed;
191 
192  // cnet.Draw(st,cut,"goff");
193  // cout<<"2bis"<<endl;
194  // Long64_t entriesx = (Long64_t)cnet.GetSelectedRows();
195  // cout<< entriesx<<endl;
196  // Long64_t entriesx = cnet.Draw(st,veto_not_vetoed,"goff");
197  Long64_t entriesx = cnet.Draw(st,mycut,"goff");
198  cout<<"Comparison bkg events above threshold: "<< entriesx <<endl;
199  double* rhox = cnet.GetV1();
200 //cout<<"3"<<endl;
201  comph = (TH1D*)gDirectory->Get("hcomp");
202  // comph = (TH1D*) trbkg2->GetHistogram();
203  sprintf(st,"rho[%d]>>hcur(%d,%f,%f)",pp_irho,NBINS,BINMIN,BINMAX);
204  //Long64_t entriesy = wave.Draw(st,veto_not_vetoed,"goff");
205  Long64_t entriesy = wave.Draw(st,mycut,"goff");
206 cout<<"Current bkg events above threshold: "<< entriesy <<endl;
207 // Long64_t entriesy = wave.Draw(st,cut,"goff");
208  double* rhoy = wave.GetV1();
209  double RHOMAX=TMath::Max(TMath::MaxElement(entriesy,rhoy),TMath::MaxElement(entriesx,rhox));
210  cout<<"Rho max: "<<RHOMAX<<endl;
211  // curh =(TH1D*) trbkg->GetHistogram();
212 // TH1D *comph = (TH1D*)gDirectory->Get("hnew");
213  curh = (TH1D*)gDirectory->Get("hcur");
214 // curh->Scale(1/OLIVE);
215 
216 //for(int i=0;i<300;i++){comph->SetBinContent(i+1,TMath::Nint(nrate[i]*NLIVE));}
217 //comph->Scale(1/NLIVE);
218 comph->GetXaxis()->SetRangeUser(BINMIN,BINMAX);
219 
220 cout<<"Un-binned KS test"<<endl;
221 TMath::KolmogorovTest(entriesx,rhox,entriesy,rhoy,"D");
222 cout<<"Binned KS test (no rescaling)"<<endl;
223 curh->KolmogorovTest(comph,"D");
224 curh->AndersonDarlingTest(comph,"D");
225 
226 
227 curh->GetXaxis()->SetTitle("#rho");
228 curh->GetXaxis()->CenterTitle(true);
229 curh->GetYaxis()->SetTitle("#events");
230 curh->GetYaxis()->CenterTitle(true);
231 curh->SetFillColor(kBlue);
232 curh->SetTitle("Distribution of rho");
233 
234 TH1D* comphr=(TH1D*)comph->Clone("comphr");
235 comphr->Scale(K);
236 double maxy = TMath::Max(comphr->GetMaximum(),curh->GetMaximum());
237 curh->GetYaxis()->SetRangeUser(0.1,1.2*maxy);
238 curh->GetXaxis()->SetRangeUser(T_cut,1.2*RHOMAX);
239 //curhr->GetXaxis()->SetTitle("RHO");
240 //curhr->GetYaxis()->SetTitle("#events");
241 comphr->SetLineColor(kRed);
242 comphr->SetFillColor(kRed);
243 comphr->SetFillStyle(3001);
244 
245 
246 TLegend* leg = new TLegend(0.65,0.7,0.99,0.96);
247 
248  //leg->AddEntry("");
249 leg->SetTextSize(0.03);
250 char entry[256];
251 sprintf(entry,"Rescaling factor K = %f", K);
252  leg->SetHeader(entry);
253 sprintf(entry,"Current BKG");
254 leg->AddEntry(curh,entry,"f");
255 sprintf(entry,"Rescaled Comparison BKG");
256 leg->AddEntry(comphr,entry,"f");
257 
258 
259 #ifdef myBATCH
260 c0->cd();
261 c0->Clear();
262 c0->SetLogy(kTRUE);
263 c0->SetLogx(kTRUE);
264 curh->Draw();
265 comphr->Draw("same");
266 leg->Draw();
267 char fname[1024];
268 sprintf(fname,"%s/Rho_Distribution.png",netdir);
269 c0->Update();
270 c0->SaveAs(fname);
271 #else
272 
273 cout <<"Plotting pad 1"<<endl;
274 canvas1->cd(1);
275 curh->Draw();
276 comphr->Draw("same");
277  leg->Draw();
278 
279 #endif
280 
281 const Int_t nq = entriesy/REBIN_MIN_EVTS_PER_BIN;cout<<"nq ="<<nq<<endl;
282 Double_t* xq = new Double_t[nq]; // position where to compute the quantiles in [0,1]
283 Double_t* yq = new Double_t[nq];
284 Double_t* yq2 = new Double_t[nq+1];
285 for (Int_t i=0;i<nq;i++) xq[i] = Float_t(i+1)/nq;
286 curh->GetQuantiles(nq,yq,xq);
287 
288 for(int i=1;i<nq+1;i++){yq2[i]=yq[i-1];}
289 yq2[0]= BINMIN;
290 yq2[nq]= RHOMAX*1.2;
291 TH1D *hnew2 = new TH1D("hnew","rebinned",nq,yq2);
292 TH1D *hnew3 = new TH1D("hnew3","rebinned",nq,yq2);
293 TH1D* Sh3 = new TH1D("Sh3","Significance vs rho bin",nq,yq2);
294 TH1D* Sh4 = new TH1D("Sh4","Distribution of significance",200,-10.,10.);
295 TH1D* Shn = new TH1D("Shn","Normal Distribution",200,-10.,10.);
296 TRandom3 P;
297 P.SetSeed(1234.);
298 for(int i=0;i<entriesy;i++){hnew2->Fill(rhoy[i]);}
299 for(int i=0;i<entriesx;i++){hnew3->Fill(rhox[i]);}
300 
301 hnew2->GetXaxis()->SetTitle("#rho");
302 hnew2->GetXaxis()->CenterTitle(true);
303 hnew2->GetYaxis()->SetTitle("#events");
304 hnew2->GetYaxis()->CenterTitle(true);
305 hnew2->SetFillColor(kBlue);
306 hnew2->SetTitle("Distribution of rho");
307 hnew3->Scale(liveTot/cliveTot);
308 hnew3->SetLineColor(kRed);
309 hnew3->SetFillColor(kRed);
310 hnew3->SetFillStyle(3001);
311 
312 
313 #ifdef myBATCH
314 c0->cd();
315 c0->Clear();
316 c0->SetLogy(kTRUE);
317 c0->SetLogx(kTRUE);
318 hnew2->Draw();
319 hnew3->Draw("SAME");
320 leg->Draw();
321 sprintf(fname,"%s/Rho_Distribution_rebin.png",netdir);
322 c0->Update();
323 c0->SaveAs(fname);
324 #else
325 cout<<"Plotting pad 2"<<endl;
326 canvas1->cd(2);
327 
328 hnew2->Draw();
329 hnew3->Draw("SAME");
330 #endif
331 cout<<"After Rebinning"<<endl;
332 cout <<"Anderson-Darling test (no rescaling)"<<endl;
333 hnew2->AndersonDarlingTest(hnew3,"D");
334 
335 
336 
337 
338 for(int i=0;i<NBINS+1;i++){
339 // cout << i <<" "<<curh->GetBinContent(i+1)<<" "<<comph->GetBinContent(i+1)<<" ";
340  if((curh->GetBinContent(i+1)>0) || (comph->GetBinContent(i+1)>0)){
341 
342  Sh->SetBinContent(i+1,(curh->GetBinContent(i+1)-comph->GetBinContent(i+1)*K)/TMath::Sqrt(pow(curh->GetBinError(i+1),2)+pow(comph->GetBinError(i+1)*K,2)));
343  Sh2->Fill(Sh->GetBinContent(i+1));
344  }
345  else{Sh->SetBinContent(i+1,0.0);}
346  // cout<<Sh->GetBinContent(i+1)<<" - ";
347 }
348 Sh->GetXaxis()->SetTitle("#rho");
349 Sh->GetXaxis()->CenterTitle(true);
350 Sh->GetYaxis()->SetTitle("Observed normalized significances");
351 Sh->GetYaxis()->CenterTitle(true);
352 
353 
354 #ifdef myBATCH
355 c0->cd();
356 c0->Clear();
357 c0->SetLogy(kFALSE);
358 c0->SetLogx(kTRUE);
359 Sh->GetXaxis()->SetRangeUser(T_cut,1.2*RHOMAX);
360 Sh->Draw();
361 sprintf(fname,"%s/Significance_rho.png",netdir);
362 c0->Update();
363 c0->SaveAs(fname);
364 #else
365 cout<<"Plotting pad 3"<<endl;
366 canvas1->cd(3);
367 Sh->Draw();
368 #endif
369 
370 
371 double w_tmp;
372 double w[nq+2];
373 int count =0;
374 for(int i=0;i<nq+2;i++){
375 // cout << i <<" "<<hnew2->GetBinContent(i+1)<<" "<<hnew3->GetBinContent(i+1)<<" ";
376  if((hnew2->GetBinContent(i+1)>0) ||(hnew3->GetBinContent(i+1)>0)){
377  w_tmp = (hnew2->GetBinContent(i+1)-hnew3->GetBinContent(i+1))/TMath::Sqrt(pow(hnew2->GetBinError(i+1),2)+pow(hnew3->GetBinError(i+1),2));
378  Sh3->SetBinContent(i+1,w_tmp);
379  Sh4->Fill(Sh3->GetBinContent(i+1));
380  w[i]=w_tmp;
381  count++;
382  }
383  else{Sh3->SetBinContent(i+1,0.0);w[i]=0.0;}
384  // cout<<w[i]<<" - ";
385 }
386 cout<<endl;
387 Sh3->GetXaxis()->SetTitle("#rho");
388 Sh3->GetXaxis()->CenterTitle(true);
389 Sh3->GetYaxis()->SetTitle("Observed normalized significances");
390 Sh3->GetYaxis()->CenterTitle(true);
391 #ifdef myBATCH
392 c0->cd();
393 c0->Clear();
394 c0->SetLogy(kFALSE);
395 c0->SetLogx(kTRUE);
396 Sh3->GetXaxis()->SetRangeUser(T_cut,1.2*RHOMAX);
397 Sh3->Draw();
398 sprintf(fname,"%s/Significance_rebinrho.png",netdir);
399 c0->Update();
400 c0->SaveAs(fname);
401 #else
402 cout<<"Plotting pad 4"<<endl;
403 canvas1->cd(4);
404 Sh3->Draw();
405 #endif
406 
407 Sh2->GetXaxis()->SetTitle("Observed normalized significances");
408 Sh2->GetXaxis()->CenterTitle(true);
409 Sh2->GetYaxis()->SetTitle("#bins");
410 Sh2->GetYaxis()->CenterTitle(true);
411 Sh2->SetFillColor(kBlue);
412 Sh2->SetFillStyle(3001);
413 
414 #ifdef myBATCH
415 c0->cd();
416 c0->Clear();
417 c0->SetLogy(kTRUE);
418 c0->SetLogx(kFALSE);
419 Sh2->Draw();
420 sprintf(fname,"%s/Significance.png",netdir);
421 c0->Update();
422 c0->SaveAs(fname);
423 #else
424 
425 cout<<"Plotting pad 5"<<endl;
426 canvas1->cd(5);
427 Sh2->Draw();
428 #endif
429 
430 Sh4->GetXaxis()->SetTitle("Observed normalized significances");
431 Sh4->GetXaxis()->CenterTitle(true);
432 Sh4->GetYaxis()->SetTitle("#bins");
433 Sh4->GetYaxis()->CenterTitle(true);
434 Sh4->SetFillColor(kBlue);
435 Sh4->SetFillStyle(3001);
436 
437 #ifdef myBATCH
438 c0->cd();
439 c0->Clear();
440 c0->SetLogy(kTRUE);
441 c0->SetLogx(kFALSE);
442 Sh4->Draw();
443 sprintf(fname,"%s/Significance_rebin.png",netdir);
444 c0->Update();
445 c0->SaveAs(fname);
446 #else
447 cout<<"Plotting pad 6"<<endl;
448 canvas1->cd(6);
449 Sh4->Draw();
450 #endif
451 
452 for(int i=0;i<(int)Sh4->GetEntries();i++){Shn->Fill(P.Gaus(0,1));}
453 cout <<"Anderson-Darling 2-sample test significance distribution vs Normal (no rescaling)"<<endl;
454 Sh4->AndersonDarlingTest(Shn,"D");
455 
456 ROOT::Math::GoFTest* goftest_1 = new ROOT::Math::GoFTest(count, w, ROOT::Math::GoFTest::kGaussian);
457 Double_t pvalueAD_1 = goftest_1-> AndersonDarlingTest();
458 cout <<"Anderson-Darling 1-sample test significance distribution vs Normal (no rescaling) : "<<pvalueAD_1<<endl;
459 
460 cout<<"Starting Q-Q plot ..."<<endl;
461 TGraphQQ* gr;
462 if (entriesy>=entriesx){
463 
464  gr = new TGraphQQ(entriesy,rhoy,entriesx,rhox);
465  gr->GetHistogram()->GetXaxis()->SetTitle("Quantiles current histogram");
466  gr->GetHistogram()->GetYaxis()->SetTitle("Quantiles compare histogram");
467 }
468 else{
469  gr = new TGraphQQ(entriesx,rhox,entriesy,rhoy);
470  gr->GetHistogram()->GetXaxis()->SetTitle("Quantiles compare histogram");
471  gr->GetHistogram()->GetYaxis()->SetTitle("Quantiles current histogram");
472 }
473 
474 
475  gr->SetMarkerColor(kRed);
476  gr->GetHistogram()->GetYaxis()->CenterTitle(true);
477  gr->GetHistogram()->GetXaxis()->CenterTitle(true);
478  // gr->SetLineColor(kRed);
479  gr->SetMarkerSize(1.0);
480  gr->SetMarkerStyle(20);
481  gr->SetTitle("Quantile-Quantile Plot");
482  TLine *line = new TLine(BINMIN, BINMIN,BINMAX,BINMAX);
483 line->SetLineColor(kGreen);
484 line->SetLineWidth(2);
485  line->SetLineStyle(2);
486 
487 #ifdef myBATCH
488 c0->cd();
489 c0->SetLogy(kFALSE);
490 c0->SetLogx(kFALSE);
491 cout<<"Drawing Q-Q plot ..."<<endl;
492 gr->Draw("ALP");
493 cout<<"Finished Q-Q plot ..."<<endl;
494 
495 line->Draw();
496 sprintf(fname,"%s/Q-Q_Plot.png",netdir);
497 c0->Update();
498 c0->SaveAs(fname);
499 #else
500 canvas2->cd();
501 gr->Draw("ALP");
502 line->Draw();
503 #endif
504 
505 TF1* g1 = new TF1("g1","gaus",-10.,10.);
506 g1->SetParameter(0,count/sqrt(TMath::TwoPi()));
507 g1->SetParameter(1,0.);
508 g1->SetParameter(2,1.);
509 
510 TGraphQQ* gr2 = new TGraphQQ(nq,w,g1);
511  gr2->SetMarkerColor(kRed);
512  gr2->GetHistogram()->GetYaxis()->CenterTitle(true);
513  gr2->GetHistogram()->GetXaxis()->CenterTitle(true);
514  // gr->SetLineColor(kRed);
515  gr2->SetMarkerSize(1.0);
516  gr2->SetMarkerStyle(20);
517  gr2->SetTitle("Quantile-Quantile Plot");
518  double binmin = TMath::Max(gr2->GetX()[0],gr2->GetY()[0]);
519 double binmax = TMath::Min(gr2->GetX()[nq-1],gr2->GetY()[nq-1]);
520  TLine *line = new TLine(binmin,binmin,binmax,binmax);
521 line->SetLineColor(kGreen);
522 line->SetLineWidth(2);
523  line->SetLineStyle(2);
524  cout << "Normalized significance distribution vs Gauss(0,1)"<<endl;
525  cout << "Correlation Factor : "<<gr2->GetCorrelationFactor()<<endl;
526  cout << "Covariance : " <<gr2->GetCovariance()<<endl;;
527 
528 #ifdef myBATCH
529 c0->cd();
530 c0->Clear();
531 c0->SetLogy(kFALSE);
532 c0->SetLogx(kFALSE);
533 gr2->Draw("ALP");
534 line->Draw();
535 sprintf(fname,"%s/Q-Q_Plot_significance.png",netdir);
536 c0->Update();
537 c0->SaveAs(fname);
538 
539 char exec[1024];
540 sprintf(exec,"ln -s %s/%s/index.html %s/index.html",work_dir, pp_dir, netdir);
541 gSystem->Exec(exec);
542 sprintf(exec,"ln -s %s/%s/header.html %s/header.html",work_dir, pp_dir, netdir);
543 gSystem->Exec(exec);
544 sprintf(exec,"cp $CWB_MACROS/../postproduction/burst/compare_bkg.html %s/body.html",netdir);
545 gSystem->Exec(exec);
546 
547 
548 
549 exit(0);
550 #else
551 canvas3->cd();
552 gr2->Draw("ALP");
553 line->Draw();
554 #endif
555 
556 
557 
558 //exit(0);
559 }
char ch2[2048]
mycut
Definition: compare_bkg.C:187
double w[nq+2]
Definition: compare_bkg.C:372
double binmax
Definition: compare_bkg.C:519
yq2[0]
Definition: compare_bkg.C:289
TCanvas * canvas2
Definition: compare_bkg.C:57
#define NBINS
TCanvas * canvas3
Definition: compare_bkg.C:64
cout<<"Un-binned KS test"<< endl;TMath::KolmogorovTest(entriesx, rhox, entriesy, rhoy,"D");cout<<"Binned KS test (no rescaling)"<< endl;curh-> KolmogorovTest(comph,"D")
double binmin
Definition: compare_bkg.C:518
TString("c")
int count
Definition: compare_bkg.C:373
TLegend * leg
Definition: compare_bkg.C:246
TRandom3 P
Definition: compare_bkg.C:296
TChain live("liveTime")
static double getLiveTime2(TChain &liv)
Definition: CBCTool.cc:519
i drho i
Double_t pvalueAD_1
Definition: compare_bkg.C:457
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:3956
TChain wave("waveburst")
CWB::Toolbox TB
Definition: ComputeSNR.C:5
char cliv_file_name[1024]
Definition: compare_bkg.C:97
TString Compare_live
Definition: compare_bkg.C:117
const Int_t nq
Definition: compare_bkg.C:281
TH1D * hnew3
Definition: compare_bkg.C:292
TGraph * gr
#define REBIN_MIN_EVTS_PER_BIN
char cnet_file_name[1024]
Definition: compare_bkg.C:96
double maxy
Definition: compare_bkg.C:236
curh AndersonDarlingTest(comph,"D")
i() int(T_cor *100))
TF1 * g1
Definition: compare_bkg.C:505
char netdir[1024]
TH1D * hnew2
Definition: compare_bkg.C:291
const Float_t * yq
TGraphQQ * gr2
Definition: compare_bkg.C:510
char fname[1024]
double liveTot
double w_tmp
Definition: compare_bkg.C:371
TObjArray * token
#define BINMIN
#define BINMAX
char net_file_name[256]
char liv_file_name[256]
TH1D * comphr
Definition: compare_bkg.C:234
sprintf(cnet_file_name,"%s", Compare_tree.Data())
TLine * line
Definition: compare_bkg.C:482
Long64_t entriesx
Definition: compare_bkg.C:197
char pp_dir[512]
Definition: test_config1.C:155
static void mkDir(TString dir, bool question=false, bool remove=true)
Definition: Toolbox.cc:4000
TH1D * Sh3
Definition: compare_bkg.C:293
char veto_not_vetoed[1024]
double T_cut
TH1D * Shn
Definition: compare_bkg.C:295
char work_dir[512]
Definition: test_config1.C:143
char entry[256]
Definition: compare_bkg.C:250
Long64_t entriesy
Definition: compare_bkg.C:205
ROOT::Math::GoFTest * goftest_1
Definition: compare_bkg.C:456
i drho pp_irho
const Float_t xq[6]
TString Compare_tree
Definition: compare_bkg.C:99
exit(0)
TH1D * Sh4
Definition: compare_bkg.C:294