ATLAS Offline Software
Classes | Typedefs | Functions | Variables
comparitor.cxx File Reference
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <regex>
#include "TrigInDetAnalysis/Efficiency1D.h"
#include "TrigInDetAnalysis/Efficiency2D.h"
#include "ReadCards.h"
#include "Resplot.h"
#include "utils.h"
#include "label.h"
#include "DrawLabel.h"
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TH2F.h"
#include "TH1D.h"
#include "TPad.h"
#include "TCanvas.h"
#include "TLegend.h"
#include "TStyle.h"
#include "TF1.h"
#include "TPave.h"
#include "TPaveStats.h"
#include "TColor.h"
#include "computils.h"
#include "AtlasStyle.h"
#include "AtlasLabels.h"
#include "default_panels.h"

Go to the source code of this file.

Classes

class  bands
 

Typedefs

typedef std::map< std::string, std::string > chainmap_t
 global typedef here is ok, since this is a standalone executable, including a main(). More...
 

Functions

void SetZeros (TH2D *h)
 
void Scale (TH1 *h, double d=1)
 
TH1F * Rebin (TH1F *h, double f)
 
TH1F * rebin_log (TH1F *h, bool low=false)
 
template<typename T = TH1F>
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, then check for dir/name, allows optional remapping of the reference chain information More...
 
TH1F * d0rebin (TH1F *h)
 
int usage (const std::string &name, int status, const std::string &err_msg="")
 
void binwidth (TH1F *h)
 
void ascale (TH1F *h, double s_)
 
std::string fullreplace (std::string s, const std::string &s2, const std::string &s3)
 
void print_pad (const std::string &s)
 
void zero (TH2 *h)
 zero the contents of a 2d histogram More...
 
void normy (TH2 *h)
 zero the contents of a 2d histogram More...
 
void autox (TH2 *h)
 get the auto x range of a 2d histogram More...
 
void autoy (TH2 *h)
 get the auto y range of a 2d histogram More...
 
double chi2 (TH1 *h0, TH1 *h1)
 
int main (int argc, char **argv)
 

Variables

bool fulldbg = false
 
bool LINEF
 
bool LINES
 
int colours [6]
 
int markers [6]
 

Detailed Description

Author
mark sutton
Date
Fri 12 Oct 2012 13:39:05 BST

Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration

Definition in file comparitor.cxx.

Typedef Documentation

◆ chainmap_t

typedef std::map<std::string,std::string> chainmap_t

global typedef here is ok, since this is a standalone executable, including a main().

As such it does not need to be in a namespace at this point as it won't in any case be visible outside this translation unit

Definition at line 171 of file comparitor.cxx.

Function Documentation

◆ ascale()

void ascale ( TH1F *  h,
double  s_ 
)

Definition at line 411 of file comparitor.cxx.

411  {
412  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
413  h->SetBinContent( i, h->GetBinContent(i)*s_ );
414  h->SetBinError( i, h->GetBinError(i)*s_ );
415  }
416 }

◆ autox()

void autox ( TH2 *  h)

get the auto x range of a 2d histogram

Definition at line 463 of file comparitor.cxx.

463  {
464 
465  int Nx = h->GetNbinsX();
466  int Ny = h->GetNbinsY();
467 
468  double xhi = h->GetXaxis()->GetBinLowEdge(1);
469  double xlo = h->GetXaxis()->GetBinLowEdge( h->GetXaxis()->GetNbins() );
470 
471  for ( int i=1 ; i<=Nx ; i++ ) {
472  double x = h->GetXaxis()->GetBinLowEdge(i);
473  for ( int j=1 ; j<=Ny ; j++ ) {
474  double n = h->GetBinContent(i,j);
475  if ( n!=0 ) {
476  if ( x<xlo ) {
477  if ( i>1 ) xlo = h->GetXaxis()->GetBinLowEdge(i-1);
478  else xlo = x;
479  }
480  if ( x>xhi ) {
481  if ( i<h->GetXaxis()->GetNbins() ) xhi = h->GetXaxis()->GetBinLowEdge(i+1);
482  else xhi = x;
483  }
484  }
485  }
486  }
487 
488  h->GetXaxis()->SetRangeUser( xlo, xhi );
489 }

◆ autoy()

void autoy ( TH2 *  h)

get the auto y range of a 2d histogram

Definition at line 493 of file comparitor.cxx.

493  {
494 
495  int Nx = h->GetNbinsX();
496  int Ny = h->GetNbinsY();
497 
498  double yhi = h->GetYaxis()->GetBinLowEdge(1);
499  double ylo = h->GetYaxis()->GetBinLowEdge( h->GetYaxis()->GetNbins() );
500 
501  for ( int i=1 ; i<=Ny ; i++ ) {
502  double y = h->GetYaxis()->GetBinLowEdge(i);
503  for ( int j=1 ; j<=Nx ; j++ ) {
504  double n = h->GetBinContent(j,i);
505  if ( n!=0 ) {
506  if ( y<ylo ) {
507  if ( i>1 ) ylo = h->GetYaxis()->GetBinLowEdge(i-1);
508  else ylo = y;
509  }
510  if ( y>yhi ) {
511  if ( i<h->GetYaxis()->GetNbins() ) yhi = h->GetYaxis()->GetBinLowEdge(i+1);
512  else yhi = y;
513  }
514  }
515  }
516  }
517 
518  h->GetYaxis()->SetRangeUser( ylo, yhi );
519 }

◆ binwidth()

void binwidth ( TH1F *  h)

Definition at line 403 of file comparitor.cxx.

403  {
404  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
405  double w = h->GetBinLowEdge(i+1) - h->GetBinLowEdge(i);
406  h->SetBinContent( i, h->GetBinContent(i)/w );
407  h->SetBinError( i, h->GetBinError(i)/w );
408  }
409 }

◆ chi2()

double chi2 ( TH1 *  h0,
TH1 *  h1 
)

Definition at line 523 of file comparitor.cxx.

523  {
524  double c2 = 0;
525 
526  for ( int i=0 ; i<h0->GetNbinsX() ; i++ ) {
527 
528  double d0 = h0->GetBinContent(i+1);
529  double d1 = h1->GetBinContent(i+1);
530 
531  double e0 = h0->GetBinError(i+1);
532  double e1 = h1->GetBinError(i+1);
533 
534  double e2 = e0*e0+e1*e1;
535 
536  if ( e2>0 ) c2 += (d0-d1)*(d0-d1)/e2;
537 
538  }
539 
540  return c2;
541 }

◆ d0rebin()

TH1F* d0rebin ( TH1F *  h)

Definition at line 273 of file comparitor.cxx.

273  {
274 
275  std::vector<double> limits;
276 
277  for ( int i=1 ; i<h->GetNbinsX() ; i++ ) {
278  limits.push_back( h->GetBinLowEdge(i) );
279  }
280 
281  std::vector<double> alimits;
282  std::vector<double> nlimits;
283 
284  double x = 0;
285 
286  for ( [[maybe_unused]] int i=0 ; x<20 ; i++ ) {
287 
288  alimits.push_back(x);
289 
290 #if 0
291  if ( x<0.5 ) x+=0.2;
292  else if ( x<1.0 ) x+=0.2;
293  else if ( x<1.5 ) x+=0.3;
294  else if ( x<2.0 ) x+=0.4;
295  else if ( x<2.5 ) x+=0.5;
296  else x+=0.6;
297 #else
298  if ( x<0.5 ) x+=0.1;
299  else if ( x<1.0 ) x+=0.2;
300  else if ( x<1.5 ) x+=0.2;
301  else if ( x<2.0 ) x+=0.2;
302  else if ( x<2.5 ) x+=0.2;
303  else if ( x<3.0 ) x+=0.3;
304  else x+=0.3;
305 #endif
306 
307  }
308 
309  for ( size_t i=alimits.size() ; i-- ; ) {
310  if ( alimits[i]<=15 ) nlimits.push_back( -alimits[i] );
311  }
312 
313  for ( size_t i=1 ; i<alimits.size() ; i++ ) {
314  if ( alimits[i]<=15 ) nlimits.push_back( alimits[i] );
315  }
316 
317  std::cout << "limits: " << limits.size() << " " << nlimits.size() << std::endl;
318 
319  TH1F* hnew = new TH1F( "h", h->GetTitle(), nlimits.size()-1, &nlimits[0] );
320 
321  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
322  double d = h->GetBinCenter(i);
323  int j = hnew->FindBin( d );
324  hnew->SetBinContent( j, hnew->GetBinContent(j)+h->GetBinContent(i) );
325  }
326 
327  return hnew;
328 }

◆ fullreplace()

std::string fullreplace ( std::string  s,
const std::string &  s2,
const std::string &  s3 
)

cowardly, don't replace string by itself

Definition at line 421 of file comparitor.cxx.

421  {
422  if ( s2=="" || s2==s3 ) return s;
423  std::string::size_type pos;
424  while ( (pos=s.find(s2)) != std::string::npos ) s.replace(pos, s2.size(), s3);
425  return s;
426 }

◆ Get()

template<typename T = TH1F>
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, then check for dir/name, allows optional remapping of the reference chain information

Definition at line 179 of file comparitor.cxx.

180  {
181 
182  std::string name;
183 
184  size_t pos = n.find('+');
185  if ( pos!=std::string::npos ) name = n.substr( 0, pos );
186  else name = n;
187 
188  T* h = (T*)f.Get( name.c_str() );
189  if ( h || dir.empty() || name.find(dir)!=std::string::npos ) {
190  std::cout << "Get() name 0 " << name << " :: " << h << std::endl;
191  }
192  else {
193  name = dir+'/'+name;
194  h = (T*)f.Get( name.c_str() );
195  std::cout << "Get() name 1 " << name << " :: " << h << std::endl;
196  }
197 
198  if ( h == 0 ) {
199  if ( chainmap && chainmap->size()!=0 ) {
200  for ( chainmap_t::const_iterator itr=chainmap->begin() ; itr!=chainmap->end() ; ++itr ) {
201  if ( contains( name, itr->first ) ) {
202  std::cout << "\tmatch: " << itr->first << " -> " << itr->second << std::endl;
203  name.replace( name.find(itr->first), itr->first.size(), itr->second );
204  h = (T*)f.Get( name.c_str() );
205  break;
206  }
207  }
208  }
209  }
210 
211  if ( saved ) saved->push_back( name );
212 
213  if ( h ) h->SetDirectory(0);
214 
215  return h;
216 }

◆ main()

int main ( int  argc,
char **  argv 
)

control stuff

control flags and labels

leave this commented here - now instead of bombing out if we don't specify the reference file, just carry on as if it was not specified at all, so as this changes the external behaviour of the code we want this retained

don't fail anymore if can't open the reference file, now continue without plotting the refereces, instead printing a warning on the plots

get release data

we divide the resolutions by these values if we have an "entries" histogram to tell us how many events there are overall

get from Chains?

set up the correct reference chain names ...

get the actual chain name and track collection from

the Chain histogram if present

reference chains

set up the plot panels

read config in from a file if requested ...

read the histos - 1 panel per histo

read in the panel descriptions

use the default values as single histogram panels

use the default panels

a better colour palette than the egregious root default

Fixme: add the 2D histogram processing here ??

words can not express the sheer unpleasantness in trying to do anything serious with subpanels

  • if any margins between pads are set to 0, root messes up the pad margins so they are 0 with seemingly no way to prevent it - have to use a very small (but non 0) value, but then the margins don't size properly.
  • Once you cd() to one of the child pads, if you ask for the child GetWh() or GetWw() you don't get the parameters of the child pad, but the main pad etc

How are you supposed to get the paremeters of the actual pad ? It is insane.

histos within the panel

leave this code commented here for the time being ... if ( histo.name()=="pT" || histo.name()=="pT_rec" ) ypos = 0.19;

calculate all the postions for the items in the legend

legends ....

leave these comments here for testing ...

get the actual chain name and track collection from the Chain histogram if present

refit the resplots - get the 2d histogram and refit

get the test histogram

Actually DO refit the references - if we are adding together many resplots, then the means etc may not even have been calculated

leave this code commented here since we want to know where to change this in the future it was added for a reason, so is useful to keep for now

useful test for debugging ...

everything else

leave this code commented here since we want to know where to change this in the future it was added for a reason, so useful to keep for now

debugging ...

rebin if requested ...

now recalculate reference

leave for documentation purposes ...

again, this changes the external behaviour so we want to leave this "continue" in place, but commented

only set the plot name once )

replace the "/" in the filename so we don't try to make plots in subdirectories by accident

calculate and set axis limits

resolutions

calculate power

try to localise all axis range setting, log, lin scales etc to this one place

sort out the range settings for the xaxis ...

calculate the log range

keep the original equation by way of documentation ...

leave this code commented here since we want to know where to change this in the future it was added for a reason, so it is useful to keep for now
std::exit(-1);

calculate the required range such that the histogram labels won't crowd the points

actually draw the plot here ...

loop over histograms in panel

NB: now, we no longer print the individual plots - only the "panels" individual plots can still be printed by creating a "panel" which contains only that plots - in fast the "histos" item that before provided details of the separate plots is now interpreted as a list of single plot panels so this is done for you

loop over panels

if deleting all non-used reference histograms

make sure we are not using the same reference as test file

clean up reference file

copy the release tree

debugging ...

close files

now actually overwrite the old reference file

Definition at line 544 of file comparitor.cxx.

544  {
545 
546  std::cout << "\n---------------------------------\n";
547  std::cout << "\n comparitor is off ...\n";
548 
549  if ( argc<4 ) return usage(argv[0], -1, "too few arguments");
550 
552 
553  std::string tag = "";
554  std::string key = "";
555 
556  std::string dir = "";
557 
558  std::string ftestname = "";
559  std::string frefname = "";
560 
561  TFile* ftest_ = 0;
562  TFile* fref_ = 0;
563 
564  bool effset = false;
565  double effmin = 90;
566  double effmax = 102;
567 
568  std::string defreflabel = "";
569 
571 
572  std::vector<std::string> usrlabels;
573  bool uselabels = false;
574  bool addinglabels = false;
575 
576  std::vector<std::string> taglabels;
577  bool addingtags = false;
578 
579  bool make_ref_efficiencies = false;
580  bool refit_resplots = false;
581  bool refitref_resplots = false;
582  bool bayes = true;
583  bool nostats = false;
584  bool nomeans = false;
585  bool noref = false;
586  bool atlasstyle = false;
587  bool deleteref = false;
588  bool nowatermark = false;
589  bool noplots = false;
590  bool nopng = false;
591  bool nopdf = false;
592  bool Cfile = false;
593  bool notitle = true;
594  bool dochi2 = false;
595  bool normref = false;
596  bool scalepix = false;
597  bool oldrms = false;
598  bool addchains = false;
599  bool usechainref = false;
600  bool quiet = false;
601 
602  bool RANGEMAP = false;
603  bool ALLRANGEMAP = false;
604 
605  double xerror = 0;
606 
607  std::string atlaslabel_tmp = "Internal";
608 
609 
610  double scale_eff = -1;
611  double scale_eff_ref = -1;
612 
613  std::string configfile = "";
614 
615  double xoffset = 0;
616 
617 
618  double ypos_arg = 0;
619 
620  std::string pattern = "";
621  std::string regex = "";
622 
623  std::string patternr = "";
624  std::string regexr = "";
625 
626  std::string patternt = "";
627  std::string regext = "";
628 
629  std::string basedir = "";
630 
631  std::string xpattern = "";
632  std::string xregex = "";
633 
634  std::vector<std::string> chains;
635  std::vector<std::string> refchains;
636 
637  bool addingrefchains = false;
638 
639  std::string mapfile = "";
640 
641  std::vector<std::string> chainfiles;
642 
643  int ncols = 2;
644 
645  for(int i=1; i<argc; i++){
646  std::string arg = argv[i];
647 
648 
649  if ( arg.find('-')!=0 && addinglabels ) {
650  std::string label = arg;
651  fullreplace( label, "__", " " );
652  replace( label, '#', ' ' );
653  usrlabels.push_back( label );
654  continue;
655  }
656  else addinglabels = false;
657 
658  if ( arg.find('-')!=0 && addingrefchains ) {
659  refchains.push_back( arg );
660  continue;
661  }
662  else addingrefchains = false;
663 
664  if ( arg.find('-')!=0 && addingtags ) {
665  taglabels.push_back( fullreplace( arg, "__", " " ) );
666  std::cout << "\tadding tag label: " << taglabels.back() << std::endl;
667  continue;
668  }
669  else addingtags = false;
670 
671  if ( arg=="-h" || arg=="--help" ) {
672  return usage(argv[0], 0);
673  }
674  else if ( arg=="-c" || arg=="--config" ) {
675  if ( ++i<argc ) configfile=argv[i];
676  else return usage(argv[0], -1, "no config file provided");
677  }
678  else if ( arg=="-t" || arg=="--tag" ) {
679  if ( ++i<argc ) tag=std::string("-")+argv[i];
680  else return usage(argv[0], -1, "no tag provided");
681  }
682  else if ( arg=="-l" || arg=="--labels" ) {
683  addinglabels = true;
684  }
685  else if ( arg=="-el" ) {
686  LINES = true;
687  }
688  else if ( arg=="-k" || arg=="--key" ) {
689  if ( ++i<argc ) key=argv[i];
690  else return usage(argv[0], -1, "no key provided");
691  }
692  else if ( arg=="-m" || arg=="--mapfile" ) {
693  if ( ++i<argc ) mapfile=argv[i];
694  else return usage(argv[0], -1, "no mapfile provided");
695  }
696  else if ( arg=="-d" || arg=="--dir" ) {
697  if ( ++i<argc ) dir=argv[i];
698  else return usage(argv[0], -1, "no directory provided");
699  }
700  else if ( arg=="-b" || arg=="--bdir" ) {
701  if ( ++i<argc ) basedir=argv[i];
702  else return usage(argv[0], -1, "no directory provided");
703  }
704  else if ( arg=="--taglabels" ) {
705  addingtags = true;
706  }
707  else if ( arg=="--unscalepix" ) {
708  scalepix = false;
709  }
710  else if ( arg=="--scalepix" ) {
711  scalepix = true;
712  }
713  else if ( arg=="-ac" || arg=="--addchains" ) {
714  addchains = true;
715  }
716  else if ( arg=="-yrange" ) {
717  effset = true;
718  if ( ++i<argc ) effmin=std::atof(argv[i]);
719  else return usage(argv[0], -1, "no range specified");
720  if ( ++i<argc ) effmax=std::atof(argv[i]);
721  else return usage(argv[0], -1, "no upper y limit specified");
722  }
723  else if ( arg=="-e" || arg=="--efficiencies" ) {
724  make_ref_efficiencies = true;
725  }
726  else if ( arg=="-r" || arg=="--refit" ) {
727  refit_resplots = true;
728  }
729  else if ( arg=="-rr" || arg=="--refitref" ) {
730  refitref_resplots = true;
731  }
732  else if ( arg=="--oldrms" ) {
733  oldrms = true;
734  }
735  else if ( arg=="-nw" || arg=="--nowatermark" ) {
736  nowatermark = true;
737  Plots::setwatermark(!nowatermark);
738  }
739  else if ( arg=="--chi2" ) {
740  dochi2 = true;
741  }
742  else if ( arg=="-ns" || arg=="--nostats" ) {
743  nostats = true;
744  }
745  else if ( arg=="-nm" || arg=="--nomeans" ) {
746  nomeans = true;
747  }
748  else if ( arg=="-nt" || arg=="--notitle" ) {
749  notitle = true;
750  }
751  else if ( arg=="-nr" || arg=="--noref" ) {
752  Plotter::setplotref(false);
753  noref = true;
754  }
755  else if ( arg=="--normref" ) {
756  normref = true;
757  }
758  else if ( arg=="-rc" || arg=="--refchains" ) {
759  addingrefchains = true;
760  }
761  else if ( arg=="-uc" || arg=="--usechainref" ) {
762  usechainref = true;
763  }
764  else if ( arg=="-nb" || arg=="--nobayes" ) {
765  bayes = false;
766  }
767  else if ( arg=="-es" || arg=="--effscale" ) {
768  if ( ++i<argc ) scale_eff=std::atof(argv[i]);
769  else return usage(argv[0], -1, "no efficiency scale provided");
770  }
771  else if ( arg=="-er" || arg=="--effscaleref" ) {
772  if ( ++i<argc ) scale_eff_ref=std::atof(argv[i]);
773  else return usage(argv[0], -1, "no efficiency scale for the reference histograms provided");
774  }
775  else if ( arg=="--ncols" ) {
776  if ( ++i<argc ) ncols=std::atoi(argv[i]);
777  else return usage(argv[0], -1, "no number of columns provided");
778  }
779  else if ( arg=="-np" || arg=="--noplots" ) {
780  noplots = true;
781  }
782  else if ( arg=="-C" || arg=="--Cfiles" ) {
783  Cfile = true;
784  }
785  else if ( arg=="--deleteref" ) {
786  deleteref = true;
787  }
788  else if ( arg=="--nopng" ) {
789  nopng = true;
790  }
791  else if ( arg=="--nopdf" ) {
792  nopdf = true;
793  }
794  else if ( arg=="-as" || arg=="--atlasstyle" ) {
795  atlasstyle = true;
796  }
797  else if ( arg=="-q" || arg=="--quiet" ) {
798  quiet = true;
799  }
800  else if ( arg=="-al" || arg=="--atlaslabel" ) {
801  if ( ++i<argc ) atlaslabel_tmp=argv[i];
802  else return usage(argv[0], -1, "no label provided");
803  }
804  else if ( arg=="-xo" || arg=="--xoffset" ) {
805  if ( ++i<argc ) xoffset=std::atof(argv[i]);
806  else return usage(argv[0], -1, "no xoffset provided");
807  }
808  else if ( arg=="-yp" || arg=="--ypos" ) {
809  if ( ++i<argc ) ypos_arg=std::atof(argv[i]);
810  else return usage(argv[0], -1, "no y position provided");
811  }
812  else if ( arg=="-xe" || arg=="--xerror" ) {
813  if ( ++i<argc ) xerror=std::atof(argv[i]);
814  else return usage(argv[0], -1, "no x error provided");
815  }
816  else if ( arg=="-s" || arg=="--swap" ) {
817  if ( ++i<argc ) pattern=argv[i];
818  else return usage(argv[0], -1, "no patterns provided");
819  if ( ++i<argc ) regex=argv[i];
820  else return usage(argv[0], -1, "no target pattern provided");
821  }
822  else if ( arg=="--swapt" ) {
823  if ( ++i<argc ) patternt=argv[i];
824  else return usage(argv[0], -1, "no patterns provided");
825  if ( ++i<argc ) regext=argv[i];
826  else return usage(argv[0], -1, "no target pattern provided");
827  }
828  else if ( arg=="--swapr" ) {
829  if ( ++i<argc ) patternr=argv[i];
830  else return usage(argv[0], -1, "no patterns provided");
831  if ( ++i<argc ) regexr=argv[i];
832  else return usage(argv[0], -1, "no target pattern provided");
833  }
834  else if ( arg=="-sx" || arg=="--swapaxtitles" ) {
835  if ( ++i<argc ) xregex=argv[i];
836  else return usage(argv[0], -1, "no target pattern provided");
837  if ( ++i<argc ) xpattern=argv[i];
838  else return usage(argv[0], -1, "no patterns provided");
839  }
840  else if ( arg.find('-')==0 ) {
841  std::cerr << "unknown option: " << arg << "\n" << std::endl;
842  return usage(argv[0], -4);
843  }
844  else {
845  if ( ftestname=="" ) ftestname = arg;
846  else if ( frefname=="" ) frefname = arg;
847  else {
848  std::string file = "";
849 
850  if ( arg.find(":file:")!=std::string::npos ) {
851  file = arg.substr( 0, arg.find(":file:") );
852  chainfiles.push_back( file );
853  arg = arg.substr(arg.find(":file:")+6,arg.size());
854  }
855 
856  std::string chain = arg;
857 
858  replace ( chain, ':', '_' );
859  replace ( chain, ';', '_' );
860  chains.push_back(chain);
861 
862  std::cout << "file: " << file << "\tchain: " << chain << std::endl;
863 
864  }
865  }
866  }
867 
868  if ( ftestname.empty() ) {
869  std::cerr << "main(): test file not specified " << std::endl;
870  return -1;
871  }
872 
873  if ( !exists(ftestname) ) {
874  std::cerr << "main(): test file " << ftestname << " does not exist" << std::endl;
875  return -1;
876  }
877 
878  std::vector<TFile*> chainTFiles;
879 
880 
881 
882  if ( chainfiles.size()==0 ) ftest_ = TFile::Open( ftestname.c_str() );
883  else {
884  noref=true;
885  chainTFiles.resize(chainfiles.size());
886  for ( size_t i=0 ; i<chainfiles.size() ; i++ ) {
887  chainTFiles[i] = TFile::Open( chainfiles[i].c_str() );
888  if ( chainTFiles[i] == 0 ) {
889  std::cerr << "\tfile: " << chainfiles[i] << " could not be opened" << std::endl;
890  return -1;
891  }
892  else std::cout << "\tchainfiles: " << chainfiles[i] << " " << chainTFiles[i] << std::endl;
893  }
894  }
895 
896 
897  if ( noref==false ) {
898  if ( frefname.empty() ) {
899  std::cerr << "main(): ref file not specified " << std::endl;
900  Plotter::setplotref(false);
901  noref = true;
906  // return -1;
907  }
908 
909  if ( frefname==ftestname ) fref_ = ftest_;
910  else if ( exists(frefname) ) fref_ = TFile::Open( frefname.c_str() );
911  else {
912  std::cerr << "main(): ref file " << frefname << " does not exist" << std::endl;
913  // return -1;
914  Plotter::setplotref(false);
915  noref=true;
916  }
917  }
918  else fref_ = ftest_;
919 
920  if ( chainfiles.size()==0 ) {
921  if ( ftest_==0 ) {
922  std::cerr << "could not open test file " << ftestname << std::endl;
923  return -1;
924  }
925 
926  if ( noref==false && fref_==0 ) {
927  std::cerr << "could not open files " << std::endl;
931  noref=true;
932  fref_=ftest_;
933  defreflabel = "failed to open reference file";
934  }
935 
936  }
937 
938  if ( scale_eff == -1 ) scale_eff = 100;
939  if ( scale_eff_ref == -1 ) scale_eff_ref = scale_eff;
940 
941 
942  bool noreftmp = noref;
943 
944  if ( chains.size()==0 ) return usage(argv[0], -1, "no chains specified");
945 
946 
947  if ( basedir.size()>0 ) {
948  if ( basedir[basedir.size()-1]!='/' ) basedir += "/";
949  for ( size_t ic=chains.size() ; ic-- ; ) chains[ic] = basedir+chains[ic];
950  }
951 
952  if ( refchains.size()>0 && refchains.size()!=chains.size() ) return usage(argv[0], -1, "not enough chains specified");
953 
954  if ( refchains.size()==0 ) refchains = chains;
955 
956  std::vector<std::string> chainref(chains.size(),"");
957  std::vector<std::string> chain_name(chains.size(),"");
958 
959  std::vector<std::string> refchain(chainref.size(),"");
960 
961 
962 
963  std::cout << argv[0] << " options:" << std::endl;
964  std::cout << "\tATLAS style: " << ( atlasstyle ? "true" : "false" ) << std::endl;
965  std::cout << "\tBayesian uncertainties: " << ( bayes ? "true" : "false" ) << std::endl;
966  std::cout << "\trefit resplot uncertainties: " << ( refit_resplots ? "true" : "false" ) << std::endl;
967  std::cout << "\tsuppress mean and rms stats: " << ( nostats ? "true" : "false" ) << std::endl;
968  if ( !nostats ) std::cout << "\tsuppress meanstats: " << ( nomeans ? "true" : "false" ) << std::endl;
969  std::cout << "\tsuppress png output: " << ( nopng ? "true" : "false" ) << std::endl;
970  std::cout << "\tsuppress pdf output: " << ( nopdf ? "true" : "false" ) << std::endl;
971  std::cout << "\tsuppress reference output: " << ( noref ? "true" : "false" ) << std::endl;
972  std::cout << "\tuse chain references: " << ( usechainref ? "true" : "false" ) << std::endl;
973  std::cout << "\tpanel ncols: " << ncols << std::endl;
974 
975  if ( usrlabels.size()>0 ) std::cout << "\tlabels: " << usrlabels.size() << std::endl;
976  if ( taglabels.size()>0 ) std::cout << "\textra text: " << taglabels << std::endl;
977 
978 
979  for ( size_t il=0 ; il<usrlabels.size() ; il++ ) {
980  std::cout << "usr label[" << il << "] : " << usrlabels[il] << std::endl;
981  }
982 
983  std::cout << "atlas style : " << atlasstyle << std::endl;
984 
985  if ( atlasstyle ) {
986  SetAtlasStyle();
987  gStyle = AtlasStyle();
988  gStyle->cd();
989  }
990  else {
991  gROOT->SetStyle("Plain");
992  gStyle->cd();
993  gStyle->SetLineScalePS(1);
994  xoffset += 0.02;
995  }
996 
997  gStyle->SetErrorX(xerror);
998 
999  gStyle->SetPadLeftMargin(0.15);
1000  gStyle->SetPadBottomMargin(0.15);
1001 
1002  gStyle->SetPadRightMargin(0.02);
1003  gStyle->SetPadTopMargin(0.05);
1004 
1005  std::cout << "Chains: " << std::endl;
1006  for ( unsigned ic=0 ; ic<chains.size() ; ic++ ) std::cout << "\t" << chains[ic] << std::endl;
1007 
1008  if ( usrlabels.size()>0 ) std::cout << "labels: " << usrlabels << std::endl;
1009 
1010  if ( usrlabels.size()>0 && usrlabels.size()==chains.size() ) uselabels = true;
1011 
1013 
1014  TTree* dataTree = 0;
1015  TString* releaseData = new TString("");
1016  std::vector<std::string> release_data;
1017 
1018  if ( !nowatermark && ftest_ ) {
1019 
1020  dataTree = (TTree*)ftest_->Get("dataTree");
1021 
1022  if ( dataTree ) {
1023  dataTree->SetBranchAddress( "ReleaseMetaData", &releaseData);
1024 
1025  for (unsigned int i=0; i<dataTree->GetEntries() ; i++ ) {
1026  dataTree->GetEntry(i);
1027  release_data.push_back( releaseData->Data() );
1028  std::cout << "main() release data: " << release_data.back() << " : " << *releaseData << std::endl;
1029  }
1030  }
1031 
1032 
1033  if ( release_data.size()>0 ) {
1034  if ( release_data.size()>1 ) std::cerr << "main() more than one release - using only the first" << std::endl;
1035 
1036  // std::cout << "release: " << chop(release_data[0], " " ) << std::endl;
1037 
1038  std::string nightly = chop(release_data[0], " " );
1039 
1040  if ( contains(nightly,"private" ) ) {
1041  for ( int ic=0 ; ic<4 ; ic++ ) chop(release_data[0], " " );
1042  release += " (" + release_data[0]+")";
1043  }
1044  else {
1045  release += " (" + nightly;
1046  chop( release_data[0], " " );
1047  release += " " + chop(release_data[0], " " ) + ")";
1048  }
1049  }
1050  }
1051 
1052 
1053  // Make output directory
1054  if (!dir.empty()) {
1055 
1056  gDirectory->pwd();
1057 
1058  std::cout << "trying to make directory" << std::endl;
1059  dir += '/';
1060  if ( !quiet && !noplots && !exists(dir) ) {
1061  if ( mkdir( dir.c_str(), 0777 ) ) std::cerr << "main() couldn't create directory " << dir << std::endl;
1062  else std::cout << "main() output will be sent to directory " << dir << std::endl;
1063  }
1064  }
1065 
1066  if ( ftest_==0 && chainTFiles.size()>0 ) fref_ = ftest_ = chainTFiles[0];
1067 
1068  TFile* ftest = ftest_;
1069  TFile* fref = fref_;
1070 
1071  std::string testrun = findrun( ftest );
1072 
1073  std::string rawrefrun = "";
1074  std::string refrun = "";
1075 
1076  if ( fref_ ) refrun = rawrefrun = findrun( fref );
1077 
1078  std::cout << "testrun: " << testrun << "\nrefrun: " << refrun << std::endl;
1079 
1080  if ( !testrun.empty() && refrun != testrun ) {
1081  if ( pattern.empty() ) {
1082  pattern = testrun;
1083  regex = refrun;
1084  }
1085 
1086  }
1087 
1088  if ( !refrun.empty() ) {
1089 
1090  std::string newtag = "Reference: ";
1091 
1092  std::cout << "refrun: " << refrun << std::endl;
1093 
1094  size_t pos;
1095  while ( (pos=refrun.find('_'))!=std::string::npos ) refrun.replace( pos, 1, " " );
1096  newtag += refrun;
1097 
1098  std::string rawrun = refrun.erase( refrun.find("run"), 4 );
1099 
1100  if ( contains(frefname, rawrun) ) {
1101 
1102  std::string release = frefname;
1103 
1104  release.erase( 0, release.find(rawrun) );
1105 
1106  if ( contains(release,"HIST") ) release.erase( 0, release.find("HIST")+5 );
1107  while ( contains(release,".") ) release.erase( release.find('.'), release.size() );
1108  while ( contains(release,"-") ) release.erase( release.find('-'), release.size() );
1109  while ( contains(release,"_p") ) release.erase( release.find("_p"), release.size() );
1110  while ( contains(release,"_t") ) release.erase( release.find("_t"), release.size() );
1111 
1112  newtag += " ";
1113  newtag += release;
1114 
1115  }
1116 
1117  taglabels.push_back( newtag );
1118 
1119  std::cout << "tag labels: " << taglabels << std::endl;
1120 
1121  }
1122 
1127  int NeventTest = 1;
1128  int NeventRef = 1;
1129 
1130 
1131  std::vector<std::string> savedhistos;
1132 
1133 
1134  if ( !nowatermark ) {
1135 
1136  TH1D* htestev = (TH1D*)ftest->Get("event") ;
1137  TH1D* hrefev = (TH1D*)fref->Get("event") ;
1138 
1139  std::cout << "htestev " << htestev << " " << hrefev << std::endl;
1140 
1141  if ( htestev ) NeventTest = htestev->GetEntries();
1142  if ( hrefev ) NeventRef = hrefev->GetEntries();
1143 
1144  savedhistos.push_back("event");
1145  }
1146  else {
1147  NeventTest = 1;
1148  NeventRef = 1;
1149  }
1150 
1151 
1152  if ( NeventTest>1 ) std::cout << "Nevents Test: " << NeventTest << std::endl;
1153  if ( NeventRef>1 ) std::cout << "Nevents Ref: " << NeventRef << std::endl;
1154 
1155  chainmap_t* chainmap = nullptr;
1156 
1157  if ( mapfile.empty() ) mapfile = configfile;
1158 
1159  if ( !mapfile.empty() ) {
1160 
1161  ReadCards m( mapfile );
1162 
1163  if ( m.isTagDefined( "ChainMap" ) ) {
1164  std::vector<std::string> chains = m.GetStringVector( "ChainMap" );
1165 
1166  chainmap = new chainmap_t();
1167 
1168  for ( size_t i=0 ; i<chains.size() ; i+=2 ) {
1169  chainmap->insert( chainmap_t::value_type( chains[i], chains[i+1] ) );
1170  }
1171 
1172  std::cout << "\nusing chain map:" << std::endl;
1173 
1174  for ( chainmap_t::iterator itr=chainmap->begin() ; itr!=chainmap->end() ; ++itr ) {
1175  std::cout << "\t" << itr->first << "\t" << itr->second << std::endl;
1176  }
1177  }
1178  }
1179 
1181 
1182  std::cout << "\ncreating chain and reference information ..." << std::endl;
1183 
1184  for ( size_t j=0; j<chains.size(); j++) {
1185 
1186  if ( !regex.empty() ) chains[j] = fullreplace( chains[j], pattern, regex );
1187  if ( !regext.empty() ) chains[j] = fullreplace( chains[j], patternt, regext );
1188 
1190 
1192  std::cout << "chain: " << chains[j] << "\taddchains: " << addchains << std::endl;
1193 
1194  if ( addchains && ( contains(chains[j],"Shifter") || ( !contains(chains[j],"HLT_") && !contains(chains[j], "Fullscan" ) ) ) ) {
1195 
1196  TFile* fftest = ftest;
1197 
1198  if ( chainfiles.size()>0 && chainfiles.size()>j ) fftest = chainTFiles[j];
1199 
1200  TH1F* hchain = Get( *fftest, chains[j]+"/Chain", testrun );
1201 
1202  if ( hchain ) {
1203 
1204  std::string name = hchain->GetTitle();
1205 
1206  if ( usechainref && !contains(chains[j],"Purity") ) {
1207 
1208  chainref[j] = name;
1209 
1210  std::cout << "new chainref: " << chainref[j] << std::endl;
1211 
1212  std::string::size_type pos = chainref[j].find(":for");
1213  if ( pos!=std::string::npos ) chainref[j].replace( pos, 4, "_for" );
1214  std::replace( chainref[j].begin(), chainref[j].end(), ':', '/');
1215  std::string newchain = dirname( dirname( chains[j]) ) + "/Expert/" + chainref[j];
1216  chainref[j] = newchain;
1217 
1218  std::cout << "final chainref: " << chainref[j] << std::endl;
1219 
1220  }
1221 
1222  std::cout << "chainref: " << chainref[j] << std::endl;
1223 
1224  while ( contains( name, "HLT_" ) ) name = name.erase( name.find("HLT_"), 4 );
1225 
1226  std::cout << "name: " << name << std::endl;
1227 
1228  if ( contains( name, ":" ) ) chain_name[j] = name.substr( 0, name.find(':') ) + " : ";
1229  else chain_name[j] = name;
1230 
1231  if ( chain_name[j] == " : " ) chain_name[j] = "";
1232 
1233  std::cout << "chain_name: " << chain_name[j] << std::endl;
1234  }
1235  }
1236  }
1237 
1238  std::cout << "chainref size: " << chainref.size() << " " << refchains.size() << std::endl;
1239 
1240  for ( size_t j=0 ; j<chainref.size() ; j++ ) {
1241  std::cout << "chainref: " << chainref[j] << " :: " << refchains[j] << std::endl;
1242 
1244  if ( chainref[j]!="" ) refchain[j] = fullreplace( chainref[j], pattern, regex );
1245  else refchain[j] = fullreplace( refchains[j], pattern, regex );
1246 
1247  if ( !patternr.empty() ) {
1248  if ( chainref[j]!="" ) refchain[j] = fullreplace( chainref[j], patternr, regexr );
1249  else refchain[j] = fullreplace( refchains[j], patternr, regexr );
1250  }
1251 
1252  std::cout << "refchain: " << refchain[j] << std::endl;
1253  }
1254 
1255  std::cout << "done chains" << std::endl;
1256 
1258 
1259  std::vector<Panel> panels;
1260 
1262 
1263  bands bnd;
1264 
1265 
1266  std::vector<int> ccolours;
1267  std::vector<int> cstyles;
1268 
1269  std::vector<std::string> ctags;
1270  std::vector<std::string> ctaglabels;
1271 
1272 
1273  std::cout << "\n" << argv[0] << "\tconfigfile: " << configfile << std::endl;
1274 
1275  bool use_file_config = false;
1276 
1277  if ( configfile!="" ) {
1278 
1279  if ( exists(configfile) ) {
1280 
1281  std::cout << argv[0] << ":\treading configuration file " << configfile << std::endl;
1282 
1283  ReadCards rc(configfile);
1284 
1285 
1287 
1288  if ( rc.isTagDefined( "histos" ) ) {
1289 
1290  std::cout << argv[0] << ":\treading histogram configuration from file " << configfile << std::endl;
1291 
1292  use_file_config = true;
1293 
1294  std::vector<std::string> raw_input = rc.GetStringVector( "histos" );
1295 
1296  for ( size_t iraw=0 ; iraw<raw_input.size() ; iraw += 6) {
1297  HistDetails h( &(raw_input[iraw]) );
1298  Panel p( h.name(), 1 );
1299  p.push_back( h );
1300  panels.push_back( p );
1301  }
1302 
1303  }
1304 
1305  std::cout << "searching for panels" << std::endl;
1306 
1308 
1309  if ( rc.isTagDefined( "panels" ) ) {
1310 
1311  std::cout << argv[0] << ":\treading histogram panel configuration from file " << configfile << std::endl;
1312 
1313  use_file_config = true;
1314 
1315  std::vector<std::string> panel_config = rc.GetStringVector( "panels" );
1316 
1317  std::vector<string> panel_columns;
1318 
1319  if ( rc.isTagDefined("panel_columns") ) {
1320  panel_columns = rc.GetStringVector( "panel_columns" );
1321  if ( panel_columns.size()%2 ) return usage( argv[0], -1, "incorrect panel settings" );
1322  }
1323 
1324 
1325  for ( size_t ipanel=panel_config.size() ; ipanel-- ; ) {
1326 
1327  std::vector<std::string> raw_input = rc.GetStringVector( panel_config[ipanel] );
1328 
1329  int tncols = ncols;
1330 
1331  if ( panel_columns.size() ) {
1332  std::vector<string>::iterator itr = find( panel_columns.begin(), panel_columns.end(), panel_config[ipanel] );
1333  if ( itr!=panel_columns.end() ) tncols = std::atoi( (++itr)->c_str() );
1334  }
1335 
1336  Panel p( panel_config[ipanel], tncols );
1337 
1338  if ( raw_input.empty() ) throw std::exception();
1339  for ( size_t iraw=0 ; iraw<raw_input.size() ; iraw += 6 ) p.push_back( HistDetails( &(raw_input[iraw]) ) );
1340 
1341  panels.push_back( p );
1342 
1343  }
1344 
1345  }
1346 
1347  if ( rc.isTagDefined( "Bands" ) && rc.isTagDefined( "Labels" ) ) {
1348  bnd = bands( rc.GetVector( "Bands"), rc.GetStringVector( "Labels" ) );
1349  }
1350 
1351 
1352  if ( rc.isTagDefined("Colours") ) ccolours = rc.GetIntVector("Colours");
1353  if ( rc.isTagDefined("Styles") ) cstyles = rc.GetIntVector("Styles");
1354  if ( rc.isTagDefined("Tags") ) ctags = rc.GetStringVector("Tags");
1355  if ( rc.isTagDefined("TagLabels") ) ctaglabels = rc.GetStringVector("TagLabels");
1356  if ( rc.isTagDefined("TagLabels") ) usrlabels = rc.GetStringVector("TagLabels");
1357 
1358  if ( rc.isTagDefined("Styles") ) {
1359  for ( size_t is=0 ; is<cstyles.size() && is<6 ; is++ ) {
1360  markers[is] = cstyles[is];
1361  }
1362  }
1363 
1364 
1365  uselabels = true;
1366 
1367 
1368  std::cout << argv[0] << "\tuserlabels :" << usrlabels << ":" << std::endl;
1369 
1370 
1371 
1372  if ( rc.isTagDefined("RANGEMAP") ) RANGEMAP = true;
1373  if ( rc.isTagDefined("ALLRANGEMAP") ) ALLRANGEMAP = true;
1374 
1375  std::cout << "Extra: " << rc.isTagDefined("Extra") << std::endl;
1376 
1377  if ( rc.isTagDefined("Extra") ) taglabels.push_back( fullreplace( rc.GetString("Extra"), "__", " " ) );
1378 
1379 
1380  }
1381  else {
1382  std::cerr << argv[0] << ":\t config file not found: " << configfile << std::endl;
1383  return -1;
1384  }
1385 
1386  }
1387 
1388  if ( !use_file_config ) {
1389 
1390  std::cout << "using default panels" << std::endl;
1391 
1393 
1394  // for ( size_t iraw=0 ; iraw<Nhistos ; iraw++ ) {
1395  // Panel p( histos_default[iraw][0], 1 );
1396  // p.push_back( histos_default[iraw] );
1397  // panels.push_back( p );
1398  // }
1399 
1400  // default panel efficiencies plotted from 0 to 100,
1401  // so scale efficiencies no matter what
1402 
1403  scale_eff = 100;
1404  scale_eff_ref = 100;
1405 
1407 
1408  std::string (*inpanels[3])[6] = { eff_panel, res_panel, diff_panel };
1409 
1410  size_t nphist[3] = { 4, 4, 10 };
1411 
1412  std::string pnames[3] = { "eff", "res", "diff" };
1413 
1414  for ( size_t ip=0 ; ip<3 ; ip++ ) {
1415  Panel p( pnames[ip]+"_panel", 2 );
1416  for ( size_t iraw=0 ; iraw<nphist[ip] ; iraw++ ) p.push_back( HistDetails( inpanels[ip][iraw] ) );
1417  panels.push_back( p );
1418  }
1419 
1420  }
1421 
1422 
1423  std::cout << "taglabels" << std::endl;
1424 
1425  for ( size_t it=0 ; it<taglabels.size() ; it++ ) std::cout << taglabels[it] << std::endl;
1426 
1427 
1428  std::cout << "\npanels: " << panels.size() << std::endl;
1429 
1430  if ( panels.size()==0 ) return usage(argv[0], -1, "no panels to plot");
1431 
1432  for ( size_t ip=0 ; ip<panels.size() ; ip++ ) std::cout << panels[ip] << std::endl;
1433 
1434 
1436  if ( true ) {
1437  gStyle->SetPadRightMargin(0.05);
1438  gStyle->SetPadTopMargin(0.05);
1439 
1440  const Int_t Number = 3;
1441  Double_t Red[Number] = { 0.00, 0.00, 1.00};
1442  Double_t Green[Number] = { 0.00, 5.00, 1.00};
1443  Double_t Blue[Number] = { 0.00, 0.50, 0.00};
1444  Double_t Length[Number] = { 0.00, 0.50, 1.00 };
1445  Int_t nb=50;
1446  TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
1447  }
1448  else gStyle->SetPalette(1);
1449 
1450  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1451 
1452  double rightmargin = gStyle->GetPadRightMargin();
1453  gStyle->SetPadRightMargin(0.1);
1454 
1456 
1457  gStyle->SetPadRightMargin(rightmargin);
1458 
1459  // gStyle->SetLineScalePS(1);
1460 
1461  for ( size_t ipanel=0 ; ipanel<panels.size() ; ipanel++ ) {
1462 
1463  Panel& panel = panels[ipanel];
1464 
1465  std::cout << "\n\n---------------------------------------------\n";
1466 
1467  std::cout << panel << "\n" << std::endl;
1468 
1469  int ncolsp = panel.ncols();
1470  int nrowsp = panel.nrows();
1471 
1472  double extraw = 1;
1473 
1474  std::cout << "\nncols: " << ncolsp << "\tnrows: " << nrowsp << std::endl;
1475 
1476  bool multipanel = ( panel.size() > 1 );
1477 
1478  if ( panel.size()==0 ) {
1479  std::cout << "panel empty: " << panel.name() << std::endl;
1480  continue;
1481  }
1482 
1483  gStyle->cd();
1484 
1485  if ( panel.size()>4 ) gStyle->SetLineScalePS(0.5);
1486 
1487  if ( multipanel ) extraw = 1.05;
1488 
1489  TCanvas* tc = new TCanvas( "tc", "", extraw*ncolsp*800, nrowsp*600 );
1490 
1491  tc->cd();
1492 
1493  const std::string& atlaslabel = atlaslabel_tmp;
1494 
1495 
1496  if ( multipanel ) {
1497 
1498  gStyle->SetLineScalePS(1);
1499 
1502 
1510 
1513 
1514  tc->Divide( ncolsp, nrowsp, 0.0001, 0.0003 );
1515  // atlaslabel = " " + atlaslabel_tmp;
1516  }
1517 
1519 
1520  std::string plotname = "";
1521 
1522  for ( size_t i=0 ; i<panel.size() ; i++ ) {
1523 
1524  HistDetails histo = panel[i];
1525 
1526  bool drawmeans = false;
1527  bool drawresiduals = true;
1528 
1529  if ( contains(histo.detail(), "+mean" ) ) drawmeans = true;
1530  if ( contains(histo.detail(), "-residual") ) drawresiduals = false;
1531 
1532  std::string xaxis = histo.xtitle();
1533  std::string yaxis = histo.ytitle();
1534 
1535  if ( !xregex.empty() ) {
1536  size_t pos = xaxis.find(xregex);
1537  if ( pos!=std::string::npos ) xaxis.replace( pos, xregex.size(), xpattern );
1538  pos = yaxis.find(xregex);
1539  if ( pos!=std::string::npos ) yaxis.replace( pos, xregex.size(), xpattern );
1540  }
1541 
1542  const AxisInfo& xinfo = histo.xaxis();
1543  const AxisInfo& yinfo = histo.yaxis();
1544 
1545  std::string hname = histo.name();
1546  std::string detail = histo.detail();
1547 
1548  double rebin = 1;
1549  bool d0rebin_flag = false;
1550 
1551  if ( contains( detail, "+d0rebin" ) ) d0rebin_flag = true;
1552 
1553  if ( contains( detail, "+Rebin" ) ) {
1554  rebin = std::atof( detail.substr( detail.find("+Rebin")+6, detail.size() ).c_str() );
1555  }
1556 
1557  if ( contains( detail, "+rebin" ) ) {
1558  rebin = std::atof( detail.substr( detail.find("+rebin")+6, detail.size() ).c_str() );
1559  }
1560 
1561 
1562  int npanel = nrowsp*(i/nrowsp) + i%nrowsp + 1 ;
1563 
1564  std::cout << "panel: panel: " << panel.name() << "\tsubpanel: " << npanel << std::endl;
1565 
1566  if ( multipanel ) tc->cd( npanel );
1567 
1568  SetAtlasStyle();
1569 
1570  noreftmp = noref;
1571 
1572  Plotter::setplotref(!noreftmp);
1573 
1574  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1575 
1576  std::cout << "main() processing histo[" << i << "] " << (i<10 ? " " : "" ) << histo.name() << "\t" << histo.xaxis() << std::endl;
1577 
1578  Plots plots_eff( "", yinfo.trim() );
1579  plots_eff.clear();
1580 
1581  Plots plots( "", yinfo.trim() );
1582  plots.clear();
1583 
1584  std::string noreflabel=defreflabel;
1585 
1586  double xpos = 0.18;
1587  double ypos = 0.91;
1588 
1589  if ( contains(histo.name(),"eff") || contains(histo.name(),"Eff_") ) ypos = 0.19;
1590 
1591  // ypos = 0.19;
1592 
1595 
1596  if ( atlasstyle ) {
1597  xpos = 0.18;
1598  if ( ypos>0.5 ) ypos = 0.85;
1599  else ypos = 0.18;
1600  }
1601 
1602  if ( ypos_arg!=0 ) ypos = ypos_arg;
1603 
1604  double xpos_original = xpos;
1605 
1606  xpos += xoffset;
1607 
1608  if ( xinfo.offset() != 0 ) {
1609 
1610  std::cout << "HA ! xinfo.offset: " << xinfo.offset() << std::endl;
1611 
1612  xpos = xinfo.offset();
1613 
1614  }
1615 
1616 
1617  if ( yinfo.offset() != 0 ) {
1618 
1619  std::cout << "HA ! yinfo.offset: " << yinfo.offset() << std::endl;
1620 
1621  ypos = yinfo.offset();
1622 
1623  }
1624 
1625 
1626 
1628 
1629  size_t Nrows = chains.size();
1630 
1631  if ( ALLRANGEMAP || (RANGEMAP && xaxis.find("p_{T}")!=std::string::npos && ccolours.size() ) )
1632  Nrows = ( Nrows < ccolours.size() ? Nrows : ccolours.size() );
1633 
1634  int Nlines = Nrows + taglabels.size();
1635 
1636  std::vector<double> ypositions;
1637 
1638  double deltay = (Nrows*0.055-0.005)/Nrows;
1639 
1640  double ylo = ypos;
1641  double yhi = ypos-0.01;
1642 
1643  if ( ypos>0.5 ) ylo -= Nlines*deltay;
1644  else yhi += Nlines*deltay;
1645 
1646  ypositions.reserve(Nlines);
1647  for ( int ilines=0 ; ilines<Nlines ; ilines++ ) {
1648  ypositions.push_back( yhi - deltay*(ilines+0.5) );
1649  }
1650 
1651  // specify different legends for efficiencies or residuals?
1652 
1654 
1655 
1656  if ( !contains(histo.name(),"eff") && !contains(histo.name(),"Eff_") ) ylo -= 0.02;
1657 
1658  Legend legend( xpos, xpos+0.1, ylo, ylo+Nrows*0.06-0.005 );
1659  Legend legend_eff( xpos, xpos+0.1, ylo, ylo+Nrows*0.06-0.005 );
1660 
1661 
1662  std::vector<std::string> Mean;
1663  std::vector<std::string> RMS;
1664 
1665  Mean.clear();
1666  RMS.clear();
1667 
1668  std::vector<std::string> Chi2;
1669  std::vector<std::string> MeanRef;
1670  std::vector<std::string> RMSRef;
1671 
1672  // int colours[6] = { 1, 2, 4, 6, 7, 8 };
1673 
1674  Chi2.clear();
1675  MeanRef.clear();
1676  RMSRef.clear();
1677 
1678  int mean_power = 0;
1679  int rms_power = 0;
1680  bool power_set = false;
1681 
1682  LINEF = true;
1683 
1685  // bool uselogx = xinfo.log();
1686  // bool uselogy = yinfo.log();
1687 
1688  for ( unsigned int j=0; j<chains.size(); j++) {
1689 
1690  TFile* fftest = ftest;
1691  TFile* ffref = fref;
1692 
1693  if ( chainfiles.size()>0 && chainfiles.size()>j ) ffref = fftest = chainTFiles[j];
1694 
1697 
1698  std::cout << "chain: " << chains[j] << "\taddchains: " << addchains << std::endl;
1699  std::cout << "chainref: " << chainref[j] << std::endl;
1700 
1701  noreftmp = noref;
1702  Plotter::setplotref(!noreftmp);
1703 
1704  TH1F* htest = 0;
1705  TH1F* href = 0;
1706 
1707  TH1F* htestnum = 0;
1708  TH1F* htestden = 0;
1709  TH1F* hrefnum = 0;
1710 
1711  TGraphAsymmErrors* tgtest = 0;
1712 
1713  std::cout << "refchain.size() " << refchain.size() << std::endl;
1714 
1715  std::cout << "refchain: " << refchain[j] << std::endl;
1716 
1718 
1719  gPad->SetRightMargin(0.03);
1720 
1721  if ( contains(histo.name(),"/2d") ) {
1722 
1723  gPad->SetRightMargin(0.13);
1724 
1725  TH2D* h2test = Get<TH2D>( *fftest, chains[j]+"/"+histo.name(), testrun, 0, &savedhistos );
1726 
1727  DrawLabel( 0.5, 0.5, "a test" );
1728 
1729  h2test->GetYaxis()->SetTitleOffset(1.55);
1730  h2test->GetXaxis()->SetTitleOffset(1.5);
1731  h2test->GetXaxis()->SetTitle(xaxis.c_str());
1732  h2test->GetYaxis()->SetTitle(yaxis.c_str());
1733 
1734  const AxisInfo& xinfo = histo.xaxis();
1735  const AxisInfo& yinfo = histo.yaxis();
1736 
1737 
1738  std::cout << xinfo << std::endl;
1739  std::cout << yinfo << std::endl;
1740 
1741  if ( yinfo.rangeset() ) {
1742  h2test->GetYaxis()->SetRangeUser( yinfo.lo(), yinfo.hi() );
1743  }
1744 
1745  if ( yinfo.normset() ) normy( h2test );
1746 
1747  if ( xinfo.rangeset() ) {
1748  h2test->GetXaxis()->SetRangeUser( xinfo.lo(), xinfo.hi() );
1749  }
1750 
1751  if ( xinfo.autoset() ) autox( h2test );
1752  if ( yinfo.autoset() ) autoy( h2test );
1753 
1754  SetZeros( h2test );
1755 
1756  h2test->DrawCopy("colz");
1757 
1758  if ( histo.detail().find("logz")!=std::string::npos ) gPad->SetLogz(true);
1759  else gPad->SetLogz(false);
1760 
1761 
1762  }
1763  else if ( refit_resplots && ( contains(histo.name(),"/sigma") || contains(histo.name(),"/mean") ) ) {
1764 
1765  bool bsigma = false;
1766  if ( contains(histo.name(),"/sigma") ) bsigma = true;
1767 
1768  bool bmean = false;
1769  if ( contains(histo.name(),"/mean") ) bmean = true;
1770 
1771  std::cout << "\trefitting: " << histo.name() << std::endl;
1772 
1773  Resplot::setoldrms95(oldrms);
1774  Resplot::setscalerms95(true);
1775 
1776  std::string tmp_ = histo.name();
1777  std::string base;
1778 
1779  if ( bsigma ) base = chop( tmp_, "/sigma" );
1780  if ( bmean ) base = chop( tmp_, "/mean" );
1781 
1782  TH2D* htest2d_ = Get<TH2D>( *fftest, chains[j]+"/"+base+"/2d", testrun, 0, &savedhistos );
1783 
1784  std::cout << "ffref " << ffref << std::endl;
1785  TH2D* href2d_ = 0;
1786 
1787  if ( ffref ) href2d_ = Get<TH2D>( *ffref, chains[j]+"/"+base+"/2d", testrun );
1788 
1789  if ( htest2d_==0 ) continue;
1790  if ( !noreftmp && href2d_==0 ) noreftmp = true;
1791  Plotter::setplotref(!noreftmp);
1792 
1794 
1795  Resplot rtest("tmp", htest2d_ );
1796 
1797  if ( rtest.finalised() ) {
1798  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") || contains(histo.name(),"nsi") || contains(histo.name(),"nbl") ) rtest.Refit(Resplot::FitNull);
1799  else rtest.Refit(Resplot::FitNull95);
1800  }
1801  else {
1802  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") || contains(histo.name(),"nsi") || contains(histo.name(),"nbl") ) rtest.Finalise(Resplot::FitNull);
1803  else rtest.Finalise(Resplot::FitNull95);
1804  }
1805 
1806  if ( bsigma ) { htest = (TH1F*)rtest.Sigma()->Clone("rtest_sigma"); htest->SetDirectory(0); }
1807  if ( bmean ) { htest = (TH1F*)rtest.Mean()->Clone("rtest_mean"); htest->SetDirectory(0); }
1808 
1809  if ( htest==0 ) {
1810  std::cerr << "missing test histogram: " << (refchain[j]+" / "+histo.name()) << " " << htest << "(test)" << std::endl;
1811  continue;
1812  }
1813 
1814 
1817 
1818  TH1F* hreft = 0;
1819 
1820  if ( !noreftmp ) {
1821  if ( refitref_resplots ) {
1822 
1823  Resplot rref("tmp", href2d_ );
1824 
1825  if ( rref.finalised() ) {
1826  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") ) rref.Refit(Resplot::FitNull);
1827  else rref.Refit(Resplot::FitNull95);
1828  }
1829  else {
1830  if ( contains(histo.name(),"npix") || contains(histo.name(),"nsct") ) rref.Finalise(Resplot::FitNull);
1831  else rref.Finalise(Resplot::FitNull95);
1832  }
1833 
1834  if ( bsigma ) { hreft = (TH1F*)rref.Sigma()->Clone("rref_sigma"); hreft->SetDirectory(0); }
1835  if ( bmean ) { hreft = (TH1F*)rref.Mean()->Clone("rref_mean"); hreft->SetDirectory(0); }
1836 
1837  }
1838  else {
1839  hreft = Get( *ffref, refchain[j]+"/"+histo.name(), rawrefrun, chainmap );
1840  if ( hreft==0 ) {
1841  std::cerr << "ERROR: could not find " << (refchain[j]+"/"+histo.name()) << std::endl;
1842  }
1843  }
1844  }
1845 
1846  if ( !noreftmp && hreft==0 ) {
1847  std::cerr << "missing ref histogram: " << (refchain[j]+" / "+histo.name()) << " " << htest << "(ref)" << std::endl;
1848 
1849  noreftmp = true;
1850  Plotter::setplotref(!noreftmp);
1851  noreflabel="reference not found";
1854  // std::exit(-1);
1855  }
1856 
1857  if ( !noreftmp ) {
1858  href = (TH1F*)hreft->Clone();
1859  href->SetDirectory(0);
1860  }
1861 
1863  // std::cout << "\tget " << (refchain[j]+"/"+histos[i]) << "\t" << href << std::endl;
1864 
1865  savedhistos.push_back( refchain[j]+"/"+histo.name() );
1866 
1867  }
1868  else {
1869 
1870  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1871 
1873 
1874  std::string reghist = histo.name();
1875 
1876  std::cout << "hist: " << (chains[j]+"/"+reghist) << "\tftest " << ftest << std::endl;
1877 
1878  htest = Get( *fftest, chains[j]+"/"+reghist, testrun, 0, &savedhistos );
1879 
1880  std::cout << "hist: " << htest << std::endl;
1881 
1882  std::cout << xaxis << std::endl;
1883 
1884  if ( htest==0 ) {
1885  std::cerr << "missing test histogram: " << (chains[j]+" / "+reghist) << " " << htest<< std::endl;
1886  continue;
1887  }
1888 
1889  TH1F* hreft = 0;
1890 
1891  std::cout << "hreft: " << hreft << std::endl;
1892 
1893  if ( ffref ) hreft = Get( *ffref, refchain[j]+"/"+reghist, rawrefrun, chainmap );
1894  else noreftmp = true;
1895 
1896  std::cout << "hreft: " << hreft << std::endl;
1897 
1898  if ( std::string(htest->ClassName()).find("TH2")!=std::string::npos ) {
1899  std::cout << "Class TH2: " << htest->GetName() << std::endl;
1900  continue;
1901  }
1902 
1903  if ( std::string(htest->ClassName()).find("TH1")!=std::string::npos ) {
1904  std::cout << "Class TH1: " << htest->GetName() << std::endl;
1905  }
1906  else if ( std::string(htest->ClassName()).find("TProfile")!=std::string::npos ) {
1907  std::cout << "Class TProf: " << htest->GetName() << std::endl;
1908  }
1909 
1910 
1911 
1912  if ( !noreftmp && hreft==0 ) {
1913  std::cerr << "missing ref histogram: " << (refchain[j]+" / "+reghist)
1914  << " " << hreft << std::endl;
1915  noreftmp = true;
1916  Plotter::setplotref(false);
1917  noreflabel="reference not found";
1920  // std::exit(-1);
1921 
1922  }
1923 
1924  if ( hreft!=0 ) {
1925  href = (TH1F*)hreft->Clone();
1926  href->SetDirectory(0);
1927  }
1928  else {
1929  noreftmp = true;
1930  href = 0;
1931  }
1932 
1933  std::cout << " \tget " << (chains[j]+"/"+reghist) << "\thtest " << htest << std::endl;
1934  std::cout << " \tget " << (refchain[j]+"/"+reghist) << "\thref " << href << std::endl;
1935 
1936  if ( htest==0 ) continue;
1937 
1938  if ( !noreftmp && href==0 ) {
1939  noreftmp = true;
1940  Plotter::setplotref(!noreftmp);
1941  }
1942 
1943  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1944 
1945 
1946  if ( rebin!=1 ) {
1947  std::cout << "rebin: " << hname << "\t" << rebin << std::endl;
1948  if ( htest ) htest->Rebin(rebin);
1949  if ( href ) href->Rebin(rebin);
1950  for ( int ip=0 ; ip<10 ; ip++ ) std::cout << std::endl;
1951  }
1952 
1953 #if 0
1954  if ( !contains( histo.name(), "rdz_vs_zed" ) && contains( histo.name(), "1d") ) {
1956  std::cout << "Rebinning histogram: " << histo.name() << std::endl;
1957  if ( htest->GetNbinsX()>500 ) htest->Rebin(10);
1958  if ( href && href->GetNbinsX()>500 ) href->Rebin(10);
1959  }
1960 #endif
1961 
1962 
1963  if ( histo.name().find("zed_eff")!=std::string::npos ) {
1964  if ( htest->GetNbinsX()>100 ) htest->Rebin(5);
1965  if ( href && href->GetNbinsX()>100 ) href->Rebin(5);
1966  }
1967 
1968 
1969  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1970 
1971  if ( scalepix && std::string(htest->GetName()).find("npix")!=std::string::npos ) Scale(htest,0.5);
1972  if ( scalepix && href && std::string(htest->GetName()).find("npix")!=std::string::npos ) Scale(href,0.5);
1973 
1974  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1975 
1976  if ( notitle ) {
1977  htest->SetTitle("");
1978  if( href ) href->SetTitle("");
1979  }
1980 
1981  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1982 
1983  }
1984 
1985  if ( fulldbg ) std::cout << __LINE__ << std::endl;
1986 
1987  if ( make_ref_efficiencies ) {
1988  if ( htest && href ) {
1989 
1991  // std::cout << "contains _eff " << contains( std::string(htest->GetName()), "eff" ) << std::endl;
1992 
1993  if ( contains( std::string(htest->GetName()), "eff" ) ) {
1994 
1995  std::string effhist = histo.name();
1996 
1997  htestnum = Get( *fftest, chains[j]+"/"+effhist+"_n", testrun, 0, &savedhistos );
1998 
1999  TH1F* hrefnumt = Get( *ffref, refchain[j]+"/"+effhist+"_n", rawrefrun, chainmap, &savedhistos );
2000 
2001  if ( !noreftmp && hrefnumt!=0 ) {
2002  hrefnum = (TH1F*)hrefnumt->Clone();
2003  hrefnum->SetDirectory(0);
2004  }
2005 
2006  }
2007  }
2008  }
2009 
2010 
2011  if ( bayes ) {
2012 
2013  if ( htest && contains( std::string(htest->GetName()), "eff" ) ) {
2014 
2015  std::string effhist = histo.name();
2016 
2018 
2019  if ( rebin!=1 ) std::cout << effhist << "\trebin: " << rebin << std::endl;
2020 
2021  htestnum = Get( *fftest, chains[j]+"/"+effhist+"_n", testrun, 0, &savedhistos ) ;
2022  htestden = Get( *fftest, chains[j]+"/"+effhist+"_d", testrun, 0, &savedhistos ) ;
2023 
2024  std::cout << "1: Bayesian error calculation " << htestnum << " " << htestden << "\tscale " << scale_eff << std::endl;
2025 
2026  if ( htestnum && htestden ) {
2027 
2028  if ( d0rebin_flag ) {
2029  htestnum = d0rebin( htestnum );
2030  htestden = d0rebin( htestden );
2031  }
2032  else if ( rebin!=1 ) {
2033  htestnum = Rebin(htestnum, rebin );
2034  htestden = Rebin(htestden, rebin );
2035  }
2036 
2037  std::cout << "test histogram name: : " << htestnum->GetName() << "\txaxis: " << xaxis << "\t" << std::endl;
2038 
2039  // if ( xaxis.find("p_{T}")!=std::string::npos || xaxis.find("pt")!=std::string::npos ) {
2040  if ( std::string(htestnum->GetName()).find("ntrax_eff")!=std::string::npos ) {
2041 
2042  bool low = true;
2043 
2044  // if ( chains[j].find("j55")!=std::string::npos ) low = false;
2045 
2046  htestnum = rebin_log( htestnum, low );
2047  htestden = rebin_log( htestden, low );
2048  }
2049 
2050 #if 0
2051  if ( contains( htest->GetName(), "_vs_lb" ) ) {
2054  std::cout << "rebin " << histo.name() << std::endl;
2055  htestnum->Rebin(3);
2056  htestden->Rebin(3);
2057  }
2058 
2059  if ( contains( htest->GetName(), "eta_eff" ) ) {
2060  std::cout << "rebin " << histo.name() << std::endl;
2061  htestnum->Rebin(2);
2062  htestden->Rebin(2);
2063  }
2064 #endif
2065 
2066  // if ( RANGEMAP && (effhist.find("pT")!=std::string::npos || effhist.find("pt")!=std::string::npos ) ) {
2067  if ( RANGEMAP && (effhist.find("ET")!=std::string::npos ) ) {
2068  std::cout << "\trange: " << j << " " << htest << std::endl;
2069  bnd.range( chains[j], htestnum );
2070  bnd.range( chains[j], htestden );
2071  }
2072 
2073 
2074  Efficiency1D e( htestnum, htestden, "", scale_eff );
2075  tgtest = e.Bayes(scale_eff);
2076 
2077  htest = e.Hist();
2078 
2079  std::cout << "effhist: " << effhist << std::endl;
2080 
2081  }
2082 
2084 
2085  std::cout << "recalculating reference efficiencies ..." << std::endl;
2086 
2087  if ( href ) {
2088 
2089  std::cout << "doin ..." << std::endl;
2090 
2091  TH1F* hrefnum = Get( *ffref, refchain[j]+"/"+histo.name()+"_n", rawrefrun, chainmap );
2092 
2093  TH1F* hrefden = Get( *ffref, refchain[j]+"/"+histo.name()+"_d", rawrefrun, chainmap );
2094 
2095  std::cout << "2. Bayesian error calculation " << htestnum << " " << htestden << "\tscale " << scale_eff << std::endl;
2096  std::cout << "3. Bayesian error calculation " << hrefnum << " " << hrefden << "\tscale " << scale_eff_ref << std::endl;
2097 
2098 
2099  if ( hrefnum && hrefden ) {
2100 
2101  if ( d0rebin_flag ) {
2102  hrefnum = d0rebin( hrefnum );
2103  hrefden = d0rebin( hrefden );
2104  }
2105  else if ( rebin!=1 ) {
2106  hrefnum = Rebin(hrefnum, rebin );
2107  hrefden = Rebin(hrefden, rebin );
2108  }
2109 
2110  Efficiency1D e( hrefnum, hrefden, "", scale_eff_ref );
2112  // tgref = e.Bayes(scale_eff);
2113 
2114  href = e.Hist();
2115 
2116  }
2117  }
2118  }
2119 
2120  }
2121 
2122 
2123  if ( htest==0 ) {
2124  std::cout << " no test histogram : " << (chains[j]+"/"+histo.name()) << std::endl;
2125  continue;
2126  }
2127 
2128  if ( !noreftmp && href==0 ) {
2129  std::cout << " no ref histogram : " << (chains[j]+"/"+histo.name()) << std::endl;
2130  noreftmp = true;
2131  Plotter::setplotref(!noreftmp);
2132  noreflabel="reference not found";
2135  // continue;
2136  }
2137 
2138 
2139  htest->GetYaxis()->SetTitleOffset(1.55);
2140  htest->GetXaxis()->SetTitleOffset(1.5);
2141  htest->GetXaxis()->SetTitle(xaxis.c_str());
2142  htest->GetYaxis()->SetTitle(yaxis.c_str());
2143 
2144  if ( !noreftmp ) {
2145  href->GetYaxis()->SetTitleOffset(1.5);
2146  href->GetXaxis()->SetTitleOffset(1.5);
2147  href->GetXaxis()->SetTitle(xaxis.c_str());
2148  if ( contains(yaxis,"Efficiency") && !contains(yaxis,"%") && scale_eff==100 ) href->GetYaxis()->SetTitle((yaxis+" [%]").c_str());
2149  else href->GetYaxis()->SetTitle(yaxis.c_str());
2150  }
2151 
2152  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2153 
2154 #if 1
2155  if ( contains(histo.name(),"ntracks") ) {
2156 
2157  double xm = htest->GetMean();
2158 
2159  if ( xm>=10 ) {
2160  double lxm = std::log10(xm);
2161  int newbins = int(0.5+xm/std::pow(10,int(lxm)))*pow(10,int(lxm));
2162  int nrebin = int( (newbins+5)/10 );
2163 
2164  if ( nrebin>1 ) {
2165  std::cout << "rebin: " << htest->GetName() << "\tbins: " << nrebin << std::endl;
2166  htest->Rebin(nrebin);
2167  htest->Sumw2();
2168  if ( !noreftmp ) {
2169  href->Rebin(nrebin);
2170  href->Sumw2();
2171  }
2172  }
2173  }
2174  }
2175 #endif
2176 
2177  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2178 
2180  if ( plotname == "" ) {
2181 
2182  if ( key!="" ) {
2183  htest->SetTitle("");
2184  if ( href ) href->SetTitle("");
2185  plotname = key+"_";
2186  }
2187  else if (fcontains(chains[j],"HLT_")) {
2188  htest->SetTitle("");
2189  if ( href ) href->SetTitle("");
2190  plotname = "HLT_";
2191  }
2192  else if (fcontains(chains[j],"EF_")) {
2193  htest->SetTitle("");
2194  if ( href ) href->SetTitle("");
2195  plotname = "EF_";
2196  }
2197  else if (fcontains(chains[j],"L2_")) {
2198  htest->SetTitle("");
2199  if ( href ) href->SetTitle("");
2200  plotname = "L2_";
2201  }
2202  else if (contains(chains[j],"FTK") && ! contains(chains[j],"HLT_") ) {
2203  htest->SetTitle(("FTK "+ histo.name()).c_str());
2204  if ( href ) href->SetTitle(("FTK "+ histo.name()).c_str());
2205  plotname = "FTK_";
2206  }
2207 
2208  plotname += histo.name();
2209 
2212  replace(plotname, '/', '_');
2213 
2214  }
2215 
2216 
2217  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2218 
2219  bool residual = false;
2220 
2221  if ( contains(histo.name(),"_res") || contains(histo.name(),"residual_") || contains(histo.name(),"1d") ) residual = true;
2222 
2223 
2224 
2225 
2226  std::string collection = basename( chains[j] );
2227 
2228  std::string actual_chain = basename( dirname( chains[j] ) );
2229 
2230  if ( collection.find("_InDet")!=std::string::npos ) collection.erase( 0, collection.find("_InDet")+1 );
2231  if ( actual_chain.find("_InDet")!=std::string::npos ) actual_chain.erase( actual_chain.find("_InDet") );
2232 
2233 
2234  std::cout << "raw: " << chains[j] << std::endl;
2235 
2236  std::cout << "track collection: " << collection << std::endl;
2237  std::cout << "actual chain: " << actual_chain << std::endl;
2238 
2239  std::regex rx("_HLT_[^_]*RoI.*");
2240  std::regex rx1("_HLT_[^_]*_RoI.*");
2241 
2242  actual_chain = std::regex_replace( actual_chain, std::regex( "_HLT_IDTrack.*" ), "" );
2243 
2244  collection = std::regex_replace( collection, std::regex(".*HLT_IDTrack_"), "IDTrack " );
2245  collection = std::regex_replace( collection, std::regex("IDTrack "), "" );
2246  collection = std::regex_replace( std::regex_replace( collection, rx, "" ), rx1, "" );
2247 
2248  if ( actual_chain.find("HLT_IDTrack_")!=std::string::npos ) actual_chain.erase( actual_chain.find("HLT_IDTrack_"), 12 );
2249  if ( actual_chain.find("_IDTrack_")!=std::string::npos ) actual_chain.erase( actual_chain.find("_IDTrack_"), 9 );
2250  if ( actual_chain.find("IDTrack")!=std::string::npos ) actual_chain.erase( actual_chain.find("IDTrack"), 7 );
2251  if ( actual_chain.find("_idperf")!=std::string::npos ) actual_chain.erase( actual_chain.find("_idperf"), 7 );
2252  if ( actual_chain.find("_bperf")!=std::string::npos ) actual_chain.erase( actual_chain.find("_bperf"), 6 );
2253  if ( actual_chain.find("_boffperf")!=std::string::npos ) actual_chain.erase( actual_chain.find("_boffperf"), 9 );
2254  if ( actual_chain.find("_HLT_")!=std::string::npos ) actual_chain.replace( actual_chain.find("_HLT_"), 5, " " );
2255  if ( actual_chain.find("HLT_")!=std::string::npos ) actual_chain.erase( actual_chain.find("HLT_"), 4 );
2256 
2257  if ( collection.find("_IDTrkNoCut")!=std::string::npos ) collection.erase( collection.find("_IDTrkNoCut"), 11 );
2258  if ( collection.find("xAODCnv")!=std::string::npos ) collection.erase( collection.find("xAODCnv"), 7 );
2259  if ( collection.find("HLT_IDTrack_")!=std::string::npos ) collection.erase( collection.find("HLT_IDTrack_"), 12 );
2260  if ( collection.find("HLT_IDTrack")!=std::string::npos ) collection.erase( collection.find("HLT_IDTrack"), 11 );
2261  if ( collection.find("Tracking")!=std::string::npos ) collection.replace( collection.find("Tracking"), 8, "Trk" );
2262  if ( collection.find("InDetTrigTrk_")!=std::string::npos ) collection.erase( collection.find("InDetTrigTrk_"), 13 );
2263  if ( collection.find("HLT_xAODTracks_")!=std::string::npos ) collection.erase( collection.find("HLT_xAODTracks_"), 15 );
2264  if ( collection.find("_HLT_")!=std::string::npos ) collection.replace( collection.find("_HLT_"), 5, " " );
2265  if ( collection.find("HLT_")!=std::string::npos ) collection.erase( collection.find("HLT_"), 4 );
2266 
2267 
2268  if ( actual_chain.size()>30 ) {
2269  size_t pos = actual_chain.find_last_of("_");
2270  while ( pos!=std::string::npos && actual_chain.size()>30 ) {
2271  actual_chain.erase( pos, actual_chain.size()-pos );
2272  actual_chain+="...";
2273  pos = actual_chain.find_last_of("_");
2274  }
2275  }
2276 
2277  std::string c = actual_chain + " : " + collection;
2278 
2279  std::cout << "track collection: " << collection << " <-" << std::endl;
2280  std::cout << "actual chain: " << actual_chain << " <-" << std::endl;
2281 
2282  replace( c, "_In", " : " );
2283 
2284  c = " " + c;
2285 
2286  std::cout << "use label: " << c << "\tchains size " << chains.size() << "\t" << usrlabels.size() << std::endl;
2287 
2288  std::cout << "chains.size() " << chains.size() << " " << j << std::endl;
2289  std::cout << "chains.size() " << chains.size() << " " << j << std::endl;
2290 
2291  std::cout << "chains[j] : " << j << " " << chains[j] << std::endl;
2292 
2293  std::cout << "userlabels.size() " << usrlabels.size() << std::endl;
2294 
2295  if ( usrlabels.size() < j+1 ) {
2296  if ( usrlabels.size()!=0 ) std::cerr << "userlabels not large enough - not using userlabels" << std::endl;
2297  }
2298  else c = usrlabels[ j ];
2299 
2300  std::cout << "use label: c: " << c << std::endl;
2301 
2303 
2304  // std::cout << "adding plot " << histos[i] << " " << htest->GetName() << std::endl;
2305 
2306  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2307 
2308 
2309 
2310  std::cout << "\n\n\n\nxaxis: " << xaxis << std::endl;
2311 
2312 
2313 
2314  if ( ALLRANGEMAP || xaxis.find("p_{T}")!=std::string::npos || xaxis.find("E_{T}")!=std::string::npos ) {
2315 
2316  if ( RANGEMAP && xaxis.find("p_{T}")!=std::string::npos ) {
2317  bnd.range( chains[j], htest );
2318  if ( href ) bnd.range( chains[j], href );
2319  }
2320 
2321  if ( RANGEMAP || ALLRANGEMAP ) {
2322 
2323  LINEF = false;
2324 
2325  std::cout << "\n\n\nctags " << ctags.size() << "\n\n" << std::endl;
2326 
2327  for ( size_t ic=0 ; ic<ctags.size() ; ic++ ) {
2328 
2329  // std::cout << "\tctags[" << ic << "] = " << ctags[ic] << std::endl;
2330 
2331  std::cout << "\n\nic: " << ic << " " << ctags[ic] << " " << ccolours[ic] << "\n\n" << std::endl;
2332 
2333  if ( chains[j].find(ctags[ic])!=std::string::npos ) {
2334  std::cout << "\ttag " << ctags[ic] << " \tcolour: " << ccolours[ic] << "\tstyle: " << cstyles[ic] << std::endl;
2335  htest->SetLineColor( ccolours[ic] );
2336  htest->SetMarkerColor( ccolours[ic] );
2337  htest->SetMarkerStyle( cstyles[ic] );
2338  c = ctaglabels[ic];
2339  if ( tgtest ) {
2340  tgtest->SetLineColor(htest->GetMarkerColor());
2341  tgtest->SetMarkerStyle(htest->GetMarkerStyle());
2342  tgtest->SetMarkerColor(htest->GetMarkerColor());
2343  }
2344  break;
2345  }
2346  }
2347 
2348  }
2349 
2350  std::cout << "test: " << chains[j] << "chains colour: " << htest->GetMarkerColor() << std::endl;
2351 
2352  }
2353 
2354 
2355  std::cout << "movin' on ..." << std::endl;
2356 
2357  std::cout << "chain: " << chains[j] << " \t marker colour: " << htest->GetMarkerColor() << std::endl;
2358 
2359  // std::exit(0);
2360 
2361  std::cout << "Plotter marker : " << htest->GetMarkerColor() << " " << htest->GetMarkerStyle() << std::endl;
2362 
2363  // if ( uselabels ) plots.push_back( Plotter( htest, href, chain_name+usrlabels[j], tgtest ) );
2364  if ( uselabels ) plots.push_back( Plotter( htest, href, " " + chain_name[j] + c, tgtest ) );
2365  else {
2366  std::cout << "using label: " << c << std::endl;
2367  plots.push_back( Plotter( htest, href, c, tgtest ) );
2368  }
2369 
2370  if ( ALLRANGEMAP || ( RANGEMAP && xaxis.find("p_{T}")!=std::string::npos ) ) plots.back().max_entries( ccolours.size() );
2371 
2372  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2373 
2374  if ( make_ref_efficiencies ) {
2375 
2376  if ( htestnum && hrefnum ) {
2377  Efficiency1D e( htestnum, hrefnum, "", scale_eff );
2378 
2379  TH1* h = e.Hist();
2380 
2381  double range = h->GetMaximum()-h->GetMinimum();
2382 
2383  if ( range<0.2*scale_eff ) {
2384 
2385  double max = int( (h->GetMaximum() + 20)*0.1 )*0.1*scale_eff;
2386  double min = int( (h->GetMinimum() - 10)*0.1 )*0.1*scale_eff;
2387 
2388  if ( max>1*scale_eff ) max = 1.02*scale_eff;
2389  if ( min<0 ) min = 0;
2390 
2391  h->SetMinimum(min);
2392  h->SetMaximum(max);
2393 
2394  }
2395 
2396  plots_eff.push_back( Plotter( e.Hist(), 0, c ) );
2397 
2398  }
2399  }
2400 
2401 
2402  if ( href ) Chi2.push_back( label( "chi2 = %5.2lf / %2.0lf", chi2( htest, href ), double(htest->GetNbinsX()) ) );
2403 
2404  if ( drawmeans ) {
2405 
2406  double mean_95 = htest->GetMean();
2407  double dmean_95 = htest->GetMeanError();
2408  double rms_95 = htest->GetRMS();
2409  double drms_95 = htest->GetRMSError();
2410 
2411  Mean.push_back(label(" mean = %4.2lf #pm %4.2lf", mean_95, dmean_95) );
2412  RMS.push_back(label( " rms = %4.2lf #pm %4.2lf", rms_95, drms_95 ) );
2413 
2414  }
2415 
2416  if ( residual && drawresiduals ) {
2417 
2419 
2420  xpos = xpos_original;
2421 
2422  std::cout << "calculating resolutions : " << histo.name() << " " << htest->GetName() << std::endl;
2423 
2424  TF1* d95 = Resplot::FitNull95( (TH1D*)htest );
2425 
2426  double mean_95 = d95->GetParameter(1);
2427  double dmean_95 = d95->GetParError(1);
2428  double rms_95 = d95->GetParameter(2);
2429  double drms_95 = d95->GetParError(2);
2430 
2431  std::cout << "\t\t" << histo.name()
2432  << "\tmean: " << mean_95 << " +- " << dmean_95
2433  << "\trms: " << rms_95 << " +- " << drms_95 << std::endl;
2434 
2436 
2437  if ( !power_set ) {
2438  for ( int ip=-2 ; ip<9 ; ip++ ) {
2439  if ( std::fabs(mean_95) >= std::pow( 10., double(-ip) ) ) {
2440  mean_power = ip;
2441  break;
2442  }
2443  }
2444 
2445  for ( int ip=-2 ; ip<9 ; ip++ ) {
2446  if ( std::fabs(rms_95) >= std::pow( 10., double(-ip) ) ) {
2447  rms_power = ip;
2448  break;
2449  }
2450  }
2451  }
2452 
2453  power_set = true;
2454 
2455  std::cout << "\t\t" << histo.name()
2456  << "\tmean: " << mean_95 << " +- " << dmean_95 << " : pow " << mean_power
2457  << "\trms: " << rms_95 << " +- " << drms_95 << " : pow " << rms_power << std::endl;
2458 
2459 
2460  if ( mean_power == 0 ) {
2461  Mean.push_back(label("mean_{95} = %4.2lf #pm %4.2lf", mean_95, dmean_95) );
2462  }
2463  else {
2464  Mean.push_back(label("mean_{95} = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2465  mean_95*std::pow(10.,double(mean_power)), dmean_95*std::pow(10,double(mean_power)), -mean_power ) );
2466 
2467  }
2468 
2469  if ( rms_power == 0 ) {
2470  RMS.push_back(label( "rms_{95} = %4.2lf #pm %4.2lf", rms_95, drms_95 ) );
2471  }
2472  else {
2473  RMS.push_back(label( "rms_{95} = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2474  rms_95*std::pow(10.,double(rms_power)), drms_95*std::pow(10,double(rms_power)), -rms_power ) );
2475  }
2476 
2477  if ( href ) {
2478  TF1* d95ref = Resplot::FitNull95( (TH1D*)href );
2479 
2480  double mean_95ref = d95ref->GetParameter(1);
2481  double dmean_95ref = d95ref->GetParError(1);
2482  double rms_95ref = d95ref->GetParameter(2);
2483  double drms_95ref = d95ref->GetParError(2);
2484 
2485  std::cout << "\t\t" << histo.name()
2486  << "\tmean ref: " << mean_95ref << " +- " << dmean_95ref << " : pow " << mean_power
2487  << "\trms ref: " << rms_95ref << " +- " << drms_95ref << " : pow " << rms_power << std::endl;
2488 
2489  if ( mean_power == 0 ) {
2490  MeanRef.push_back(label("mean_{95} ref = %4.2lf #pm %4.2lf", mean_95ref, dmean_95ref) );
2491  }
2492  else {
2493  MeanRef.push_back(label("mean_{95} ref = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2494  mean_95ref*std::pow(10,double(mean_power)), dmean_95ref*std::pow(10,double(mean_power)), -mean_power ) );
2495 
2496  }
2497 
2498 
2499  if ( rms_power == 0 ) {
2500  RMSRef.push_back(label( "rms_{95} ref = %4.2lf #pm %4.2lf", rms_95ref, drms_95ref ) );
2501  }
2502  else {
2503  RMSRef.push_back(label( "rms_{95} ref = ( %4.2lf #pm %4.2lf ) #times 10^{%d}",
2504  rms_95ref*std::pow(10,double(rms_power)), drms_95ref*std::pow(10,double(rms_power)), -rms_power ) );
2505  }
2506  }
2507 
2508  htest->Sumw2();
2509  if ( href ) href->Sumw2();
2510  }
2511 
2512  if ( yinfo.normset() ) {
2513  Norm( htest );
2514  if ( href ) Norm( href );
2515  }
2516  else if ( yinfo.refnormset() ) {
2517  if ( href ) Norm( href, Entries(htest) );
2518  }
2519 
2520  if ( yinfo.binwidth() ) {
2521  binwidth( htest );
2522  if ( href ) binwidth( href );
2523  }
2524 
2525 
2526 
2527  if ( !noreftmp && normref &&
2528  !contains( histo.name(), "mean") && !contains( histo.name(), "sigma" ) &&
2529  !contains( histo.name(), "Eff") && !contains( histo.name(), "eff") &&
2530  !contains( histo.name(), "Res") && !contains( histo.name(), "vs") && !contains( histo.name(), "_lb") ) {
2531  Norm( href, Entries( htest ) );
2532  }
2533 
2534  }
2535 
2536  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2537 
2538  if ( !noplots ) {
2539 
2542 
2543  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2544 
2546  plots.sortx( xinfo );
2547 
2548  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2549 
2550  double yminset = 0;
2551  double ymaxset = 0;
2552 
2553  double rmin = 0;
2554  double rmax = 0;
2555 
2556  if ( xinfo.rangeset() ) {
2557  rmin = plots.realmin( plots.lo(), plots.hi() );
2558  rmax = plots.realmax( plots.lo(), plots.hi() );
2559  }
2560  else {
2561  rmin = plots.realmin();
2562  rmax = plots.realmax();
2563  }
2564 
2565  if ( yinfo.autoset() ) {
2566 
2567  int csize = chains.size() + taglabels.size() + ( atlasstyle ? 1 : 0 );
2568 
2569  if ( yinfo.log() && rmin>0 && rmax>0 ) {
2570 
2572  double delta = std::log10(rmax)-std::log10(rmin);
2573 
2575  // ymaxset = rmax*std::pow(10,delta*0.15*csize);
2576 
2577  yminset = rmin*std::pow(10,-delta*0.1);
2578 
2579  double newdelta = std::log10(rmax) - std::log10(yminset) + 0.05*delta;
2580 
2581  if ( csize<10 ) ymaxset = rmin*std::pow(10,newdelta/(1-0.07*csize));
2582  else ymaxset = rmin*std::pow(10,newdelta*2);
2583 
2584  if ( yminset!=yminset ) {
2585  std::cerr << " range error " << delta << " " << yminset << " " << ymaxset << "\t(" << rmin << " " << rmax << ")" << std::endl;
2589  continue;
2590  }
2591 
2592  }
2593  else {
2594 
2597 
2598  if ( ypos>0.5 ) {
2599  double delta = rmax-rmin;
2600 
2601  yminset = rmin-0.1*delta;
2602 
2603  if ( rmin>=0 && yminset<=0 ) yminset = 0;
2604 
2605  double newdelta = rmax - yminset + 0.05*delta;
2606 
2607  if ( csize<10 ) ymaxset = yminset + newdelta/(1-0.09*csize);
2608  else ymaxset = yminset + newdelta*2;
2609  }
2610  else {
2611  double delta = rmax-rmin;
2612 
2613  ymaxset = rmax+0.1*delta;
2614 
2615  double newdelta = ymaxset - rmin - 0.05*delta;
2616 
2617  if ( csize<10 ) yminset = ymaxset - newdelta/(1-0.09*csize);
2618  else yminset = ymaxset - newdelta*2;
2619 
2620  if ( rmin>=0 && yminset<=0 ) yminset = 0;
2621 
2622  }
2623 
2624  }
2625 
2626  }
2627  else {
2628  if ( yinfo.rangeset() ) {
2629  yminset = yinfo.lo();
2630  ymaxset = yinfo.hi();
2631  }
2632  }
2633 
2634  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2635 
2636  // more useful debugging ...
2637  // std::cout << "yauto: " << yinfo.autoset() << "\tyrange " << yinfo.rangeset() << std::endl;
2638 
2639  // std::cout << "yminset " << yminset << "\tymaxset " << ymaxset << std::endl;
2640 
2641  if ( yinfo.autoset() && yinfo.rangeset() ) {
2642 
2643  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2644 
2645  if ( yminset>yinfo.lo() ) yminset = yinfo.lo();
2646  if ( ymaxset<yinfo.hi() ) ymaxset = yinfo.hi();
2647  }
2648 
2649 
2650  if ( contains(histo.name(),"_eff") ) {
2651 
2652  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2653 
2654  if ( effset ) {
2655  ymaxset = effmax;
2656  yminset = effmin;
2657  }
2658  }
2659 
2660  if ( ymaxset!=0 || yminset!=0 ) {
2661 
2662  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2663 
2664  plots.Max( ymaxset );
2665  plots.Min( yminset );
2666  }
2667 
2668  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2669 
2670  if ( yminset!=0 || ymaxset!=0 ) {
2671  if ( yminset>0 ) plots.SetLogy(yinfo.log());
2672  else plots.SetLogy(false);
2673  }
2674  else plots.SetLogy(yinfo.log());
2675 
2676  // plots.SetLogy(false);
2677 
2678  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2679 
2680  // plots.limits();
2681 
2683 
2684  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2685 
2686  plots.Draw( legend );
2687 
2688  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2689 
2690  if ( atlasstyle ) ATLASLabel( xpos, ypositions[0]+deltay, atlaslabel, kBlack, ncolsp, nrowsp );
2691 
2692  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2693 
2694  for ( unsigned it=0 ; it<taglabels.size() ; it++ ) {
2695  DrawLabel( xpos, ypositions[it], taglabels[it], kBlack, 0.04 );
2696  }
2697  }
2698 
2699  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2700 
2701 
2702  if ( ( !nostats || !nomeans ) && !noplots ) {
2703  if ( dochi2 ) for ( unsigned j=0 ; j<Chi2.size() ; j++ ) DrawLabel( 0.75, 0.85-j*0.035, Chi2[j], colours[j%6] );
2704  if ( ( (contains(histo.name(),"_res") ||
2705  contains(histo.name(),"1d") ||
2706  histo.name()=="pT" ||
2707  contains(histo.name(),"residual_") ||
2708  contains(histo.name(),"vs_pt") ) && !contains(histo.name(),"sigma") ) || drawmeans ) {
2709 
2710  if ( contains(histo.name(),"_res") || contains(histo.name(),"residual_") || contains(histo.name(),"1d") || drawresiduals ){
2711  for ( unsigned j=0 ; j<chains.size() ; j++ ) {
2712  if ( !noreftmp ) {
2713  if ( j<MeanRef.size() ) {
2714  if ( !nomeans ) DrawLabel( xpos_original-0.02, (0.67-j*0.035), MeanRef[j], colours[j%6] );
2715  DrawLabel( xpos_original-0.01, (0.67-0.035*chains.size()-j*0.035)-0.01, RMSRef[j], colours[j%6] );
2716  }
2717  }
2718  if ( j<Mean.size() ) {
2719  if ( !nomeans ) DrawLabel( 0.62, (0.67-j*0.035), Mean[j], colours[j%6] );
2720  DrawLabel( 0.62, (0.67-0.035*chains.size()-j*0.035)-0.01, RMS[j], colours[j%6] );
2721  }
2722  }
2723  }
2724  }
2725 
2726  }
2727 
2728  if ( xinfo.log() ) gPad->SetLogx(true);
2729  else gPad->SetLogx(false);
2730 
2731  if ( yinfo.log() ) gPad->SetLogy(true);
2732  else gPad->SetLogy(false);
2733 
2734  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2735 
2736  if ( !noplots ) {
2737 
2738  if ( make_ref_efficiencies ) {
2739 
2740  plots_eff.SetXaxisTitle( plots.GetXaxisTitle() );
2741  plots_eff.SetYaxisTitle( plots.GetYaxisTitle() );
2742 
2743  plots_eff.Draw( legend_eff );
2744  }
2745 
2746  if ( !noreflabel.empty() ) DrawLabel(0.1, 0.06, noreflabel, kRed, 0.03 );
2747 
2748  } // no plots
2749 
2750  }
2751 
2752 
2758 
2759  if ( !noplots ) {
2760 
2761  if ( !quiet ) {
2762 
2763  tc->cd();
2764 
2765  std::string useplotname;
2766 
2767  if ( panel.size()>1 ) {
2768  useplotname = panel.name();
2769  replace( useplotname, '/', '_' );
2770  }
2771  else {
2772  useplotname = plotname;
2773  }
2774 
2775  useplotname.erase( std::remove( useplotname.begin(), useplotname.end(), '+' ), useplotname.end() );
2776 
2777  // std::string printbase = dir+"HLT_"+ppanelname+tag;
2778  std::string printbase = dir + useplotname + tag;
2779 
2780  tc->Update();
2781 
2782  if ( !nopdf ) print_pad( printbase+".pdf" );
2783  if ( !nopng ) print_pad( printbase+".png" );
2784  if ( Cfile ) print_pad( printbase+".C" );
2785 
2786  std::cout << std::endl;
2787  }
2788 
2789  }
2790 
2791  if ( tc ) delete tc;
2792 
2793  }
2794 
2795 
2796  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2797 
2799 
2800 
2802  bool files_duplicated = ( fref_==ftest_ );
2803 
2804  if ( deleteref && !files_duplicated ) {
2805 
2806  if ( fref_ ) {
2807 
2809 
2810  std::cout << "main() cleaning up reference file" << std::endl;
2811 
2812  TFile* newout = new TFile(".newout.root","recreate");
2813  newout->cd();
2814 
2816  copyReleaseInfo( fref, newout );
2817 
2818  TDirectory* base = gDirectory;
2819 
2820  for ( unsigned i=0 ; i<savedhistos.size() ; i++ ) {
2821 
2823  // std::cout << i << " " << savedhistos[i] << std::endl;
2824 
2825  std::vector<std::string> dirs = AxisInfo::split( savedhistos[i], "/" );
2826 
2827  for ( unsigned j=0 ; j<dirs.size()-1 ; j++ ) {
2828  std::cout << "\t" << dirs[j] << std::endl;
2829  TDirectory* renedir = gDirectory->GetDirectory( dirs[j].c_str() );
2830  if ( renedir==0 ) gDirectory->mkdir( dirs[j].c_str() );
2831  gDirectory->cd( dirs[j].c_str() );
2832  }
2833 
2834 
2835  TH1* href = (TH1*)fref->Get( savedhistos[i].c_str() );
2836  if ( !noreftmp && href ) {
2837  std::cout << i << " " << savedhistos[i] << " 0x" << href << std::endl;
2838  href->Write( dirs.back().c_str() );
2839  }
2840 
2841 
2842  base->cd();
2843  }
2844 
2845  newout->Close();
2846 
2847  }
2848  }
2849 
2850 
2851  if ( fulldbg ) std::cout << __LINE__ << std::endl;
2852 
2854 
2855  if ( fref_ && !files_duplicated ) fref_->Close();
2856  if ( ftest_ ) ftest_->Close();
2857 
2859 
2860  if ( deleteref && !noref ) {
2861  std::cout << "ref " << frefname << "\ttest " << ftestname << std::endl;
2862  if ( frefname != ftestname && !files_duplicated ) {
2863  std::string cmd = std::string("mv ") + frefname + " " + frefname + ".bak";
2864  std::system( cmd.c_str() );
2865 
2866  cmd = std::string("mv .newout.root ") + std::string(frefname);
2867  std::system( cmd.c_str() );
2868  }
2869  else {
2870  std::cerr << "reference file and test file are the same - not replacing" << std::endl;
2871  }
2872  }
2873 
2874  // std::cout << "deleting " << __LINE__ << std::endl;
2875 
2876  if ( fref_ && !files_duplicated ) delete fref_;
2877  if ( ftest_ ) delete ftest_;
2878 
2879  return 0;
2880 }

◆ normy()

void normy ( TH2 *  h)

zero the contents of a 2d histogram

Definition at line 451 of file comparitor.cxx.

451  {
452  int Nx = h->GetNbinsX();
453  int Ny = h->GetNbinsY();
454  for ( int i=1 ; i<=Nx ; i++ ) {
455  double n = 0;
456  for ( int j=1 ; j<=Ny ; j++ ) n += h->GetBinContent(i,j);
457  if ( n>0 ) for ( int j=1 ; j<=Ny ; j++ ) h->SetBinContent( i, j, h->GetBinContent(i,j)/n );
458  }
459 }

◆ print_pad()

void print_pad ( const std::string &  s)

Definition at line 428 of file comparitor.cxx.

428  {
429  std::cout << "Printing " << s << std::endl;
430  gPad->Print( s.c_str() );
431 }

◆ Rebin()

TH1F* Rebin ( TH1F *  h,
double  f 
)

Definition at line 86 of file comparitor.cxx.

86  {
87 
88  std::cout << "\nREBIN: " << h->GetName() << " :: " << f << std::endl;
89 
90  if ( int(f) == f ) {
91  TH1F* n = (TH1F*)h->Clone("foeda"); n->SetDirectory(0);
92  n->Rebin(int(f));
93  return n;
94  }
95 
96  int fi=int(f);
97  double fb=(f-fi);
98 
99  for ( int i=0 ; i<10 ; i++ ) {
100  fb *= 10;
101  if ( std::fabs(int(fb)-fb)<1e-6 ) break;
102  }
103 
104  std::vector<double> limits;
105  std::vector<double> contents;
106 
107  for ( int i=1 ; i<=h->GetNbinsX()+1 ; i++ ) {
108  limits.push_back( h->GetBinLowEdge(i) );
109  contents.push_back( h->GetBinContent(i) );
110  if ( i<fb ) {
111  for ( int ib=1 ; ib<fi ; ib++ ) contents.back() += h->GetBinContent(++i);
112  }
113  }
114 
115  TH1F* n = new TH1F( "foeda", h->GetTitle(), limits.size()-1, &limits[0] ); n->SetDirectory(0);
116 
117  for ( size_t i=0 ; i<contents.size() ; i++ ) n->SetBinContent( i+1, contents[i] );
118 
119  return n;
120 }

◆ rebin_log()

TH1F* rebin_log ( TH1F *  h,
bool  low = false 
)

Definition at line 125 of file comparitor.cxx.

125  {
126 
127  double limits[40] = {
128  0.5, 1.5, 2.5, 3.5, 4.5,
129  5.5, 6.5, 7.5, 8.5, 9.5,
130  10.5, 11.5, 12.5, 13.5, 14.5,
131  15.5, 16.5, 17.5, 18.5, 19.5,
132  20.5, 21.5, 22.5, 23.5, 24.5,
133  25.5, 26.5, 28.5, 30.5, 32.5,
134  35.5, 38.5, 42.5, 46.5, 50.5,
135  55.5, 60.5, 66.5, 72.5, 78.5
136  };
137 
138  double lowlimits[24] = {
139  0.5, 1.5, 2.5, 3.5, 4.5,
140  5.5, 6.5, 7.5, 8.5, 9.5,
141  10.5, 11.5, 12.5, 14.5, 17.5,
142  20.5, 24.5, 29.5, 35.5, 42.5,
143  50.5, 60.5, 72.5, 86.5,
144  };
145 
146  TH1F* n;
147 
148  if ( low ) n = new TH1F( "foeda", h->GetTitle(), 39, limits );
149  else n = new TH1F( "foeda", h->GetTitle(), 23, lowlimits );
150 
151  n->SetDirectory(0);
152 
153  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
154  n->Fill( h->GetBinCenter(i), h->GetBinContent(i) );
155  }
156 
157 
158  for ( int i=1 ; i<=n->GetNbinsX() ; i++ ) {
159  n->SetBinError(i, std::sqrt( n->GetBinContent(i) ) );
160  }
161 
162  return n;
163 }

◆ Scale()

void Scale ( TH1 *  h,
double  d = 1 
)

Definition at line 77 of file comparitor.cxx.

77  {
78  if ( d==1 ) return;
79  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
80  h->SetBinContent( i, h->GetBinContent(i)*d );
81  h->SetBinError( i, h->GetBinError(i)*d );
82  }
83 }

◆ SetZeros()

void SetZeros ( TH2D *  h)

Definition at line 68 of file comparitor.cxx.

68  {
69  for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) {
70  for ( int j=1 ; j<=h->GetNbinsY() ; j++ ) {
71  int ibin = h->GetBin( i, j );
72  if ( h->GetBinContent(ibin)==0 ) h->SetBinContent(ibin, 0.1);
73  }
74  }
75 }

◆ usage()

int usage ( const std::string &  name,
int  status,
const std::string &  err_msg = "" 
)

Definition at line 333 of file comparitor.cxx.

333  {
334  if ( err_msg != "" ) std::cerr << err_msg << "\n" << std::endl;
335  std::ostream& s = std::cout;
336  s << "Usage: " << name << "\t [OPTIONS] test.root reference.root chain1 chain2 chain2 ...\n\n";
337  s << "\t" << " plots comparison histograms";
338  s << " - compiled on " << __DATE__ << " at " << __TIME__ << "\n\n";
339  s << "Options: \n";
340  s << " -c, --config value \t configure which histograms to plot from config file,\n\n";
341  s << " -t, --tag value \t appends tag 'value' to the end of output plot names, \n";
342  s << " -k, --key value \t prepends key 'value' to the front of output plots name, \n";
343  s << " -t, --tag value \t post pend tag 'value' to the end of output plots name, \n";
344  s << " -d, --dir value \t creates output files into directory, \"value\" \n\n";
345  s << " --ncols value \t creates panels with \"value\" columns\n\n";
346 
347  s << " -e, --efficiencies \t make test efficiencies with respect to reference \n";
348  s << " -es, --effscale value \t scale efficiencies to value\n";
349  s << " -er, --effscaleref value \t scale reference efficiencies to value\n";
350  s << " -nb --nobayes \t do not calculate Basyesian efficiency uncertaintiesr\n\n";
351 
352  s << " -r, --refit \t refit all test resplots\n";
353  s << " -rr, --refitref \t also refit all reference resplots\n";
354  s << " --oldrms \t use fast rms95 when refitting resplots\n\n";
355 
356  s << " -as, --atlasstyle \t use ATLAS style\n";
357  s << " -l, --labels values\t use specified labels for key\n";
358  s << " --taglabels values\t use specified additional labels \n";
359  s << " -al, --atlaslable value \t set value for atlas label\n";
360  s << " -sx, --swapaxtitles exp pattern\t swap the expression \"exp \" in the axis titles with \"pattern\"\n";
361  s << " -ac, --addchains \t if possible, add chain names histogram labels \n\n";
362 
363  s << " -m, --mapfile \t remap file for reference histograms \n\n";
364 
365  s << " -rc, --refchains values ..\t allow different reference chains for comparison\n";
366  s << " -s, --swap pattern regex \t swap \"pattern\" in the chain names by \"regex\"\n";
367  s << " --swapr pattern regex \t swap \"pattern\" in the ref chain names by \"regex\"\n";
368  s << " --swapt pattern regex \t swap \"pattern\" in the test chain names by \"regex\"\n";
369  s << " -nr, --noref \t do not plot reference histograms\n";
370  s << " --normref \t normalise the reference counting histograms to test histograms\n";
371  s << " -us, --usechainref \t use the histograms from chain definied in the \"Chain\" histogram as reference\n\n";
372 
373  s << " -ns, --nostats \t do not show stats for mean and rms\n";
374  s << " -nm, --nomeans \t do not show stats for the means\n";
375  s << " --chi2 \t show the chi2 with respect to the reference\n\n";
376 
377  s << " -np, --noplots \t do not actually make any plot\n";
378  s << " -q, --quiet \t make the plots but do not print them out\n\n";
379 
380  s << " --unscalepix \t do not scale the number of pixels by 0.5 (unscaled by default)\n";
381  s << " --scalepix \t do scale the number of pixels by 0.5 (unscaled by default)\n";
382  s << " --yrange min max \t use specified y axis range\n";
383  s << " -xo, --xoffset value \t relative x offset for the key\n";
384  s << " -yp, --ypos value \t relative yposition for the key\n";
385  s << " -xe, --xerror value \t size of the x error tick marks\n";
386  s << " -nw, --nowatermark \t do not plot the release watermark\n\n";
387 
388  s << " -C, --Cfiles \t write C files also\n";
389  s << " --nopng \t do not print png files\n";
390  s << " --nopdf \t do not print pdf files\n";
391  s << " --deleteref \t delete unused reference histograms\n\n";
392 
393  s << " --printconfig \t print the configuration being used in the form useable as an input file\n\n";
394 
395  s << " -h, --help \t this help\n";
396  // s << "\nSee " << PACKAGE_URL << " for more details\n";
397  // s << "\nReport bugs to <" << PACKAGE_BUGREPORT << ">";
398  s << std::endl;
399  return status;
400 }

◆ zero()

void zero ( TH2 *  h)

zero the contents of a 2d histogram

Definition at line 436 of file comparitor.cxx.

436  {
437  int Nx = h->GetNbinsX();
438  int Ny = h->GetNbinsY();
439  for ( int i=1 ; i<=Nx ; i++ ) {
440  for ( int j=1 ; j<=Ny ; j++ ) {
441  if ( h->GetBinContent( i, j )==0 ) {
442  h->SetBinContent( i, j, 1e-10 );
443  h->SetBinError( i, j, 1e-10 );
444  }
445  }
446  }
447 }

Variable Documentation

◆ colours

int colours[6]

Definition at line 45 of file computils.cxx.

◆ fulldbg

bool fulldbg = false

Definition at line 57 of file comparitor.cxx.

◆ LINEF

bool LINEF

Definition at line 39 of file computils.cxx.

◆ LINES

bool LINES

Definition at line 40 of file computils.cxx.

◆ markers

int markers[6]

Definition at line 46 of file computils.cxx.

xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Rebin
TH1F * Rebin(TH1F *h, double f)
Definition: comparitor.cxx:86
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:451
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
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:403
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
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SetZeros
void SetZeros(TH2D *h)
Definition: comparitor.cxx:68
usage
int usage(const std::string &name, int status, const std::string &err_msg="")
Definition: comparitor.cxx:333
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
AxisInfo::autoset
bool autoset() const
Definition: computils.h:250
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
dirname
std::string dirname(std::string name)
Definition: utils.cxx:200
Resplot::setoldrms95
static bool setoldrms95(bool b)
Definition: Resplot.h:553
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
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:273
Panel::size
size_t size() const
Definition: computils.h:1344
print_pad
void print_pad(const std::string &s)
Definition: comparitor.cxx:428
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
DrawLabel
int DrawLabel(float xstart, float ystart, string label)
Definition: GraphToolKit.h:13
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
IDTPMcnv.href
href
Definition: IDTPMcnv.py:30
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
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:463
Panel::name
const std::string & name() const
Definition: computils.h:1342
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:179
fulldbg
bool fulldbg
Definition: comparitor.cxx:57
tPlotter::setplotref
static void setplotref(bool b)
Definition: computils.h:859
WritePulseShapeToCool.xhi
xhi
Definition: WritePulseShapeToCool.py:152
autoy
void autoy(TH2 *h)
get the auto y range of a 2d histogram
Definition: comparitor.cxx:493
ReadCards
Get tag-value pairs from a file.
Definition: ReadCards.h:50
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
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:523
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
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:233
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:77
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
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:220
python.handimod.Red
Red
Definition: handimod.py:551
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
LArSamples::AtlasStyle
@ AtlasStyle
Definition: ShapeDrawer.h:22
fullreplace
std::string fullreplace(std::string s, const std::string &s2, const std::string &s3)
Definition: comparitor.cxx:421
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
copyReleaseInfo
void copyReleaseInfo(TFile *finput, TFile *foutdir)
copy the release info TTree
Definition: computils.cxx:619
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
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:125
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
covarianceTool.plots
plots
Definition: covarianceTool.py:698
checkFileSG.fi
fi
Definition: checkFileSG.py:65
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
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
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
colours
int colours[6]
Definition: computils.cxx:45
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
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
LArMonTransforms.Mean
def Mean(inputs)
Definition: LArMonTransforms.py:438
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
python.trfValidateRootFile.rc
rc
Definition: trfValidateRootFile.py:358
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:171
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
beamspotman.basename
basename
Definition: beamspotman.py:640