Logo coherent WaveBurst  
Library Reference Guide
Logo
cwb_mkfad.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 // this macro compute the FAD statistic
20 // it is used in post production
21 // can be run in standalone or it is called from the sim report
22 
23 #include <vector>
24 
25 #define FAR_FILE_NAME "rate_threshold_veto.txt"
26 #define LIV_FILE_NAME "live.txt"
27 
28 // -----------------------------------------
29 // plot type : ptype
30 // -----------------------------------------
31 // "FARvsRHO"
32 // "REFFvsRHO"
33 // "REFFvsIRHO"
34 // "VISvsRHO"
35 // "PRODvsFAD"
36 // "EVTvsRHO"
37 // "FADvsRHO"
38 // "FAPvsRHO"
39 // "RECvsINJ"
40 // "OBSTIMEvsFAR"
41 // -----------------------------------------
42 
43 #define DENSITY_FORMULA
44 #define APPLY_ENORM
45 
46 void MakePlot(TString ptype, bool pAll);
47 TGraphErrors* Plot(int mtype, TString ptitle, TString xtitle, TString ytitle, bool save=true);
48 void RECvsINJ(int mtype, TString ptitle, TString xtitle, TString ytitle);
49 void MakeHtml(TString ptitle);
50 void MakeHtmlIndex(TString* ptype, int psize);
53 
54 // --------------------------------------------------------
55 // Global variables
56 // --------------------------------------------------------
57 TString gODIR = pp_dir; // output dir
58 TString gPTYPE = "VISvsRHO"; // plot type
59 int gMTYPE = -1; // mdc type
60 bool gFIT = false; // enable fit
61 TCanvas* gCANVAS = NULL; // canvas object
62 CWB::mdc* gMDC = NULL; // MDC object
63 TTree* gTRWAVE = NULL; // wave tree
64 TTree* gTRMDC = NULL; // mdc tree
65 bool gINSPIRAL = false; // inspiral/burst mdc
66 double gOBSTIME= 0.0; // observation livetime
67 double gBKGTIME= 0.0; // background livetime
68 double gRHOMIN = 5.; // minimum rho value selected for plots
69 int gNBINS = 100; // number of bins used in mdc histo
70 int gNZBINS = -1; // le_0 -> standard FAD statistic
71  // ge_0 -> modified FAD statistic
72 
73 vector<double> RHO; // rho
74 vector<double> eRHO; // RHO error
75 vector<double> VIS; // visible volume`
76 vector<double> eVIS; // VIS error
77 vector<double> FAR; // FAR
78 vector<double> eFAR; // FAR error
79 vector<double> dFAR; // differendial FAR
80 vector<double> normHRSS; // normalization hrss
81 
82 // --bkgrep : directory of the background report (used to read rate_threshold_veto.txt and live.txt)
83 // --hrss : if it is a number then it is used as normalization constant for all MDC types (def=0)
84 // if =0 then hrss rescale is not applied
85 // if it is a file then it is the list of hrss used for each MDC type
86 // (format : for each line -> hrss)
87 // --gfit : true/false -> enable/disable fit in the output plots (default=false)
88 // --rhomin : minimum rho value selected for plots (default = 5)
89 // --units : K -> Kpc,Kyr : M -> Mpc,Myr (def=M)
90 // --distr : formula/mdc -> radial distribution is computed from formula or from mdc injections (def=MDC)
91 // --nbins : number of bins used in hist to computed the radial distribution from the mdc injections
92 // --header : if true -> add cwb header to fad html file (def=false)
93 // --multi : if true -> FAD multi plot for each mdc set are created and substituted in the sim report
94 // page to the eff_freq plots (def=false)
95 // --title : title of the html page (default=FAD) : spaces must be filled with *
96 // --subtitle: subtitle of the html page (default="") : spaces must be filled with *
97 
98 
109 
110 #define nPLOT 10
111 
113  "FARvsRHO",
114  "RECvsINJ",
115  "VISvsRHO",
116  "REFFvsRHO",
117  "REFFvsIRHO",
118  "FADvsRHO",
119  "PRODvsFAD",
120  "EVTvsRHO",
121  "FAPvsRHO",
122  "OBSTIMEvsFAR"
123  };
124 
125 
126 void cwb_mkfad(TString odir="fad", int nzbins=-1, double obstime=0, bool bexit=true) {
127 //
128 // odir : output fad directory (default="fad")
129 // nzbins : (default is -1)
130 // - NOTE : if it is defined in pp_fad the input value is overwritten
131 // - if nzbin=0 the FAD statistic is computed with classical FAD
132 // - if nzbin>0 the FAD statistic is computed until there are nzbins
133 // consecutive bins with zero events inside
134 // - if nzbin<0 the FAD statistic is computed with classical FAD and min-hold
135 // obstime : zero lag observation time, if 0 then it is read from live.txt
136 // bexit : if true (def) then the macro exit at the end of the execution
137 //
138 // NOTE : pp_fad must be defined in user_pparameters.C file or in the input
139 // fad config file (fad.in) provided to the line command cwb_mkfad
140 // Ex: cwb_mkfad M1 fad.in fad
141 //
142 
144 
145  TB.checkFile(gSystem->Getenv("CWB_ROOTLOGON_FILE"));
146  TB.checkFile(gSystem->Getenv("CWB_PARAMETERS_FILE"));
147  TB.checkFile(gSystem->Getenv("CWB_UPARAMETERS_FILE"));
148  TB.checkFile(gSystem->Getenv("CWB_PPARAMETERS_FILE"));
149  TB.checkFile(gSystem->Getenv("CWB_UPPARAMETERS_FILE"));
150  TB.checkFile(gSystem->Getenv("CWB_EPPARAMETERS_FILE"));
151 
152  // ------------------------------------------------
153  // cwb_mkfad works only with simulation=4 mode
154  // ------------------------------------------------
155 /*
156  if(simulation!=4) {
157  cout << "cwb_mkfad.C - Error : cwb_mkfad works only with simulation=4 mode" << endl;
158  exit(1);
159  }
160 */
161 
162  // ------------------------------------------------
163  // read pp_fad
164  // ------------------------------------------------
165  if(pp_fad=="") { // nothing to be done
166  cout<<endl<<"cwb_mkfad.C : Warning : pp_fad is not defined, macro is not executed !!!"<<endl<<endl;
167  exit(0);
168  }
169 
170  // get --bkgrep
171  pp_fad_bkgrep = CWB::Toolbox::getParameter(pp_fad,"--bkgrep");
172  if(pp_fad_bkgrep=="") {
173  cout<<"cwb_mkfad.C : Error : pp_fad --bkgrep not defined"<<endl;exit(1);}
174 
176 
177  // get --hrss
178  pp_fad_hrss = CWB::Toolbox::getParameter(pp_fad,"--hrss");
179  if(pp_fad_hrss=="") {pp_fad_hrss="0";
180  cout<<"cwb_mkfad.C : Info : pp_fad --hrss not defined : set hrss=1"<<endl;}
181 
182  if(!pp_fad_hrss.IsFloat()) {
183  // hrss normalization values are define in a file
185  }
186 
187  // get --rhomin
188  pp_fad_rhomin = CWB::Toolbox::getParameter(pp_fad,"--rhomin");
189  if(pp_fad_rhomin!="") {
190  if(pp_fad_rhomin.IsFloat()) {
191  gRHOMIN = pp_fad_rhomin.Atof();
192  } else {
193  cout<<"cwb_mkfad.C : Error : pp_fad --rhomin must be a number"<<endl;
194  exit(1);
195  }
196  }
197 
198  // get --gfit
199  pp_fad_gfit = CWB::Toolbox::getParameter(pp_fad,"--gfit");
200  if(pp_fad_gfit!="") {
201  if((pp_fad_gfit!="true")&&(pp_fad_gfit!="false")) {
202  cout<<"cwb_mkfad.C : Error : pp_fad --gfit bad value -> must be true/false"<<endl;
203  exit(1);
204  } else {
205  if(pp_fad_gfit=="true") gFIT=true;
206  if(pp_fad_gfit=="false") gFIT=false;
207  }
208  }
209 
210  // get --units
211  pp_fad_units = CWB::Toolbox::getParameter(pp_fad,"--units");
212  if(pp_fad_units=="") pp_fad_units="M";
213  pp_fad_units.ToUpper();
214  if((pp_fad_units!="K")&&(pp_fad_units!="M")) {
215  cout<<"cwb_mkfad.C : Error : pp_fad --units bad value -> must be K/M"<<endl;
216  exit(1);
217  }
218 
219  // get --distr
220  pp_fad_distr = CWB::Toolbox::getParameter(pp_fad,"--distr");
221  if(pp_fad_distr=="") pp_fad_distr="mdc";
222  pp_fad_distr.ToUpper();
223  if((pp_fad_distr!="MDC")&&(pp_fad_distr!="FORMULA")) {
224  cout<<"cwb_mkfad.C : Error : pp_fad --distr bad value -> must be MDC/FORMULA"<<endl;
225  exit(1);
226  }
227 
228  // get --nzbins (if it is defined in pp_fad the input value is overwritten)
229  gNZBINS = nzbins;
230  pp_fad_nzbins = CWB::Toolbox::getParameter(pp_fad,"--nzbins");
231  if(pp_fad_nzbins!="") {
232  TString _pp_fad_nzbins = pp_fad_nzbins;
233  if((_pp_fad_nzbins[0]=='+')||(_pp_fad_nzbins[0]=='-')) _pp_fad_nzbins.Remove(0,1);
234  if(_pp_fad_nzbins.IsDigit()) {
235  gNZBINS = pp_fad_nzbins.Atoi();
236  } else {
237  cout<<"cwb_mkfad.C : Error : pp_fad --nzbins must be an integer number"<<endl;
238  exit(1);
239  }
240  }
241 
242  // get --nbins
243  pp_fad_nbins = CWB::Toolbox::getParameter(pp_fad,"--nbins");
244  if(pp_fad_nbins!="") {
245  if(pp_fad_nbins.IsDigit()) {
246  gNBINS = pp_fad_nbins.Atoi();
247  } else {
248  cout<<"cwb_mkfad.C : Error : pp_fad --nbins must be an integer number"<<endl;
249  exit(1);
250  }
251  }
252 
253  // get --header
254  TString pp_fad_header = CWB::Toolbox::getParameter(pp_fad,"--header");
255  if(pp_fad_header=="") pp_fad_header="false";
256  pp_fad_header.ToUpper();
257 
258  // get --multi
259  TString pp_fad_multi = CWB::Toolbox::getParameter(pp_fad,"--multi");
260  if(pp_fad_multi=="") pp_fad_multi="false";
261  pp_fad_multi.ToUpper();
262 
263  // get --title
264  TString pp_fad_title = CWB::Toolbox::getParameter(pp_fad,"--title");
265  pp_fad_title.ReplaceAll("*"," ");
266  if(pp_fad_title=="") pp_fad_title="FAD";
267 
268  // get --subtitle
269  TString pp_fad_subtitle = CWB::Toolbox::getParameter(pp_fad,"--subtitle");
270  pp_fad_subtitle.ReplaceAll("*"," ");
271 
272  // ------------------------------------------------
273  // create canvas
274  // ------------------------------------------------
275  gCANVAS = new TCanvas("canvas", "canvas",16,30,825,546);
276  gCANVAS->Range(-19.4801,-9.25,-17.4775,83.25);
277  gCANVAS->SetBorderSize(2);
278  gCANVAS->SetFrameFillColor(0);
279  gCANVAS->SetGridx();
280  gCANVAS->SetGridy();
281 
282  gStyle->SetOptFit(kTRUE);
283 
284  // ------------------------------------------------
285  // define output dir
286  // ------------------------------------------------
287  gODIR = TString(pp_dir)+TString("/")+odir;
288 
289  // ------------------------------------------------
290  // export to CINT net,cfg
291  // exec config plugin
292  // if Burst MDC then extract mdcHRSS which is defined in config plugin
293  // ------------------------------------------------
294  char cmd[128];
295  //sprintf(cmd,"network* net = (network*)%p;",net);
296  sprintf(cmd,"network* net = new network;");
297  gROOT->ProcessLine(cmd);
298  CWB::config* cfg = new CWB::config;
299  cfg->Import();
300  sprintf(cmd,"CWB::config* cfg = (CWB::config*)%p;",cfg);
301  gROOT->ProcessLine(cmd);
302  sprintf(cmd,"int gIFACTOR=1;");
303  gROOT->ProcessLine(cmd);
304  configPlugin.Exec();
305  //MDC.Print();
306  gMDC = &MDC;
307 
308  gINSPIRAL = gMDC->GetInspiral()!="" ? true : false; // Inspiral/Burst MDC
309 
310  if(!gINSPIRAL) { // if burst then mdcHRSS must be declaren in the config plugin
311  // verify if mdcHRSS exist
312  TGlobal* global = (TGlobal*)gROOT->GetGlobal("mdcHRSS",true);
313  if(global!=NULL) {
314  cout << global->GetTypeName() << endl;
315  if(TString(global->GetTypeName())!="vector<double>") {
316  cout << "cwb_mkfad.C - Error : 'vector<double> mdcHRSS' do not exist in CINT" << endl;
317  gSystem->Exit(1);
318  }
319  }
320  }
321 
322  // ------------------------------------------------
323  // open wave/mdc trees
324  // ------------------------------------------------
325  // open wave file
326  TFile* fwave = TFile::Open(sim_file_name);
327  gTRWAVE = (TTree*) gROOT->FindObject("waveburst");
328  // open mdc file
329  TFile *fmdc = TFile::Open(mdc_file_name);
330  gTRMDC = (TTree*) gROOT->FindObject("mdc");
331 
332  // ------------------------------------------------
333  // get observation time
334  // ------------------------------------------------
335  char liv_file_path[1024];
336  sprintf(liv_file_path,"%s/%s",pp_fad_bkgrep.Data(),LIV_FILE_NAME);
337  int countlag=0;
338  gBKGTIME=GetLiveTime(liv_file_path,-1,-1,countlag); // get full livetime
339  gOBSTIME=GetLiveTime(liv_file_path,0,0,countlag); // get zero lag livetime
340  gBKGTIME-=gOBSTIME; // background livetime
341  if(obstime>0) gOBSTIME=obstime; // user provided zero lag livetime
342  cout << "Zero Lag Observation Time : " << gOBSTIME << " sec" << endl;
343  if(gOBSTIME==0) {
344  cout << "cwb_mkfad.C - Error : Observation Time is zero" << endl;
345  cout << " probably your set do not includes the zero lag" << endl << endl;
346  exit(1);
347  }
348  cout << "Background Observation Time : " << gBKGTIME << " sec" << endl;
349 
350  // ------------------------------------------------
351  // read cumulative rho far from rate_threshold_veto.txt file
352  // ------------------------------------------------
353 
354  char far_file_path[1024];
355  sprintf(far_file_path,"%s/%s",pp_fad_bkgrep.Data(),FAR_FILE_NAME);
356 
357  ifstream infar;
358  infar.open(far_file_path, ios::in);
359  if (!infar.good()) {cout << "Error Opening File : " << far_file_path << endl;exit(1);}
360  while (1) {
361  float irho,ifar;
362  infar >> irho >> ifar;
363  if (!infar.good()) break;
364  if(irho<gRHOMIN) continue;
365  if(ifar==0) break;
366  RHO.push_back(irho);
367  FAR.push_back(ifar);
368  eFAR.push_back(sqrt(gBKGTIME*ifar)/gBKGTIME);
369  dFAR.push_back(ifar);
370  }
371  infar.close();
372  // add one more value with FAR=0
373  float drho=RHO[RHO.size()-1]-RHO[RHO.size()-2];
374  RHO.push_back(RHO[RHO.size()-1]+drho);
375  FAR.push_back(0);
376  eFAR.push_back(0);
377  dFAR.push_back(0);
378 
379  // add eRHO
380  eRHO.resize(RHO.size());
381  for(int i=0;i<eRHO.size();i++) eRHO[i]=0;
382 
383  // compute the differential FAR
384  for(int i=0;i<RHO.size()-1;i++) {
385  dFAR[i]=dFAR[i]-dFAR[i+1];
386  }
387 
388  for(int i=0;i<RHO.size()-1;i++) {
389  //cout << i << " " <<RHO[i] << " " << dFAR[i] << endl;
390  }
391 
392  // ------------------------------------------------
393  // read normalization hrss
394  // ------------------------------------------------
395  int N = gMDC->wfList.size(); // get number of MDC types
396 
397  if(pp_fad_hrss.IsFloat()) { // apply the same valye to all mtypes
398 
399  for(int i=0;i<N;i++) normHRSS.push_back(pp_fad_hrss.Atof());
400 
401  } else { // hrss normalization values are define in a file
402 
403  ifstream in_hrss_norm;
404  in_hrss_norm.open(pp_fad_hrss.Data());
405  int count=0;
406  double hrss_temp;
407  while(1) {
408  in_hrss_norm >> hrss_temp;
409  if (!in_hrss_norm.good()) break;
410  //cout << hrss_temp << endl;
411  normHRSS.push_back(hrss_temp);
412  count++;
413  if(count>N) {
414  cout << "cwb_mkfad.C - Errors : too many waveforms on " << pp_fad_hrss << " file " << endl;
415  exit(1);
416  }
417  }
418  in_hrss_norm.close();
419  }
420 
421  // ------------------------------------------------
422  // create output dir
423  // ------------------------------------------------
424  TB.mkDir(gODIR,!pp_batch);
425 
426  // ------------------------------------------------
427  // create multiPlot - used in sim report page
428  // ------------------------------------------------
429  if(pp_fad_multi=="TRUE") MakeMultiPlotFAD(mdc_inj_file);
430 
431  // ------------------------------------------------
432  // create plots
433  // ------------------------------------------------
434  gMTYPE = -1; // reset initial value of mdc type
435  gCANVAS->cd(); // must be done because MakeMultiPlotFAD set a different canvas
436  for(int i=0;i<nPLOT;i++) MakePlot(ptype[i], false);
437 
438  // ------------------------------------------------
439  // make fad.html
440  // ------------------------------------------------
441  MakeHtmlIndex(ptype,nPLOT);
442  if(pp_fad_header=="TRUE") AddHtmlHeader(gODIR);
443 
444  if(bexit) gSystem->Exit(0); else return;
445 }
446 
447 void MakePlot(TString ptype, bool pAll) {
448 
449  gPTYPE = ptype;
450 
451  char rho_type[32];sprintf(rho_type,"rho[%d]",pp_irho);
452 
453  TString ptitle;
454  TString xtitle;
455  TString ytitle;
456 
457  if(gPTYPE=="REFFvsRHO") {
458  gCANVAS->SetLogx(false);
459  gCANVAS->SetLogy(false);
460  ptitle=TString("Effective Radius vs ")+rho_type;
461  gStyle->SetStatY(0.3);
462  xtitle=rho_type;
463  ytitle="Reff (Kpc)";
464 
465  } else if(gPTYPE=="REFFvsIRHO") {
466  gCANVAS->SetLogx(false);
467  gCANVAS->SetLogy(true);
468  ptitle=TString("Effective Radius vs inverse ")+rho_type;
469  xtitle=TString(rho_type)+"^{-1}";
470  ytitle="Reff (Kpc)";
471 
472  } else if(gPTYPE=="VISvsRHO") {
473  gCANVAS->SetLogx(false);
474  gCANVAS->SetLogy(true);
475  ptitle=TString("Visible Volume vs ")+rho_type;
476  xtitle=rho_type;
477  ytitle="Vvis (Kpc^{3})";
478 
479  } else if(gPTYPE=="PRODvsFAD") {
480  gCANVAS->SetLogx(true);
481  gCANVAS->SetLogy(false);
482  ptitle=TString("Productivity vs False Alarm Density");
483  xtitle="FAD (Kpc^{-3} Kyr^{-1})";
484  ytitle="Productivity (Kpc^{3} Kyr)";
485 
486  } else if(gPTYPE=="FADvsRHO") {
487  gCANVAS->SetLogx(false);
488  gCANVAS->SetLogy(true);
489  ptitle=TString("False Alarm Density vs ")+rho_type;
490  xtitle=rho_type;
491  ytitle="FAD (Kpc^{-3} Kyr^{-1})";
492 
493  } else if(gPTYPE=="FARvsRHO") {
494  gCANVAS->SetLogx(false);
495  gCANVAS->SetLogy(true);
496  ptitle=TString("False Alarm Rate vs ")+rho_type;
497  xtitle=rho_type;
498  ytitle="False Alarm Rate (sec^{-1})";
499 
500  } else if(gPTYPE=="FAPvsRHO") {
501  gCANVAS->SetLogx(false);
502  gCANVAS->SetLogy(true);
503  ptitle=TString("False Alarm Probability vs ")+rho_type;
504  xtitle=rho_type;
505  ytitle="False Alarm Probability";
506 
507  } else if(gPTYPE=="EVTvsRHO") {
508  gCANVAS->SetLogx(false);
509  gCANVAS->SetLogy(true);
510  ptitle=TString("Expected background events per Observation time vs ")+rho_type;
511  xtitle=rho_type;
512  ytitle="Expected Events";
513 
514  } else if(gPTYPE=="OBSTIMEvsFAR") {
515  gCANVAS->SetLogx(true);
516  gCANVAS->SetLogy(false);
517  ptitle=TString("Observation Time vs False Alarm Rate");
518  xtitle="FAR (sec^{-1})";
519  ytitle="Observation Time (sec)";
520 
521  } else if(gPTYPE=="RECvsINJ") {
522  gCANVAS->SetLogx(false);
523  gCANVAS->SetLogy(true);
524  ptitle="Reconstructed events vs Injected events";
525  gStyle->SetOptStat(0);
526  xtitle = "distance (Kpc)";
527  ytitle = "counts";
528  }
529 
530  // get number of MDC types
531  int N = gMDC->wfList.size();
532 
533  if(gPTYPE=="RECvsINJ") {
534 
535  if(pAll) for(int i=0;i<=N;i++) RECvsINJ(i, ptitle, xtitle, ytitle);
536  else RECvsINJ(0, ptitle, xtitle, ytitle);
537 
538  } else {
539 
540  if(gPTYPE=="EVTvsRHO") {
541  Plot(0, ptitle, xtitle, ytitle);
542  } else {
543 
544 #ifdef APPLY_ENORM
545  if(pAll) for(int i=0;i<=N;i++) Plot(i, ptitle, xtitle, ytitle);
546  else Plot(0, ptitle, xtitle, ytitle);
547 #else
548  for(int i=1;i<=N;i++) Plot(i, ptitle, xtitle, ytitle);
549  //Plot(1, ptitle);
550 #endif
551 
552  }
553  }
554 
555  return;
556 }
557 
559 
560  char sel[1024];
561  char cut[1024];
562  TF1 *vdens = NULL;
563 // TF1 *hdist = NULL;
564 
565  // INJECTED
566  if(mtype==0) {
567  sprintf(cut,"1==1");
568  } else {
569  //sprintf(cut,"type[0]==%d",mtype);
570  sprintf(cut,"type==%d",mtype);
571  }
572 
573  double min_dist = gTRMDC->GetMinimum("distance");
574  double max_dist = gTRMDC->GetMaximum("distance");
575 #ifdef APPLY_ENORM
576  double enorm_max=0;
577  for(int i=0;i<normHRSS.size();i++) {
578  double enorm=normHRSS[i]/mdcHRSS[i];
579  if(enorm>enorm_max) enorm_max=enorm;
580  }
581  min_dist *= enorm_max;
582  max_dist *= enorm_max;
583 #endif
584 
585  TH1F* hdist = new TH1F("hdist","hdist",gNBINS,1000*min_dist,1000*max_dist); // Mpc -> Kpc
586 
587  TTreeFormula mcut("mcut", cut, gTRMDC);
588  gTRMDC->SetBranchStatus("*",false);
589  gTRMDC->SetBranchStatus("distance",true);
590  gTRMDC->SetBranchStatus("type",true);
591  int type;
592  float distance;
593  gTRMDC->SetBranchAddress("distance",&distance);
594  gTRMDC->SetBranchAddress("type",&type);
595  int msize = gTRMDC->GetEntries();
596  int nmdc = 0;
597  for(int i=0;i<msize;i++) {
598  gTRMDC->GetEntry(i);
599  if(mcut.EvalInstance()==0) continue;
600  distance*=1000;
601 #ifdef APPLY_ENORM
602  // compute Normalization to hrss @ 10 Kpc
603  if(normHRSS.size()&&(normHRSS[type-1]>0)) {
604  distance *= normHRSS[type-1]/mdcHRSS[type-1];
605  }
606 #endif
607  hdist->Fill(distance);
608  nmdc++;
609  }
610  cout << "nmdc : " << nmdc << endl;
611  gTRMDC->SetBranchStatus("*",true);
612 
613 /*
614  double min_dist = gTRMDC->GetMinimum("distance");
615  double max_dist = gTRMDC->GetMaximum("distance");
616 
617  // get total number of inject MDC with TYPE=type
618  sprintf(sel,"1000*distance>>hdist1(%d,%f,%f)",gNBINS,1000*min_dist,1000*max_dist); // Mpc -> Kpc
619  if(mtype==0) {
620  sprintf(cut,"");
621  } else {
622  sprintf(cut,"type[0]==%d",mtype);
623  }
624  gTRMDC->Draw(sel,cut,"goff");
625  int nmdc = gTRMDC->GetSelectedRows();
626  cout << "nmdc : " << nmdc << endl;
627 */
628 
629  // get Sky Distribution parameters
630  TString sky_dist_formula = gMDC->GetSkyFile(); // get distribution formula
631  vector<mdcpar> sky_parms = gMDC->GetSkyParms();
632  bool error=false;
633  int entries = gMDC->GetPar("entries",sky_parms,error);
634  double min_dist = gMDC->GetPar("rho_min",sky_parms,error); // get rho min
635  if(error) min_dist=0.;
636  double dist_max = gMDC->GetPar("rho_max",sky_parms,error); // get rho max
637  if(error) dist_max=0.;
638 
639  bool formula = ((sky_dist_formula!="")&&(dist_max>0)) ? true : false;
640 
641  formula&=(pp_fad_distr=="FORMULA");
642 
643  if(formula) { // radial distribution is extract from the config plugin
644 
645  cout << "sky_dist_formula : " << sky_dist_formula << endl;
646  cout << "min_dist : " << min_dist << " dist_max : " << dist_max << endl;
647 
648  // compute the formula normalization
649  // the integral between min_dist and dist_max must be the total number
650  // of the injected mdc = nmdc
651  TF1 *fdist = new TF1("fdist",sky_dist_formula,min_dist,dist_max);
652  double norm=fdist->Integral(min_dist,dist_max);
653  norm=nmdc/norm;
654  cout << norm << endl;
655 
656  // visible volume density formula
657  char vdens_expression[256];
658  sprintf(vdens_expression,"(4*TMath::Pi()*x*x)/(%f*(%s))",norm,sky_dist_formula.Data());
659  cout << "vdens_expression : " << vdens_expression << endl;
660  vdens = new TF1("vdens",vdens_expression,min_dist,dist_max);
661 
662  } else { // radial distribution is extract from the mdc injection root file
663 
664 //hdist = (TH1F*)gDirectory->Get("hdist1");
665  if (hdist!=NULL) {
666  // compute radial distribution density histogram
667  for(int i=1;i<=hdist->GetNbinsX();i++) {
668  double value = hdist->GetBinContent(i);
669  value /= hdist->GetBinWidth(i);
670  hdist->SetBinContent(i,value);
671  }
672  //hdist->Draw("HIST");
673  //gCANVAS->Print("hdist.png");
674  } else {
675  cout << "cwb_mkfad.C - Error : hdist is NULL" << endl;
676  gSystem->Exit(1);
677  }
678  }
679 
680  int nRHO = RHO.size();
681 
682  // compute visible volume vs rho
683  VIS.resize(nRHO);
684  eVIS.resize(nRHO);
685  VIS[nRHO-1] = 0;
686  eVIS[nRHO-1] = 0;
687  for(int n=nRHO-1;n>=0;n--) {
688 
689  double rho_min = RHO[n];
690  double rho_max = n==nRHO-1 ? 1.e80 : RHO[n+1]; // when n=nRHO-1 the range is [RHO[n],1e80]
691 
692  sprintf(sel,"range[1]:type[1]");
693  if(mtype==0) {
694  sprintf(cut,"abs(time[0]-time[%d])<%f && netcc[%d]>%f && rho[%d]>%f && rho[%d]<=%f",
695  nIFO,T_win,pp_inetcc,T_cor,pp_irho,rho_min,pp_irho,rho_max);
696  } else {
697  sprintf(cut,"type[1]==%d && abs(time[0]-time[%d])<%f && netcc[%d]>%f && rho[%d]>%f && rho[%d]<=%f",
698  mtype,nIFO,T_win,pp_inetcc,T_cor,pp_irho,rho_min,pp_irho,rho_max);
699  }
700  if(T_vED>0) sprintf(cut,"%s && neted[0]/ecor<%f",cut,T_vED);
701  if(T_pen>0) sprintf(cut,"%s && penalty>%f",cut,T_pen);
702  gTRWAVE->Draw(sel,cut,"goff");
703  int nwave = gTRWAVE->GetSelectedRows();
704  //cout << "rho_min " << rho_min << "\trho_max " << rho_max << "\tnwave : " << nwave << endl;
705  double* range = gTRWAVE->GetV1();
706  double* itype = gTRWAVE->GetV2();
707 
708  double Pi = TMath::Pi();
709 
710  for(int i=0;i<nwave;i++) {
711  double dist=1000*range[i]; // Mpc -> Kpc
712 #ifdef APPLY_ENORM
713  // compute Normalization to hrss @ 10 Kpc
714  if(normHRSS.size()&&(normHRSS[itype[i]-1]>0)) {
715  dist *= normHRSS[itype[i]-1]/mdcHRSS[itype[i]-1];
716  }
717 #endif
718 
719  double ivdens;
720  if(formula) {
721  ivdens = vdens->Eval(dist);
722  } else {
723  ivdens = (4*TMath::Pi()*dist*dist)/hdist->Interpolate(dist);
724  }
725  VIS[n] +=ivdens;
726  eVIS[n]+=pow(ivdens,2);
727  }
728  eVIS[n]=sqrt(eVIS[n]);
729 
730  if(n>0) VIS[n-1]=VIS[n];
731 
732  if(pp_fad_units=="M") {VIS[n]*=1.e-9; eVIS[n]*=1.e-9;} // Kpc^3 -> Mpc^3
733 
734  //cout << n << " " << RHO[n] << " " << VIS[n] << endl;
735  //cout << n << " " << eRHO[n] << " " << eVIS[n] << endl;
736  }
737 
738  if(hdist) delete hdist;
739 
740  gMTYPE = mtype; // update global value
741  return;
742 }
743 
744 TGraphErrors* Plot(int mtype, TString ptitle, TString xtitle, TString ytitle, bool save) {
745 
746  // set RHO,eRHO,VIS,eVIS
747  // visible volume is computed only if mtype is different
748  // from the previous mtype value (stored in gMTYPE)
749  if(mtype!=gMTYPE) getVisibleVolume(mtype);
750 
751  if(pp_fad_units=="M") { // Kpc -> Mpc : Kyr -> Myr
752  ptitle.ReplaceAll("Kpc","Mpc");
753  xtitle.ReplaceAll("Kpc","Mpc");
754  ytitle.ReplaceAll("Kpc","Mpc");
755  ptitle.ReplaceAll("Kyr","Myr");
756  xtitle.ReplaceAll("Kyr","Myr");
757  ytitle.ReplaceAll("Kyr","Myr");
758  }
759 
760  int nRHO = RHO.size();
761  wavearray<double> x(nRHO);
762  wavearray<double> ex(nRHO);
763  wavearray<double> y(nRHO);
764  wavearray<double> ey(nRHO);
765 
766  if(gPTYPE=="FARvsRHO") {
767 
768  for(int n=0;n<nRHO;n++) {
769  x[n]=RHO[n];
770  ex[n]=eRHO[n];
771  y[n]=FAR[n];
772  ey[n]=eFAR[n];
773  }
774  }
775 
776  if((gPTYPE=="FADvsRHO")||(gPTYPE=="EVTvsRHO")||(gPTYPE=="FAPvsRHO")||
777  (gPTYPE=="PRODvsFAD")||(gPTYPE=="OBSTIMEvsFAR")) {
778 
779  double Kyr = 86400.*365.*1000.;
780  double Myr = 86400.*365.*1000000.;
781  wavearray<double> FAD(nRHO);
782  wavearray<double> eFAD(nRHO);
783 
784  if(gNZBINS<0) { // compute classic FAD statistic + min-hold
785  for(int n=0;n<nRHO;n++) {
786  FAD[n]=FAR[n]/VIS[n];
787  eFAD[n]=sqrt(pow(eFAR[n]/FAR[n],2)+pow(eVIS[n]/VIS[n],2))*FAD[n];
788  }
789 
790  // apply min hold to make FAD monothonic
791  wavearray<double> mFAD(nRHO);
792  wavearray<double> meFAD(nRHO);
793  mFAD=0;mFAD[0]=FAD[0];meFAD[0]=eFAD[0];
794  for(int n=1;n<nRHO;n++) {
795  if(FAD[n]<mFAD[n-1]) {mFAD[n]=FAD[n];meFAD[n]=eFAD[n];}
796  else {mFAD[n]=mFAD[n-1];meFAD[n]=meFAD[n-1];}
797  }
798  for(int n=0;n<nRHO;n++) {FAD[n]=mFAD[n];eFAD[n]=meFAD[n];}
799  } else if(gNZBINS==0) { // compute standard FAD statistic
800  for(int n=0;n<nRHO;n++) {
801  FAD[n]=dFAR[n]/VIS[n];
802  eFAD[n]=sqrt(pow(eFAR[n]/FAR[n],2)+pow(eVIS[n]/VIS[n],2))*FAD[n];
803  }
804  for(int n=nRHO-1;n>0;n--) FAD[n-1]+=FAD[n];
805  } else if(gNZBINS>0) { // compute classic FAD statistic + max hold
806  for(int n=0;n<nRHO;n++) {
807  FAD[n]=FAR[n]/VIS[n];
808  eFAD[n]=sqrt(pow(eFAR[n]/FAR[n],2)+pow(eVIS[n]/VIS[n],2))*FAD[n];
809  }
810  // find first gNZBINS consecutive zero FAR bin = zbin : start from n=1 because dFAR[0]=0
811  int nzbins=0;
812  for(int n=1;n<nRHO;n++) {
813  if(dFAR[n]==0) {
814  nzbins++;
815  if(nzbins==gNZBINS) {
816  nRHO=n-(gNZBINS-1);break;
817  }
818  } else nzbins=0;
819  }
820  x.resize(nRHO);
821  // apply max hold to make FAD monothonic
822  // max hold FAD is applied only below bin<zbin
823  wavearray<double> mFAD(nRHO);
824  mFAD=0;mFAD[nRHO-1]=FAD[nRHO-1];
825  for(int n=nRHO-2;n>=0;n--) {
826  if(FAD[n]>mFAD[n+1]) mFAD[n]=FAD[n]; else mFAD[n]=mFAD[n+1];
827  }
828  for(int n=0;n<nRHO;n++) FAD[n]=mFAD[n];
829  }
830 
831  double Xyr = (pp_fad_units=="M") ? Myr : Kyr;
832  // sec -> Kyr/Myr
833  for(int n=0;n<nRHO;n++) {FAD[n]*=Xyr;eFAD[n]*=Xyr;}
834 
835  for(int n=0;n<nRHO;n++) {
836  x[n]=RHO[n];
837  ex[n]=eRHO[n];
838  if(gPTYPE=="FADvsRHO") { y[n]=FAD[n]; ey[n]=eFAD[n]; }
839  if(gPTYPE=="PRODvsFAD") {
840  x[n]=FAD[n]; ex[n]=eFAD[n];
841  // if FAD not change the productivity not change
842  if(n && (FAD[n]==FAD[n-1])) {
843  y[n]=y[n-1]; ey[n]=ey[n-1];
844  } else {
845  y[n]=(gOBSTIME/Xyr)*VIS[n]; ey[n]=(gOBSTIME/Xyr)*eVIS[n];
846  }
847  }
848  if(gPTYPE=="EVTvsRHO") {
849  // if FAD not change the expected events not change
850  if(n && (FAD[n]==FAD[n-1])) {
851  y[n]=y[n-1]; ey[n]=ey[n-1];
852  } else {
853  y[n]=FAD[n]*(gOBSTIME/Xyr)*VIS[n]; ey[n]=0;
854  }
855  }
856  if(gPTYPE=="FAPvsRHO") {
857  // if FAD not change the FAP not change
858  if(n && (FAD[n]==FAD[n-1])) {
859  y[n]=y[n-1]; ey[n]=ey[n-1];
860  } else {
861  y[n]=FAD[n]*(gOBSTIME/Xyr)*VIS[n];
862  y[n]=1.-exp(-y[n]);
863  }
864  ey[n]=0;
865  }
866  }
867  }
868 
869  if(gPTYPE=="OBSTIMEvsFAR") {
870  for(int n=0;n<nRHO;n++) {
871  x[n]=FAR[n]; ex[n]=eFAR[n];
872  y[n]=gOBSTIME; ey[n]=0;
873  }
874  }
875 
876  if(gPTYPE=="VISvsRHO") {
877 
878  for(int n=0;n<nRHO;n++) {
879  x[n]=RHO[n];
880  ex[n]=eRHO[n];
881  y[n]=VIS[n];
882  ey[n]=eVIS[n];
883  }
884  }
885 
886  if(gPTYPE=="REFFvsRHO") {
887 
888  for(int n=0;n<nRHO;n++) {
889  x[n]=RHO[n];
890  ex[n]=eRHO[n];
891  y[n]=pow(3*VIS[n]/(4.*TMath::Pi()),1./3.);
892  ey[n]=y[n]/3.*(eVIS[n]/VIS[n]);
893  }
894  }
895 
896  if(gPTYPE=="REFFvsIRHO") {
897 
898  for(int n=0;n<nRHO;n++) {
899  x[n]=1./RHO[n];
900  ex[n]=eRHO[n] ? 1./eRHO[n] : 0.;
901  y[n]=pow(3*VIS[n]/(4.*TMath::Pi()),1./3.);
902  ey[n]=y[n]/3.*(eVIS[n]/VIS[n]);
903  }
904  }
905 
906  for(int n=0;n<nRHO;n++) {
907  //cout << n << " " << x[n] << " " << ex[n] << " " << y[n] << " " << ey[n] << endl;
908  }
909 
910  char title[256];
911 
912 #ifdef APPLY_ENORM
913  if(mtype==0) {
914  sprintf(title,"%s : %s", ptitle.Data(),"ALL");
915  } else {
916  if(normHRSS.size()) {
917  sprintf(title,"%s : %s : Strain @ 10Kpc = %g",
918  ptitle.Data(),gMDC->wfList[mtype-1].name.Data(),normHRSS[mtype-1]);
919  } else {
920  sprintf(title,"%s : %s",
921  ptitle.Data(),gMDC->wfList[mtype-1].name.Data());
922  }
923  }
924 #else
925  if(mtype==0) {
926  cout << "MakeFAD.C : Error - mtype=0 non allowed when data are not normalized" << endl;
927  gSystem->Exit(1);
928  }
929  sprintf(title,"%s : %s : Strain @ 10Kpc = %g",
930  ptitle.Data(),gMDC->wfList[mtype-1].name.Data(),mdcHRSS[mtype-1]);
931 #endif
932 
933  if(gPTYPE=="EVTvsRHO") sprintf(title,"%s : %s", ptitle.Data(),"ALL");
934 
935  TGraphErrors* gr = new TGraphErrors;
936  int cnt=0;
937  gr->SetPoint(cnt,x[0],y[0]);
938  gr->SetPointError(cnt++,0,0);
939  for(int i=1;i<nRHO;i++) {
940  double dx = (x[i]-x[i-1])/10000.;
941  gr->SetPoint(cnt,x[i],y[i-1]);
942  //gr->SetPointError(cnt++,0,ey[i-1]);
943  gr->SetPointError(cnt++,ex[i],ey[i-1]);
944  gr->SetPoint(cnt,x[i]+dx,y[i]);
945  //gr->SetPointError(cnt++,0,ey[i]);
946  gr->SetPointError(cnt++,ex[i],ey[i]);
947  }
948  gr->GetHistogram()->GetXaxis()->SetTitle(xtitle.Data());
949  gr->GetHistogram()->GetYaxis()->SetTitle(ytitle.Data());
950  gr->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
951  gr->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
952 
953  // convert logx,logy to linx,liny when x,y ranges are less than a 1 order of magnitude
954  double xmax=0;double xmin=1e80;
955  double ymax=0;double ymin=1e80;
956  for(int i=0;i<nRHO;i++) {if(x[i]>xmax) xmax=x[i]; if(x[i]<xmin && x[i]!=0) xmin=x[i];}
957  for(int i=0;i<nRHO;i++) {if(y[i]>ymax) ymax=y[i]; if(y[i]<ymin && y[i]!=0) ymin=y[i];}
958  if(xmax/xmin<10) gCANVAS->SetLogx(false);
959  if(ymax/ymin<10) gCANVAS->SetLogy(false);
960  gr->GetHistogram()->GetXaxis()->SetRangeUser(xmin,xmax);
961  gr->GetHistogram()->GetYaxis()->SetRangeUser(0.95*ymin,1.05*ymax);
962 
963  gr->SetTitle(title);
964  gr->SetLineColor(kRed);
965  gr->SetLineWidth(2);
966  gr->SetFillColor(2);
967  gr->SetFillStyle(3003);
968  gr->Draw("3AL");
969 
970  if(gFIT) {
971  TF1 *gfit=NULL;
972 
973  if(gPTYPE=="VISvsRHO") gfit = new TF1("gfit","[0]+[1]/pow(x,3)",x[0],x[nRHO-1]);
974  if(gPTYPE=="REFFvsRHO") gfit = new TF1("gfit","[0]/x",x[0],x[nRHO-1]);
975  if(gPTYPE=="REFFvsIRHO") gfit = new TF1("gfit","[0]*x",x[0],x[nRHO-1]);
976 
977  if((gPTYPE=="VISvsRHO") || (gPTYPE=="REFFvsRHO") || (gPTYPE=="REFFvsIRHO")) {
978  gr->Fit(gfit,"R");
979  gfit=gr->GetFunction("gfit");
980  gfit->SetLineColor(kBlue);
981  gfit->SetLineWidth(1);
982  }
983  }
984 
985  if(!save) return gr;
986 
987  // print plot
988  char ofname[256];
989  if(mtype==0) {
990  sprintf(ofname,"%s/%s_%s.png",
991  gODIR.Data(),gPTYPE.Data(),"ALL");
992  } else {
993  sprintf(ofname,"%s/%s_%s.png",
994  gODIR.Data(),gMDC->wfList[mtype-1].name.Data());
995  }
996  cout << ofname << endl;
997  gCANVAS->Print(ofname);
998  if(mtype==0) {
999  sprintf(ofname,"%s/%s_%s.txt",
1000  gODIR.Data(),gPTYPE.Data(),"ALL");
1001  cout << "Write values on: " << ofname << endl;
1002  ofstream outf;
1003  outf.open(ofname);
1004  //for (int index=0; index<x.size(); index++) {out << x.data[index] << "\t" << y.data[index] << "\t" << ex.data[index] << " " << ey.data[index] << endl;}
1005  for (int index=0; index<x.size(); index++) {outf << x.data[index] << "\t" << y.data[index] << endl;}
1006  outf.close();
1007  }
1008 
1009  return gr;
1010 }
1011 
1012 void RECvsINJ(int itype, TString ptitle, TString xtitle, TString ytitle) {
1013 
1014  char cut[256];
1015  char title[256];
1016 
1017  if(pp_fad_units=="M") xtitle.ReplaceAll("Kpc","Mpc");
1018 
1019  // INJECTED
1020  float ufactor;
1021  if(pp_fad_units=="M") { // Kyr -> Myr
1022  ufactor=1;
1023  } else { // Kpc -> Mpc
1024  ufactor=1000;
1025  }
1026  if(itype==0) {
1027  sprintf(cut,"1==1");
1028  } else {
1029  sprintf(cut,"type==%d",itype);
1030  }
1031 
1032  float dmin = gTRMDC->GetMinimum("distance");
1033  float dmax = gTRMDC->GetMaximum("distance");
1034 #ifdef APPLY_ENORM
1035  double enorm_max=0;
1036  for(int i=0;i<normHRSS.size();i++) {
1037  double enorm=normHRSS[i]/mdcHRSS[i];
1038  if(enorm>enorm_max) enorm_max=enorm;
1039  }
1040 #endif
1041  if(enorm_max==0) enorm_max=1;
1042  dmin*=ufactor*enorm_max;
1043  dmax*=ufactor*enorm_max;
1044 
1045  TH1F* mhist = new TH1F("mhist","mhist",100,dmin,dmax);
1046 
1047  TTreeFormula mcut("mcut", cut, gTRMDC);
1048  gTRMDC->SetBranchStatus("*",false);
1049  gTRMDC->SetBranchStatus("distance",true);
1050  gTRMDC->SetBranchStatus("type",true);
1051  int mtype;
1052  float distance;
1053  gTRMDC->SetBranchAddress("distance",&distance);
1054  gTRMDC->SetBranchAddress("type",&mtype);
1055  int msize = gTRMDC->GetEntries();
1056  int nmdc = 0;
1057  for(i=0;i<msize;i++) {
1058  gTRMDC->GetEntry(i);
1059  if(mcut.EvalInstance()==0) continue;
1060  distance*=ufactor;
1061 #ifdef APPLY_ENORM
1062  // compute Normalization to hrss @ 10 Kpc
1063  if(normHRSS.size()&&(normHRSS[mtype-1]>0)) {
1064  distance *= normHRSS[mtype-1]/mdcHRSS[mtype-1];
1065  }
1066 #endif
1067  mhist->Fill(distance);
1068  nmdc++;
1069  }
1070  gTRMDC->SetBranchStatus("*",true);
1071  cout << "nmdc : " << nmdc << endl;
1072 
1073  mhist->Draw("HIST");
1074  mhist->GetXaxis()->SetTitle(xtitle);
1075  mhist->GetYaxis()->SetTitle(ytitle);
1076  mhist->GetYaxis()->SetRangeUser(0.1,pow(10.,TMath::Ceil(TMath::Log10(mhist->GetMaximum()))));
1077 
1078  // DETECTED
1079  if(itype==0) {
1080  sprintf(cut,"abs(time[0]-time[%d])<%g && netcc[%d]>%g && rho[%d]>%g",
1082  } else {
1083  sprintf(cut,"type[1]==%d && abs(time[0]-time[%d])<%g && netcc[%d]>%g && rho[%d]>%g",
1085  }
1086  if(T_vED>0) sprintf(cut,"%s && neted[0]/ecor<%f",cut,T_vED);
1087  if(T_pen>0) sprintf(cut,"%s && penalty>%f",cut,T_pen);
1088 
1089  TH1F* whist = new TH1F("whist","whist",100,dmin,dmax);
1090 
1091  TTreeFormula wcut("wcut", cut, gTRWAVE);
1092  gTRWAVE->SetBranchStatus("*",false);
1093  gTRWAVE->SetBranchStatus("range",true);
1094  gTRWAVE->SetBranchStatus("type",true);
1095  gTRWAVE->SetBranchStatus("time",true);
1096  gTRWAVE->SetBranchStatus("neted",true);
1097  gTRWAVE->SetBranchStatus("ecor",true);
1098  gTRWAVE->SetBranchStatus("netcc",true);
1099  gTRWAVE->SetBranchStatus("rho",true);
1100  gTRWAVE->SetBranchStatus("penalty",true);
1101  int wtype[2];
1102  float range[2];
1103  gTRWAVE->SetBranchAddress("range",range);
1104  gTRWAVE->SetBranchAddress("type",wtype);
1105  int wsize = gTRWAVE->GetEntries();
1106  int nwave = 0;
1107  for(i=0;i<wsize;i++) {
1108  gTRWAVE->GetEntry(i);
1109  if(wcut.EvalInstance()==0) continue;
1110  distance=ufactor*range[1];
1111 #ifdef APPLY_ENORM
1112  // compute Normalization to hrss @ 10 Kpc
1113  if(normHRSS.size()&&(normHRSS[wtype[1]-1]>0)) {
1114  distance *= normHRSS[wtype[1]-1]/mdcHRSS[wtype[1]-1];
1115  }
1116 #endif
1117  whist->Fill(distance);
1118  nwave++;
1119  }
1120  gTRWAVE->SetBranchStatus("*",true);
1121  cout << "nwave : " << nwave << endl;
1122  whist->SetFillColor(kRed);
1123  whist->Draw("SAME");
1124 
1125  sprintf(title,"%s",cut);
1126 
1127  sprintf(title,"%s : inj = %d : rec : %d",ptitle.Data(),nmdc,nwave);
1128  mhist->SetTitle(title);
1129 
1130  // print plot
1131  char ofname[1024];
1132  if(itype==0) {
1133  sprintf(ofname,"%s/%s_%s.png",
1134  gODIR.Data(),gPTYPE.Data(),"ALL");
1135  } else {
1136  sprintf(ofname,"%s/%s_%s.png",
1137  gODIR.Data(),gPTYPE.Data(),gMDC->wfList[itype-1].name.Data());
1138  }
1139  cout << ofname << endl;
1140  gCANVAS->Print(ofname);
1141 
1142  // compute efficiency vs distance
1143  TH1F* ehist = new TH1F("ehist","ehist",100,dmin,dmax);
1144  for(int i=1;i<=mhist->GetNbinsX();i++) {
1145  double ndet = whist->GetBinContent(i);
1146  double ninj = mhist->GetBinContent(i);
1147  double eff = ninj ? ndet/ninj : 0.;
1148  ehist->SetBinContent(i,eff);
1149  }
1150  ehist->Draw("HIST");
1151  ehist->GetXaxis()->SetTitle(xtitle);
1152  ehist->GetYaxis()->SetTitle("efficiency");
1153  //ehist->GetYaxis()->SetRangeUser(0.1,pow(10.,TMath::Ceil(TMath::Log10(ehist->GetMaximum()))));
1154  ehist->SetTitle("Efficiency vs Distance");
1155  // print efficiency plot
1156  if(itype==0) {
1157  sprintf(ofname,"%s/%s_%s.png",
1158  gODIR.Data(),"EFFvsDIST","ALL");
1159  } else {
1160  sprintf(ofname,"%s/%s_%s.png",
1161  gODIR.Data(),"EFFvsDIST",gMDC->wfList[itype-1].name.Data());
1162  }
1163  cout << ofname << endl;
1164  gCANVAS->Print(ofname);
1165 
1166  delete mhist;
1167  delete whist;
1168  delete ehist;
1169 
1170  return;
1171 }
1172 
1173 void
1175 
1176  char index_file[1024];
1177 
1178  sprintf(index_file,"%s/%s/fad.html",gODIR.Data(), gPTYPE.Data());
1179 
1180  ofstream out;
1181  out.open(index_file,ios::out); // create index.html
1182  char oline[1024];
1183  out << "<html>" << endl;
1184  out << "<font color=\"black\" style=\"font-weight:bold;\"><center><p><h2>"
1185  << ptitle.Data() << "</h2><p><center></font>" << endl;
1186  out << "<hr><br>" << endl;
1187  int offset=1;
1188 #ifdef APPLY_ENORM
1189  offset=0;
1190 #endif
1191  int size=gMDC->wfList.size();
1192  if(gPTYPE=="EVTvsRHO") {offset=0; size=0;}
1193 
1194  for(int i=offset;i<=size;i++) {
1195  out << "<table border=0 cellpadding=2 align=\"center\">" << endl;
1196  out << "<tr align=\"center\">" << endl;
1197  if(i==0) {
1198  out << "<td><font style=\"font-weight:bold;\"><center><p><h2>"
1199  << "ALL" << "</h2><p><center></font></td>" << endl;
1200  } else {
1201  out << "<td><font style=\"font-weight:bold;\"><center><p><h2>"
1202  << gMDC->wfList[i-1].name.Data() << "</h2><p><center></font></td>" << endl;
1203  }
1204  out << "</tr>" << endl;
1205  out << "<tr align=\"center\">" << endl;
1206  char fname[1024];
1207  if(i==0) {
1208  sprintf(fname,"%s_%s_%s.png",gPTYPE.Data(),data_label,"ALL");
1209  } else {
1210  sprintf(fname,"%s_%s_%s.png",gPTYPE.Data(),data_label,gMDC->wfList[i-1].name.Data());
1211  }
1212  sprintf(oline,"<td><a href=\"%s\"><img src=\"%s\" width=650></a></td>",fname,fname);
1213  out << oline << endl;
1214  out << "</tr>" << endl;
1215  out << "</table>" << endl;
1216  }
1217  out << "</html>" << endl;
1218  out.close();
1219 
1220  return;
1221 }
1222 
1223 void
1224 MakeHtmlIndex(TString* pTYPE, int pSIZE) {
1225 
1226  // add EFFvsDIST plot to the pTYPE plot list
1227  int psize=pSIZE+1;
1228  TString* ptype = new TString[psize+1];
1229  int I=0;
1230  for(int i=0;i<pSIZE;i++) {
1231  ptype[I++]=pTYPE[i];
1232  if(pTYPE[i]=="RECvsINJ") ptype[I++]="EFFvsDIST";
1233  }
1234 
1235  TString info="";
1236 
1237  char index_file[1024];
1238  sprintf(index_file,"%s/fad.html",gODIR.Data());
1239 
1240  ofstream out;
1241  out.open(index_file,ios::out); // create index.html
1242  char oline[1024];
1243  out << "<html>" << endl;
1244  out << "<font color=\"black\" style=\"font-weight:bold;\"><center><p><h1>"
1245  << pp_fad_title << "</h1><p></center></font>" << endl;
1246  if(pp_fad_subtitle!="") {
1247  out << "<font color=\"red\" style=\"font-weight:bold;\"><center><p><h3>"
1248  << pp_fad_subtitle << "</h3><p></center></font>" << endl;
1249  }
1250  out << "<hr>" << endl;
1251  out << "<h3>FAD Options</h3>" << endl;
1252 
1253  TString odir = TString(gSystem->WorkingDirectory())+"/"+gODIR;
1254  out << "<ul>" << endl;
1255  out << "<li> odir : <font color=\"red\"> " << odir << "</font>" << endl;
1256  out << "</ul>" << endl;
1257 
1258  out << "<ul>" << endl;
1259  out << "<li> --bkgrep : <font color=\"red\"> " << pp_fad_bkgrep << "</font>" << endl;
1260  out << "</ul>" << endl;
1261 
1262  if(pp_fad_hrss.IsFloat()) {
1263  if(pp_fad_hrss=="0") info = " (hrss rescale is not applied)";
1264  else info = " (apply a constant hrss rescale)";
1265  } else info = " (hrss is rescaled using custom hrss factors)";
1266 
1267  out << "<ul>" << endl;
1268  out << "<li> --hrss : <font color=\"red\"> " << pp_fad_hrss << "</font>" << info << endl;
1269  out << "</ul>" << endl;
1270 
1271  if(gFIT) info = " (apply fit)";
1272  else info = " (fit not applied)";
1273 
1274  out << "<ul>" << endl;
1275  out << "<li> --gfit : <font color=\"red\"> " << gFIT << "</font>" << info << endl;
1276  out << "</ul>" << endl;
1277 
1278  out << "<ul>" << endl;
1279  out << "<li> --rhomin : <font color=\"red\"> " << gRHOMIN << "</font>"
1280  << " (rho minimum used to compute FAD plots)" << endl;
1281  out << "</ul>" << endl;
1282 
1283  if(gNZBINS<0) info = " (un-biased FAD)";
1284  else if(gNZBINS==0) info = " (standard FAD)";
1285  else if(gNZBINS>0) info = " (test FAD)";
1286 
1287  out << "<ul>" << endl;
1288  out << "<li> --nzbins : <font color=\"red\"> " << gNZBINS << "</font>" << info << endl;
1289  out << "</ul>" << endl;
1290 
1291  if(pp_fad_units=="K") info = " (Kpc,Kyr)";
1292  else info = " (Mpc,Myr)";
1293 
1294  out << "<ul>" << endl;
1295  out << "<li> --units : <font color=\"red\"> " << pp_fad_units << "</font>" << info << endl;
1296  out << "</ul>" << endl;
1297 
1298  if(pp_fad_distr=="FORMULA") info = " (radial distribution is computed from formula)";
1299  else info = " (radial distribution is computed from mdc injections)";
1300 
1301  out << "<ul>" << endl;
1302  out << "<li> --distr : <font color=\"red\"> " << pp_fad_distr << "</font>" << info << endl;
1303  out << "</ul>" << endl;
1304 
1305  out << "<ul>" << endl;
1306  out << "<li> --nbins : <font color=\"red\"> " << gNBINS << "</font>"
1307  << " (number of bins used in hist to computed the radial distribution from the MDC injections root file)" << endl;
1308  out << "</ul>" << endl;
1309 
1310  out << "<hr><br>" << endl;
1311 
1312  TString _ptype[nPLOT+1];
1313  int index=0;
1314  _ptype[index++]="FAPvsRHO";
1315  for(int i=0;i<nPLOT+1;i++) if(ptype[i]!="FAPvsRHO") _ptype[index++]=ptype[i];
1316 
1317  for(int i=0;i<psize;i++) {
1318  out << "<table border=0 cellpadding=2 align=\"center\">" << endl;
1319  out << "<tr align=\"center\">" << endl;
1320  out << "</tr>" << endl;
1321  out << "<tr align=\"center\">" << endl;
1322  char fname[1024];
1323  if(i==0) {
1324  sprintf(fname,"%s_%s.png",_ptype[i].Data(),"ALL");
1325  sprintf(oline,"<td><a href=\"%s\"><img src=\"%s\" width=650></a></td>",fname,fname);
1326  out << oline << endl;
1327  } else {
1328  sprintf(fname,"%s_%s.png",_ptype[i].Data(),"ALL");
1329  sprintf(oline,"<td><a href=\"%s\"><img src=\"%s\" width=520></a></td>",fname,fname);
1330  out << oline << endl;
1331  sprintf(fname,"%s_%s.png",_ptype[i+1].Data(),"ALL");
1332  sprintf(oline,"<td><a href=\"%s\"><img src=\"%s\" width=520></a></td>",fname,fname);
1333  out << oline << endl;
1334  }
1335  out << "</tr>" << endl;
1336  out << "</table>" << endl;
1337  if(i==0) out << "<hr><br>" << endl; else i++;
1338  }
1339  out << "</html>" << endl;
1340  out.close();
1341 
1342  return;
1343 }
1344 
1346 
1347  char cmd[1024];
1348 
1349  sprintf(cmd,"root -n -l -b ${CWB_ROOTLOGON_FILE} '${HOME_CWB}/info/macros/MakeHTML.C\(\"%s\",false\)'",odir.Data());
1350  gSystem->Exec(cmd);
1351  sprintf(cmd,"cp ${HOME_WAT}//html/etc/html/ROOT.css %s",odir.Data());
1352  gSystem->Exec(cmd);
1353  sprintf(cmd,"cp ${HOME_WAT}//html/etc/html/ROOT.js %s",odir.Data());
1354  gSystem->Exec(cmd);
1355  sprintf(cmd,"cp ${HOME_WAT}//html/etc/html/tabber.css %s",odir.Data());
1356  gSystem->Exec(cmd);
1357  sprintf(cmd,"cp ${HOME_WAT}//html/etc/html/tabber.js %s",odir.Data());
1358  gSystem->Exec(cmd);
1359 }
1360 
1362 
1363  #define NTYPE_MAX 20
1364  #define NMDC_MAX 64
1365 
1366  // read injection file types
1367  char imdc_set[NMDC_MAX][128]; // injection set
1368  size_t imdc_type[NMDC_MAX]; // injection type
1369  char imdc_name[NMDC_MAX][128]; // injection name
1370  double imdc_fcentral[NMDC_MAX]; // injection central frequencies
1371  double imdc_fbandwidth[NMDC_MAX]; // injection bandwidth frequencies
1372  size_t imdc_index[NMDC_MAX]; // type reference array
1373  size_t imdc_iset[NMDC_MAX]; // injection set index
1374 
1375  int ninj=ReadInjType(mdc_inj_file.Data(),NMDC_MAX,imdc_set,imdc_type,
1377  if(ninj==0) {cout << "Error - no injection - terminated" << endl;exit(1);}
1378 
1380  int nset=0;
1381  for(int i=0;i<ninj;i++) {
1382  bool bnew=true;
1383  for(int j=0;j<nset;j++) if(imdc_set[i]==imdc_set_name[j]) bnew=false;
1384  if(bnew) imdc_set_name[nset++]=imdc_set[i];
1385  }
1386  cout << "nset : " << nset << endl;
1387 
1388  for(int i=0;i<nset;i++) {
1389  for(int j=0;j<ninj;j++) if(imdc_set[j]==imdc_set_name[i]) imdc_iset[j]=i;
1390  }
1391  for (int iset=0;iset<nset;iset++) cout << iset << " " << imdc_set_name[iset].Data() << endl;
1392 
1393  Color_t colors[NMDC_MAX] = { 6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
1394  6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
1395  6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7,
1396  6, 3, 2, 8,43, 7, 8, 4, 4, 2,43, 1, 3, 1, 6, 7 };
1397  Style_t markers[NMDC_MAX]= {20,21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,
1398  21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20,
1399  21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20,
1400  21,22,23,29,29,21,22,20,21,22,23,29,20,21,22,20 };
1401 
1402  char title[256];
1403  char ofile[256];
1404  TCanvas* canvas[NTYPE_MAX];
1405  TMultiGraph* mg[NTYPE_MAX];
1406  TGraphErrors* gr[NMDC_MAX];
1407  TLegend* legend[NTYPE_MAX];
1408 
1409  char rho_type[32];sprintf(rho_type,"rho[%d]",pp_irho);
1410 
1411  for(int iset=0;iset<nset;iset++) {
1412 
1413  int iset_size=0; // iset size
1414  for(i=0; i<ninj; i++) if(imdc_iset[i]==iset) iset_size++;
1415  double hleg = 0.88-iset_size*0.08;
1416  legend[iset] = new TLegend(0.58,hleg,0.99,0.88,NULL,"brNDC");
1417  legend[iset]->AddEntry((TObject*)0, "", "");
1418 
1419  mg[iset] = new TMultiGraph();
1420 
1421  // set plot type
1422  gPTYPE = "FADvsRHO";
1423  TString ptitle=imdc_set_name[iset];
1424  TString xtitle=rho_type;
1425  TString ytitle="FAD (Kpc^{-3} Kyr^{-1})";
1426  if(pp_fad_units=="M") ytitle.ReplaceAll("Kpc","Mpc");
1427  if(pp_fad_units=="M") ytitle.ReplaceAll("Kyr","Myr");
1428 
1429  double ymin=1e40;
1430  double ymax=0;
1431  for(int i=0; i<ninj; i++) {
1432  if(imdc_iset[i]!=iset) continue; // skip unwanted injection types
1433  cout << "MakeMultiPlotFAD : Processing -> " << imdc_name[i] << endl;
1434  gr[i] = Plot(i+1, ptitle, xtitle, ytitle, false);
1435  gr[i]->SetLineColor(colors[i]);
1436  int N = gr[i]->GetN();
1437  double* Y = gr[i]->GetY();
1438  for(int k=0;k<N;k++) if(Y[k]>0 && Y[k]<ymin) ymin=Y[k];
1439  for(int k=0;k<N;k++) if(Y[k]>0 && Y[k]>ymax) ymax=Y[k];
1440  double fad_rho8 = gr[i]->Eval(8); // get FAD @ rho=8
1441  char legname[32];sprintf(legname,"%s, %5.1E",imdc_name[i], fad_rho8);
1442  legend[iset]->AddEntry(gr[i],legname,"lp");
1443  mg[iset]->Add(gr[i]);
1444  }
1445 
1446  char namecanvas[8];
1447  sprintf(namecanvas,"c%i",iset);
1448  canvas[iset] = new TCanvas(namecanvas,namecanvas,125+iset*10,82,976,576);
1449  canvas[iset]->Clear();
1450  canvas[iset]->ToggleEventStatus();
1451  canvas[iset]->SetLogy(true);
1452  canvas[iset]->SetLogx(true);
1453  canvas[iset]->SetGridx();
1454  canvas[iset]->SetGridy();
1455  canvas[iset]->SetFillColor(kWhite);
1456  canvas[iset]->cd();
1457 
1458  mg[iset]->SetTitle(ptitle);
1459  mg[iset]->Paint("alp");
1460  mg[iset]->GetHistogram()->GetXaxis()->SetTitle(xtitle);
1461  mg[iset]->GetHistogram()->GetYaxis()->SetTitle(ytitle);
1462  mg[iset]->GetHistogram()->GetXaxis()->CenterTitle(true);
1463  mg[iset]->GetHistogram()->GetXaxis()->SetLabelFont(42);
1464  mg[iset]->GetHistogram()->GetXaxis()->SetTitleFont(42);
1465  mg[iset]->GetHistogram()->GetXaxis()->SetTitleOffset(1.3);
1466  mg[iset]->GetHistogram()->GetYaxis()->SetLabelFont(42);
1467  mg[iset]->GetHistogram()->GetYaxis()->SetTitleFont(42);
1468  mg[iset]->GetHistogram()->GetXaxis()->SetRangeUser(RHO[0],RHO[RHO.size()-2]);
1469  mg[iset]->GetHistogram()->GetYaxis()->SetRangeUser(0.90*ymin,1.1*ymax);
1470  mg[iset]->GetHistogram()->GetXaxis()->SetMoreLogLabels();
1471 
1472  mg[iset]->Draw("alp");
1473 
1474  char leg_header[32];sprintf(leg_header,"FAD @ rho[%d]=8",pp_irho);
1475  legend[iset]->SetHeader(leg_header);
1476  legend[iset]->SetBorderSize(1);
1477  legend[iset]->SetTextAlign(22);
1478  legend[iset]->SetTextFont(12);
1479  legend[iset]->SetLineColor(1);
1480  legend[iset]->SetLineStyle(1);
1481  legend[iset]->SetLineWidth(1);
1482  legend[iset]->SetFillColor(0);
1483  legend[iset]->SetFillStyle(1001);
1484  legend[iset]->SetTextSize(0.04);
1485  legend[iset]->SetLineColor(kBlack);
1486  legend[iset]->SetFillColor(kWhite);
1487 
1488  legend[iset]->Draw();
1489 
1490  sprintf(ofile,"%s/fad_rho_%s.gif",gODIR.Data(),imdc_set_name[iset].Data());
1491  cout << ofile << endl;
1492  canvas[iset]->SaveAs(ofile);
1493  }
1494 
1495  return;
1496 }
char ofile[1024]
CWB::config * cfg
void AddHtmlHeader(TString odir)
Definition: cwb_mkfad.C:1345
TGraphErrors * Plot(int mtype, TString ptitle, TString xtitle, TString ytitle, bool save=true)
Definition: cwb_mkfad.C:744
vector< double > FAR
Definition: cwb_mkfad.C:77
TString gPTYPE
Definition: cwb_mkfad.C:58
char xtitle[1024]
vector< mdcpar > GetSkyParms()
Definition: mdc.hh:295
vector< double > eVIS
Definition: cwb_mkfad.C:76
double T_pen
par [0] value
std::vector< double > mdcHRSS(K)
double dist
Definition: ConvertGWGC.C:48
int offset
Definition: TestSTFT_2.C:19
void getVisibleVolume(int mtype)
Definition: cwb_mkfad.C:558
TString ptype[nPLOT]
Definition: cwb_mkfad.C:112
vector< double > eRHO
Definition: cwb_mkfad.C:74
int error
Definition: cwb_compile.C:43
int n
Definition: cwb_net.C:28
void GetLiveTime()
Definition: GetLiveTime.C:31
double rho_min
TString("c")
int nset
Definition: cwb_mkeff.C:75
TString pp_fad_units
Definition: cwb_mkfad.C:103
#define nRHO
Definition: Average.C:43
double T_cor
#define nPLOT
Definition: cwb_mkfad.C:110
ofstream out
Definition: cwb_merge.C:214
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
TTree * gTRMDC
Definition: cwb_mkfad.C:64
char odir[1024]
vector< double > RHO
Definition: cwb_mkfad.C:73
CWB::Toolbox TB
return wmap canvas
CWB::mdc * MDC
i pp_inetcc
Long_t size
#define FAR_FILE_NAME
Definition: cwb_mkfad.C:25
Color_t colors[16]
vector< double > eFAR
Definition: cwb_mkfad.C:78
TString gODIR
Definition: cwb_mkfad.C:57
void MakeMultiPlotFAD(TString mdc_inj_file)
Definition: cwb_mkfad.C:1361
int j
Definition: cwb_net.C:28
i drho i
TString GetSkyFile()
Definition: mdc.hh:294
void Import(TString umacro="")
Definition: config.cc:352
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:4670
int nmdc
#define N
size_t imdc_iset[NMDC_MAX]
Definition: cwb_mkeff.C:68
TString pp_fad_nbins
Definition: cwb_mkfad.C:105
TString pp_fad_bkgrep
Definition: cwb_mkfad.C:99
double GetPar(TString name, vector< mdcpar > par, bool &error)
Definition: mdc.cc:432
#define nIFO
vector< int > mtype
Definition: cwb_report_pe.C:66
virtual size_t size() const
Definition: wavearray.hh:145
char data_label[512]
Definition: test_config1.C:160
vector< double > normHRSS
Definition: cwb_mkfad.C:80
size_t imdc_index[NMDC_MAX]
Definition: cwb_mkeff.C:67
TGlobal * global
Definition: config.cc:23
vector< double > VIS
Definition: cwb_mkfad.C:75
char mdc_inj_file[1024]
Definition: cwb_dump_inj.C:98
Definition: mdc.hh:248
TGraph * gr
TString pp_fad_title
Definition: cwb_mkfad.C:107
void RECvsINJ(int mtype, TString ptitle, TString xtitle, TString ytitle)
Definition: cwb_mkfad.C:1012
TString pp_fad_distr
Definition: cwb_mkfad.C:104
double rho_max
double Pi
char oline[1024]
void MakeHtmlIndex(TString *ptype, int psize)
Definition: cwb_mkfad.C:1224
int ninj
Definition: cwb_mkeff.C:70
char cut[512]
char fname[1024]
TString pp_fad_multi
CWB::mdc * gMDC
Definition: cwb_mkfad.C:62
#define NTYPE_MAX
int gNBINS
Definition: cwb_mkfad.C:69
int gNZBINS
Definition: cwb_mkfad.C:70
bool gINSPIRAL
Definition: cwb_mkfad.C:65
int nwave
int k
TString sel("slag[1]:slag[2]")
bool gFIT
Definition: cwb_mkfad.C:60
char imdc_name[NMDC_MAX][128]
Definition: cwb_mkeff.C:64
#define NMDC_MAX
TString pp_fad_gfit
Definition: cwb_mkfad.C:102
vector< waveform > wfList
Definition: mdc.hh:387
double gBKGTIME
Definition: cwb_mkfad.C:67
int ReadInjType(TString ifName, int ntype_max, char set[][128], size_t type[], char name[][128], double fcentral[], double fbandwidth[])
Definition: Toolfun.hh:816
char sim_file_name[1024]
void MakePlot(TString ptype, bool pAll)
Definition: cwb_mkfad.C:447
TTree * gTRWAVE
Definition: cwb_mkfad.C:63
float irho
char title[256]
Definition: SSeriesExample.C:1
static TString getParameter(TString options, TString param="")
Definition: Toolbox.cc:6727
double gOBSTIME
Definition: cwb_mkfad.C:66
ifstream in
#define LIV_FILE_NAME
Definition: cwb_mkfad.C:26
double gRHOMIN
Definition: cwb_mkfad.C:68
wavearray< int > index
double T_win
TCanvas * gCANVAS
Definition: cwb_mkfad.C:61
char pp_dir[512]
Definition: test_config1.C:155
TString pp_fad_subtitle
Definition: cwb_mkfad.C:108
static void mkDir(TString dir, bool question=false, bool remove=true)
Definition: Toolbox.cc:4714
int gMTYPE
Definition: cwb_mkfad.C:59
char cmd[1024]
int cnt
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
double T_cut
float distance
TString pp_fad_nzbins
Definition: cwb_mkfad.C:106
DataType_t * data
Definition: wavearray.hh:319
TMacro configPlugin
void cwb_mkfad(TString odir="fad", int nzbins=-1, double obstime=0, bool bexit=true)
Definition: cwb_mkfad.C:126
TString pp_fad_rhomin
Definition: cwb_mkfad.C:101
char formula[256]
size_t imdc_type[NMDC_MAX]
Definition: cwb_mkeff.C:63
vector< double > dFAR
Definition: cwb_mkfad.C:79
bool save
double T_vED
char mdc_file_name[1024]
TString pp_fad_hrss
Definition: cwb_mkfad.C:100
void MakeHtml(TString ptitle)
Definition: cwb_mkfad.C:1174
TString config
TString * imdc_set_name
Definition: cwb_mkeff.C:74
virtual void resize(unsigned int)
Definition: wavearray.cc:463
wavearray< double > y
Definition: Test10.C:31
double imdc_fcentral[NMDC_MAX]
Definition: cwb_mkeff.C:65
TMultiGraph * mg
i drho pp_irho
char imdc_set[NMDC_MAX][128]
Definition: cwb_mkeff.C:62
double imdc_fbandwidth[NMDC_MAX]
Definition: cwb_mkeff.C:66
exit(0)