Gaudi Framework, version v21r11

Home   Generated: 30 Sep 2010

HistoLabels.cpp File Reference

#include "GaudiUtils/HistoLabels.h"
#include "GaudiUtils/Aida2ROOT.h"
#include "TH1D.h"
#include "TH2D.h"
#include "TProfile.h"
#include "TProfile2D.h"

Include dependency graph for HistoLabels.cpp:

Go to the source code of this file.

Namespaces

namespace  Gaudi
namespace  Gaudi::Utils
namespace  Gaudi::Utils::Histos

Functions

template<typename R, typename A>
bool setAxisLabels_ (A *aida, const std::string &xAxis, const std::string &yAxis)
bool setBinLabels_ (TAxis *axis, const Gaudi::Utils::Histos::BinLabels &labels)
template<typename R, typename A>
bool setBinLabels_ (A *aida, const Gaudi::Utils::Histos::BinLabels &labels)
template<typename Histogram>
bool setBinLabels_ (Histogram *hist, const Gaudi::Utils::Histos::Labels &labels)
bool Gaudi::Utils::Histos::setBinLabels (AIDA::IHistogram1D *hist, const Labels &labels)
 Set the Bin labels for a given 1D histogram.
bool Gaudi::Utils::Histos::setBinLabels (AIDA::IProfile1D *hist, const Labels &labels)
 Set the Bin labels for a given 1D profile histogram.
bool Gaudi::Utils::Histos::setBinLabels (AIDA::IHistogram2D *hist, const Labels &xlabels, const Labels &ylabels)
 Set the Bin labels for a given 2D histogram.
bool Gaudi::Utils::Histos::setBinLabels (AIDA::IProfile2D *hist, const Labels &xlabels, const Labels &ylabels)
 Set the Bin labels for a given 2D profile histogram.
bool Gaudi::Utils::Histos::setAxisLabels (AIDA::IHistogram1D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 1D histogram.
bool Gaudi::Utils::Histos::setAxisLabels (AIDA::IProfile1D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 1D profile histogram.
bool Gaudi::Utils::Histos::setAxisLabels (AIDA::IHistogram2D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 2D histogram.
bool Gaudi::Utils::Histos::setAxisLabels (AIDA::IProfile2D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 2D profile histogram.


Function Documentation

template<typename R, typename A>
bool @715::setAxisLabels_ ( A *  aida,
const std::string xAxis,
const std::string yAxis 
) [inline, static]

Definition at line 26 of file HistoLabels.cpp.

00029   {
00030     if (!aida) return false;
00031     R * root = Gaudi::Utils::Aida2ROOT::aida2root( aida );
00032     if (!root) return false;
00033     root->SetXTitle(xAxis.c_str());
00034     root->SetYTitle(yAxis.c_str());
00035     return true;
00036   }

template<typename Histogram>
bool @715::setBinLabels_ ( Histogram *  hist,
const Gaudi::Utils::Histos::Labels labels 
) [inline, static]

Definition at line 68 of file HistoLabels.cpp.

00070   {
00071     Gaudi::Utils::Histos::BinLabels l;
00072     l.reserve(labels.size());
00073     for ( unsigned i = 0; i<labels.size(); ++i ) 
00074     { 
00075       l.push_back( Gaudi::Utils::Histos::BinLabel(i,labels[i]) ); 
00076     }
00077     return Gaudi::Utils::Histos::setBinLabels(hist,l);
00078   }

template<typename R, typename A>
bool @715::setBinLabels_ ( A *  aida,
const Gaudi::Utils::Histos::BinLabels labels 
) [inline, static]

Definition at line 58 of file HistoLabels.cpp.

00060   {
00061     if (!aida) return false;
00062     R * root = Gaudi::Utils::Aida2ROOT::aida2root( aida );
00063     if (!root) return false;
00064     return setBinLabels_( root->GetXaxis(), labels );
00065   }

bool @715::setBinLabels_ ( TAxis *  axis,
const Gaudi::Utils::Histos::BinLabels labels 
) [static]

Definition at line 40 of file HistoLabels.cpp.

00042   {
00043     if (!axis) return false;
00044     const unsigned nbins = axis->GetNbins();
00045     for ( Gaudi::Utils::Histos::BinLabels::const_iterator i = labels.begin();
00046          i != labels.end(); ++i )
00047     {
00048       if ( 1+i->first <= 0 || 1+i->first > nbins ) return false;
00049       // Argh... ROOT bins start counting at '1' instead of '0'
00050       axis -> SetBinLabel( 1 + i->first, i->second.c_str() );
00051     }
00052     return true;
00053   }


Generated at Thu Sep 30 09:58:12 2010 for Gaudi Framework, version v21r11 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004