20 # pragma warning( disable : 4996 )
33 #include <TProfile2D.h>
39 template <
typename R,
typename A>
41 if ( !aida )
return false;
43 if ( !
root )
return false;
52 if ( !axis )
return false;
53 const unsigned nbins = axis->GetNbins();
54 for (
const auto& i : labels ) {
55 if ( 1 + i.first <= 0 || 1 + i.first > nbins )
return false;
57 axis->SetBinLabel( 1 + i.first, i.second.c_str() );
64 template <
typename R,
typename A>
66 if ( !aida )
return false;
68 if ( !
root )
return false;
69 return setBinLabels_(
root->GetXaxis(), labels );
72 template <
typename Histogram>
75 l.reserve( labels.
size() );
76 for (
unsigned i = 0; i < labels.
size(); ++i )
l.emplace_back( i, labels[i] );
90 return setBinLabels_<TH1D>( hist, labels );
94 return setBinLabels_<TProfile>( hist, labels );
97 bool setBinLabels( AIDA::IHistogram1D* hist,
const Labels& labels ) {
return setBinLabels_( hist, labels ); }
99 bool setBinLabels( AIDA::IProfile1D* hist,
const Labels& labels ) {
return setBinLabels_( hist, labels ); }
102 if ( !hist )
return false;
104 if ( !h2d )
return false;
107 for (
unsigned int i = 0; i < xlabels.
size(); ++i ) { lx.
emplace_back( i, xlabels[i] ); }
110 for (
unsigned int i = 0; i < ylabels.
size(); ++i ) { ly.
emplace_back( i, ylabels[i] ); }
111 return ( setBinLabels_( h2d->GetXaxis(), lx ) && setBinLabels_( h2d->GetYaxis(), ly ) );
116 return ( h2d && setBinLabels_( h2d->GetXaxis(), xlabels ) && setBinLabels_( h2d->GetYaxis(), ylabels ) );
120 if ( !hist )
return false;
122 if ( !h2d )
return false;
125 for (
unsigned int i = 0; i < xlabels.
size(); ++i ) { lx.
emplace_back( i, xlabels[i] ); }
128 for (
unsigned int i = 0; i < ylabels.
size(); ++i ) { ly.
emplace_back( i, ylabels[i] ); }
129 return ( setBinLabels_( h2d->GetXaxis(), lx ) && setBinLabels_( h2d->GetYaxis(), ly ) );
134 return ( h2d && setBinLabels_( h2d->GetXaxis(), xlabels ) && setBinLabels_( h2d->GetYaxis(), ylabels ) );
140 return setAxisLabels_<TH1D>( hist, xAxis, yAxis );
144 return setAxisLabels_<TProfile>( hist, xAxis, yAxis );
148 return setAxisLabels_<TH2D>( hist, xAxis, yAxis );
152 return setAxisLabels_<TProfile2D>( hist, xAxis, yAxis );