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