set of generic plots
More...
#include <computils.h>
|
| | Plots (const std::string &s="", bool errors=false) |
| double | realmin (double lo=0, double hi=0) |
| double | realmax (double lo=0, double hi=0) |
| void | MaxScale (double scale=1.1, double lo=0, double hi=0) |
| void | MinScale (double scale, double lo=0, double hi=0) |
| void | Min (double scale) |
| void | Max (double scale) |
| std::vector< double > | findxrange (bool symmetric=false) |
| void | sortx (const AxisInfo &xinfo) |
| double | lo () const |
| double | hi () const |
| void | xrange (bool symmetric=false) |
| void | SetRangeUser (double lo, double hi) |
| void | limits () |
| void | Draw (Legend &leg, bool means=false) |
| void | Draw_i (Legend &leg, bool means=false) |
| void | SetLogx (bool b=true) |
| void | SetLogy (bool b=true) |
| std::string | GetXaxisTitle () |
| std::string | GetYaxisTitle () |
| void | SetXaxisTitle (const std::string &s) |
| void | SetYaxisTitle (const std::string &s) |
| 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
|
set of generic plots
Definition at line 917 of file computils.h.
◆ Plots()
| Plots::Plots |
( |
const std::string & | s = "", |
|
|
bool | errors = false ) |
|
inline |
Definition at line 921 of file computils.h.
921 :
929 { }
bool m_maxset
yaxis range setting
bool m_logx
canvas log setting
bool m_rangeset
xaxis range setting
◆ Draw()
| void Plots::Draw |
( |
Legend & | leg, |
|
|
bool | means = false ) |
|
inline |
Definition at line 1156 of file computils.h.
1156 {
1162 }
1163 }
void Draw_i(Legend &leg, bool means=false)
◆ Draw_i()
| void Plots::Draw_i |
( |
Legend & | leg, |
|
|
bool | means = false ) |
|
inline |
increase the number of log labels if only a few decades
still can't get this working correctly - for the time being leave these alternative loop orders in place but commented out until we can find a better solution ...
Definition at line 1165 of file computils.h.
1165 {
1166
1168
1170 for (
unsigned i=0 ;
i<
size() ;
i++,
first=false ) {
1171 double ymax = at(i).htest()->GetMaximum();
1172 double ymin = at(i).htest()->GetMinimum();
1173 at(i).htest()->GetYaxis()->SetMoreLogLabels(true);
1174 if (
ymax/
ymin>1e6 ) at(i).htest()->GetYaxis()->SetMoreLogLabels(
false);
1175 break;
1176 }
1177 }
1178
1180
1183
1184
1185
1186 for (
unsigned i=
size() ;
i-- ;
first=false ) at(i).Draw( i, &leg, means, first, i==0 );
1187
1189
1192 }
std::string stime()
return the current data and time
static std::string release
◆ findxrange()
| std::vector< double > Plots::findxrange |
( |
bool | symmetric = false | ) |
|
|
inline |
don't use empty histograms to find the bin limits unless they are all empty
Definition at line 1023 of file computils.h.
1023 {
1024
1027
1028 std::vector<double>
v(2,0);
1029
1030 TH1F* hf = at(0).htest();
1031
1032 double vlo = 1e21;
1033 double vhi = -1e21;
1034
1035 if ( hf->GetBinLowEdge(1)<vlo ) vlo = hf->GetBinLowEdge(1);
1036 if ( hf->GetBinLowEdge(hf->GetNbinsX()+1)>vhi ) vhi = hf->GetBinLowEdge( hf->GetNbinsX()+1 );
1037
1039
1041
1042 for (
unsigned i=1 ;
i<
size() ;
i++ ) {
1043
1044 hf = at(i).htest();
1045
1046 if (
::empty( hf ) )
continue;
1047
1048 if ( hf->GetBinLowEdge(1)<vlo ) vlo = hf->GetBinLowEdge(1);
1049 if ( hf->GetBinLowEdge(hf->GetNbinsX()+1)>vhi ) vhi = hf->GetBinLowEdge( hf->GetNbinsX()+1 );
1050
1052
1055
1056 if ( first ) {
1057
1060 }
1061 else {
1062 if ( v[0]>
lo )
v[0] =
lo;
1063 if ( v[1]<
hi )
v[1] =
hi;
1064 }
1065
1067 }
1068
1069 double upper = (
v[1]-
v[0] )*1.1 + v[0];
1070 double lower =
v[0] - (
v[1]-
v[0] )*0.1;
1071
1073 double dx = std::log10(v[1])-std::log10(v[0]);
1074 upper = std::pow(10,dx*1.1 + std::log10(v[0]));
1075 lower = std::pow(10,std::log10(v[0]) - dx*0.1);
1076 }
1077
1078 if ( lower<vlo ) lower = vlo;
1080
1083
1085 }
static const Attributes_t empty
std::vector< double > findxrangeuser(TH1 *h, bool symmetric=false)
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
◆ GetXaxisTitle()
| std::string Plots::GetXaxisTitle |
( |
| ) |
|
|
inline |
Definition at line 1197 of file computils.h.
1197 {
1198 if (
size()>0 )
return at(0).htest()->GetXaxis()->GetTitle();
1199 return "";
1200 }
◆ GetYaxisTitle()
| std::string Plots::GetYaxisTitle |
( |
| ) |
|
|
inline |
Definition at line 1202 of file computils.h.
1202 {
1203 if (
size()>0 )
return at(0).htest()->GetYaxis()->GetTitle();
1204 return "";
1205 }
◆ hi()
| double Plots::hi |
( |
| ) |
const |
|
inline |
◆ limits()
Definition at line 1146 of file computils.h.
1146 {
1149 if ( rmin<0 ) {
1150 std::cout <<
"\tlimits \t" <<
m_name <<
"\tmin " << rmin <<
"\tmax " << rmax << std::endl;
1151 }
1152 }
double realmax(double lo=0, double hi=0)
double realmin(double lo=0, double hi=0)
◆ lo()
| double Plots::lo |
( |
| ) |
const |
|
inline |
◆ Max()
| void Plots::Max |
( |
double | scale | ) |
|
|
inline |
Definition at line 1015 of file computils.h.
1015 {
1017 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
1018 if ( at(i).
href() ) at(i).href()->SetMaximum(scale);
1019 at(i).htest()->SetMaximum(scale);
1020 }
1021 }
◆ MaxScale()
| void Plots::MaxScale |
( |
double | scale = 1.1, |
|
|
double | lo = 0, |
|
|
double | hi = 0 ) |
|
inline |
Definition at line 956 of file computils.h.
956 {
957
958 if (
size()<1 )
return;
959
962
964
966
967 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
968 if ( at(i).
href() ) at(i).href()->SetMaximum(scale*tmax);
969 at(i).htest()->SetMaximum(scale*tmax);
970 }
971
972 }
◆ Min()
| void Plots::Min |
( |
double | scale | ) |
|
|
inline |
Definition at line 1002 of file computils.h.
1002 {
1004 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
1005 if ( at(i).
href() ) at(i).href()->SetMinimum(scale);
1006 at(i).htest()->SetMinimum(scale);
1008 if ( at(i).
href() )
if ( at(i).
href()->GetMinimum()<=0 ) at(i).href()->GetMinimum(1e-4);
1009 if ( at(i).
htest()->GetMinimum()<=0 ) at(i).htest()->GetMinimum(1e-4);
1010 }
1011 }
1012 }
◆ MinScale()
| void Plots::MinScale |
( |
double | scale, |
|
|
double | lo = 0, |
|
|
double | hi = 0 ) |
|
inline |
Definition at line 975 of file computils.h.
975 {
976
977 if (
size()<1 )
return;
978
979 if ( scale==0 ) {
980 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
981 if ( at(i).
href() ) at(i).href()->SetMinimum(0);
982 at(i).htest()->SetMinimum(0);
983 }
984 return;
985 }
986
987
988 double tmin = 0;
989
992
994
995 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
996 if ( at(i).
href() ) at(i).href()->SetMinimum(scale*tmin);
997 at(i).htest()->SetMinimum(scale*tmin);
998 }
999 }
◆ push_back()
| void Plots::push_back |
( |
const Plotter & | val | ) |
|
|
inline |
this is so that we can update the stats as we go along, but no updating isn't done at the moment
Definition at line 1218 of file computils.h.
1218 {
1219 std::vector<Plotter>::push_back( val );
1220 }
◆ realmax()
| double Plots::realmax |
( |
double | lo = 0, |
|
|
double | hi = 0 ) |
|
inline |
Definition at line 942 of file computils.h.
942 {
945 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
946
948 if ( rmtest!=0 && ( first ||
max<rmtest ) )
max = rmtest;
949 if ( rmtest!=0 )
first =
false;
950 }
952 }
◆ realmin()
| double Plots::realmin |
( |
double | lo = 0, |
|
|
double | hi = 0 ) |
|
inline |
Definition at line 931 of file computils.h.
931 {
934 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
936 if ( rmtest!=0 && ( first ||
min>rmtest ) )
min = rmtest;
937 if ( rmtest!=0 )
first =
false;
938 }
940 }
◆ SetLogx()
| void Plots::SetLogx |
( |
bool | b = true | ) |
|
|
inline |
◆ SetLogy()
| void Plots::SetLogy |
( |
bool | b = true | ) |
|
|
inline |
◆ SetRangeUser()
| void Plots::SetRangeUser |
( |
double | lo, |
|
|
double | hi ) |
|
inline |
Definition at line 1135 of file computils.h.
1135 {
1139 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
1140 if ( at(i).
href() ) at(i).href()->GetXaxis()->SetRangeUser(
m_lo,
m_hi );
1141 at(i).htest()->GetXaxis()->SetRangeUser(
m_lo,
m_hi );
1142 }
1143 }
◆ setwatermark()
| void Plots::setwatermark |
( |
bool | b | ) |
|
|
inlinestatic |
◆ SetXaxisTitle()
| void Plots::SetXaxisTitle |
( |
const std::string & | s | ) |
|
|
inline |
Definition at line 1207 of file computils.h.
1207 {
1208 if (
size()>0 ) at(0).htest()->GetXaxis()->SetTitle(
s.c_str());
1209 }
◆ SetYaxisTitle()
| void Plots::SetYaxisTitle |
( |
const std::string & | s | ) |
|
|
inline |
Definition at line 1211 of file computils.h.
1211 {
1212 if (
size()>0 ) at(0).htest()->GetYaxis()->SetTitle(
s.c_str());
1213 }
◆ sortx()
| void Plots::sortx |
( |
const AxisInfo & | xinfo | ) |
|
|
inline |
Definition at line 1089 of file computils.h.
1089 {
1090
1094 }
1095
1101 }
1102 else {
1105 }
1106 }
1107 else if (
size() == 0)
1108 {
1109 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;
1112 }
1113
1118 }
1119
1120 }
std::vector< double > findxrange(bool symmetric=false)
void SetLogx(bool b=true)
void SetRangeUser(double lo, double hi)
◆ xrange()
| void Plots::xrange |
( |
bool | symmetric = false | ) |
|
|
inline |
Definition at line 1127 of file computils.h.
1127 {
1129 for (
unsigned i=0 ;
i<
size() ;
i++ ) {
1132 }
1133 }
void xrange(bool symmetric=false)
◆ elements
| T std::vector< T >::elements |
|
inherited |
◆ m_hi
◆ m_lo
◆ m_logx
◆ m_logy
◆ m_max
◆ m_maxset
◆ m_min
◆ m_minset
◆ m_name
| std::string Plots::m_name |
|
private |
◆ m_rangeset
◆ m_trim_errors
| bool Plots::m_trim_errors |
|
private |
◆ s_watermark
| bool Plots::s_watermark = true |
|
staticprivate |
The documentation for this class was generated from the following files: