33#include "TGraphAsymmErrors.h"
45void band_plot( TH1*
h,
double xlo,
double xhi,
double ylo=-999,
double yhi=-999 );
49void myText( Double_t
x, Double_t
y, Color_t
color,
const std::string& text, Double_t tsize);
58void Norm( TH1*
h,
double scale=1,
double xmin=0,
double xmax=0 );
63bool contains(
const std::string& s,
const std::string& p);
64bool contains(
const std::string& s,
char p)
noexcept;
67bool fcontains(
const std::string& s,
const std::string& p);
70bool exists(
const std::string& filename );
73std::string
tail( std::string s,
const std::string& pattern );
76std::string
head( std::string s,
const std::string& pattern );
79std::string
globbed(
const std::string& s );
81void contents( std::vector<std::string>& keys,
83 const std::string& directory=
"",
84 const std::string& pattern=
"",
85 const std::string& path=
"" );
87void contents( std::vector<std::string>& keys,
89 const std::string& directory=
"",
90 const std::vector<std::string>&
patterns=std::vector<std::string>(),
91 const std::string& path=
"" );
94double realmax( TH1*
h,
bool include_error=
true,
double lo=0,
double hi=0 );
95double realmin( TH1*
h,
bool include_error=
true,
double lo=0,
double hi=0 );
97std::string
findcell( std::string name,
const std::string& regex,
const std::string& splitex=
"/" );
107 virtual const char*
what()
const throw() {
return "data don't match"; }
113std::ostream&
operator<<( std::ostream& s, std::vector<T>& v) {
114 for (
unsigned i=0 ; i<v.size() ; i++ ) s <<
"\t" << v[i];
120std::vector<int>
findxrange(TH1*
h,
bool symmetric=
false );
128void xrange(TH1*
h,
bool symmetric=
true );
180 std::vector<std::string> keys =
split( s,
":" );
184 if ( keys.size()>0 )
m_tag = keys[0];
189 for (
size_t i=1 ; i<keys.size() ; i++ ) {
191 if ( keys[i]==
"lin" )
m_log =
false;
192 else if ( keys[i]==
"log" )
m_log =
true;
194 else if ( keys[i]==
"norm" )
m_norm =
true;
195 else if ( keys[i]==
"refn" )
m_refnorm =
true;
196 else if ( keys[i]==
"width" )
m_binwidth =
true;
197 else if ( keys[i]==
"auto" )
m_autoset =
true;
198 else if ( keys[i]==
"trim" )
m_trim =
true;
200 else if ( keys[i].
find(
"offset")==0 ) {
202 std::cout <<
"offset:" << std::endl;
203 std::cout <<
"\tkey: " << keys[i] << std::endl;
204 std::cout <<
"\tpos: " << keys[i].find(
"offset") << std::endl;
206 std::string
offset = keys[i];
209 std::cout <<
"m_offset: " <<
m_offset << std::endl;
211 else if ( keys[i]==
"auton" ) {
215 else if ( keys[i]==
"autow" ) {
219 else if ( keys[i]==
"autown" || keys[i]==
"autonw" ) {
224 else if ( keys[i]==
"autosym" ) {
228 else if ( keys[i]==
"normw" || keys[i]==
"widthn" ) {
232 else if ( !minset ) {
235 if ( i<keys.size() )
m_hi = std::atof(keys[i].
c_str());
237 std::cerr <<
"not enough values for the axis range: " << s << std::endl;
247 std::cout <<
"AxisInfo::info" <<
m_info <<
"\n";
248 std::cout <<
"\tlog " <<
m_log <<
"\n";
249 std::cout <<
"\tauto " <<
m_autoset <<
"\n";
291 static std::vector<std::string>
split(
const std::string& s,
const std::string& t=
":" ) {
294 size_t pos =
sc.find(t);
296 std::vector<std::string>
tags;
298 while ( pos!=std::string::npos ) {
336 s <<
"[ " <<
a.tag() << (
a.log() ?
" : log" :
"" ) <<
" ";
337 if (
a.autoset() ) s <<
" : auto";
338 else if (
a.rangeset() ) s <<
" : range " <<
a.lo() <<
" - " <<
a.hi();
361 Legend(
double x1,
double x2,
double y1,
double y2):
m_leg(nullptr) {
391 void AddEntry( TObject* tobj,
const std::string& s,
const std::string&
type=
"p" ) {
392 m_obj.push_back( tobj );
415 m_leg->SetBorderSize(0);
416 m_leg->SetTextFont(42);
417 m_leg->SetTextSize(0.04);
418 m_leg->SetFillStyle(3000);
419 m_leg->SetFillColor(0);
420 m_leg->SetLineColor(0);
423 for (
size_t i=0 ; i<
m_entries.size() ; i++ ) {
452 tg->SetLineColor(
h->GetLineColor() );
453 tg->SetMarkerColor(
h->GetMarkerColor() );
454 tg->SetMarkerStyle(
h->GetMarkerStyle() );
455 tg->SetMarkerSize(
h->GetMarkerSize() );
456 tg->SetLineWidth(
h->GetLineWidth() );
457 tg->SetLineStyle(
h->GetLineStyle() );
477 tPlotter(T* fo_htest=0, T* fo_href=0,
const std::string& s=
"", TGraphAsymmErrors* fo_tgtest=0, TGraphAsymmErrors* fo_tgref=0 ) :
526 void Draw(
int i,
Legend* lleg,
bool mean=
false,
bool first=
true,
bool drawlegend=
false ) {
528 std::cout <<
"Draw " << __LINE__ << std::endl;
538 gStyle->SetOptStat(0);
546 double lo =
htest()->GetBinLowEdge(1);
547 double hi =
htest()->GetBinLowEdge(
htest()->GetNbinsX()+1);
549 std::cout <<
"aes lo: " << lo << std::endl;
550 std::cout <<
"ase hi: " << hi << std::endl;
552 std::cout <<
"ase m_lo: " <<
m_lo << std::endl;
553 std::cout <<
"ase m_hi: " <<
m_hi << std::endl;
557 std::cout <<
"xaxis: " << *
m_xaxis << std::endl;
558 std::cout <<
"xaxis: lo; " <<
m_xaxis->m_lo << std::endl;
559 std::cout <<
"xaxis: hi: " <<
m_xaxis->m_hi << std::endl;
579 std::cout <<
"hist lo: " << lo << std::endl;
580 std::cout <<
"hist hi: " << hi << std::endl;
582 TH1D* hnull =
new TH1D(
"hnull",
htest()->GetTitle(), 100, lo, hi );
583 hnull->SetDirectory(0);
585 hnull->SetMaximum(
htest()->GetMaximum());
586 hnull->SetMinimum(
htest()->GetMinimum());
587 hnull->GetXaxis()->SetMoreLogLabels(
true);
589 hnull->GetXaxis()->SetTitle(
htest()->GetXaxis()->GetTitle());
590 hnull->GetYaxis()->SetTitle(
htest()->GetYaxis()->GetTitle());
592 for (
int ib=1 ; ib<101 ; ib++ ) hnull->SetBinContent(ib, hnull->GetMinimum()-1e10);
596 std::cout <<
htest()->GetTitle() << std::endl;
597 std::cout << hnull->GetXaxis()->GetTitle() << std::endl;
598 std::cout << hnull->GetYaxis()->GetTitle() << std::endl;
606 href()->SetLineStyle(2);
607 href()->SetMarkerStyle(0);
613 if (
contains( std::string(
htest()->GetName()),
"vs_mu") )
htest()->GetXaxis()->SetRangeUser( 18, 58 );
614 if (
contains( std::string(
htest()->GetName()),
"a0_eff") )
htest()->GetXaxis()->SetRangeUser( -200, 200 );
616 std::cout <<
"TEST: " <<
htest()->GetName() <<
" " <<
mc() <<
"\t" << std::endl;
619 htest()->SetLineStyle(1);
630 std::cout << std::endl;
639 TH1F*
h = (TH1F*)
htest()->Clone(
"h");
h->SetDirectory(0);
642 h->GetXaxis()->SetMoreLogLabels(
true);
646 TH1D* hnull = nrew TH1D(
"hnull",
"", 100,
m_xlo,
m_xhi );
647 hnull->SetMinimum(
h->GetMinimum() );
648 hnull->SetMaximum(
h->GetMaximum() );
649 hnull->SetTitle(
h->GetTitle() );
658 if (
LINES )
h->Draw(
"lhistsame");
664 std::cout <<
"shte lo: " <<
m_lo << std::endl;
665 std::cout <<
"shte hi: " <<
m_hi << std::endl;
668 htest()->GetXaxis()->SetMoreLogLabels(
true);
683 std::cout <<
"cck lo: " <<
m_lo << std::endl;
684 std::cout <<
"cck hi: " <<
m_hi << std::endl;
686 htest()->GetXaxis()->SetMoreLogLabels(
true);
702 else href()->Draw(
"hist same");
717 if (
htest()->GetMarkerStyle()>23 ) {
718 TH1D* hnull = (TH1D*)
htest()->Clone(
"duff"); hnull->SetDirectory(0);
720 hnull->SetLineColor(kWhite);
721 hnull->SetMarkerStyle(
htest()->GetMarkerStyle()-4 );
723 hnull->SetMarkerColor(kWhite);
724 hnull->SetMarkerSize(
htest()->GetMarkerSize()*0.75 );
726 hnull->DrawCopy(
"l same");
728 std::cout <<
"cnt lo: " <<
m_lo << std::endl;
729 std::cout <<
"cnt hi: " <<
m_hi << std::endl;
736 std::cout <<
"TEST MC: " <<
htest()->GetName() <<
" " <<
mc() << std::endl;
740 TList* ccklist =
h->GetListOfFunctions();
742 size_t tlsize = ccklist->GetSize();
744 std::cout <<
"tlsize: " << tlsize << std::endl;
747 for (
size_t icck=0 ; icck<tlsize ; icck++ ) {
748 std::cout <<
"tlist: " << icck <<
" " << ccklist->At(icck)->GetName() << std::endl;
750 TF1* cck = (TF1*)ccklist->At(icck);
752 cck->SetLineColor(
htest()->GetLineColor());
754 if ( std::string(cck->GetName()) ==
"sinus" ) {
755 phibeam = cck->GetParameter(1);
756 xbeam = cck->GetParameter(0)*cos(phibeam);
757 ybeam = cck->GetParameter(0)*sin(phibeam);
758 offbeam = cck->GetParameter(2);
760 std::cout <<
"phi = " << phibeam
762 <<
" mm\ny = " << ybeam
763 <<
" mm\noff = " << offbeam <<
" mm" << std::endl;
774 std::cout <<
"TEST mtype " <<
htest()->GetMarkerStyle() <<
" " <<
htest()->GetMarkerColor() << std::endl;
776 if (
contains( std::string(
h->GetName()),
"a0_eff") ) {
780 std::cout <<
"STUFF" << std::endl;
783 for (
int i=0 ; i<
h->GetNbinsX() ; i++ ) {
784 if (
h->GetBinCenter(i)<-200 ) {
785 h->SetBinContent(i,0);
791 htest()->Draw(
"ep same");
797 std::cout <<
"colour: " <<
htest()->GetMarkerColor() << std::endl;
801 htest()->SetFillStyle(455);
802 htest()->SetFillColor(
htest()->GetMarkerColor());
803 htest()->SetMarkerStyle(0);
807 if (
contains( std::string(
h->GetName()),
"vs_mu") )
h->GetXaxis()->SetRangeUser( 18, 58 );
808 if (
contains( std::string(
h->GetName()),
"a0_eff") ) {
809 h->GetXaxis()->SetRangeUser( -200,200 );
811 std::cout <<
"STUFF" << std::endl;
813 for (
int i=0 ; i<
h->GetNbinsX() ; i++ ) {
814 if (
h->GetBinCenter(i)<-200 ) {
815 h->SetBinContent(i,0);
822 htest()->Draw(
"e3lhistsame");
832 static TH1D* hnull =
new TH1D(
"hnull",
"", 1, 0, 1);
833 hnull->SetMarkerColor(kWhite);
834 hnull->SetLineColor(kWhite);
835 hnull->SetMarkerStyle(0);
836 hnull->SetLineStyle(0);
837 hnull->SetLineWidth(0);
838 hnull->SetMarkerSize(0);
848 bool displayref =
false;
852 std::snprintf( meanrefc, 64,
" <t> = %3.2f #pm %3.2f ms (ref)", muref.
mean(), muref.
error() );
855 std::snprintf( meanrefc, 64,
"%s",
"" );
860 std::snprintf( meanc, 64,
" <t> = %3.2f #pm %3.2f ms", mutest.
mean(), mutest.
error() );
862 std::string dkey = key;
864 std::string remove[7] = {
"TIME_",
"Time_",
"All_",
"Algorithm_",
"Class_",
"HLT_",
"Chain_HLT_" };
866 if ( dkey.find(
"Chain")!=std::string::npos ) {
867 if ( dkey.find(
"__")!=std::string::npos ) dkey.erase( 0, dkey.find(
"__")+2 );
871 for (
int ir=0 ;
ir<7 ;
ir++ ) {
872 if ( dkey.find( remove[
ir] )!=std::string::npos ) dkey.erase( dkey.find( remove[
ir]), remove[
ir].size() );
875 std::string rkey = dkey;
879 dkey += std::string(
" : ");
881 if ( (dkey+meanc).
size()>58 ) {
882 leg.AddEntry(
htest(), dkey,
"p" );
883 leg.AddEntry( hnull, meanc,
"p" );
886 leg.AddEntry(
htest(), (dkey+meanc).c_str(),
"p" );
890 rkey += std::string(
" : ");
894 if ( (rkey+meanrefc).
size()>58 ) {
895 leg.AddEntry(
href(), rkey,
"l" );
896 leg.AddEntry( hnull, meanrefc,
"l" );
899 leg.AddEntry(
href(), (rkey+meanrefc).c_str(),
"l" );
916 if ( drawlegend ) leg.Draw();
919 if ( xbeam!=0 || ybeam!=0 ) {
922 DrawLabel( 0.19, 0.20+i*0.045,
label(
"x =%6.3lf mm y =%6.3lf mm off =%6.3lf mm", xbeam, ybeam, offbeam, 0 ),
htest()->GetLineColor() );
940 gStyle->SetOptStat(0);
943 href()->SetLineStyle(2);
944 href()->SetMarkerStyle(0);
948 htest()->SetLineStyle(1);
953 std::cout << std::endl;
959 htest()->GetXaxis()->SetMoreLogLabels(
true);
969 htest()->GetXaxis()->SetMoreLogLabels(
true);
985 else href()->Draw(
"hist same");
1002 if (
htest()->GetMarkerStyle()>23 ) {
1003 TH1D* hnull = (TH1D*)
htest()->Clone(
"duff"); hnull->SetDirectory(0);
1005 hnull->SetLineColor(kWhite);
1006 hnull->SetMarkerStyle(
htest()->GetMarkerStyle()-4 );
1008 hnull->SetMarkerColor(kWhite);
1009 hnull->SetMarkerSize(
htest()->GetMarkerSize()*0.75 );
1011 hnull->DrawCopy(
"l same");
1024 static TH1D* hnull =
new TH1D(
"hnull",
"", 1, 0, 1);
1025 hnull->SetMarkerColor(kWhite);
1026 hnull->SetLineColor(kWhite);
1027 hnull->SetMarkerStyle(0);
1028 hnull->SetLineStyle(0);
1029 hnull->SetLineWidth(0);
1030 hnull->SetMarkerSize(0);
1036 bool displayref =
false;
1040 std::sprintf( meanrefc,
" <t> = %3.2f #pm %3.2f ms (ref)", muref.
mean(), muref.
error() );
1043 std::sprintf( meanrefc,
"%s",
"" );
1049 std::sprintf( meanc,
" <t> = %3.2f #pm %3.2f ms", mutest.
mean(), mutest.
error() );
1051 std::string dkey = key;
1053 std::string remove[7] = {
"TIME_",
"Time_",
"All_",
"Algorithm_",
"Class_",
"HLT_",
"Chain_HLT_" };
1055 if ( dkey.find(
"Chain")!=std::string::npos ) {
1056 if ( dkey.find(
"__")!=std::string::npos ) dkey.erase( 0, dkey.find(
"__")+2 );
1060 for (
int ir=0 ;
ir<7 ;
ir++ ) {
1061 if ( dkey.find( remove[
ir] )!=std::string::npos ) dkey.erase( dkey.find( remove[
ir]), remove[
ir].size() );
1064 std::string rkey = dkey;
1068 dkey += std::string(
" : ");
1070 if ( (dkey+meanc).
size()>58 ) {
1071 leg.AddEntry(
htest(), dkey,
"p" );
1072 leg.AddEntry( hnull, meanc,
"p" );
1075 leg.AddEntry(
htest(), (dkey+meanc).c_str(),
"p" );
1079 rkey += std::string(
" : ");
1082 if ( (rkey+meanrefc).
size()>58 ) {
1083 leg.AddEntry(
href(), rkey,
"l" );
1084 leg.AddEntry( hnull, meanrefc,
"l" );
1087 leg.AddEntry(
href(), (rkey+meanrefc).c_str(),
"l" );
1104 if ( drawlegend ) leg.Draw();
1113 if ( s!=
"" ) gPad->Print(s.c_str());
1191 std::cout << __FUNCTION__ << std::endl;
1192 for (
int i=1 ; i<=
h->GetNbinsX() ; i++ ) {
1193 double duff =
h->GetBinContent(i);
1195 std::cout<<
"\t\t" << __FUNCTION__ <<
" " <<
h->GetName() <<
" " << i <<
" " <<
h->GetBinContent(i) <<
" " << (duff*1e6) << std::endl;
1199 gPad->Print( (std::string(
"duff-")+
h->GetName()+
".pdf").c_str() );
1204class Plots :
public std::vector<Plotter> {
1208 Plots(
const std::string& s=
"",
bool errors=
false ) :
1221 for (
unsigned i=0 ; i<
size() ; i++ ) {
1223 if ( rmtest!=0 && ( first ||
min>rmtest ) )
min = rmtest;
1224 if ( rmtest!=0 ) first =
false;
1232 for (
unsigned i=0 ; i<
size() ; i++ ) {
1235 if ( rmtest!=0 && ( first ||
max<rmtest ) )
max = rmtest;
1236 if ( rmtest!=0 ) first =
false;
1245 if (
size()<1 )
return;
1254 for (
unsigned i=0 ; i<
size() ; i++ ) {
1255 if ( at(i).href() ) at(i).href()->SetMaximum(scale*tmax);
1256 at(i).htest()->SetMaximum(scale*tmax);
1264 if (
size()<1 )
return;
1267 for (
unsigned i=0 ; i<
size() ; i++ ) {
1268 if ( at(i).href() ) at(i).href()->SetMinimum(0);
1269 at(i).htest()->SetMinimum(0);
1282 for (
unsigned i=0 ; i<
size() ; i++ ) {
1283 if ( at(i).href() ) at(i).href()->SetMinimum(scale*tmin);
1284 at(i).htest()->SetMinimum(scale*tmin);
1291 for (
unsigned i=0 ; i<
size() ; i++ ) {
1292 if ( at(i).href() ) at(i).href()->SetMinimum(scale);
1293 at(i).htest()->SetMinimum(scale);
1295 if ( at(i).href() )
if ( at(i).href()->GetMinimum()<=0 ) at(i).href()->GetMinimum(1e-4);
1296 if ( at(i).htest()->GetMinimum()<=0 ) at(i).htest()->GetMinimum(1e-4);
1304 for (
unsigned i=0 ; i<
size() ; i++ ) {
1305 if ( at(i).href() ) at(i).href()->SetMaximum(scale);
1306 at(i).htest()->SetMaximum(scale);
1315 std::vector<double> v(2,0);
1317 TH1F* hf = at(0).htest();
1322 if ( hf->GetBinLowEdge(1)<vlo ) vlo = hf->GetBinLowEdge(1);
1323 if ( hf->GetBinLowEdge(hf->GetNbinsX()+1)>vhi ) vhi = hf->GetBinLowEdge( hf->GetNbinsX()+1 );
1329 for (
unsigned i=1 ; i<
size() ; i++ ) {
1333 if (
::empty( hf ) )
continue;
1335 if ( hf->GetBinLowEdge(1)<vlo ) vlo = hf->GetBinLowEdge(1);
1336 if ( hf->GetBinLowEdge(hf->GetNbinsX()+1)>vhi ) vhi = hf->GetBinLowEdge( hf->GetNbinsX()+1 );
1348 if ( v[0]>
lo ) v[0] =
lo;
1349 if ( v[1]<
hi ) v[1] =
hi;
1355 double upper = ( v[1]-v[0] )*1.1 + v[0];
1356 double lower = v[0] - ( v[1]-v[0] )*0.1;
1359 double dx = std::log10(v[1])-std::log10(v[0]);
1360 upper = std::pow(10,dx*1.1 + std::log10(v[0]));
1361 lower = std::pow(10,std::log10(v[0]) - dx*0.1);
1364 if ( lower<vlo ) lower = vlo;
1378 std::cout <<
"xr1: " << xinfo << std::endl;
1386 std::cout <<
"xr2: " << xinfo << std::endl;
1391 std::cout <<
"xr3: " << xinfo << std::endl;
1396 else if (
size() == 0)
1398 std::cout<<
"Warning in computils.h::sortx() size=0. Setting m_lo/m_hi to 0/1. You will probably have empty figures."<<std::endl;
1418 for (
unsigned i=0 ; i<
size() ; i++ ) {
1419 if ( at(i).href() )
::xrange( at(i).href(), symmetric );
1420 ::xrange( at(i).htest(), symmetric );
1428 for (
unsigned i=0 ; i<
size() ; i++ ) {
1429 if ( at(i).href() ) at(i).href()->GetXaxis()->SetRangeUser(
m_lo,
m_hi );
1430 at(i).htest()->GetXaxis()->SetRangeUser(
m_lo,
m_hi );
1440 std::cout <<
"\tlimits \t" <<
m_name <<
"\tmin " << rmin <<
"\tmax " << rmax << std::endl;
1461 for (
unsigned i=0 ; i<
size() ; i++, first=false ) {
1462 double ymax = at(i).htest()->GetMaximum();
1463 double ymin = at(i).htest()->GetMinimum();
1464 at(i).htest()->GetYaxis()->SetMoreLogLabels(
true);
1465 if (
ymax/
ymin>1e6 ) at(i).htest()->GetYaxis()->SetMoreLogLabels(
false);
1482 for (
unsigned i=
size() ; i-- ; first=false ) at(i).Draw( i, &leg, means, first, i==0 );
1501 if (
size()>0 )
return at(0).htest()->GetXaxis()->GetTitle();
1506 if (
size()>0 )
return at(0).htest()->GetYaxis()->GetTitle();
1511 if (
size()>0 ) at(0).htest()->GetXaxis()->SetTitle(s.c_str());
1515 if (
size()>0 ) at(0).htest()->GetYaxis()->SetTitle(s.c_str());
1522 std::vector<Plotter>::push_back( val );
1567 if ( v.size()!=6 )
throw std::exception();
1573 template<
typename Iterator>
1575 if (
m_details.size()!=6 )
throw std::exception();
1620 return s <<
"[ " <<
h.name() <<
" \tx: \"" <<
h.xtitle() <<
"\" " <<
h.xaxis() <<
"\t\ty: \"" <<
h.ytitle() <<
"\" " <<
h.yaxis() <<
" ]";
1639 Panel(
const std::string& s,
int nr,
int nc ) :
1651 m_hist.emplace_back( s );
1656 template<
typename Iterator>
1658 m_hist.emplace_back( first, last );
1693 s <<
"Panel: " << p.name();
1694 if ( p.size() == 1 ) s <<
"\t" << p[0];
1695 else for (
size_t i=0 ; i<p.size() ; i++ ) s <<
"\n\t" << p[i];
size_t size() const
Number of registered mappings.
static const Attributes_t empty
Header file for AthHistogramAlgorithm.
class to store information about axes, limits, whether it is log or linear scale etc
AxisInfo & operator=(const AxisInfo &a)=default
AxisInfo(const std::string &s)
static std::vector< std::string > split(const std::string &s, const std::string &t=":")
const std::string & c_str() const
AxisInfo(const AxisInfo &a)=default
const std::string & tag() const
accessors
details of the histogram axes etc
const AxisInfo & xaxis() const
const std::string & info() const
const std::string & ytitle() const
std::vector< std::string > m_details
const std::string & name() const
HistDetails(Iterator first, Iterator last)
const std::string & xtitle() const
HistDetails(const std::vector< std::string > &v)
const std::string & detail() const
const AxisInfo & yaxis() const
slightly more convenient legend class
std::vector< TObject * > m_obj
std::vector< std::string > m_entries
Legend(double x1, double x2, double y1, double y2)
void AddEntry(TObject *tobj, const std::string &s, const std::string &type="p")
Legend(const Legend &legend)
std::vector< std::string > m_type
void push_back(const HistDetails &h)
void push_back(const std::vector< std::string > &s)
Panel(const std::string &s, int nc)
don't know how many rows or total hists yet, but do know number of columns
std::vector< HistDetails > m_hist
const std::string & name() const
HistDetails & operator[](int i)
const HistDetails & operator[](int i) const
Panel(const std::string &s, int nr, int nc)
know number of rows and columns
const HistDetails & back() const
void push_back(Iterator first, Iterator last)
void sortx(const AxisInfo &xinfo)
void xrange(bool symmetric=false)
double realmax(double lo=0, double hi=0)
void Draw_i(Legend &leg, bool means=false)
void SetXaxisTitle(const std::string &s)
void MaxScale(double scale=1.1, double lo=0, double hi=0)
std::vector< double > findxrange(bool symmetric=false)
bool m_maxset
yaxis range setting
void push_back(const Plotter &val)
this is so that we can update the stats as we go along, but no updating isn't done at the moment
Plots(const std::string &s="", bool errors=false)
double realmin(double lo=0, double hi=0)
void Draw(Legend &leg, bool means=false)
std::string GetYaxisTitle()
bool m_logx
canvas log setting
void MinScale(double scale, double lo=0, double hi=0)
bool m_rangeset
xaxis range setting
void SetLogy(bool b=true)
void SetLogx(bool b=true)
void SetYaxisTitle(const std::string &s)
std::string GetXaxisTitle()
void SetRangeUser(double lo, double hi)
static void setwatermark(bool b)
virtual const char * what() const
data_mismatch(const std::string &s)
generic plotter class - better to have one of these - make sure it can be configured however you like...
~tPlotter()
sadly, root manages all the histograms (does it really?
const std::string & plotfilename() const
tPlotter(T *fo_htest=0, T *fo_href=0, const std::string &s="", TGraphAsymmErrors *fo_tgtest=0, TGraphAsymmErrors *fo_tgref=0)
void Draw(int i, Legend *lleg, bool mean=false, bool first=true, bool drawlegend=false)
tPlotter(const tPlotter &p)
void xaxis(const AxisInfo *a)
void DrawLegend(int i, Legend &leg, bool mean=false, bool first=true, bool drawlegend=false)
void SetRange(double lo, double hi)
TGraphAsymmErrors * tgref()
std::string m_plotfilename
static bool s_meanplotref
void Print(const std::string &s="")
print the output
const AxisInfo * yaxis() const
TGraphAsymmErrors * m_tgtest
static void setplotref(bool b)
void yaxis(const AxisInfo *a)
static void setmeanplotref(bool b)
TGraphAsymmErrors * tgtest()
const AxisInfo * xaxis() const
TGraphAsymmErrors * m_tgref
void xrange(TH1 *h, bool symmetric=true)
std::ostream & operator<<(std::ostream &s, std::vector< T > &v)
bool contains(const std::string &s, const std::string &p)
does a string contain the substring
double realmin(TH1 *h, bool include_error=true, double lo=0, double hi=0)
void copyReleaseInfo(TFile *finput, TFile *foutdir)
copy the TTree of release info from one directory to another
void band_plot(TH1 *h, double xlo, double xhi, double ylo=-999, double yhi=-999)
std::string stime()
return the current data and time
void Norm(TH1 *h, double scale=1, double xmin=0, double xmax=0)
std::string globbed(const std::string &s)
match a file name
std::string findcell(std::string name, const std::string ®ex, const std::string &splitex="/")
std::string findrun(TFile *f)
void ATLASFORAPP_LABEL(double x, double y, int color, double size=0.06)
bool exists(const std::string &filename)
does a file exist
std::string tail(std::string s, const std::string &pattern)
tail of a string
void contents(std::vector< std::string > &keys, TDirectory *td, const std::string &directory="", const std::string &pattern="", const std::string &path="")
static std::string release
std::vector< int > findxrange(TH1 *h, bool symmetric=false)
automatically set the xrange on a histogram
double realmax(TH1 *h, bool include_error=true, double lo=0, double hi=0)
void trim_tgraph(TH1 *h, TGraphAsymmErrors *t)
void setParameters(T *h, TGraphAsymmErrors *tg)
void myText(Double_t x, Double_t y, Color_t color, const std::string &text, Double_t tsize)
std::string head(std::string s, const std::string &pattern)
head of a string
bool fcontains(const std::string &s, const std::string &p)
does a string contain the substring at the beginning of the string
std::vector< double > findxrangeuser(TH1 *h, bool symmetric=false)
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
int ir
counter of the current depth
std::vector< std::string > tags
std::string find(const std::string &s)
return a remapped string
std::string chop(std::string &s1, const std::string &s2)
std::string label(const std::string &format, int i)
std::vector< std::string > patterns