ATLAS Offline Software
comparitor.cxx
Go to the documentation of this file.
1 
11 #include <cstdio>
12 #include <cmath>
13 #include <cstdlib>
14 #include <sys/time.h>
15 #include <sys/stat.h>
16 #include <sys/types.h>
17 
18 #include <iostream>
19 #include <string>
20 #include <vector>
21 #include <set>
22 #include <algorithm>
23 #include <regex>
24 
27 
28 #include "ReadCards.h"
29 
30 #include "Resplot.h"
31 #include "utils.h"
32 #include "label.h"
33 #include "DrawLabel.h"
34 
35 #include "TFile.h"
36 #include "TTree.h"
37 #include "TString.h"
38 #include "TH2F.h"
39 #include "TH1D.h"
40 #include "TPad.h"
41 #include "TCanvas.h"
42 #include "TLegend.h"
43 #include "TStyle.h"
44 #include "TF1.h"
45 #include "TPave.h"
46 #include "TPaveStats.h"
47 #include "TColor.h"
48 
49 #include "computils.h"
50 
51 #include "AtlasStyle.h"
52 #include "AtlasLabels.h"
53 
54 #include "default_panels.h"
55 
56 bool fulldbg = false;
57 
58 
59 extern bool LINEF;
60 extern bool LINES;
61 
62 
63 extern int colours[6];
64 extern int markers[6];
65 
66 
67 void SetZeros( TH2D* h ) {
68  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
69  for ( int j=1 ; j<=h->GetNbinsY() ; j++ ) {
70  int ibin = h->GetBin( i, j );
71  if ( h->GetBinContent(ibin)==0 ) h->SetBinContent(ibin, 0.1);
72  }
73  }
74 }
75 
76 void Scale( TH1* h, double d=1 ) {
77  if ( d==1 ) return;
78  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
79  h->SetBinContent( i, h->GetBinContent(i)*d );
80  h->SetBinError( i, h->GetBinError(i)*d );
81  }
82 }
83 
84 
85 TH1F* Rebin( TH1F* h, double f ) {
86 
87  std::cout << "\nREBIN: " << h->GetName() << " :: " << f << std::endl;
88 
89  if ( int(f) == f ) {
90  TH1F* n = (TH1F*)h->Clone("foeda"); n->SetDirectory(0);
91  n->Rebin(int(f));
92  return n;
93  }
94 
95  int fi=int(f);
96  double fb=(f-fi);
97 
98  for ( int i=0 ; i<10 ; i++ ) {
99  fb *= 10;
100  if ( std::fabs(int(fb)-fb)<1e-6 ) break;
101  }
102 
103  std::vector<double> limits;
104  std::vector<double> contents;
105 
106  for ( int i=1 ; i<=h->GetNbinsX()+1 ; i++ ) {
107  limits.push_back( h->GetBinLowEdge(i) );
108  contents.push_back( h->GetBinContent(i) );
109  if ( i<fb ) {
110  for ( int ib=1 ; ib<fi ; ib++ ) contents.back() += h->GetBinContent(++i);
111  }
112  }
113 
114  TH1F* n = new TH1F( "foeda", h->GetTitle(), limits.size()-1, &limits[0] ); n->SetDirectory(0);
115 
116  for ( size_t i=0 ; i<contents.size() ; i++ ) n->SetBinContent( i+1, contents[i] );
117 
118  return n;
119 }
120 
121 
122 
123 
124 TH1F* rebin_log( TH1F* h, bool low=false ) {
125 
126  double limits[40] = {
127  0.5, 1.5, 2.5, 3.5, 4.5,
128  5.5, 6.5, 7.5, 8.5, 9.5,
129  10.5, 11.5, 12.5, 13.5, 14.5,
130  15.5, 16.5, 17.5, 18.5, 19.5,
131  20.5, 21.5, 22.5, 23.5, 24.5,
132  25.5, 26.5, 28.5, 30.5, 32.5,
133  35.5, 38.5, 42.5, 46.5, 50.5,
134  55.5, 60.5, 66.5, 72.5, 78.5
135  };
136 
137  double lowlimits[24] = {
138  0.5, 1.5, 2.5, 3.5, 4.5,
139  5.5, 6.5, 7.5, 8.5, 9.5,
140  10.5, 11.5, 12.5, 14.5, 17.5,
141  20.5, 24.5, 29.5, 35.5, 42.5,
142  50.5, 60.5, 72.5, 86.5,
143  };
144 
145  TH1F* n;
146 
147  if ( low ) n = new TH1F( "foeda", h->GetTitle(), 39, limits );
148  else n = new TH1F( "foeda", h->GetTitle(), 23, lowlimits );
149 
150  n->SetDirectory(0);
151 
152  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
153  n->Fill( h->GetBinCenter(i), h->GetBinContent(i) );
154  }
155 
156 
157  for ( int i=1 ; i<=n->GetNbinsX() ; i++ ) {
158  n->SetBinError(i, std::sqrt( n->GetBinContent(i) ) );
159  }
160 
161  return n;
162 }
163 
164 
169 
170 typedef std::map<std::string,std::string> chainmap_t;
171 
172 
176 
177 template<typename T=TH1F>
178 T* Get( TFile& f, const std::string& n, const std::string& dir="",
179  const chainmap_t* chainmap=0, std::vector<std::string>* saved=0 ) {
180 
181  std::string name;
182 
183  size_t pos = n.find('+');
184  if ( pos!=std::string::npos ) name = n.substr( 0, pos );
185  else name = n;
186 
187  T* h = (T*)f.Get( name.c_str() );
188  if ( h || dir.empty() || name.find(dir)!=std::string::npos ) {
189  std::cout << "Get() name 0 " << name << " :: " << h << std::endl;
190  }
191  else {
192  name = dir+'/'+name;
193  h = (T*)f.Get( name.c_str() );
194  std::cout << "Get() name 1 " << name << " :: " << h << std::endl;
195  }
196 
197  if ( h == 0 ) {
198  if ( chainmap && chainmap->size()!=0 ) {
199  for ( chainmap_t::const_iterator itr=chainmap->begin() ; itr!=chainmap->end() ; ++itr ) {
200  if ( contains( name, itr->first ) ) {
201  std::cout << "\tmatch: " << itr->first << " -> " << itr->second << std::endl;
202  name.replace( name.find(itr->first), itr->first.size(), itr->second );
203  h = (T*)f.Get( name.c_str() );
204  break;
205  }
206  }
207  }
208  }
209 
210  if ( saved ) saved->push_back( name );
211 
212  if ( h ) h->SetDirectory(0);
213 
214  return h;
215 }
216 
217 
218 
219 class bands {
220 
221 public:
222 
223  bands() { }
224 
225  bands( const bands& b ) = default;
226  bands& operator= ( const bands& b ) = default;
227 
228  bands( const std::vector<double>& limits, const std::vector<std::string>& labels )
229  : m_limits(limits), m_labels(labels)
230  { }
231 
232  void range( const std::string& chain, TH1F* h ) {
233  for ( size_t i=0 ; i<m_labels.size() ; i++ ) {
234  if ( chain.find(m_labels[i])!=std::string::npos ) return range( i, h );
235  }
236  return range( m_labels.size(), h );
237  }
238 
239 
240  void range( size_t i, TH1F* h ) {
241 
242  double minx = h->GetBinLowEdge(1);
243  double maxx = h->GetBinLowEdge(h->GetNbinsX()+1);
244 
245  if ( i>=m_limits.size() ) { maxx+=1; minx=maxx; }
246  else if ( (i+1)==m_limits.size() ) minx=m_limits[i];
247  else {
248  minx = m_limits[i];
249  maxx = m_limits[i+1];
250  }
251 
252 
253  for ( int j=1 ; j<=h->GetNbinsX() ; j++ ) {
254 
255  std::cout << "range: " << j << "\tminx: " << minx << "\t" << maxx << std::endl;
256  if ( ! ( h->GetBinCenter(j)>=minx && h->GetBinCenter(j)<maxx ) ) {
257  h->SetBinContent(j,0);
258  h->SetBinError(j,0);
259  }
260  }
261  }
262 
263 
264 private:
265 
266  std::vector<double> m_limits;
267  std::vector<std::string> m_labels;
268 
269 };
270 
271 
273 
274  std::vector<double> limits;
275 
276  for ( int i=1 ; i<h->GetNbinsX() ; i++ ) {
277  limits.push_back( h->GetBinLowEdge(i) );
278  }
279 
280  std::vector<double> alimits;
281  std::vector<double> nlimits;
282 
283  double x = 0;
284 
285  for ( [[maybe_unused]] int i=0 ; x<20 ; i++ ) {
286 
287  alimits.push_back(x);
288 
289 #if 0
290  if ( x<0.5 ) x+=0.2;
291  else if ( x<1.0 ) x+=0.2;
292  else if ( x<1.5 ) x+=0.3;
293  else if ( x<2.0 ) x+=0.4;
294  else if ( x<2.5 ) x+=0.5;
295  else x+=0.6;
296 #else
297  if ( x<0.5 ) x+=0.1;
298  else if ( x<1.0 ) x+=0.2;
299  else if ( x<1.5 ) x+=0.2;
300  else if ( x<2.0 ) x+=0.2;
301  else if ( x<2.5 ) x+=0.2;
302  else if ( x<3.0 ) x+=0.3;
303  else x+=0.3;
304 #endif
305 
306  }
307 
308  for ( size_t i=alimits.size() ; i-- ; ) {
309  if ( alimits[i]<=15 ) nlimits.push_back( -alimits[i] );
310  }
311 
312  for ( size_t i=1 ; i<alimits.size() ; i++ ) {
313  if ( alimits[i]<=15 ) nlimits.push_back( alimits[i] );
314  }
315 
316  std::cout << "limits: " << limits.size() << " " << nlimits.size() << std::endl;
317 
318  TH1F* hnew = new TH1F( "h", h->GetTitle(), nlimits.size()-1, &nlimits[0] );
319 
320  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
321  double d = h->GetBinCenter(i);
322  int j = hnew->FindBin( d );
323  hnew->SetBinContent( j, hnew->GetBinContent(j)+h->GetBinContent(i) );
324  }
325 
326  return hnew;
327 }
328 
329 
330 
331 
332 int usage(const std::string& name, int status, const std::string& err_msg="" ) {
333  if ( err_msg != "" ) std::cerr << err_msg << "\n" << std::endl;
334  std::ostream& s = std::cout;
335  s << "Usage: " << name << "\t [OPTIONS] test.root reference.root chain1 chain2 chain2 ...\n\n";
336  s << "\t" << " plots comparison histograms";
337  s << " - compiled on " << __DATE__ << " at " << __TIME__ << "\n\n";
338  s << "Options: \n";
339  s << " -c, --config value \t configure which histograms to plot from config file,\n\n";
340  s << " -t, --tag value \t appends tag 'value' to the end of output plot names, \n";
341  s << " -k, --key value \t prepends key 'value' to the front of output plots name, \n";
342  s << " -t, --tag value \t post pend tag 'value' to the end of output plots name, \n";
343  s << " -d, --dir value \t creates output files into directory, \"value\" \n\n";
344  s << " --ncols value \t creates panels with \"value\" columns\n\n";
345 
346  s << " -e, --efficiencies \t make test efficiencies with respect to reference \n";
347  s << " -es, --effscale value \t scale efficiencies to value\n";
348  s << " -er, --effscaleref value \t scale reference efficiencies to value\n";
349  s << " -nb --nobayes \t do not calculate Basyesian efficiency uncertaintiesr\n\n";
350 
351  s << " -r, --refit \t refit all test resplots\n";
352  s << " -rr, --refitref \t also refit all reference resplots\n";
353  s << " --oldrms \t use fast rms95 when refitting resplots\n\n";
354 
355  s << " -as, --atlasstyle \t use ATLAS style\n";
356  s << " -l, --labels values\t use specified labels for key\n";
357  s << " --taglabels values\t use specified additional labels \n";
358  s << " -al, --atlaslable value \t set value for atlas label\n";
359  s << " -sx, --swapaxtitles exp pattern\t swap the expression \"exp \" in the axis titles with \"pattern\"\n";
360  s << " -ac, --addchains \t if possible, add chain names histogram labels \n\n";
361 
362  s << " -m, --mapfile \t remap file for reference histograms \n\n";
363 
364  s << " -rc, --refchains values ..\t allow different reference chains for comparison\n";
365  s << " -s, --swap pattern regex \t swap \"pattern\" in the chain names by \"regex\"\n";
366  s << " --swapr pattern regex \t swap \"pattern\" in the ref chain names by \"regex\"\n";
367  s << " --swapt pattern regex \t swap \"pattern\" in the test chain names by \"regex\"\n";
368  s << " -nr, --noref \t do not plot reference histograms\n";
369  s << " --normref \t normalise the reference counting histograms to test histograms\n";
370  s << " -us, --usechainref \t use the histograms from chain definied in the \"Chain\" histogram as reference\n\n";
371 
372  s << " -ns, --nostats \t do not show stats for mean and rms\n";
373  s << " -nm, --nomeans \t do not show stats for the means\n";
374  s << " --chi2 \t show the chi2 with respect to the reference\n\n";
375 
376  s << " -np, --noplots \t do not actually make any plot\n";
377  s << " -q, --quiet \t make the plots but do not print them out\n\n";
378 
379  s << " --unscalepix \t do not scale the number of pixels by 0.5 (unscaled by default)\n";
380  s << " --scalepix \t do scale the number of pixels by 0.5 (unscaled by default)\n";
381  s << " --yrange min max \t use specified y axis range\n";
382  s << " -xo, --xoffset value \t relative x offset for the key\n";
383  s << " -yp, --ypos value \t relative yposition for the key\n";
384  s << " -xe, --xerror value \t size of the x error tick marks\n";
385  s << " -nw, --nowatermark \t do not plot the release watermark\n\n";
386 
387  s << " -C, --Cfiles \t write C files also\n";
388  s << " --nopng \t do not print png files\n";
389  s << " --nopdf \t do not print pdf files\n";
390  s << " --deleteref \t delete unused reference histograms\n\n";
391 
392  s << " --printconfig \t print the configuration being used in the form useable as an input file\n\n";
393 
394  s << " -h, --help \t this help\n";
395  // s << "\nSee " << PACKAGE_URL << " for more details\n";
396  // s << "\nReport bugs to <" << PACKAGE_BUGREPORT << ">";
397  s << std::endl;
398  return status;
399 }
400 
401 
402 void binwidth( TH1F* h ) {
403  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
404  double w = h->GetBinLowEdge(i+1) - h->GetBinLowEdge(i);
405  h->SetBinContent( i, h->GetBinContent(i)/w );
406  h->SetBinError( i, h->GetBinError(i)/w );
407  }
408 }
409 
410 void ascale( TH1F* h, double s_ ) {
411  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
412  h->SetBinContent( i, h->GetBinContent(i)*s_ );
413  h->SetBinError( i, h->GetBinError(i)*s_ );
414  }
415 }
416 
417 
418 
419 // replace from a string
420 std::string fullreplace( std::string s, const std::string& s2, const std::string& s3) {
421  if ( s2=="" || s2==s3 ) return s;
422  std::string::size_type pos;
423  while ( (pos=s.find(s2)) != std::string::npos ) s.replace(pos, s2.size(), s3);
424  return s;
425 }
426 
427 void print_pad( const std::string& s ) {
428  std::cout << "Printing " << s << std::endl;
429  gPad->Print( s.c_str() );
430 }
431 
432 
433 
435 void zero( TH2* h ) {
436  int Nx = h->GetNbinsX();
437  int Ny = h->GetNbinsY();
438  for ( int i=1 ; i<=Nx ; i++ ) {
439  for ( int j=1 ; j<=Ny ; j++ ) {
440  if ( h->GetBinContent( i, j )==0 ) {
441  h->SetBinContent( i, j, 1e-10 );
442  h->SetBinError( i, j, 1e-10 );
443  }
444  }
445  }
446 }
447 
448 
450 void normy( TH2* h ) {
451  int Nx = h->GetNbinsX();
452  int Ny = h->GetNbinsY();
453  for ( int i=1 ; i<=Nx ; i++ ) {
454  double n = 0;
455  for ( int j=1 ; j<=Ny ; j++ ) n += h->GetBinContent(i,j);
456  if ( n>0 ) for ( int j=1 ; j<=Ny ; j++ ) h->SetBinContent( i, j, h->GetBinContent(i,j)/n );
457  }
458 }
459 
460 
462 void autox( TH2* h ) {
463 
464  int Nx = h->GetNbinsX();
465  int Ny = h->GetNbinsY();
466 
467  double xhi = h->GetXaxis()->GetBinLowEdge(1);
468  double xlo = h->GetXaxis()->GetBinLowEdge( h->GetXaxis()->GetNbins() );
469 
470  for ( int i=1 ; i<=Nx ; i++ ) {
471  double x = h->GetXaxis()->GetBinLowEdge(i);
472  for ( int j=1 ; j<=Ny ; j++ ) {
473  double n = h->GetBinContent(i,j);
474  if ( n!=0 ) {
475  if ( x<xlo ) {
476  if ( i>1 ) xlo = h->GetXaxis()->GetBinLowEdge(i-1);
477  else xlo = x;
478  }
479  if ( x>xhi ) {
480  if ( i<h->GetXaxis()->GetNbins() ) xhi = h->GetXaxis()->GetBinLowEdge(i+1);
481  else xhi = x;
482  }
483  }
484  }
485  }
486 
487  h->GetXaxis()->SetRangeUser( xlo, xhi );
488 }
489 
490 
492 void autoy( TH2* h ) {
493 
494  int Nx = h->GetNbinsX();
495  int Ny = h->GetNbinsY();
496 
497  double yhi = h->GetYaxis()->GetBinLowEdge(1);
498  double ylo = h->GetYaxis()->GetBinLowEdge( h->GetYaxis()->GetNbins() );
499 
500  for ( int i=1 ; i<=Ny ; i++ ) {
501  double y = h->GetYaxis()->GetBinLowEdge(i);
502  for ( int j=1 ; j<=Nx ; j++ ) {
503  double n = h->GetBinContent(j,i);
504  if ( n!=0 ) {
505  if ( y<ylo ) {
506  if ( i>1 ) ylo = h->GetYaxis()->GetBinLowEdge(i-1);
507  else ylo = y;
508  }
509  if ( y>yhi ) {
510  if ( i<h->GetYaxis()->GetNbins() ) yhi = h->GetYaxis()->GetBinLowEdge(i+1);
511  else yhi = y;
512  }
513  }
514  }
515  }
516 
517  h->GetYaxis()->SetRangeUser( ylo, yhi );
518 }
519 
520 
521 
522 double chi2( TH1* h0, TH1* h1 ) {
523  double c2 = 0;
524 
525  for ( int i=0 ; i<h0->GetNbinsX() ; i++ ) {
526 
527  double d0 = h0->GetBinContent(i+1);
528  double d1 = h1->GetBinContent(i+1);
529 
530  double e0 = h0->GetBinError(i+1);
531  double e1 = h1->GetBinError(i+1);
532 
533  double e2 = e0*e0+e1*e1;
534 
535  if ( e2>0 ) c2 += (d0-d1)*(d0-d1)/e2;
536 
537  }
538 
539  return c2;
540 }
541 
542 
543 int main(int argc, char** argv) {
544 
545  std::cout << "\n---------------------------------\n";
546  std::cout << "\n comparitor is off ...\n";
547 
548  if ( argc<4 ) return usage(argv[0], -1, "too few arguments");
549 
551 
552  std::string tag = "";
553  std::string key = "";
554 
555  std::string dir = "";
556 
557  std::string ftestname = "";
558  std::string frefname = "";
559 
560  TFile* ftest_ = 0;
561  TFile* fref_ = 0;
562 
563  bool effset = false;
564  double effmin = 90;
565  double effmax = 102;
566 
567  std::string defreflabel = "";
568 
570 
571  std::vector<std::string> usrlabels;
572  bool uselabels = false;
573  bool addinglabels = false;
574 
575  std::vector<std::string> taglabels;
576  bool addingtags = false;
577 
578  bool make_ref_efficiencies = false;
579  bool refit_resplots = false;
580  bool refitref_resplots = false;
581  bool bayes = true;
582  bool nostats = false;
583  bool nomeans = false;
584  bool noref = false;
585  bool atlasstyle = false;
586  bool deleteref = false;
587  bool nowatermark = false;
588  bool noplots = false;
589  bool nopng = false;
590  bool nopdf = false;
591  bool Cfile = false;
592  bool notitle = true;
593  bool dochi2 = false;
594  bool normref = false;
595  bool scalepix = false;
596  bool oldrms = false;
597  bool addchains = false;
598  bool usechainref = false;
599  bool quiet = false;
600 
601  bool RANGEMAP = false;
602  bool ALLRANGEMAP = false;
603 
604  double xerror = 0;
605 
606  std::string atlaslabel_tmp = "Internal";
607 
608 
609  double scale_eff = -1;
610  double scale_eff_ref = -1;
611 
612  std::string configfile = "";
613 
614  double xoffset = 0;
615 
616 
617  double ypos_arg = 0;
618 
619  std::string pattern = "";
620  std::string regex = "";
621 
622  std::string patternr = "";
623  std::string regexr = "";
624 
625  std::string patternt = "";
626  std::string regext = "";
627 
628  std::string basedir = "";
629 
630  std::string xpattern = "";
631  std::string xregex = "";
632 
633  std::vector<std::string> chains;
634  std::vector<std::string> refchains;
635 
636  bool addingrefchains = false;
637 
638  std::string mapfile = "";
639 
640  std::vector<std::string> chainfiles;
641 
642  int ncols = 2;
643 
644  for(int i=1; i<argc; i++){
645  std::string arg = argv[i];
646 
647 
648  if ( arg.find('-')!=0 && addinglabels ) {
649  std::string label = arg;
650  fullreplace( label, "__", " " );
651  replace( label, '#', ' ' );
652  usrlabels.push_back( label );
653  continue;
654  }
655  else addinglabels = false;
656 
657  if ( arg.find('-')!=0 && addingrefchains ) {
658  refchains.push_back( arg );
659  continue;
660  }
661  else addingrefchains = false;
662 
663  if ( arg.find('-')!=0 && addingtags ) {
664  taglabels.push_back( fullreplace( arg, "__", " " ) );
665  std::cout << "\tadding tag label: " << taglabels.back() << std::endl;
666  continue;
667  }
668  else addingtags = false;
669 
670  if ( arg=="-h" || arg=="--help" ) {
671  return usage(argv[0], 0);
672  }
673  else if ( arg=="-c" || arg=="--config" ) {
674  if ( ++i<argc ) configfile=argv[i];
675  else return usage(argv[0], -1, "no config file provided");
676  }
677  else if ( arg=="-t" || arg=="--tag" ) {
678  if ( ++i<argc ) tag=std::string("-")+argv[i];
679  else return usage(argv[0], -1, "no tag provided");
680  }
681  else if ( arg=="-l" || arg=="--labels" ) {
682  addinglabels = true;
683  }
684  else if ( arg=="-el" ) {
685  LINES = true;
686  }
687  else if ( arg=="-k" || arg=="--key" ) {
688  if ( ++i<argc ) key=argv[i];
689  else return usage(argv[0], -1, "no key provided");
690  }
691  else if ( arg=="-m" || arg=="--mapfile" ) {
692  if ( ++i<argc ) mapfile=argv[i];
693  else return usage(argv[0], -1, "no mapfile provided");
694  }
695  else if ( arg=="-d" || arg=="--dir" ) {
696  if ( ++i<argc ) dir=argv[i];
697  else return usage(argv[0], -1, "no directory provided");
698  }
699  else if ( arg=="-b" || arg=="--bdir" ) {
700  if ( ++i<argc ) basedir=argv[i];
701  else return usage(argv[0], -1, "no directory provided");
702  }
703  else if ( arg=="--taglabels" ) {
704  addingtags = true;
705  }
706  else if ( arg=="--unscalepix" ) {
707  scalepix = false;
708  }
709  else if ( arg=="--scalepix" ) {
710  scalepix = true;
711  }
712  else if ( arg=="-ac" || arg=="--addchains" ) {
713  addchains = true;
714  }
715  else if ( arg=="-yrange" ) {
716  effset = true;
717  if ( ++i<argc ) effmin=std::atof(argv[i]);
718  else return usage(argv[0], -1, "no range specified");
719  if ( ++i<argc ) effmax=std::atof(argv[i]);
720  else return usage(argv[0], -1, "no upper y limit specified");
721  }
722  else if ( arg=="-e" || arg=="--efficiencies" ) {
723  make_ref_efficiencies = true;
724  }
725  else if ( arg=="-r" || arg=="--refit" ) {
726  refit_resplots = true;
727  }
728  else if ( arg=="-rr" || arg=="--refitref" ) {
729  refitref_resplots = true;
730  }
731  else if ( arg=="--oldrms" ) {
732  oldrms = true;
733  }
734  else if ( arg=="-nw" || arg=="--nowatermark" ) {
735  nowatermark = true;
736  Plots::setwatermark(!nowatermark);
737  }
738  else if ( arg=="--chi2" ) {
739  dochi2 = true;
740  }
741  else if ( arg=="-ns" || arg=="--nostats" ) {
742  nostats = true;
743  }
744  else if ( arg=="-nm" || arg=="--nomeans" ) {
745  nomeans = true;
746  }
747  else if ( arg=="-nt" || arg=="--notitle" ) {
748  notitle = true;
749  }
750  else if ( arg=="-nr" || arg=="--noref" ) {
751  Plotter::setplotref(false);
752  noref = true;
753  }
754  else if ( arg=="--normref" ) {
755  normref = true;
756  }
757  else if ( arg=="-rc" || arg=="--refchains" ) {
758  addingrefchains = true;
759  }
760  else if ( arg=="-uc" || arg=="--usechainref" ) {
761  usechainref = true;
762  }
763  else if ( arg=="-nb" || arg=="--nobayes" ) {
764  bayes = false;
765  }
766  else if ( arg=="-es" || arg=="--effscale" ) {
767  if ( ++i<argc ) scale_eff=std::atof(argv[i]);
768  else return usage(argv[0], -1, "no efficiency scale provided");
769  }
770  else if ( arg=="-er" || arg=="--effscaleref" ) {
771  if ( ++i<argc ) scale_eff_ref=std::atof(argv[i]);
772  else return usage(argv[0], -1, "no efficiency scale for the reference histograms provided");
773  }
774  else if ( arg=="--ncols" ) {
775  if ( ++i<argc ) ncols=std::atoi(argv[i]);
776  else return usage(argv[0], -1, "no number of columns provided");
777  }
778  else if ( arg=="-np" || arg=="--noplots" ) {
779  noplots = true;
780  }
781  else if ( arg=="-C" || arg=="--Cfiles" ) {
782  Cfile = true;
783  }
784  else if ( arg=="--deleteref" ) {
785  deleteref = true;
786  }
787  else if ( arg=="--nopng" ) {
788  nopng = true;
789  }
790  else if ( arg=="--nopdf" ) {
791  nopdf = true;
792  }
793  else if ( arg=="-as" || arg=="--atlasstyle" ) {
794  atlasstyle = true;
795  }
796  else if ( arg=="-q" || arg=="--quiet" ) {
797  quiet = true;
798  }
799  else if ( arg=="-al" || arg=="--atlaslabel" ) {
800  if ( ++i<argc ) atlaslabel_tmp=argv[i];
801  else return usage(argv[0], -1, "no label provided");
802  }
803  else if ( arg=="-xo" || arg=="--xoffset" ) {
804  if ( ++i<argc ) xoffset=std::atof(argv[i]);
805  else return usage(argv[0], -1, "no xoffset provided");
806  }
807  else if ( arg=="-yp" || arg=="--ypos" ) {
808  if ( ++i<argc ) ypos_arg=std::atof(argv[i]);
809  else return usage(argv[0], -1, "no y position provided");
810  }
811  else if ( arg=="-xe" || arg=="--xerror" ) {
812  if ( ++i<argc ) xerror=std::atof(argv[i]);
813  else return usage(argv[0], -1, "no x error provided");
814  }
815  else if ( arg=="-s" || arg=="--swap" ) {
816  if ( ++i<argc ) pattern=argv[i];
817  else return usage(argv[0], -1, "no patterns provided");
818  if ( ++i<argc ) regex=argv[i];
819  else return usage(argv[0], -1, "no target pattern provided");
820  }
821  else if ( arg=="--swapt" ) {
822  if ( ++i<argc ) patternt=argv[i];
823  else return usage(argv[0], -1, "no patterns provided");
824  if ( ++i<argc ) regext=argv[i];
825  else return usage(argv[0], -1, "no target pattern provided");
826  }
827  else if ( arg=="--swapr" ) {
828  if ( ++i<argc ) patternr=argv[i];
829  else return usage(argv[0], -1, "no patterns provided");
830  if ( ++i<argc ) regexr=argv[i];
831  else return usage(argv[0], -1, "no target pattern provided");
832  }
833  else if ( arg=="-sx" || arg=="--swapaxtitles" ) {
834  if ( ++i<argc ) xregex=argv[i];
835  else return usage(argv[0], -1, "no target pattern provided");
836  if ( ++i<argc ) xpattern=argv[i];
837  else return usage(argv[0], -1, "no patterns provided");
838  }
839  else if ( arg.find('-')==0 ) {
840  std::cerr << "unknown option: " << arg << "\n" << std::endl;
841  return usage(argv[0], -4);
842  }
843  else {
844  if ( ftestname=="" ) ftestname = arg;
845  else if ( frefname=="" ) frefname = arg;
846  else {
847  std::string file = "";
848 
849  if ( arg.find(":file:")!=std::string::npos ) {
850  file = arg.substr( 0, arg.find(":file:") );
851  chainfiles.push_back( file );
852  arg = arg.substr(arg.find(":file:")+6,arg.size());
853  }
854 
855  std::string chain = arg;
856 
857  replace ( chain, ':', '_' );
858  replace ( chain, ';', '_' );
859  chains.push_back(chain);
860 
861  std::cout << "file: " << file << "\tchain: " << chain << std::endl;
862 
863  }
864  }
865  }
866 
867  if ( ftestname.empty() ) {
868  std::cerr << "main(): test file not specified " << std::endl;
869  return -1;
870  }
871 
872  if ( !exists(ftestname) ) {
873  std::cerr << "main(): test file " << ftestname << " does not exist" << std::endl;
874  return -1;
875  }
876 
877  std::vector<TFile*> chainTFiles;
878 
879 
880 
881  if ( chainfiles.size()==0 ) ftest_ = TFile::Open( ftestname.c_str() );
882  else {
883  noref=true;
884  chainTFiles.resize(chainfiles.size());
885  for ( size_t i=0 ; i<chainfiles.size() ; i++ ) {
886  chainTFiles[i] = TFile::Open( chainfiles[i].c_str() );
887  if ( chainTFiles[i] == 0 ) {
888  std::cerr << "\tfile: " << chainfiles[i] << " could not be opened" << std::endl;
889  return -1;
890  }
891  else std::cout << "\tchainfiles: " << chainfiles[i] << " " << chainTFiles[i] << std::endl;
892  }
893  }
894 
895 
896  if ( noref==false ) {
897  if ( frefname.empty() ) {
898  std::cerr << "main(): ref file not specified " << std::endl;
899  Plotter::setplotref(false);
900  noref = true;
905  // return -1;
906  }
907 
908  if ( frefname==ftestname ) fref_ = ftest_;
909  else if ( exists(frefname) ) fref_ = TFile::Open( frefname.c_str() );
910  else {
911  std::cerr << "main(): ref file " << frefname << " does not exist" << std::endl;
912  // return -1;
913  Plotter::setplotref(false);
914  noref=true;
915  }
916  }
917  else fref_ = ftest_;
918 
919  if ( chainfiles.size()==0 ) {
920  if ( ftest_==0 ) {
921  std::cerr << "could not open test file " << ftestname << std::endl;
922  return -1;
923  }
924 
925  if ( noref==false && fref_==0 ) {
926  std::cerr << "could not open files " << std::endl;
930  noref=true;
931  fref_=ftest_;
932  defreflabel = "failed to open reference file";
933  }
934 
935  }
936 
937  if ( scale_eff == -1 ) scale_eff = 100;
938  if ( scale_eff_ref == -1 ) scale_eff_ref = scale_eff;
939 
940 
941  bool noreftmp = noref;
942 
943  if ( chains.size()==0 ) return usage(argv[0], -1, "no chains specified");
944 
945 
946  if ( basedir.size()>0 ) {
947  if ( basedir[basedir.size()-1]!='/' ) basedir += "/";
948  for ( size_t ic=chains.size() ; ic-- ; ) chains[ic] = basedir+chains[ic];
949  }
950 
951  if ( refchains.size()>0 && refchains.size()!=chains.size() ) return usage(argv[0], -1, "not enough chains specified");
952 
953  if ( refchains.size()==0 ) refchains = chains;
954 
955  std::vector<std::string> chainref(chains.size(),"");
956  std::vector<std::string> chain_name(chains.size(),"");
957 
958  std::vector<std::string> refchain(chainref.size(),"");
959 
960 
961 
962  std::cout << argv[0] << " options:" << std::endl;
963  std::cout << "\tATLAS style: " << ( atlasstyle ? "true" : "false" ) << std::endl;
964  std::cout << "\tBayesian uncertainties: " << ( bayes ? "true" : "false" ) << std::endl;
965  std::cout << "\trefit resplot uncertainties: " << ( refit_resplots ? "true" : "false" ) << std::endl;
966  std::cout << "\tsuppress mean and rms stats: " << ( nostats ? "true" : "false" ) << std::endl;
967  if ( !nostats ) std::cout << "\tsuppress meanstats: " << ( nomeans ? "true" : "false" ) << std::endl;
968  std::cout << "\tsuppress png output: " << ( nopng ? "true" : "false" ) << std::endl;
969  std::cout << "\tsuppress pdf output: " << ( nopdf ? "true" : "false" ) << std::endl;
970  std::cout << "\tsuppress reference output: " << ( noref ? "true" : "false" ) << std::endl;
971  std::cout << "\tuse chain references: " << ( usechainref ? "true" : "false" ) << std::endl;
972  std::cout << "\tpanel ncols: " << ncols << std::endl;
973 
974  if ( usrlabels.size()>0 ) std::cout << "\tlabels: " << usrlabels.size() << std::endl;
975  if ( taglabels.size()>0 ) std::cout << "\textra text: " << taglabels << std::endl;
976 
977 
978  for ( size_t il=0 ; il<usrlabels.size() ; il++ ) {
979  std::cout << "usr label[" << il << "] : " << usrlabels[il] << std::endl;
980  }
981 
982  std::cout << "atlas style : " << atlasstyle << std::endl;
983 
984  if ( atlasstyle ) {
985  SetAtlasStyle();
986  gStyle = AtlasStyle();
987  gStyle->cd();
988  }
989  else {
990  gROOT->SetStyle("Plain");
991  gStyle->cd();
992  gStyle->SetLineScalePS(1);
993  xoffset += 0.02;
994  }
995 
996  gStyle->SetErrorX(xerror);
997 
998  gStyle->SetPadLeftMargin(0.15);
999  gStyle->SetPadBottomMargin(0.15);
1000 
1001  gStyle->SetPadRightMargin(0.02);
1002  gStyle->SetPadTopMargin(0.05);
1003 
1004  std::cout << "Chains: " << std::endl;
1005  for ( unsigned ic=0 ; ic<chains.size() ; ic++ ) std::cout << "\t" << chains[ic] << std::endl;
1006 
1007  if ( usrlabels.size()>0 ) std::cout << "labels: " << usrlabels << std::endl;
1008 
1009  if ( usrlabels.size()>0 && usrlabels.size()==chains.size() ) uselabels = true;
1010 
1012 
1013  TTree* dataTree = 0;
1014  TString* releaseData = new TString("");
1015  std::vector<std::string> release_data;
1016 
1017  if ( !nowatermark && ftest_ ) {
1018 
1019  dataTree = (TTree*)ftest_->Get("dataTree");
1020 
1021  if ( dataTree ) {
1022  dataTree->SetBranchAddress( "ReleaseMetaData", &releaseData);
1023 
1024  for (unsigned int i=0; i<dataTree->GetEntries() ; i++ ) {
1025  dataTree->GetEntry(i);
1026  release_data.push_back( releaseData->Data() );
1027  std::cout << "main() release data: " << release_data.back() << " : " << *releaseData << std::endl;
1028  }
1029  }
1030 
1031 
1032  if ( release_data.size()>0 ) {
1033  if ( release_data.size()>1 ) std::cerr << "main() more than one release - using only the first" << std::endl;
1034 
1035  // std::cout << "release: " << chop(release_data[0], " " ) << std::endl;
1036 
1037  std::string nightly = chop(release_data[0], " " );
1038 
1039  if ( contains(nightly,"private" ) ) {
1040  for ( int ic=0 ; ic<4 ; ic++ ) chop(release_data[0], " " );
1041  release += " (" + release_data[0]+")";
1042  }
1043  else {
1044  release += " (" + nightly;
1045  chop( release_data[0], " " );
1046  release += " " + chop(release_data[0], " " ) + ")";
1047  }
1048  }
1049  }
1050 
1051 
1052  // Make output directory
1053  if (!dir.empty()) {
1054 
1055  gDirectory->pwd();
1056 
1057  std::cout << "trying to make directory" << std::endl;
1058  dir += '/';
1059  if ( !quiet && !noplots && !exists(dir) ) {
1060  if ( mkdir( dir.c_str(), 0777 ) ) std::cerr << "main() couldn't create directory " << dir << std::endl;
1061  else std::cout << "main() output will be sent to directory " << dir << std::endl;
1062  }
1063  }
1064 
1065  if ( ftest_==0 && chainTFiles.size()>0 ) fref_ = ftest_ = chainTFiles[0];
1066 
1067  TFile* ftest = ftest_;
1068  TFile* fref = fref_;
1069 
1070  std::string testrun = findrun( ftest );
1071 
1072  std::string rawrefrun = "";
1073  std::string refrun = "";
1074 
1075  if ( fref_ ) refrun = rawrefrun = findrun( fref );
1076 
1077  std::cout << "testrun: " << testrun << "\nrefrun: " << refrun << std::endl;
1078 
1079  if ( !testrun.empty() && refrun != testrun ) {
1080  if ( pattern.empty() ) {
1081  pattern = testrun;
1082  regex = refrun;
1083  }
1084 
1085  }
1086 
1087  if ( !refrun.empty() ) {
1088 
1089  std::string newtag = "Reference: ";
1090 
1091  std::cout << "refrun: " << refrun << std::endl;
1092 
1093  size_t pos;
1094  while ( (pos=refrun.find('_'))!=std::string::npos ) refrun.replace( pos, 1, " " );
1095  newtag += refrun;
1096 
1097  std::string rawrun = refrun.erase( refrun.find("run"), 4 );
1098 
1099  if ( contains(frefname, rawrun) ) {
1100 
1101  std::string release = frefname;
1102 
1103  release.erase( 0, release.find(rawrun) );
1104 
1105  if ( contains(release,"HIST") ) release.erase( 0, release.find("HIST")+5 );
1106  while ( contains(release,".") ) release.erase( release.find('.'), release.size() );
1107  while ( contains(release,"-") ) release.erase( release.find('-'), release.size() );
1108  while ( contains(release,"_p") ) release.erase( release.find("_p"), release.size() );
1109  while ( contains(release,"_t") ) release.erase( release.find("_t"), release.size() );
1110 
1111  newtag += " ";
1112  newtag += release;
1113 
1114  }
1115 
1116  taglabels.push_back( newtag );
1117 
1118  std::cout << "tag labels: " << taglabels << std::endl;
1119 
1120  }
1121 
1126  int NeventTest = 1;
1127  int NeventRef = 1;
1128 
1129 
1130  std::vector<std::string> savedhistos;
1131 
1132 
1133  if ( !nowatermark ) {
1134 
1135  TH1D* htestev = (TH1D*)ftest->Get("event") ;
1136  TH1D* hrefev = (TH1D*)fref->Get("event") ;
1137 
1138  std::cout << "htestev " << htestev << " " << hrefev << std::endl;
1139 
1140  if ( htestev ) NeventTest = htestev->GetEntries();
1141  if ( hrefev ) NeventRef = hrefev->GetEntries();
1142 
1143  savedhistos.push_back("event");
1144  }
1145  else {
1146  NeventTest = 1;
1147  NeventRef = 1;
1148  }
1149 
1150 
1151  if ( NeventTest>1 ) std::cout << "Nevents Test: " << NeventTest << std::endl;
1152  if ( NeventRef>1 ) std::cout << "Nevents Ref: " << NeventRef << std::endl;
1153 
1154  chainmap_t* chainmap = nullptr;
1155 
1156  if ( mapfile.empty() ) mapfile = configfile;
1157 
1158  if ( !mapfile.empty() ) {
1159 
1160  ReadCards m( mapfile );
1161 
1162  if ( m.isTagDefined( "ChainMap" ) ) {
1163  std::vector<std::string> chains = m.GetStringVector( "ChainMap" );
1164 
1165  chainmap = new chainmap_t();
1166 
1167  for ( size_t i=0 ; i<chains.size() ; i+=2 ) {
1168  chainmap->insert( chainmap_t::value_type( chains[i], chains[i+1] ) );
1169  }
1170 
1171  std::cout << "\nusing chain map:" << std::endl;
1172 
1173  for ( chainmap_t::iterator itr=chainmap->begin() ; itr!=chainmap->end() ; ++itr ) {
1174  std::cout << "\t" << itr->first << "\t" << itr->second << std::endl;
1175  }
1176  }
1177  }
1178 
1180 
1181  std::cout << "\ncreating chain and reference information ..." << std::endl;
1182 
1183  for ( size_t j=0; j<chains.size(); j++) {
1184 
1185  if ( !regex.empty() ) chains[j] = fullreplace( chains[j], pattern, regex );
1186  if ( !regext.empty() ) chains[j] = fullreplace( chains[j], patternt, regext );
1187 
1189 
1191  std::cout << "chain: " << chains[j] << "\taddchains: " << addchains << std::endl;
1192 
1193  if ( addchains && ( contains(chains[j],"Shifter") || ( !contains(chains[j],"HLT_") && !contains(chains[j], "Fullscan" ) ) ) ) {
1194 
1195  TFile* fftest = ftest;
1196 
1197  if ( chainfiles.size()>0 && chainfiles.size()>j ) fftest = chainTFiles[j];
1198 
1199  TH1F* hchain = Get( *fftest, chains[j]+"/Chain", testrun );
1200 
1201  if ( hchain ) {
1202 
1203  std::string name = hchain->GetTitle();
1204 
1205  if ( usechainref && !contains(chains[j],"Purity") ) {
1206 
1207  chainref[j] = name;
1208 
1209  std::cout << "new chainref: " << chainref[j] << std::endl;
1210 
1211  std::string::size_type pos = chainref[j].find(":for");
1212  if ( pos!=std::string::npos ) chainref[j].replace( pos, 4, "_for" );
1213  std::replace( chainref[j].begin(), chainref[j].end(), ':', '/');
1214  std::string newchain = dirname( dirname( chains[j]) ) + "/Expert/" + chainref[j];
1215  chainref[j] = newchain;
1216 
1217  std::cout << "final chainref: " << chainref[j] << std::endl;
1218 
1219  }
1220 
1221  std::cout << "chainref: " << chainref[j] << std::endl;
1222 
1223  while ( contains( name, "HLT_" ) ) name = name.erase( name.find("HLT_"), 4 );
1224 
1225  std::cout << "name: " << name << std::endl;
1226 
1227  if ( contains( name, ":" ) ) chain_name[j] = name.substr( 0, name.find(':') ) + " : ";
1228  else chain_name[j] = name;
1229 
1230  if ( chain_name[j] == " : " ) chain_name[j] = "";
1231 
1232  std::cout << "chain_name: " << chain_name[j] << std::endl;
1233  }
1234  }
1235  }
1236 
1237  std::cout << "chainref size: " << chainref.size() << " " << refchains.size() << std::endl;
1238 
1239  for ( size_t j=0 ; j<chainref.size() ; j++ ) {
1240  std::cout << "chainref: " << chainref[j] << " :: " << refchains[j] << std::endl;
1241 
1243  if ( chainref[j]!="" ) refchain[j] = fullreplace( chainref[j], pattern, regex );
1244  else refchain[j] = fullreplace( refchains[j], pattern, regex );
1245 
1246  if ( !patternr.empty() ) {
1247  if ( chainref[j]!="" ) refchain[j] = fullreplace( chainref[j], patternr, regexr );
1248  else refchain[j] = fullreplace( refchains[j], patternr, regexr );
1249  }
1250 
1251  std::cout << "refchain: " << refchain[j] << std::endl;
1252  }
1253 
1254  std::cout << "done chains" << std::endl;
1255 
1257 
1258  std::vector<Panel> panels;
1259 
1261 
1262  bands bnd;
1263 
1264 
1265  std::vector<int> ccolours;
1266  std::vector<int> cstyles;
1267 
1268  std::vector<std::string> ctags;
1269  std::vector<std::string> ctaglabels;
1270 
1271 
1272  std::cout << "\n" << argv[0] << "\tconfigfile: " << configfile << std::endl;
1273 
1274  bool use_file_config = false;
1275 
1276  if ( configfile!="" ) {
1277 
1278  if ( exists(configfile) ) {
1279 
1280  std::cout << argv[0] << ":\treading configuration file " << configfile << std::endl;
1281 
1282  ReadCards rc(configfile);
1283 
1284 
1286 
1287  if ( rc.isTagDefined( "histos" ) ) {
1288 
1289  std::cout << argv[0] << ":\treading histogram configuration from file " << configfile << std::endl;
1290 
1291  use_file_config = true;
1292 
1293  std::vector<std::string> raw_input = rc.GetStringVector( "histos" );
1294 
1295  for ( size_t iraw=0 ; iraw<raw_input.size() ; iraw += 6) {
1296  HistDetails h( &(raw_input[iraw]) );
1297  Panel p( h.name(), 1 );
1298  p.push_back( h );
1299  panels.push_back( p );
1300  }
1301 
1302  }
1303 
1304  std::cout << "searching for panels" << std::endl;
1305 
1307 
1308  if ( rc.isTagDefined( "panels" ) ) {
1309 
1310  std::cout << argv[0] << ":\treading histogram panel configuration from file " << configfile << std::endl;
1311 
1312  use_file_config = true;
1313 
1314  std::vector<std::string> panel_config = rc.GetStringVector( "panels" );
1315 
1316  std::vector<string> panel_columns;
1317 
1318  if ( rc.isTagDefined("panel_columns") ) {
1319  panel_columns = rc.GetStringVector( "panel_columns" );
1320  if ( panel_columns.size()%2 ) return usage( argv[0], -1, "incorrect panel settings" );
1321  }
1322 
1323 
1324  for ( size_t ipanel=panel_config.size() ; ipanel-- ; ) {
1325 
1326  std::vector<std::string> raw_input = rc.GetStringVector( panel_config[ipanel] );
1327 
1328  int tncols = ncols;
1329 
1330  if ( panel_columns.size() ) {
1331  std::vector<string>::iterator itr = find( panel_columns.begin(), panel_columns.end(), panel_config[ipanel] );
1332  if ( itr!=panel_columns.end() ) tncols = std::atoi( (++itr)->c_str() );
1333  }
1334 
1335  Panel p( panel_config[ipanel], tncols );
1336 
1337  if ( raw_input.empty() ) throw std::exception();
1338  for ( size_t iraw=0 ; iraw<raw_input.size() ; iraw += 6 ) p.push_back( HistDetails( &(raw_input[iraw]) ) );
1339 
1340  panels.push_back( p );
1341 
1342  }
1343 
1344  }
1345 
1346  if ( rc.isTagDefined( "Bands" ) && rc.isTagDefined( "Labels" ) ) {
1347  bnd = bands( rc.GetVector( "Bands"), rc.GetStringVector( "Labels" ) );
1348  }
1349 
1350 
1351  if ( rc.isTagDefined("Colours") ) ccolours = rc.GetIntVector("Colours");
1352  if ( rc.isTagDefined("Styles") ) cstyles = rc.GetIntVector("Styles");
1353  if ( rc.isTagDefined("Tags") ) ctags = rc.GetStringVector("Tags");
1354  if ( rc.isTagDefined("TagLabels") ) ctaglabels = rc.GetStringVector("TagLabels");
1355  if ( rc.isTagDefined("TagLabels") ) usrlabels = rc.GetStringVector("TagLabels");
1356 
1357  if ( rc.isTagDefined("Styles") ) {
1358  for ( size_t is=0 ; is<cstyles.size() && is<6 ; is++ ) {
1359  markers[is] = cstyles[is];
1360  }
1361  }
1362 
1363 
1364  uselabels = true;
1365 
1366 
1367  std::cout << argv[0] << "\tuserlabels :" << usrlabels << ":" << std::endl;
1368 
1369 
1370 
1371  if ( rc.isTagDefined("RANGEMAP") ) RANGEMAP = true;
1372  if ( rc.isTagDefined("ALLRANGEMAP") ) ALLRANGEMAP = true;
1373 
1374  std::cout << "Extra: " << rc.isTagDefined("Extra") << std::endl;
1375 
1376  if ( rc.isTagDefined("Extra") ) taglabels.push_back( fullreplace( rc.GetString("Extra"), "__", " " ) );
1377 
1378 
1379  }
1380  else {
1381  std::cerr << argv[0] << ":\t config file not found: " << configfile << std::endl;
1382  return -1;
1383  }
1384 
1385  }
1386 
1387  if ( !use_file_config ) {
1388 
1389  std::cout << "using default panels" << std::endl;
1390 
1392 
1393  // for ( size_t iraw=0 ; iraw<Nhistos ; iraw++ ) {
1394  // Panel p( histos_default[iraw][0], 1 );
1395  // p.push_back( histos_default[iraw] );
1396  // panels.push_back( p );
1397  // }
1398 
1399  // default panel efficiencies plotted from 0 to 100,
1400  // so scale efficiencies no matter what
1401 
1402  scale_eff = 100;
1403  scale_eff_ref = 100;
1404 
1406 
1407  std::string (*inpanels[3])[6] = { eff_panel, res_panel, diff_panel };
1408 
1409  size_t nphist[3] = { 4, 4, 10 };
1410 
1411  std::string pnames[3] = { "eff", "res", "diff" };
1412 
1413  for ( size_t ip=0 ; ip<3 ; ip++ ) {
1414  Panel p( pnames[ip]+"_panel", 2 );
1415  for ( size_t iraw=0 ; iraw<nphist[ip] ; iraw++ ) p.push_back( HistDetails( inpanels[ip][iraw] ) );
1416  panels.push_back( p );
1417  }
1418 
1419  }
1420 
1421 
1422  std::cout << "taglabels" << std::endl;
1423 
1424  for ( size_t it=0 ; it<taglabels.size() ; it++ ) std::cout << taglabels[it] << std::endl;
1425 
1426 
1427  std::cout << "\npanels: " << panels.size() << std::endl;
1428 
1429  if ( panels.size()==0 ) return usage(argv[0], -1, "no panels to plot");
1430 
1431  for ( size_t ip=0 ; ip<panels.size() ; ip++ ) std::cout << panels[ip] << std::endl;
1432 
1433 
1435  if ( true ) {
1436  gStyle->SetPadRightMargin(0.05);
1437  gStyle->SetPadTopMargin(0.05);
1438 
1439  const Int_t Number = 3;
1440  Double_t Red[Number] = { 0.00, 0.00, 1.00};
1441  Double_t Green[Number] = { 0.00, 5.00, 1.00};
1442  Double_t Blue[Number] = { 0.00, 0.50, 0.00};
1443  Double_t Length[Number] = { 0.00, 0.50, 1.00 };
1444  Int_t nb=50;
1445  TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
1446  }
1447  else gStyle->SetPalette(1);
1448 
1449  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1450 
1451  double rightmargin = gStyle->GetPadRightMargin();
1452  gStyle->SetPadRightMargin(0.1);
1453 
1455 
1456  gStyle->SetPadRightMargin(rightmargin);
1457 
1458  // gStyle->SetLineScalePS(1);
1459 
1460  for ( size_t ipanel=0 ; ipanel<panels.size() ; ipanel++ ) {
1461 
1462  Panel& panel = panels[ipanel];
1463 
1464  std::cout << "\n\n---------------------------------------------\n";
1465 
1466  std::cout << panel << "\n" << std::endl;
1467 
1468  int ncolsp = panel.ncols();
1469  int nrowsp = panel.nrows();
1470 
1471  double extraw = 1;
1472 
1473  std::cout << "\nncols: " << ncolsp << "\tnrows: " << nrowsp << std::endl;
1474 
1475  bool multipanel = ( panel.size() > 1 );
1476 
1477  if ( panel.size()==0 ) {
1478  std::cout << "panel empty: " << panel.name() << std::endl;
1479  continue;
1480  }
1481 
1482  gStyle->cd();
1483 
1484  if ( panel.size()>4 ) gStyle->SetLineScalePS(0.5);
1485 
1486  if ( multipanel ) extraw = 1.05;
1487 
1488  TCanvas* tc = new TCanvas( "tc", "", extraw*ncolsp*800, nrowsp*600 );
1489 
1490  tc->cd();
1491 
1492  const std::string& atlaslabel = atlaslabel_tmp;
1493 
1494 
1495  if ( multipanel ) {
1496 
1497  gStyle->SetLineScalePS(1);
1498 
1501 
1509 
1512 
1513  tc->Divide( ncolsp, nrowsp, 0.0001, 0.0003 );
1514  // atlaslabel = " " + atlaslabel_tmp;
1515  }
1516 
1518 
1519  std::string plotname = "";
1520 
1521  for ( size_t i=0 ; i<panel.size() ; i++ ) {
1522 
1523  HistDetails histo = panel[i];
1524 
1525  bool drawmeans = false;
1526  bool drawresiduals = true;
1527 
1528  if ( contains(histo.detail(), "+mean" ) ) drawmeans = true;
1529  if ( contains(histo.detail(), "-residual") ) drawresiduals = false;
1530 
1531  std::string xaxis = histo.xtitle();
1532  std::string yaxis = histo.ytitle();
1533 
1534  if ( !xregex.empty() ) {
1535  size_t pos = xaxis.find(xregex);
1536  if ( pos!=std::string::npos ) xaxis.replace( pos, xregex.size(), xpattern );
1537  pos = yaxis.find(xregex);
1538  if ( pos!=std::string::npos ) yaxis.replace( pos, xregex.size(), xpattern );
1539  }
1540 
1541  const AxisInfo& xinfo = histo.xaxis();
1542  const AxisInfo& yinfo = histo.yaxis();
1543 
1544  std::string hname = histo.name();
1545  std::string detail = histo.detail();
1546 
1547  double rebin = 1;
1548  bool d0rebin_flag = false;
1549 
1550  if ( contains( detail, "+d0rebin" ) ) d0rebin_flag = true;
1551 
1552  if ( contains( detail, "+Rebin" ) ) {
1553  rebin = std::atof( detail.substr( detail.find("+Rebin")+6, detail.size() ).c_str() );
1554  }
1555 
1556  if ( contains( detail, "+rebin" ) ) {
1557  rebin = std::atof( detail.substr( detail.find("+rebin")+6, detail.size() ).c_str() );
1558  }
1559 
1560 
1561  int npanel = nrowsp*(i/nrowsp) + i%nrowsp + 1 ;
1562 
1563  std::cout << "panel: panel: " << panel.name() << "\tsubpanel: " << npanel << std::endl;
1564 
1565  if ( multipanel ) tc->cd( npanel );
1566 
1567  SetAtlasStyle();
1568 
1569  noreftmp = noref;
1570 
1571  Plotter::setplotref(!noreftmp);
1572 
1573  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1574 
1575  std::cout << "main() processing histo[" << i << "] " << (i<10 ? " " : "" ) << histo.name() << "\t" << histo.xaxis() << std::endl;
1576 
1577  Plots plots_eff( "", yinfo.trim() );
1578  plots_eff.clear();
1579 
1580  Plots plots( "", yinfo.trim() );
1581  plots.clear();
1582 
1583  std::string noreflabel=defreflabel;
1584 
1585  double xpos = 0.18;
1586  double ypos = 0.91;
1587 
1588  if ( contains(histo.name(),"eff") || contains(histo.name(),"Eff_") ) ypos = 0.19;
1589 
1590  // ypos = 0.19;
1591 
1594 
1595  if ( atlasstyle ) {
1596  xpos = 0.18;
1597  if ( ypos>0.5 ) ypos = 0.85;
1598  else ypos = 0.18;
1599  }
1600 
1601  if ( ypos_arg!=0 ) ypos = ypos_arg;
1602 
1603  double xpos_original = xpos;
1604 
1605  xpos += xoffset;
1606 
1607  if ( xinfo.offset() != 0 ) {
1608 
1609  std::cout << "HA ! xinfo.offset: " << xinfo.offset() << std::endl;
1610 
1611  xpos = xinfo.offset();
1612 
1613  }
1614 
1615 
1616  if ( yinfo.offset() != 0 ) {
1617 
1618  std::cout << "HA ! yinfo.offset: " << yinfo.offset() << std::endl;
1619 
1620  ypos = yinfo.offset();
1621 
1622  }
1623 
1624 
1625 
1627 
1628  size_t Nrows = chains.size();
1629 
1630  if ( ALLRANGEMAP || (RANGEMAP && xaxis.find("p_{T}")!=std::string::npos && ccolours.size() ) )
1631  Nrows = ( Nrows < ccolours.size() ? Nrows : ccolours.size() );
1632 
1633  int Nlines = Nrows + taglabels.size();
1634 
1635  std::vector<double> ypositions;
1636 
1637  double deltay = (Nrows*0.055-0.005)/Nrows;
1638 
1639  double ylo = ypos;
1640  double yhi = ypos-0.01;
1641 
1642  if ( ypos>0.5 ) ylo -= Nlines*deltay;
1643  else yhi += Nlines*deltay;
1644 
1645  ypositions.reserve(Nlines);
1646  for ( int ilines=0 ; ilines<Nlines ; ilines++ ) {
1647  ypositions.push_back( yhi - deltay*(ilines+0.5) );
1648  }
1649 
1650  // specify different legends for efficiencies or residuals?
1651 
1653 
1654 
1655  if ( !contains(histo.name(),"eff") && !contains(histo.name(),"Eff_") ) ylo -= 0.02;
1656 
1657  Legend legend( xpos, xpos+0.1, ylo, ylo+Nrows*0.06-0.005 );
1658  Legend legend_eff( xpos, xpos+0.1, ylo, ylo+Nrows*0.06-0.005 );
1659 
1660 
1661  std::vector<std::string> Mean;
1662  std::vector<std::string> RMS;
1663 
1664  Mean.clear();
1665  RMS.clear();
1666 
1667  std::vector<std::string> Chi2;
1668  std::vector<std::string> MeanRef;
1669  std::vector<std::string> RMSRef;
1670 
1671  // int colours[6] = { 1, 2, 4, 6, 7, 8 };
1672 
1673  Chi2.clear();
1674  MeanRef.clear();
1675  RMSRef.clear();
1676 
1677  int mean_power = 0;
1678  int rms_power = 0;
1679  bool power_set = false;
1680 
1681  LINEF = true;
1682 
1684  // bool uselogx = xinfo.log();
1685  // bool uselogy = yinfo.log();
1686 
1687  for ( unsigned int j=0; j<chains.size(); j++) {
1688 
1689  TFile* fftest = ftest;
1690  TFile* ffref = fref;
1691 
1692  if ( chainfiles.size()>0 && chainfiles.size()>j ) ffref = fftest = chainTFiles[j];
1693 
1696 
1697  std::cout << "chain: " << chains[j] << "\taddchains: " << addchains << std::endl;
1698  std::cout << "chainref: " << chainref[j] << std::endl;
1699 
1700  noreftmp = noref;
1701  Plotter::setplotref(!noreftmp);
1702 
1703  TH1F* htest = 0;
1704  TH1F* href = 0;
1705 
1706  TH1F* htestnum = 0;
1707  TH1F* htestden = 0;
1708  TH1F* hrefnum = 0;
1709 
1710  TGraphAsymmErrors* tgtest = 0;
1711 
1712  std::cout << "refchain.size() " << refchain.size() << std::endl;
1713 
1714  std::cout << "refchain: " << refchain[j] << std::endl;
1715 
1717 
1718  gPad->SetRightMargin(0.03);
1719 
1720  if ( contains(histo.name(),"/2d") ) {
1721 
1722  gPad->SetRightMargin(0.13);
1723 
1724  TH2D* h2test = Get<TH2D>( *fftest, chains[j]+"/"+histo.name(), testrun, 0, &savedhistos );
1725 
1726  DrawLabel( 0.5, 0.5, "a test" );
1727 
1728  h2test->GetYaxis()->SetTitleOffset(1.55);
1729  h2test->GetXaxis()->SetTitleOffset(1.5);
1730  h2test->GetXaxis()->SetTitle(xaxis.c_str());
1731  h2test->GetYaxis()->SetTitle(yaxis.c_str());
1732 
1733  const AxisInfo& xinfo = histo.xaxis();
1734  const AxisInfo& yinfo = histo.yaxis();
1735 
1736 
1737  std::cout << xinfo << std::endl;
1738  std::cout << yinfo << std::endl;
1739 
1740  if ( yinfo.rangeset() ) {
1741  h2test->GetYaxis()->SetRangeUser( yinfo.lo(), yinfo.hi() );
1742  }
1743 
1744  if ( yinfo.normset() ) normy( h2test );
1745 
1746  if ( xinfo.rangeset() ) {
1747  h2test->GetXaxis()->SetRangeUser( xinfo.lo(), xinfo.hi() );
1748  }
1749 
1750  if ( xinfo.autoset() ) autox( h2test );
1751  if ( yinfo.autoset() ) autoy( h2test );
1752 
1753  SetZeros( h2test );
1754 
1755  h2test->DrawCopy("colz");
1756 
1757  if ( histo.detail().find("logz")!=std::string::npos ) gPad->SetLogz(true);
1758  else gPad->SetLogz(false);
1759 
1760 
1761  }
1762  else if ( refit_resplots && ( contains(histo.name(),"/sigma") || contains(histo.name(),"/mean") ) ) {
1763 
1764  bool bsigma = false;
1765  if ( contains(histo.name(),"/sigma") ) bsigma = true;
1766 
1767  bool bmean = false;
1768  if ( contains(histo.name(),"/mean") ) bmean = true;
1769 
1770  std::cout << "\trefitting: " << histo.name() << std::endl;
1771 
1772  Resplot::setoldrms95(oldrms);
1773  Resplot::setscalerms95(true);
1774 
1775  std::string tmp_ = histo.name();
1776  std::string base;
1777 
1778  if ( bsigma ) base = chop( tmp_, "/sigma" );
1779  if ( bmean ) base = chop( tmp_, "/mean" );
1780 
1781  TH2D* htest2d_ = Get<TH2D>( *fftest, chains[j]+"/"+base+"/2d", testrun, 0, &savedhistos );
1782 
1783  std::cout << "ffref " << ffref << std::endl;
1784  TH2D* href2d_ = 0;
1785 
1786  if ( ffref ) href2d_ = Get<TH2D>( *ffref, chains[j]+"/"+base+"/2d", testrun );
1787 
1788  if ( htest2d_==0 ) continue;
1789  if ( !noreftmp && href2d_==0 ) noreftmp = true;
1790  Plotter::setplotref(!noreftmp);
1791 
1793 
1794  Resplot rtest("tmp", htest2d_ );
1795 
1796  if ( rtest.finalised() ) {
1797  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") || contains(histo.name(),"nsi") || contains(histo.name(),"nbl") ) rtest.Refit(Resplot::FitNull);
1798  else rtest.Refit(Resplot::FitNull95);
1799  }
1800  else {
1801  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") || contains(histo.name(),"nsi") || contains(histo.name(),"nbl") ) rtest.Finalise(Resplot::FitNull);
1802  else rtest.Finalise(Resplot::FitNull95);
1803  }
1804 
1805  if ( bsigma ) { htest = (TH1F*)rtest.Sigma()->Clone("rtest_sigma"); htest->SetDirectory(0); }
1806  if ( bmean ) { htest = (TH1F*)rtest.Mean()->Clone("rtest_mean"); htest->SetDirectory(0); }
1807 
1808  if ( htest==0 ) {
1809  std::cerr << "missing test histogram: " << (refchain[j]+" / "+histo.name()) << " " << htest << "(test)" << std::endl;
1810  continue;
1811  }
1812 
1813 
1816 
1817  TH1F* hreft = 0;
1818 
1819  if ( !noreftmp ) {
1820  if ( refitref_resplots ) {
1821 
1822  Resplot rref("tmp", href2d_ );
1823 
1824  if ( rref.finalised() ) {
1825  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") ) rref.Refit(Resplot::FitNull);
1826  else rref.Refit(Resplot::FitNull95);
1827  }
1828  else {
1829  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") ) rref.Finalise(Resplot::FitNull);
1830  else rref.Finalise(Resplot::FitNull95);
1831  }
1832 
1833  if ( bsigma ) { hreft = (TH1F*)rref.Sigma()->Clone("rref_sigma"); hreft->SetDirectory(0); }
1834  if ( bmean ) { hreft = (TH1F*)rref.Mean()->Clone("rref_mean"); hreft->SetDirectory(0); }
1835 
1836  }
1837  else {
1838  hreft = Get( *ffref, refchain[j]+"/"+histo.name(), rawrefrun, chainmap );
1839  if ( hreft==0 ) {
1840  std::cerr << "ERROR: could not find " << (refchain[j]+"/"+histo.name()) << std::endl;
1841  }
1842  }
1843  }
1844 
1845  if ( !noreftmp && hreft==0 ) {
1846  std::cerr << "missing ref histogram: " << (refchain[j]+" / "+histo.name()) << " " << htest << "(ref)" << std::endl;
1847 
1848  noreftmp = true;
1849  Plotter::setplotref(!noreftmp);
1850  noreflabel="reference not found";
1853  // std::exit(-1);
1854  }
1855 
1856  if ( !noreftmp ) {
1857  href = (TH1F*)hreft->Clone();
1858  href->SetDirectory(0);
1859  }
1860 
1862  // std::cout << "\tget " << (refchain[j]+"/"+histos[i]) << "\t" << href << std::endl;
1863 
1864  savedhistos.push_back( refchain[j]+"/"+histo.name() );
1865 
1866  }
1867  else {
1868 
1869  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1870 
1872 
1873  std::string reghist = histo.name();
1874 
1875  std::cout << "hist: " << (chains[j]+"/"+reghist) << "\tftest " << ftest << std::endl;
1876 
1877  htest = Get( *fftest, chains[j]+"/"+reghist, testrun, 0, &savedhistos );
1878 
1879  std::cout << "hist: " << htest << std::endl;
1880 
1881  std::cout << xaxis << std::endl;
1882 
1883  if ( htest==0 ) {
1884  std::cerr << "missing test histogram: " << (chains[j]+" / "+reghist) << " " << htest<< std::endl;
1885  continue;
1886  }
1887 
1888  TH1F* hreft = 0;
1889 
1890  std::cout << "hreft: " << hreft << std::endl;
1891 
1892  if ( ffref ) hreft = Get( *ffref, refchain[j]+"/"+reghist, rawrefrun, chainmap );
1893  else noreftmp = true;
1894 
1895  std::cout << "hreft: " << hreft << std::endl;
1896 
1897  if ( std::string(htest->ClassName()).find("TH2")!=std::string::npos ) {
1898  std::cout << "Class TH2: " << htest->GetName() << std::endl;
1899  continue;
1900  }
1901 
1902  if ( std::string(htest->ClassName()).find("TH1")!=std::string::npos ) {
1903  std::cout << "Class TH1: " << htest->GetName() << std::endl;
1904  }
1905  else if ( std::string(htest->ClassName()).find("TProfile")!=std::string::npos ) {
1906  std::cout << "Class TProf: " << htest->GetName() << std::endl;
1907  }
1908 
1909 
1910 
1911  if ( !noreftmp && hreft==0 ) {
1912  std::cerr << "missing ref histogram: " << (refchain[j]+" / "+reghist)
1913  << " " << hreft << std::endl;
1914  noreftmp = true;
1915  Plotter::setplotref(false);
1916  noreflabel="reference not found";
1919  // std::exit(-1);
1920 
1921  }
1922 
1923  if ( hreft!=0 ) {
1924  href = (TH1F*)hreft->Clone();
1925  href->SetDirectory(0);
1926  }
1927  else {
1928  noreftmp = true;
1929  href = 0;
1930  }
1931 
1932  std::cout << " \tget " << (chains[j]+"/"+reghist) << "\thtest " << htest << std::endl;
1933  std::cout << " \tget " << (refchain[j]+"/"+reghist) << "\thref " << href << std::endl;
1934 
1935  if ( htest==0 ) continue;
1936 
1937  if ( !noreftmp && href==0 ) {
1938  noreftmp = true;
1939  Plotter::setplotref(!noreftmp);
1940  }
1941 
1942  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1943 
1944 
1945  if ( rebin!=1 ) {
1946  std::cout << "rebin: " << hname << "\t" << rebin << std::endl;
1947  if ( htest ) htest->Rebin(rebin);
1948  if ( href ) href->Rebin(rebin);
1949  for ( int ip=0 ; ip<10 ; ip++ ) std::cout << std::endl;
1950  }
1951 
1952 #if 0
1953  if ( !contains( histo.name(), "rdz_vs_zed" ) && contains( histo.name(), "1d") ) {
1955  std::cout << "Rebinning histogram: " << histo.name() << std::endl;
1956  if ( htest->GetNbinsX()>500 ) htest->Rebin(10);
1957  if ( href && href->GetNbinsX()>500 ) href->Rebin(10);
1958  }
1959 #endif
1960 
1961 
1962  if ( histo.name().find("zed_eff")!=std::string::npos ) {
1963  if ( htest->GetNbinsX()>100 ) htest->Rebin(5);
1964  if ( href && href->GetNbinsX()>100 ) href->Rebin(5);
1965  }
1966 
1967 
1968  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1969 
1970  if ( scalepix && std::string(htest->GetName()).find("npix")!=std::string::npos ) Scale(htest,0.5);
1971  if ( scalepix && href && std::string(htest->GetName()).find("npix")!=std::string::npos ) Scale(href,0.5);
1972 
1973  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1974 
1975  if ( notitle ) {
1976  htest->SetTitle("");
1977  if( href ) href->SetTitle("");
1978  }
1979 
1980  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1981 
1982  }
1983 
1984  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1985 
1986  if ( make_ref_efficiencies ) {
1987  if ( htest && href ) {
1988 
1990  // std::cout << "contains _eff " << contains( std::string(htest->GetName()), "eff" ) << std::endl;
1991 
1992  if ( contains( std::string(htest->GetName()), "eff" ) ) {
1993 
1994  std::string effhist = histo.name();
1995 
1996  htestnum = Get( *fftest, chains[j]+"/"+effhist+"_n", testrun, 0, &savedhistos );
1997 
1998  TH1F* hrefnumt = Get( *ffref, refchain[j]+"/"+effhist+"_n", rawrefrun, chainmap, &savedhistos );
1999 
2000  if ( !noreftmp && hrefnumt!=0 ) {
2001  hrefnum = (TH1F*)hrefnumt->Clone();
2002  hrefnum->SetDirectory(0);
2003  }
2004 
2005  }
2006  }
2007  }
2008 
2009 
2010  if ( bayes ) {
2011 
2012  if ( htest && contains( std::string(htest->GetName()), "eff" ) ) {
2013 
2014  std::string effhist = histo.name();
2015 
2017 
2018  if ( rebin!=1 ) std::cout << effhist << "\trebin: " << rebin << std::endl;
2019 
2020  htestnum = Get( *fftest, chains[j]+"/"+effhist+"_n", testrun, 0, &savedhistos ) ;
2021  htestden = Get( *fftest, chains[j]+"/"+effhist+"_d", testrun, 0, &savedhistos ) ;
2022 
2023  std::cout << "1: Bayesian error calculation " << htestnum << " " << htestden << "\tscale " << scale_eff << std::endl;
2024 
2025  if ( htestnum && htestden ) {
2026 
2027  if ( d0rebin_flag ) {
2028  htestnum = d0rebin( htestnum );
2029  htestden = d0rebin( htestden );
2030  }
2031  else if ( rebin!=1 ) {
2032  htestnum = Rebin(htestnum, rebin );
2033  htestden = Rebin(htestden, rebin );
2034  }
2035 
2036  std::cout << "test histogram name: : " << htestnum->GetName() << "\txaxis: " << xaxis << "\t" << std::endl;
2037 
2038  // if ( xaxis.find("p_{T}")!=std::string::npos || xaxis.find("pt")!=std::string::npos ) {
2039  if ( std::string(htestnum->GetName()).find("ntrax_eff")!=std::string::npos ) {
2040 
2041  bool low = true;
2042 
2043  // if ( chains[j].find("j55")!=std::string::npos ) low = false;
2044 
2045  htestnum = rebin_log( htestnum, low );
2046  htestden = rebin_log( htestden, low );
2047  }
2048 
2049 #if 0
2050  if ( contains( htest->GetName(), "_vs_lb" ) ) {
2053  std::cout << "rebin " << histo.name() << std::endl;
2054  htestnum->Rebin(3);
2055  htestden->Rebin(3);
2056  }
2057 
2058  if ( contains( htest->GetName(), "eta_eff" ) ) {
2059  std::cout << "rebin " << histo.name() << std::endl;
2060  htestnum->Rebin(2);
2061  htestden->Rebin(2);
2062  }
2063 #endif
2064 
2065  // if ( RANGEMAP && (effhist.find("pT")!=std::string::npos || effhist.find("pt")!=std::string::npos ) ) {
2066  if ( RANGEMAP && (effhist.find("ET")!=std::string::npos ) ) {
2067  std::cout << "\trange: " << j << " " << htest << std::endl;
2068  bnd.range( chains[j], htestnum );
2069  bnd.range( chains[j], htestden );
2070  }
2071 
2072 
2073  Efficiency1D e( htestnum, htestden, "", scale_eff );
2074  tgtest = e.Bayes(scale_eff);
2075 
2076  htest = e.Hist();
2077 
2078  std::cout << "effhist: " << effhist << std::endl;
2079 
2080  }
2081 
2083 
2084  std::cout << "recalculating reference efficiencies ..." << std::endl;
2085 
2086  if ( href ) {
2087 
2088  std::cout << "doin ..." << std::endl;
2089 
2090  TH1F* hrefnum = Get( *ffref, refchain[j]+"/"+histo.name()+"_n", rawrefrun, chainmap );
2091 
2092  TH1F* hrefden = Get( *ffref, refchain[j]+"/"+histo.name()+"_d", rawrefrun, chainmap );
2093 
2094  std::cout << "2. Bayesian error calculation " << htestnum << " " << htestden << "\tscale " << scale_eff << std::endl;
2095  std::cout << "3. Bayesian error calculation " << hrefnum << " " << hrefden << "\tscale " << scale_eff_ref << std::endl;
2096 
2097 
2098  if ( hrefnum && hrefden ) {
2099 
2100  if ( d0rebin_flag ) {
2101  hrefnum = d0rebin( hrefnum );
2102  hrefden = d0rebin( hrefden );
2103  }
2104  else if ( rebin!=1 ) {
2105  hrefnum = Rebin(hrefnum, rebin );
2106  hrefden = Rebin(hrefden, rebin );
2107  }
2108 
2109  Efficiency1D e( hrefnum, hrefden, "", scale_eff_ref );
2111  // tgref = e.Bayes(scale_eff);
2112 
2113  href = e.Hist();
2114 
2115  }
2116  }
2117  }
2118 
2119  }
2120 
2121 
2122  if ( htest==0 ) {
2123  std::cout << " no test histogram : " << (chains[j]+"/"+histo.name()) << std::endl;
2124  continue;
2125  }
2126 
2127  if ( !noreftmp && href==0 ) {
2128  std::cout << " no ref histogram : " << (chains[j]+"/"+histo.name()) << std::endl;
2129  noreftmp = true;
2130  Plotter::setplotref(!noreftmp);
2131  noreflabel="reference not found";
2134  // continue;
2135  }
2136 
2137 
2138  htest->GetYaxis()->SetTitleOffset(1.55);
2139  htest->GetXaxis()->SetTitleOffset(1.5);
2140  htest->GetXaxis()->SetTitle(xaxis.c_str());
2141  htest->GetYaxis()->SetTitle(yaxis.c_str());
2142 
2143  if ( !noreftmp ) {
2144  href->GetYaxis()->SetTitleOffset(1.5);
2145  href->GetXaxis()->SetTitleOffset(1.5);
2146  href->GetXaxis()->SetTitle(xaxis.c_str());
2147  if ( contains(yaxis,"Efficiency") && !contains(yaxis,"%") && scale_eff==100 ) href->GetYaxis()->SetTitle((yaxis+" [%]").c_str());
2148  else href->GetYaxis()->SetTitle(yaxis.c_str());
2149  }
2150 
2151  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2152 
2153 #if 1
2154  if ( contains(histo.name(),"ntracks") ) {
2155 
2156  double xm = htest->GetMean();
2157 
2158  if ( xm>=10 ) {
2159  double lxm = std::log10(xm);
2160  int newbins = int(0.5+xm/std::pow(10,int(lxm)))*pow(10,int(lxm));
2161  int nrebin = int( (newbins+5)/10 );
2162 
2163  if ( nrebin>1 ) {
2164  std::cout << "rebin: " << htest->GetName() << "\tbins: " << nrebin << std::endl;
2165  htest->Rebin(nrebin);
2166  htest->Sumw2();
2167  if ( !noreftmp ) {
2168  href->Rebin(nrebin);
2169  href->Sumw2();
2170  }
2171  }
2172  }
2173  }
2174 #endif
2175 
2176  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2177 
2179  if ( plotname == "" ) {
2180 
2181  if ( key!="" ) {
2182  htest->SetTitle("");
2183  if ( href ) href->SetTitle("");
2184  plotname = key+"_";
2185  }
2186  else if (fcontains(chains[j],"HLT_")) {
2187  htest->SetTitle("");
2188  if ( href ) href->SetTitle("");
2189  plotname = "HLT_";
2190  }
2191  else if (fcontains(chains[j],"EF_")) {
2192  htest->SetTitle("");
2193  if ( href ) href->SetTitle("");
2194  plotname = "EF_";
2195  }
2196  else if (fcontains(chains[j],"L2_")) {
2197  htest->SetTitle("");
2198  if ( href ) href->SetTitle("");
2199  plotname = "L2_";
2200  }
2201  else if (contains(chains[j],"FTK") && ! contains(chains[j],"HLT_") ) {
2202  htest->SetTitle(("FTK "+ histo.name()).c_str());
2203  if ( href ) href->SetTitle(("FTK "+ histo.name()).c_str());
2204  plotname = "FTK_";
2205  }
2206 
2207  plotname += histo.name();
2208 
2211  replace(plotname, '/', '_');
2212 
2213  }
2214 
2215 
2216  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2217 
2218  bool residual = false;
2219 
2220  if ( contains(histo.name(),"_res") || contains(histo.name(),"residual_") || contains(histo.name(),"1d") ) residual = true;
2221 
2222 
2223 
2224 
2225  std::string collection = basename( chains[j] );
2226 
2227  std::string actual_chain = basename( dirname( chains[j] ) );
2228 
2229  if ( collection.find("_InDet")!=std::string::npos ) collection.erase( 0, collection.find("_InDet")+1 );
2230  if ( actual_chain.find("_InDet")!=std::string::npos ) actual_chain.erase( actual_chain.find("_InDet") );
2231 
2232 
2233  std::cout << "raw: " << chains[j] << std::endl;
2234 
2235  std::cout << "track collection: " << collection << std::endl;
2236  std::cout << "actual chain: " << actual_chain << std::endl;
2237 
2238  std::regex rx("_HLT_[^_]*RoI.*");
2239  std::regex rx1("_HLT_[^_]*_RoI.*");
2240 
2241  actual_chain = std::regex_replace( actual_chain, std::regex( "_HLT_IDTrack.*" ), "" );
2242 
2243  collection = std::regex_replace( collection, std::regex(".*HLT_IDTrack_"), "IDTrack " );
2244  collection = std::regex_replace( collection, std::regex("IDTrack "), "" );
2245  collection = std::regex_replace( std::regex_replace( collection, rx, "" ), rx1, "" );
2246 
2247  if ( actual_chain.find("HLT_IDTrack_")!=std::string::npos ) actual_chain.erase( actual_chain.find("HLT_IDTrack_"), 12 );
2248  if ( actual_chain.find("_IDTrack_")!=std::string::npos ) actual_chain.erase( actual_chain.find("_IDTrack_"), 9 );
2249  if ( actual_chain.find("IDTrack")!=std::string::npos ) actual_chain.erase( actual_chain.find("IDTrack"), 7 );
2250  if ( actual_chain.find("_idperf")!=std::string::npos ) actual_chain.erase( actual_chain.find("_idperf"), 7 );
2251  if ( actual_chain.find("_bperf")!=std::string::npos ) actual_chain.erase( actual_chain.find("_bperf"), 6 );
2252  if ( actual_chain.find("_boffperf")!=std::string::npos ) actual_chain.erase( actual_chain.find("_boffperf"), 9 );
2253  if ( actual_chain.find("_HLT_")!=std::string::npos ) actual_chain.replace( actual_chain.find("_HLT_"), 5, " " );
2254  if ( actual_chain.find("HLT_")!=std::string::npos ) actual_chain.erase( actual_chain.find("HLT_"), 4 );
2255 
2256  if ( collection.find("_IDTrkNoCut")!=std::string::npos ) collection.erase( collection.find("_IDTrkNoCut"), 11 );
2257  if ( collection.find("xAODCnv")!=std::string::npos ) collection.erase( collection.find("xAODCnv"), 7 );
2258  if ( collection.find("HLT_IDTrack_")!=std::string::npos ) collection.erase( collection.find("HLT_IDTrack_"), 12 );
2259  if ( collection.find("HLT_IDTrack")!=std::string::npos ) collection.erase( collection.find("HLT_IDTrack"), 11 );
2260  if ( collection.find("Tracking")!=std::string::npos ) collection.replace( collection.find("Tracking"), 8, "Trk" );
2261  if ( collection.find("InDetTrigTrk_")!=std::string::npos ) collection.erase( collection.find("InDetTrigTrk_"), 13 );
2262  if ( collection.find("HLT_xAODTracks_")!=std::string::npos ) collection.erase( collection.find("HLT_xAODTracks_"), 15 );
2263  if ( collection.find("_HLT_")!=std::string::npos ) collection.replace( collection.find("_HLT_"), 5, " " );
2264  if ( collection.find("HLT_")!=std::string::npos ) collection.erase( collection.find("HLT_"), 4 );
2265 
2266 
2267  if ( actual_chain.size()>30 ) {
2268  size_t pos = actual_chain.find_last_of("_");
2269  while ( pos!=std::string::npos && actual_chain.size()>30 ) {
2270  actual_chain.erase( pos, actual_chain.size()-pos );
2271  actual_chain+="...";
2272  pos = actual_chain.find_last_of("_");
2273  }
2274  }
2275 
2276  std::string c = actual_chain + " : " + collection;
2277 
2278  std::cout << "track collection: " << collection << " <-" << std::endl;
2279  std::cout << "actual chain: " << actual_chain << " <-" << std::endl;
2280 
2281  replace( c, "_In", " : " );
2282 
2283  c = " " + c;
2284 
2285  std::cout << "use label: " << c << "\tchains size " << chains.size() << "\t" << usrlabels.size() << std::endl;
2286 
2287  std::cout << "chains.size() " << chains.size() << " " << j << std::endl;
2288  std::cout << "chains.size() " << chains.size() << " " << j << std::endl;
2289 
2290  std::cout << "chains[j] : " << j << " " << chains[j] << std::endl;
2291 
2292  std::cout << "userlabels.size() " << usrlabels.size() << std::endl;
2293 
2294  if ( usrlabels.size() < j+1 ) {
2295  if ( usrlabels.size()!=0 ) std::cerr << "userlabels not large enough - not using userlabels" << std::endl;
2296  }
2297  else c = usrlabels[ j ];
2298 
2299  std::cout << "use label: c: " << c << std::endl;
2300 
2302 
2303  // std::cout << "adding plot " << histos[i] << " " << htest->GetName() << std::endl;
2304 
2305  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2306 
2307 
2308 
2309  std::cout << "\n\n\n\nxaxis: " << xaxis << std::endl;
2310 
2311 
2312 
2313  if ( ALLRANGEMAP || xaxis.find("p_{T}")!=std::string::npos || xaxis.find("E_{T}")!=std::string::npos ) {
2314 
2315  if ( RANGEMAP && xaxis.find("p_{T}")!=std::string::npos ) {
2316  bnd.range( chains[j], htest );
2317  if ( href ) bnd.range( chains[j], href );
2318  }
2319 
2320  if ( RANGEMAP || ALLRANGEMAP ) {
2321 
2322  LINEF = false;
2323 
2324  std::cout << "\n\n\nctags " << ctags.size() << "\n\n" << std::endl;
2325 
2326  for ( size_t ic=0 ; ic<ctags.size() ; ic++ ) {
2327 
2328  // std::cout << "\tctags[" << ic << "] = " << ctags[ic] << std::endl;
2329 
2330  std::cout << "\n\nic: " << ic << " " << ctags[ic] << " " << ccolours[ic] << "\n\n" << std::endl;
2331 
2332  if ( chains[j].find(ctags[ic])!=std::string::npos ) {
2333  std::cout << "\ttag " << ctags[ic] << " \tcolour: " << ccolours[ic] << "\tstyle: " << cstyles[ic] << std::endl;
2334  htest->SetLineColor( ccolours[ic] );
2335  htest->SetMarkerColor( ccolours[ic] );
2336  htest->SetMarkerStyle( cstyles[ic] );
2337  c = ctaglabels[ic];
2338  if ( tgtest ) {
2339  tgtest->SetLineColor(htest->GetMarkerColor());
2340  tgtest->SetMarkerStyle(htest->GetMarkerStyle());
2341  tgtest->SetMarkerColor(htest->GetMarkerColor());
2342  }
2343  break;
2344  }
2345  }
2346 
2347  }
2348 
2349  std::cout << "test: " << chains[j] << "chains colour: " << htest->GetMarkerColor() << std::endl;
2350 
2351  }
2352 
2353 
2354  std::cout << "movin' on ..." << std::endl;
2355 
2356  std::cout << "chain: " << chains[j] << " \t marker colour: " << htest->GetMarkerColor() << std::endl;
2357 
2358  // std::exit(0);
2359 
2360  std::cout << "Plotter marker : " << htest->GetMarkerColor() << " " << htest->GetMarkerStyle() << std::endl;
2361 
2362  // if ( uselabels ) plots.push_back( Plotter( htest, href, chain_name+usrlabels[j], tgtest ) );
2363  if ( uselabels ) plots.push_back( Plotter( htest, href, " " + chain_name[j] + c, tgtest ) );
2364  else {
2365  std::cout << "using label: " << c << std::endl;
2366  plots.push_back( Plotter( htest, href, c, tgtest ) );
2367  }
2368 
2369  if ( ALLRANGEMAP || ( RANGEMAP && xaxis.find("p_{T}")!=std::string::npos ) ) plots.back().max_entries( ccolours.size() );
2370 
2371  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2372 
2373  if ( make_ref_efficiencies ) {
2374 
2375  if ( htestnum && hrefnum ) {
2376  Efficiency1D e( htestnum, hrefnum, "", scale_eff );
2377 
2378  TH1* h = e.Hist();
2379 
2380  double range = h->GetMaximum()-h->GetMinimum();
2381 
2382  if ( range<0.2*scale_eff ) {
2383 
2384  double max = int( (h->GetMaximum() + 20)*0.1 )*0.1*scale_eff;
2385  double min = int( (h->GetMinimum() - 10)*0.1 )*0.1*scale_eff;
2386 
2387  if ( max>1*scale_eff ) max = 1.02*scale_eff;
2388  if ( min<0 ) min = 0;
2389 
2390  h->SetMinimum(min);
2391  h->SetMaximum(max);
2392 
2393  }
2394 
2395  plots_eff.push_back( Plotter( e.Hist(), 0, c ) );
2396 
2397  }
2398  }
2399 
2400 
2401  if ( href ) Chi2.push_back( label( "chi2 = %5.2lf / %2.0lf", chi2( htest, href ), double(htest->GetNbinsX()) ) );
2402 
2403  if ( drawmeans ) {
2404 
2405  double mean_95 = htest->GetMean();
2406  double dmean_95 = htest->GetMeanError();
2407  double rms_95 = htest->GetRMS();
2408  double drms_95 = htest->GetRMSError();
2409 
2410  Mean.push_back(label(" mean = %4.2lf #pm %4.2lf", mean_95, dmean_95) );
2411  RMS.push_back(label( " rms = %4.2lf #pm %4.2lf", rms_95, drms_95 ) );
2412 
2413  }
2414 
2415  if ( residual && drawresiduals ) {
2416 
2418 
2419  xpos = xpos_original;
2420 
2421  std::cout << "calculating resolutions : " << histo.name() << " " << htest->GetName() << std::endl;
2422 
2423  TF1* d95 = Resplot::FitNull95( (TH1D*)htest );
2424 
2425  double mean_95 = d95->GetParameter(1);
2426  double dmean_95 = d95->GetParError(1);
2427  double rms_95 = d95->GetParameter(2);
2428  double drms_95 = d95->GetParError(2);
2429 
2430  std::cout << "\t\t" << histo.name()
2431  << "\tmean: " << mean_95 << " +- " << dmean_95
2432  << "\trms: " << rms_95 << " +- " << drms_95 << std::endl;
2433 
2435 
2436  if ( !power_set ) {
2437  for ( int ip=-2 ; ip<9 ; ip++ ) {
2438  if ( std::fabs(mean_95) >= std::pow( 10., double(-ip) ) ) {
2439  mean_power = ip;
2440  break;
2441  }
2442  }
2443 
2444  for ( int ip=-2 ; ip<9 ; ip++ ) {
2445  if ( std::fabs(rms_95) >= std::pow( 10., double(-ip) ) ) {
2446  rms_power = ip;
2447  break;
2448  }
2449  }
2450  }
2451 
2452  power_set = true;
2453 
2454  std::cout << "\t\t" << histo.name()
2455  << "\tmean: " << mean_95 << " +- " << dmean_95 << " : pow " << mean_power
2456  << "\trms: " << rms_95 << " +- " << drms_95 << " : pow " << rms_power << std::endl;
2457 
2458 
2459  if ( mean_power == 0 ) {
2460  Mean.push_back(label("mean_{95} = %4.2lf #pm %4.2lf", mean_95, dmean_95) );
2461  }
2462  else {
2463  Mean.push_back(label("mean_{95} = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2464  mean_95*std::pow(10.,double(mean_power)), dmean_95*std::pow(10,double(mean_power)), -mean_power ) );
2465 
2466  }
2467 
2468  if ( rms_power == 0 ) {
2469  RMS.push_back(label( "rms_{95} = %4.2lf #pm %4.2lf", rms_95, drms_95 ) );
2470  }
2471  else {
2472  RMS.push_back(label( "rms_{95} = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2473  rms_95*std::pow(10.,double(rms_power)), drms_95*std::pow(10,double(rms_power)), -rms_power ) );
2474  }
2475 
2476  if ( href ) {
2477  TF1* d95ref = Resplot::FitNull95( (TH1D*)href );
2478 
2479  double mean_95ref = d95ref->GetParameter(1);
2480  double dmean_95ref = d95ref->GetParError(1);
2481  double rms_95ref = d95ref->GetParameter(2);
2482  double drms_95ref = d95ref->GetParError(2);
2483 
2484  std::cout << "\t\t" << histo.name()
2485  << "\tmean ref: " << mean_95ref << " +- " << dmean_95ref << " : pow " << mean_power
2486  << "\trms ref: " << rms_95ref << " +- " << drms_95ref << " : pow " << rms_power << std::endl;
2487 
2488  if ( mean_power == 0 ) {
2489  MeanRef.push_back(label("mean_{95} ref = %4.2lf #pm %4.2lf", mean_95ref, dmean_95ref) );
2490  }
2491  else {
2492  MeanRef.push_back(label("mean_{95} ref = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2493  mean_95ref*std::pow(10,double(mean_power)), dmean_95ref*std::pow(10,double(mean_power)), -mean_power ) );
2494 
2495  }
2496 
2497 
2498  if ( rms_power == 0 ) {
2499  RMSRef.push_back(label( "rms_{95} ref = %4.2lf #pm %4.2lf", rms_95ref, drms_95ref ) );
2500  }
2501  else {
2502  RMSRef.push_back(label( "rms_{95} ref = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2503  rms_95ref*std::pow(10,double(rms_power)), drms_95ref*std::pow(10,double(rms_power)), -rms_power ) );
2504  }
2505  }
2506 
2507  htest->Sumw2();
2508  if ( href ) href->Sumw2();
2509  }
2510 
2511  if ( yinfo.normset() ) {
2512  Norm( htest );
2513  if ( href ) Norm( href );
2514  }
2515  else if ( yinfo.refnormset() ) {
2516  if ( href ) Norm( href, Entries(htest) );
2517  }
2518 
2519  if ( yinfo.binwidth() ) {
2520  binwidth( htest );
2521  if ( href ) binwidth( href );
2522  }
2523 
2524 
2525 
2526  if ( !noreftmp && normref &&
2527  !contains( histo.name(), "mean") && !contains( histo.name(), "sigma" ) &&
2528  !contains( histo.name(), "Eff") && !contains( histo.name(), "eff") &&
2529  !contains( histo.name(), "Res") && !contains( histo.name(), "vs") && !contains( histo.name(), "_lb") ) {
2530  Norm( href, Entries( htest ) );
2531  }
2532 
2533  }
2534 
2535  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2536 
2537  if ( !noplots ) {
2538 
2541 
2542  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2543 
2545  plots.sortx( xinfo );
2546 
2547  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2548 
2549  double yminset = 0;
2550  double ymaxset = 0;
2551 
2552  double rmin = 0;
2553  double rmax = 0;
2554 
2555  if ( xinfo.rangeset() ) {
2556  rmin = plots.realmin( plots.lo(), plots.hi() );
2557  rmax = plots.realmax( plots.lo(), plots.hi() );
2558  }
2559  else {
2560  rmin = plots.realmin();
2561  rmax = plots.realmax();
2562  }
2563 
2564  if ( yinfo.autoset() ) {
2565 
2566  int csize = chains.size() + taglabels.size() + ( atlasstyle ? 1 : 0 );
2567 
2568  if ( yinfo.log() && rmin>0 && rmax>0 ) {
2569 
2571  double delta = std::log10(rmax)-std::log10(rmin);
2572 
2574  // ymaxset = rmax*std::pow(10,delta*0.15*csize);
2575 
2576  yminset = rmin*std::pow(10,-delta*0.1);
2577 
2578  double newdelta = std::log10(rmax) - std::log10(yminset) + 0.05*delta;
2579 
2580  if ( csize<10 ) ymaxset = rmin*std::pow(10,newdelta/(1-0.07*csize));
2581  else ymaxset = rmin*std::pow(10,newdelta*2);
2582 
2583  if ( yminset!=yminset ) {
2584  std::cerr << " range error " << delta << " " << yminset << " " << ymaxset << "\t(" << rmin << " " << rmax << ")" << std::endl;
2588  continue;
2589  }
2590 
2591  }
2592  else {
2593 
2596 
2597  if ( ypos>0.5 ) {
2598  double delta = rmax-rmin;
2599 
2600  yminset = rmin-0.1*delta;
2601 
2602  if ( rmin>=0 && yminset<=0 ) yminset = 0;
2603 
2604  double newdelta = rmax - yminset + 0.05*delta;
2605 
2606  if ( csize<10 ) ymaxset = yminset + newdelta/(1-0.09*csize);
2607  else ymaxset = yminset + newdelta*2;
2608  }
2609  else {
2610  double delta = rmax-rmin;
2611 
2612  ymaxset = rmax+0.1*delta;
2613 
2614  double newdelta = ymaxset - rmin - 0.05*delta;
2615 
2616  if ( csize<10 ) yminset = ymaxset - newdelta/(1-0.09*csize);
2617  else yminset = ymaxset - newdelta*2;
2618 
2619  if ( rmin>=0 && yminset<=0 ) yminset = 0;
2620 
2621  }
2622 
2623  }
2624 
2625  }
2626  else {
2627  if ( yinfo.rangeset() ) {
2628  yminset = yinfo.lo();
2629  ymaxset = yinfo.hi();
2630  }
2631  }
2632 
2633  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2634 
2635  // more useful debugging ...
2636  // std::cout << "yauto: " << yinfo.autoset() << "\tyrange " << yinfo.rangeset() << std::endl;
2637 
2638  // std::cout << "yminset " << yminset << "\tymaxset " << ymaxset << std::endl;
2639 
2640  if ( yinfo.autoset() && yinfo.rangeset() ) {
2641 
2642  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2643 
2644  if ( yminset>yinfo.lo() ) yminset = yinfo.lo();
2645  if ( ymaxset<yinfo.hi() ) ymaxset = yinfo.hi();
2646  }
2647 
2648 
2649  if ( contains(histo.name(),"_eff") ) {
2650 
2651  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2652 
2653  if ( effset ) {
2654  ymaxset = effmax;
2655  yminset = effmin;
2656  }
2657  }
2658 
2659  if ( ymaxset!=0 || yminset!=0 ) {
2660 
2661  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2662 
2663  plots.Max( ymaxset );
2664  plots.Min( yminset );
2665  }
2666 
2667  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2668 
2669  if ( yminset!=0 || ymaxset!=0 ) {
2670  if ( yminset>0 ) plots.SetLogy(yinfo.log());
2671  else plots.SetLogy(false);
2672  }
2673  else plots.SetLogy(yinfo.log());
2674 
2675  // plots.SetLogy(false);
2676 
2677  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2678 
2679  // plots.limits();
2680 
2682 
2683  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2684 
2685  plots.Draw( legend );
2686 
2687  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2688 
2689  if ( atlasstyle ) ATLASLabel( xpos, ypositions[0]+deltay, atlaslabel, kBlack, ncolsp, nrowsp );
2690 
2691  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2692 
2693  for ( unsigned it=0 ; it<taglabels.size() ; it++ ) {
2694  DrawLabel( xpos, ypositions[it], taglabels[it], kBlack, 0.04 );
2695  }
2696  }
2697 
2698  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2699 
2700 
2701  if ( ( !nostats || !nomeans ) && !noplots ) {
2702  if ( dochi2 ) for ( unsigned j=0 ; j<Chi2.size() ; j++ ) DrawLabel( 0.75, 0.85-j*0.035, Chi2[j], colours[j%6] );
2703  if ( ( (contains(histo.name(),"_res") ||
2704  contains(histo.name(),"1d") ||
2705  histo.name()=="pT" ||
2706  contains(histo.name(),"residual_") ||
2707  contains(histo.name(),"vs_pt") ) && !contains(histo.name(),"sigma") ) || drawmeans ) {
2708 
2709  if ( contains(histo.name(),"_res") || contains(histo.name(),"residual_") || contains(histo.name(),"1d") || drawresiduals ){
2710  for ( unsigned j=0 ; j<chains.size() ; j++ ) {
2711  if ( !noreftmp ) {
2712  if ( j<MeanRef.size() ) {
2713  if ( !nomeans ) DrawLabel( xpos_original-0.02, (0.67-j*0.035), MeanRef[j], colours[j%6] );
2714  DrawLabel( xpos_original-0.01, (0.67-0.035*chains.size()-j*0.035)-0.01, RMSRef[j], colours[j%6] );
2715  }
2716  }
2717  if ( j<Mean.size() ) {
2718  if ( !nomeans ) DrawLabel( 0.62, (0.67-j*0.035), Mean[j], colours[j%6] );
2719  DrawLabel( 0.62, (0.67-0.035*chains.size()-j*0.035)-0.01, RMS[j], colours[j%6] );
2720  }
2721  }
2722  }
2723  }
2724 
2725  }
2726 
2727  if ( xinfo.log() ) gPad->SetLogx(true);
2728  else gPad->SetLogx(false);
2729 
2730  if ( yinfo.log() ) gPad->SetLogy(true);
2731  else gPad->SetLogy(false);
2732 
2733  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2734 
2735  if ( !noplots ) {
2736 
2737  if ( make_ref_efficiencies ) {
2738 
2739  plots_eff.SetXaxisTitle( plots.GetXaxisTitle() );
2740  plots_eff.SetYaxisTitle( plots.GetYaxisTitle() );
2741 
2742  plots_eff.Draw( legend_eff );
2743  }
2744 
2745  if ( !noreflabel.empty() ) DrawLabel(0.1, 0.06, noreflabel, kRed, 0.03 );
2746 
2747  } // no plots
2748 
2749  }
2750 
2751 
2757 
2758  if ( !noplots ) {
2759 
2760  if ( !quiet ) {
2761 
2762  tc->cd();
2763 
2764  std::string useplotname;
2765 
2766  if ( panel.size()>1 ) {
2767  useplotname = panel.name();
2768  replace( useplotname, '/', '_' );
2769  }
2770  else {
2771  useplotname = plotname;
2772  }
2773 
2774  useplotname.erase( std::remove( useplotname.begin(), useplotname.end(), '+' ), useplotname.end() );
2775 
2776  // std::string printbase = dir+"HLT_"+ppanelname+tag;
2777  std::string printbase = dir + useplotname + tag;
2778 
2779  tc->Update();
2780 
2781  if ( !nopdf ) print_pad( printbase+".pdf" );
2782  if ( !nopng ) print_pad( printbase+".png" );
2783  if ( Cfile ) print_pad( printbase+".C" );
2784 
2785  std::cout << std::endl;
2786  }
2787 
2788  }
2789 
2790  if ( tc ) delete tc;
2791 
2792  }
2793 
2794 
2795  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2796 
2798 
2799 
2801  bool files_duplicated = ( fref_==ftest_ );
2802 
2803  if ( deleteref && !files_duplicated ) {
2804 
2805  if ( fref_ ) {
2806 
2808 
2809  std::cout << "main() cleaning up reference file" << std::endl;
2810 
2811  TFile* newout = new TFile(".newout.root","recreate");
2812  newout->cd();
2813 
2815  copyReleaseInfo( fref, newout );
2816 
2817  TDirectory* base = gDirectory;
2818 
2819  for ( unsigned i=0 ; i<savedhistos.size() ; i++ ) {
2820 
2822  // std::cout << i << " " << savedhistos[i] << std::endl;
2823 
2824  std::vector<std::string> dirs = AxisInfo::split( savedhistos[i], "/" );
2825 
2826  for ( unsigned j=0 ; j<dirs.size()-1 ; j++ ) {
2827  std::cout << "\t" << dirs[j] << std::endl;
2828  TDirectory* renedir = gDirectory->GetDirectory( dirs[j].c_str() );
2829  if ( renedir==0 ) gDirectory->mkdir( dirs[j].c_str() );
2830  gDirectory->cd( dirs[j].c_str() );
2831  }
2832 
2833 
2834  TH1* href = (TH1*)fref->Get( savedhistos[i].c_str() );
2835  if ( !noreftmp && href ) {
2836  std::cout << i << " " << savedhistos[i] << " 0x" << href << std::endl;
2837  href->Write( dirs.back().c_str() );
2838  }
2839 
2840 
2841  base->cd();
2842  }
2843 
2844  newout->Close();
2845 
2846  }
2847  }
2848 
2849 
2850  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2851 
2853 
2854  if ( fref_ && !files_duplicated ) fref_->Close();
2855  if ( ftest_ ) ftest_->Close();
2856 
2858 
2859  if ( deleteref && !noref ) {
2860  std::cout << "ref " << frefname << "\ttest " << ftestname << std::endl;
2861  if ( frefname != ftestname && !files_duplicated ) {
2862  std::string cmd = std::string("mv ") + frefname + " " + frefname + ".bak";
2863  std::system( cmd.c_str() );
2864 
2865  cmd = std::string("mv .newout.root ") + std::string(frefname);
2866  std::system( cmd.c_str() );
2867  }
2868  else {
2869  std::cerr << "reference file and test file are the same - not replacing" << std::endl;
2870  }
2871  }
2872 
2873  // std::cout << "deleting " << __LINE__ << std::endl;
2874 
2875  if ( fref_ && !files_duplicated ) delete fref_;
2876  if ( ftest_ ) delete ftest_;
2877 
2878  return 0;
2879 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Rebin
TH1F * Rebin(TH1F *h, double f)
Definition: comparitor.cxx:85
bands::operator=
bands & operator=(const bands &b)=default
PlotCalibFromCool.il
il
Definition: PlotCalibFromCool.py:381
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
base
std::string base
Definition: hcg.cxx:78
normy
void normy(TH2 *h)
zero the contents of a 2d histogram
Definition: comparitor.cxx:450
WritePulseShapeToCool.yhi
yhi
Definition: WritePulseShapeToCool.py:153
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
AxisInfo::log
bool log() const
Definition: computils.h:246
fcontains
bool fcontains(const std::string &s, const std::string &p)
contains a string at the beginning of the string
Definition: computils.cxx:232
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
bands::m_labels
std::vector< std::string > m_labels
Definition: comparitor.cxx:267
TileDCSDataPlotter.h0
h0
Definition: TileDCSDataPlotter.py:873
Panel::ncols
int ncols() const
Definition: computils.h:1351
Plotter
tPlotter< TH1F > Plotter
Definition: computils.h:882
binwidth
void binwidth(TH1F *h)
Definition: comparitor.cxx:402
Panel::name
std::string name() const
Definition: computils.h:1340
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
SetAtlasStyle
void SetAtlasStyle()
Definition: InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/AtlasStyle.h:17
TH1F::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:326
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
max
#define max(a, b)
Definition: cfImp.cxx:41
findrun
std::string findrun(TFile *f)
Definition: computils.cxx:573
Entries
double Entries(TH1 *h)
Definition: computils.cxx:50
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
plot_material.mkdir
def mkdir(path, recursive=True)
Definition: plot_material.py:16
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SetZeros
void SetZeros(TH2D *h)
Definition: comparitor.cxx:67
usage
int usage(const std::string &name, int status, const std::string &err_msg="")
Definition: comparitor.cxx:332
egammaEnergyPositionAllSamples::e1
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
hist_file_dump.d
d
Definition: hist_file_dump.py:137
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
diff_panel
std::string diff_panel[10][6]
Definition: default_panels.h:118
rerun_display.cmd
string cmd
Definition: rerun_display.py:67
AxisInfo::offset
double offset() const
Definition: computils.h:261
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Plots::Draw
void Draw(Legend &leg, bool means=false)
Definition: computils.h:1151
AxisInfo::autoset
bool autoset() const
Definition: computils.h:248
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
dirname
std::string dirname(std::string name)
Definition: utils.cxx:200
TH1D
Definition: rootspy.cxx:342
Resplot::setoldrms95
static bool setoldrms95(bool b)
Definition: Resplot.h:555
Resplot.h
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
Resplot::finalised
bool finalised() const
Definition: Resplot.h:369
chop
std::string chop(std::string &s1, const std::string &s2)
Definition: hcg.cxx:158
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
AxisInfo::refnormset
bool refnormset() const
Definition: computils.h:252
AxisInfo::lo
double lo() const
Definition: computils.h:264
detail
Definition: extract_histogram_tag.cxx:14
d0rebin
TH1F * d0rebin(TH1F *h)
Definition: comparitor.cxx:272
Panel::size
size_t size() const
Definition: computils.h:1342
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
print_pad
void print_pad(const std::string &s)
Definition: comparitor.cxx:427
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
x
#define x
LINES
bool LINES
Definition: computils.cxx:39
markers
int markers[6]
Definition: computils.cxx:45
bands::range
void range(size_t i, TH1F *h)
Definition: comparitor.cxx:240
DrawLabel
int DrawLabel(float xstart, float ystart, string label)
Definition: GraphToolKit.h:13
python.App.legend
legend
Definition: App.py:62
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
bands::bands
bands(const std::vector< double > &limits, const std::vector< std::string > &labels)
Definition: comparitor.cxx:228
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
Plots::push_back
void push_back(const Plotter &val)
this is so that we can update the stats as we go along, but no updating isn't done at the moment
Definition: computils.h:1213
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
autox
void autox(TH2 *h)
get the auto x range of a 2d histogram
Definition: comparitor.cxx:462
bands::bands
bands()
Definition: comparitor.cxx:223
utils.h
beamspotnt.labels
list labels
Definition: bin/beamspotnt.py:1447
Efficiency1D
Definition: Efficiency1D.h:19
Get
T * Get(TFile &f, const std::string &n, const std::string &dir="", const chainmap_t *chainmap=0, std::vector< std::string > *saved=0)
get a histogram given a path, and an optional initial directory if histogram is not found,...
Definition: comparitor.cxx:178
Efficiency1D.h
fulldbg
bool fulldbg
Definition: comparitor.cxx:56
tPlotter::setplotref
static void setplotref(bool b)
Definition: computils.h:857
ascale
void ascale(TH1F *h, double s_)
Definition: comparitor.cxx:410
WritePulseShapeToCool.xhi
xhi
Definition: WritePulseShapeToCool.py:152
autoy
void autoy(TH2 *h)
get the auto y range of a 2d histogram
Definition: comparitor.cxx:492
ReadCards
Get tag-value pairs from a file.
Definition: ReadCards.h:50
ReadCards.h
HistDetails
details of the histogram axes etc
Definition: computils.h:1254
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
lumiFormat.i
int i
Definition: lumiFormat.py:92
Plots
set of generic plots
Definition: computils.h:913
beamspotman.n
n
Definition: beamspotman.py:731
Resplot::FitNull
static TF1 * FitNull(TH1D *s, double a=-999, double b=-999)
Definition: Resplot.cxx:1288
extractSporadic.h
list h
Definition: extractSporadic.py:97
Resplot::FitNull95
static TF1 * FitNull95(TH1D *s, double a=0, double b=0)
Definition: Resplot.cxx:1673
AxisInfo::trim
bool trim() const
Definition: computils.h:258
bands::m_limits
std::vector< double > m_limits
Definition: comparitor.cxx:266
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
Panel
Definition: computils.h:1317
AxisInfo::rangeset
bool rangeset() const
Definition: computils.h:256
calibdata.exception
exception
Definition: calibdata.py:496
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
JetVoronoiDiagramHelpers::Norm
Point Norm(const Point &a)
Definition: JetVoronoiDiagramHelpers.cxx:79
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
file
TFile * file
Definition: tile_monitor.h:29
main
int main(int argc, char **argv)
Definition: comparitor.cxx:543
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
AxisInfo::binwidth
double binwidth() const
Definition: computils.h:267
python.handimod.Green
int Green
Definition: handimod.py:524
bands::range
void range(const std::string &chain, TH1F *h)
Definition: comparitor.cxx:232
python.ExampleMonitorAlgorithm.nightly
string nightly
Definition: ExampleMonitorAlgorithm.py:173
Resplot
Definition: Resplot.h:50
Resplot::setscalerms95
static bool setscalerms95(bool b)
Definition: Resplot.h:556
TH1F::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:327
TH2D
Definition: rootspy.cxx:430
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
WritePulseShapeToCool.xlo
xlo
Definition: WritePulseShapeToCool.py:133
Scale
void Scale(TH1 *h, double d=1)
Definition: comparitor.cxx:76
Panel::nrows
int nrows() const
Definition: computils.h:1350
contents
void contents(std::vector< std::string > &keys, TDirectory *td, const std::string &directory, const std::string &pattern, const std::string &path)
Definition: computils.cxx:319
TH2
Definition: rootspy.cxx:373
WritePulseShapeToCool.ylo
ylo
Definition: WritePulseShapeToCool.py:134
Plots::SetXaxisTitle
void SetXaxisTitle(const std::string &s)
Definition: computils.h:1202
beamspotman.dir
string dir
Definition: beamspotman.py:623
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
min
#define min(a, b)
Definition: cfImp.cxx:40
grepfile.ic
int ic
Definition: grepfile.py:33
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
bands
Definition: comparitor.cxx:219
python.handimod.Red
Red
Definition: handimod.py:551
Resplot::Refit
int Refit(TF1 *(*func)(TH1D *s, double a, double b))
Definition: Resplot.h:442
Plots::setwatermark
static void setwatermark(bool b)
Definition: computils.h:1219
ReadCellNoiseFromCoolCompare.s3
s3
Definition: ReadCellNoiseFromCoolCompare.py:380
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
res_panel
std::string res_panel[4][6]
Definition: default_panels.h:108
makeegammaturnon.rebin
def rebin(binning, data)
Definition: makeegammaturnon.py:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
label.h
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
compileRPVLLRates.c2
c2
Definition: compileRPVLLRates.py:361
LArSamples::AtlasStyle
@ AtlasStyle
Definition: ShapeDrawer.h:22
fullreplace
std::string fullreplace(std::string s, const std::string &s2, const std::string &s3)
Definition: comparitor.cxx:420
Resplot::Mean
TH1D * Mean()
Definition: Resplot.h:347
LINEF
bool LINEF
Definition: computils.cxx:38
dirs
std::map< std::string, int > dirs
list of directories to be explicitly included, together with corresponding depths of subdirectories
Definition: hcg.cxx:99
Resplot::Finalise
int Finalise(double a=-999, double b=-999, TF1 *(*func)(TH1D *s, double a, double b)=Resplot::FitGaussian)
Definition: Resplot.cxx:388
copyReleaseInfo
void copyReleaseInfo(TFile *finput, TFile *foutdir)
copy the release info TTree
Definition: computils.cxx:618
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
AtlasStyle.h
ATLAS Style, based on a style file from BaBar.
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:81
AxisInfo::split
static std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition: computils.h:274
AxisInfo::hi
double hi() const
Definition: computils.h:265
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
rebin_log
TH1F * rebin_log(TH1F *h, bool low=false)
Definition: comparitor.cxx:124
y
#define y
h
TH1F
Definition: rootspy.cxx:320
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
DeMoStatus.ATLASLabel
def ATLASLabel(x, y, text="")
ATLASLabel copied from atlastyle package, as import does not work for unknown reasons.
Definition: DeMoStatus.py:51
TH1
Definition: rootspy.cxx:268
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
DiTauMassTools::HistInfoV2::RMS
@ RMS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:31
savedhistos
std::vector< std::string > savedhistos
Definition: hcg.cxx:50
Efficiency2D.h
covarianceTool.plots
plots
Definition: covarianceTool.py:698
checkFileSG.fi
fi
Definition: checkFileSG.py:65
default_panels.h
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
merge.status
status
Definition: merge.py:17
DrawLabel.h
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
Resplot::Sigma
TH1D * Sigma()
Definition: Resplot.h:351
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
python.dummyaccess.exists
def exists(filename)
Definition: dummyaccess.py:9
egammaEnergyPositionAllSamples::e0
double e0(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in pre-sampler
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
AtlasLabels.h
colours
int colours[6]
Definition: computils.cxx:44
Plots::SetYaxisTitle
void SetYaxisTitle(const std::string &s)
Definition: computils.h:1206
hotSpotInTAG.nb
nb
Definition: hotSpotInTAG.py:164
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
eff_panel
std::string eff_panel[4][6]
Definition: default_panels.h:98
computils.h
python.compressB64.c
def c
Definition: compressB64.py:93
AxisInfo
class to store information about axes, limits, whether it is log or linear scale etc
Definition: computils.h:147
zero
void zero(TH2 *h)
zero the contents of a 2d histogram
Definition: comparitor.cxx:435
bands::bands
bands(const bands &b)=default
LArMonTransforms.Mean
def Mean(inputs)
Definition: LArMonTransforms.py:438
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
HLTNavDetails::rx1
const boost::regex rx1("_v[0-9]+$")
AxisInfo::normset
bool normset() const
Definition: computils.h:250
Legend
slightly more convenient legend class
Definition: computils.h:333
chainmap_t
std::map< std::string, std::string > chainmap_t
global typedef here is ok, since this is a standalone executable, including a main().
Definition: comparitor.cxx:170
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
beamspotman.basename
basename
Definition: beamspotman.py:640