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 );
174 std::vector<std::string> keys =
split( s,
":" );
178 if ( keys.size()>0 )
m_tag = keys[0];
183 for (
size_t i=1 ; i<keys.size() ; i++ ) {
185 if ( keys[i]==
"lin" )
m_log =
false;
186 else if ( keys[i]==
"log" )
m_log =
true;
188 else if ( keys[i]==
"norm" )
m_norm =
true;
189 else if ( keys[i]==
"refn" )
m_refnorm =
true;
190 else if ( keys[i]==
"width" )
m_binwidth =
true;
191 else if ( keys[i]==
"auto" )
m_autoset =
true;
192 else if ( keys[i]==
"trim" )
m_trim =
true;
194 else if ( keys[i].
find(
"offset")==0 ) {
196 std::cout <<
"offset:" << std::endl;
197 std::cout <<
"\tkey: " << keys[i] << std::endl;
198 std::cout <<
"\tpos: " << keys[i].find(
"offset") << std::endl;
200 std::string
offset = keys[i];
203 std::cout <<
"m_offset: " <<
m_offset << std::endl;
205 else if ( keys[i]==
"auton" ) {
209 else if ( keys[i]==
"autow" ) {
213 else if ( keys[i]==
"autown" || keys[i]==
"autonw" ) {
218 else if ( keys[i]==
"autosym" ) {
222 else if ( keys[i]==
"normw" || keys[i]==
"widthn" ) {
226 else if ( !minset ) {
229 if ( i<keys.size() )
m_hi = std::atof(keys[i].
c_str());
231 std::cerr <<
"not enough values for the axis range: " << s << std::endl;
241 std::cout <<
"AxisInfo::info" <<
m_info <<
"\n";
242 std::cout <<
"\tlog " <<
m_log <<
"\n";
243 std::cout <<
"\tauto " <<
m_autoset <<
"\n";
285 static std::vector<std::string>
split(
const std::string& s,
const std::string& t=
":" ) {
288 size_t pos =
sc.find(t);
290 std::vector<std::string>
tags;
292 while ( pos!=std::string::npos ) {
330 s <<
"[ " <<
a.tag() << (
a.log() ?
" : log" :
"" ) <<
" ";
331 if (
a.autoset() ) s <<
" : auto";
332 else if (
a.rangeset() ) s <<
" : range " <<
a.lo() <<
" - " <<
a.hi();
355 Legend(
double x1,
double x2,
double y1,
double y2):
m_leg(nullptr) {
385 void AddEntry( TObject* tobj,
const std::string& s,
const std::string&
type=
"p" ) {
386 m_obj.push_back( tobj );
409 m_leg->SetBorderSize(0);
410 m_leg->SetTextFont(42);
411 m_leg->SetTextSize(0.04);
412 m_leg->SetFillStyle(3000);
413 m_leg->SetFillColor(0);
414 m_leg->SetLineColor(0);
417 for (
size_t i=0 ; i<
m_entries.size() ; i++ ) {
446 tg->SetLineColor(
h->GetLineColor() );
447 tg->SetMarkerColor(
h->GetMarkerColor() );
448 tg->SetMarkerStyle(
h->GetMarkerStyle() );
449 tg->SetMarkerSize(
h->GetMarkerSize() );
450 tg->SetLineWidth(
h->GetLineWidth() );
451 tg->SetLineStyle(
h->GetLineStyle() );
471 tPlotter(T* fo_htest=0, T* fo_href=0,
const std::string& s=
"", TGraphAsymmErrors* fo_tgtest=0, TGraphAsymmErrors* fo_tgref=0 ) :
520 void Draw(
int i,
Legend* lleg,
bool mean=
false,
bool first=
true,
bool drawlegend=
false ) {
522 std::cout <<
"Draw " << __LINE__ << std::endl;
532 gStyle->SetOptStat(0);
540 double lo =
htest()->GetBinLowEdge(1);
541 double hi =
htest()->GetBinLowEdge(
htest()->GetNbinsX()+1);
543 std::cout <<
"aes lo: " << lo << std::endl;
544 std::cout <<
"ase hi: " << hi << std::endl;
546 std::cout <<
"ase m_lo: " <<
m_lo << std::endl;
547 std::cout <<
"ase m_hi: " <<
m_hi << std::endl;
551 std::cout <<
"ase: " << *
m_xaxis << std::endl;
552 std::cout <<
"ase: " <<
m_xaxis->m_lo << std::endl;
553 std::cout <<
"ase: " <<
m_xaxis->m_hi << std::endl;
573 std::cout <<
"fck lo: " << lo << std::endl;
574 std::cout <<
"fck hi: " << hi << std::endl;
576 TH1D* hnull =
new TH1D(
"hnull",
htest()->GetTitle(), 100, lo, hi );
577 hnull->SetDirectory(0);
579 hnull->SetMaximum(
htest()->GetMaximum());
580 hnull->SetMinimum(
htest()->GetMinimum());
581 hnull->GetXaxis()->SetMoreLogLabels(
true);
583 hnull->GetXaxis()->SetTitle(
htest()->GetXaxis()->GetTitle());
584 hnull->GetYaxis()->SetTitle(
htest()->GetYaxis()->GetTitle());
588 for (
int ib=1 ; ib<101 ; ib++ ) hnull->SetBinContent(ib, hnull->GetMinimum()-1e10);
592 std::cout <<
htest()->GetTitle() << std::endl;
593 std::cout << hnull->GetXaxis()->GetTitle() << std::endl;
594 std::cout << hnull->GetYaxis()->GetTitle() << std::endl;
602 href()->SetLineStyle(2);
603 href()->SetMarkerStyle(0);
609 if (
contains( std::string(
htest()->GetName()),
"vs_mu") )
htest()->GetXaxis()->SetRangeUser( 18, 58 );
610 if (
contains( std::string(
htest()->GetName()),
"a0_eff") )
htest()->GetXaxis()->SetRangeUser( -200, 200 );
612 std::cout <<
"TEST: " <<
htest()->GetName() <<
" " <<
mc() <<
"\t" << std::endl;
615 htest()->SetLineStyle(1);
626 std::cout << std::endl;
635 TH1F*
h = (TH1F*)
htest()->Clone(
"h");
h->SetDirectory(0);
638 h->GetXaxis()->SetMoreLogLabels(
true);
642 TH1D* hnull = nrew TH1D(
"hnull",
"", 100,
m_xlo,
m_xhi );
643 hnull->SetMinimum(
h->GetMinimum() );
644 hnull->SetMaximum(
h->GetMaximum() );
645 hnull->SetTitle(
h->GetTitle() );
654 if (
LINES )
h->Draw(
"lhistsame");
660 std::cout <<
"shte lo: " <<
m_lo << std::endl;
661 std::cout <<
"shte hi: " <<
m_hi << std::endl;
664 htest()->GetXaxis()->SetMoreLogLabels(
true);
679 std::cout <<
"cck lo: " <<
m_lo << std::endl;
680 std::cout <<
"cck hi: " <<
m_hi << std::endl;
682 htest()->GetXaxis()->SetMoreLogLabels(
true);
698 else href()->Draw(
"hist same");
713 if (
htest()->GetMarkerStyle()>23 ) {
714 TH1D* hnull = (TH1D*)
htest()->Clone(
"duff"); hnull->SetDirectory(0);
716 hnull->SetLineColor(kWhite);
717 hnull->SetMarkerStyle(
htest()->GetMarkerStyle()-4 );
719 hnull->SetMarkerColor(kWhite);
720 hnull->SetMarkerSize(
htest()->GetMarkerSize()*0.75 );
722 hnull->DrawCopy(
"l same");
724 std::cout <<
"cnt lo: " <<
m_lo << std::endl;
725 std::cout <<
"cnt hi: " <<
m_hi << std::endl;
732 std::cout <<
"TEST MC: " <<
htest()->GetName() <<
" " <<
mc() << std::endl;
736 TList* ccklist =
h->GetListOfFunctions();
738 size_t tlsize = ccklist->GetSize();
740 std::cout <<
"tlsize: " << tlsize << std::endl;
743 for (
size_t icck=0 ; icck<tlsize ; icck++ ) {
744 std::cout <<
"tlist: " << icck <<
" " << ccklist->At(icck)->GetName() << std::endl;
746 TF1* cck = (TF1*)ccklist->At(icck);
748 cck->SetLineColor(
htest()->GetLineColor());
750 if ( std::string(cck->GetName()) ==
"sinus" ) {
751 phibeam = cck->GetParameter(1);
752 xbeam = cck->GetParameter(0)*cos(phibeam);
753 ybeam = cck->GetParameter(0)*sin(phibeam);
754 offbeam = cck->GetParameter(2);
756 std::cout <<
"phi = " << phibeam
758 <<
" mm\ny = " << ybeam
759 <<
" mm\noff = " << offbeam <<
" mm" << std::endl;
770 std::cout <<
"TEST mtype " <<
htest()->GetMarkerStyle() <<
" " <<
htest()->GetMarkerColor() << std::endl;
772 if (
contains( std::string(
h->GetName()),
"a0_eff") ) {
776 std::cout <<
"STUFF" << std::endl;
779 for (
int i=0 ; i<
h->GetNbinsX() ; i++ ) {
780 if (
h->GetBinCenter(i)<-200 ) {
781 h->SetBinContent(i,0);
787 std::cout <<
"SHTE" << std::endl;
789 htest()->Draw(
"ep same");
794 std::cout <<
"SHTE" << std::endl;
798 std::cout <<
"colour: " <<
htest()->GetMarkerColor() << std::endl;
802 htest()->SetFillStyle(455);
803 htest()->SetFillColor(
htest()->GetMarkerColor());
804 htest()->SetMarkerStyle(0);
808 if (
contains( std::string(
h->GetName()),
"vs_mu") )
h->GetXaxis()->SetRangeUser( 18, 58 );
809 if (
contains( std::string(
h->GetName()),
"a0_eff") ) {
810 h->GetXaxis()->SetRangeUser( -200,200 );
812 std::cout <<
"STUFF" << std::endl;
814 for (
int i=0 ; i<
h->GetNbinsX() ; i++ ) {
815 if (
h->GetBinCenter(i)<-200 ) {
816 h->SetBinContent(i,0);
823 htest()->Draw(
"e3lhistsame");
838 static TH1D* hnull =
new TH1D(
"hnull",
"", 1, 0, 1);
839 hnull->SetMarkerColor(kWhite);
840 hnull->SetLineColor(kWhite);
841 hnull->SetMarkerStyle(0);
842 hnull->SetLineStyle(0);
843 hnull->SetLineWidth(0);
844 hnull->SetMarkerSize(0);
854 bool displayref =
false;
858 std::snprintf( meanrefc, 64,
" <t> = %3.2f #pm %3.2f ms (ref)", muref.
mean(), muref.
error() );
861 std::snprintf( meanrefc, 64,
"%s",
"" );
866 std::snprintf( meanc, 64,
" <t> = %3.2f #pm %3.2f ms", mutest.
mean(), mutest.
error() );
868 std::string dkey = key;
870 std::string remove[7] = {
"TIME_",
"Time_",
"All_",
"Algorithm_",
"Class_",
"HLT_",
"Chain_HLT_" };
872 if ( dkey.find(
"Chain")!=std::string::npos ) {
873 if ( dkey.find(
"__")!=std::string::npos ) dkey.erase( 0, dkey.find(
"__")+2 );
877 for (
int ir=0 ;
ir<7 ;
ir++ ) {
878 if ( dkey.find( remove[
ir] )!=std::string::npos ) dkey.erase( dkey.find( remove[
ir]), remove[
ir].size() );
881 std::string rkey = dkey;
885 dkey += std::string(
" : ");
887 if ( (dkey+meanc).
size()>58 ) {
888 leg.AddEntry(
htest(), dkey,
"p" );
889 leg.AddEntry( hnull, meanc,
"p" );
892 leg.AddEntry(
htest(), (dkey+meanc).c_str(),
"p" );
896 rkey += std::string(
" : ");
900 if ( (rkey+meanrefc).
size()>58 ) {
901 leg.AddEntry(
href(), rkey,
"l" );
902 leg.AddEntry( hnull, meanrefc,
"l" );
905 leg.AddEntry(
href(), (rkey+meanrefc).c_str(),
"l" );
922 if ( drawlegend ) leg.Draw();
925 if ( xbeam!=0 || ybeam!=0 ) {
928 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() );
946 gStyle->SetOptStat(0);
949 href()->SetLineStyle(2);
950 href()->SetMarkerStyle(0);
954 htest()->SetLineStyle(1);
959 std::cout << std::endl;
965 htest()->GetXaxis()->SetMoreLogLabels(
true);
975 htest()->GetXaxis()->SetMoreLogLabels(
true);
991 else href()->Draw(
"hist same");
1008 if (
htest()->GetMarkerStyle()>23 ) {
1009 TH1D* hnull = (TH1D*)
htest()->Clone(
"duff"); hnull->SetDirectory(0);
1011 hnull->SetLineColor(kWhite);
1012 hnull->SetMarkerStyle(
htest()->GetMarkerStyle()-4 );
1014 hnull->SetMarkerColor(kWhite);
1015 hnull->SetMarkerSize(
htest()->GetMarkerSize()*0.75 );
1017 hnull->DrawCopy(
"l same");
1030 static TH1D* hnull =
new TH1D(
"hnull",
"", 1, 0, 1);
1031 hnull->SetMarkerColor(kWhite);
1032 hnull->SetLineColor(kWhite);
1033 hnull->SetMarkerStyle(0);
1034 hnull->SetLineStyle(0);
1035 hnull->SetLineWidth(0);
1036 hnull->SetMarkerSize(0);
1042 bool displayref =
false;
1046 std::sprintf( meanrefc,
" <t> = %3.2f #pm %3.2f ms (ref)", muref.
mean(), muref.
error() );
1049 std::sprintf( meanrefc,
"%s",
"" );
1055 std::sprintf( meanc,
" <t> = %3.2f #pm %3.2f ms", mutest.
mean(), mutest.
error() );
1057 std::string dkey = key;
1059 std::string remove[7] = {
"TIME_",
"Time_",
"All_",
"Algorithm_",
"Class_",
"HLT_",
"Chain_HLT_" };
1061 if ( dkey.find(
"Chain")!=std::string::npos ) {
1062 if ( dkey.find(
"__")!=std::string::npos ) dkey.erase( 0, dkey.find(
"__")+2 );
1066 for (
int ir=0 ;
ir<7 ;
ir++ ) {
1067 if ( dkey.find( remove[
ir] )!=std::string::npos ) dkey.erase( dkey.find( remove[
ir]), remove[
ir].size() );
1070 std::string rkey = dkey;
1074 dkey += std::string(
" : ");
1076 if ( (dkey+meanc).
size()>58 ) {
1077 leg.AddEntry(
htest(), dkey,
"p" );
1078 leg.AddEntry( hnull, meanc,
"p" );
1081 leg.AddEntry(
htest(), (dkey+meanc).c_str(),
"p" );
1085 rkey += std::string(
" : ");
1088 if ( (rkey+meanrefc).
size()>58 ) {
1089 leg.AddEntry(
href(), rkey,
"l" );
1090 leg.AddEntry( hnull, meanrefc,
"l" );
1093 leg.AddEntry(
href(), (rkey+meanrefc).c_str(),
"l" );
1110 if ( drawlegend ) leg.Draw();
1119 if ( s!=
"" ) gPad->Print(s.c_str());
1197 std::cout << __FUNCTION__ << std::endl;
1198 for (
int i=1 ; i<=
h->GetNbinsX() ; i++ ) {
1199 double duff =
h->GetBinContent(i);
1201 std::cout<<
"\t\t" << __FUNCTION__ <<
" " <<
h->GetName() <<
" " << i <<
" " <<
h->GetBinContent(i) <<
" " << (duff*1e6) << std::endl;
1205 gPad->Print( (std::string(
"duff-")+
h->GetName()+
".pdf").c_str() );
1210class Plots :
public std::vector<Plotter> {
1214 Plots(
const std::string& s=
"",
bool errors=
false ) :
1227 for (
unsigned i=0 ; i<
size() ; i++ ) {
1229 if ( rmtest!=0 && ( first ||
min>rmtest ) )
min = rmtest;
1230 if ( rmtest!=0 ) first =
false;
1238 for (
unsigned i=0 ; i<
size() ; i++ ) {
1241 if ( rmtest!=0 && ( first ||
max<rmtest ) )
max = rmtest;
1242 if ( rmtest!=0 ) first =
false;
1251 if (
size()<1 )
return;
1260 for (
unsigned i=0 ; i<
size() ; i++ ) {
1261 if ( at(i).href() ) at(i).href()->SetMaximum(scale*tmax);
1262 at(i).htest()->SetMaximum(scale*tmax);
1270 if (
size()<1 )
return;
1273 for (
unsigned i=0 ; i<
size() ; i++ ) {
1274 if ( at(i).href() ) at(i).href()->SetMinimum(0);
1275 at(i).htest()->SetMinimum(0);
1288 for (
unsigned i=0 ; i<
size() ; i++ ) {
1289 if ( at(i).href() ) at(i).href()->SetMinimum(scale*tmin);
1290 at(i).htest()->SetMinimum(scale*tmin);
1297 for (
unsigned i=0 ; i<
size() ; i++ ) {
1298 if ( at(i).href() ) at(i).href()->SetMinimum(scale);
1299 at(i).htest()->SetMinimum(scale);
1301 if ( at(i).href() )
if ( at(i).href()->GetMinimum()<=0 ) at(i).href()->GetMinimum(1e-4);
1302 if ( at(i).htest()->GetMinimum()<=0 ) at(i).htest()->GetMinimum(1e-4);
1310 for (
unsigned i=0 ; i<
size() ; i++ ) {
1311 if ( at(i).href() ) at(i).href()->SetMaximum(scale);
1312 at(i).htest()->SetMaximum(scale);
1321 std::vector<double> v(2,0);
1323 TH1F* hf = at(0).htest();
1328 if ( hf->GetBinLowEdge(1)<vlo ) vlo = hf->GetBinLowEdge(1);
1329 if ( hf->GetBinLowEdge(hf->GetNbinsX()+1)>vhi ) vhi = hf->GetBinLowEdge( hf->GetNbinsX()+1 );
1335 for (
unsigned i=1 ; i<
size() ; i++ ) {
1339 if (
::empty( hf ) )
continue;
1341 if ( hf->GetBinLowEdge(1)<vlo ) vlo = hf->GetBinLowEdge(1);
1342 if ( hf->GetBinLowEdge(hf->GetNbinsX()+1)>vhi ) vhi = hf->GetBinLowEdge( hf->GetNbinsX()+1 );
1354 if ( v[0]>
lo ) v[0] =
lo;
1355 if ( v[1]<
hi ) v[1] =
hi;
1361 double upper = ( v[1]-v[0] )*1.1 + v[0];
1362 double lower = v[0] - ( v[1]-v[0] )*0.1;
1365 double dx = std::log10(v[1])-std::log10(v[0]);
1366 upper = std::pow(10,dx*1.1 + std::log10(v[0]));
1367 lower = std::pow(10,std::log10(v[0]) - dx*0.1);
1370 if ( lower<vlo ) lower = vlo;
1384 std::cout <<
"xr1: " << xinfo << std::endl;
1392 std::cout <<
"xr2: " << xinfo << std::endl;
1397 std::cout <<
"xr3: " << xinfo << std::endl;
1402 else if (
size() == 0)
1404 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;
1424 for (
unsigned i=0 ; i<
size() ; i++ ) {
1425 if ( at(i).href() )
::xrange( at(i).href(), symmetric );
1426 ::xrange( at(i).htest(), symmetric );
1434 for (
unsigned i=0 ; i<
size() ; i++ ) {
1435 if ( at(i).href() ) at(i).href()->GetXaxis()->SetRangeUser(
m_lo,
m_hi );
1436 at(i).htest()->GetXaxis()->SetRangeUser(
m_lo,
m_hi );
1446 std::cout <<
"\tlimits \t" <<
m_name <<
"\tmin " << rmin <<
"\tmax " << rmax << std::endl;
1467 for (
unsigned i=0 ; i<
size() ; i++, first=false ) {
1468 double ymax = at(i).htest()->GetMaximum();
1469 double ymin = at(i).htest()->GetMinimum();
1470 at(i).htest()->GetYaxis()->SetMoreLogLabels(
true);
1471 if (
ymax/
ymin>1e6 ) at(i).htest()->GetYaxis()->SetMoreLogLabels(
false);
1488 for (
unsigned i=
size() ; i-- ; first=false ) at(i).Draw( i, &leg, means, first, i==0 );
1507 if (
size()>0 )
return at(0).htest()->GetXaxis()->GetTitle();
1512 if (
size()>0 )
return at(0).htest()->GetYaxis()->GetTitle();
1517 if (
size()>0 ) at(0).htest()->GetXaxis()->SetTitle(s.c_str());
1521 if (
size()>0 ) at(0).htest()->GetYaxis()->SetTitle(s.c_str());
1528 std::vector<Plotter>::push_back( val );
1573 if ( v.size() < 6 )
throw std::exception();
1575 for (
size_t i=0 ; i<6 ; i++ )
m_details.push_back(v[i]);
1581 for (
size_t i=0 ; i<6 ; i++ )
m_details.push_back(vp[i]);
1624 return s <<
"[ " <<
h.name() <<
" \tx: \"" <<
h.xtitle() <<
"\" " <<
h.xaxis() <<
"\t\ty: \"" <<
h.ytitle() <<
"\" " <<
h.yaxis() <<
" ]";
1643 Panel(
const std::string& s,
int nr,
int nc ) :
1683 s <<
"Panel: " << p.name();
1684 if ( p.size() == 1 ) s <<
"\t" << p[0];
1685 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(const std::string &s)
static std::vector< std::string > split(const std::string &s, const std::string &t=":")
const std::string & c_str() const
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
const std::string & xtitle() const
HistDetails(const std::vector< std::string > &v)
const std::string & detail() const
HistDetails(const std::string *vp)
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)
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 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