![]() |
|
|
Generated: 24 Nov 2008 |
00001 // $Id: HistoDef.cpp,v 1.1 2007/09/26 16:13:42 marcocle Exp $ 00002 // ============================================================================ 00003 // Include files 00004 // ============================================================================ 00005 // ST D& STL 00006 // ============================================================================ 00007 #include <ostream> 00008 // ============================================================================ 00009 // GaudiKernel 00010 // ============================================================================ 00011 #include "GaudiKernel/IHistogramSvc.h" 00012 #include "GaudiKernel/HistoDef.h" 00013 #include "GaudiKernel/ToStream.h" 00014 // ============================================================================ 00020 // ============================================================================ 00021 /* full constructor from edges, #bins and the title 00022 * @param low the low edge of the histogram 00023 * @param high the high edge of the histogram 00024 * @param bins number of bins 00025 * @param title the historgam title 00026 */ 00027 // ============================================================================ 00028 Gaudi::Histo1DDef::Histo1DDef 00029 ( const double low , 00030 const double high , 00031 const int bins , 00032 const std::string& title ) 00033 : m_title ( title ) 00034 , m_low ( low ) 00035 , m_high ( high ) 00036 , m_bins ( bins ) 00037 {} 00038 // ============================================================================ 00039 /* full constructor from edges, #bins and the title 00040 * @param title the historgam title 00041 * @param low the low edge of the histogram 00042 * @param high the high edge of the histogram 00043 * @param bins number of bins 00044 */ 00045 // ============================================================================ 00046 Gaudi::Histo1DDef::Histo1DDef 00047 ( const std::string& title , 00048 const double low , 00049 const double high , 00050 const int bins ) 00051 : m_title ( title ) 00052 , m_low ( low ) 00053 , m_high ( high ) 00054 , m_bins ( bins ) 00055 {} 00056 // ============================================================================ 00057 // destructor 00058 // ============================================================================ 00059 Gaudi::Histo1DDef::~Histo1DDef(){} 00060 // ============================================================================ 00061 // printout of the histogram definition 00062 // ============================================================================ 00063 std::ostream& Gaudi::Histo1DDef::fillStream( std::ostream& o ) const 00064 { 00065 return o << "(" << Gaudi::Utils::toString ( title () ) 00066 << "," << lowEdge () 00067 << "," << highEdge () 00068 << "," << bins () << ")" ; 00069 } 00070 // ============================================================================ 00071 // ordering operator (to please BoundedVerifier) 00072 // ============================================================================ 00073 bool Gaudi::Histo1DDef::operator< ( const Gaudi::Histo1DDef& right ) const 00074 { 00075 return 00076 this == &right ? false : 00077 title () < right.title () ? true : 00078 title () > right.title () ? false : 00079 lowEdge () < right.lowEdge () ? true : 00080 lowEdge () > right.lowEdge () ? false : 00081 highEdge () < right.highEdge () ? true : 00082 highEdge () > right.highEdge () ? false : bins () < right.bins () ; 00083 } 00084 // ============================================================================ 00085 // equality operator 00086 // ============================================================================ 00087 bool Gaudi::Histo1DDef::operator==( const Gaudi::Histo1DDef& right ) const 00088 { 00089 return ( this == &right ) || 00090 ( title () == right.title () && 00091 lowEdge () == right.lowEdge () && 00092 highEdge () == right.highEdge () && 00093 bins () == right.bins () ); 00094 } 00095 // ============================================================================ 00096 // non-equality 00097 // ============================================================================ 00098 bool Gaudi::Histo1DDef::operator!=( const Gaudi::Histo1DDef& right ) const 00099 { return !( *this == right ) ; } 00100 // ============================================================================ 00101 // the streamer operator for class Gaudi::Histo1DDef 00102 // ============================================================================ 00103 std::ostream& operator<<( std::ostream& o , const Gaudi::Histo1DDef& histo ) 00104 { return histo.fillStream ( o ) ; } 00105 // ============================================================================ 00106 00107 00108 00109 00110 00111 // ============================================================================ 00112 /* helper function to book 1D-histogram 00113 * @param svc pointer to Histogram Service 00114 * @param path full path in Histogram Data Store 00115 * @param hist histogram desctriprion 00116 */ 00117 // ============================================================================ 00118 AIDA::IHistogram1D* 00119 Gaudi::Histos::book 00120 ( IHistogramSvc* svc , 00121 const std::string& path , 00122 const Gaudi::Histo1DDef& hist ) 00123 { 00124 if ( 0 == svc ) { return 0 ; } 00125 return svc -> book 00126 ( path , 00127 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00128 } 00129 // ============================================================================ 00130 /* helper function to book 1D-histogram 00131 * @param svc pointer to Histogram Service 00132 * @param dir directory path in Histogram Data Store 00133 * @param id historgam identifier 00134 * @param hist histogram desctriprion 00135 */ 00136 // ============================================================================ 00137 AIDA::IHistogram1D* 00138 Gaudi::Histos::book 00139 ( IHistogramSvc* svc , 00140 const std::string& dir , 00141 const std::string& id , 00142 const Gaudi::Histo1DDef& hist ) 00143 { 00144 if ( 0 == svc ) { return 0 ; } 00145 return svc -> book 00146 ( dir , id , 00147 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00148 } 00149 // ============================================================================ 00150 /* helper function to book 1D-histogram 00151 * @param svc pointer to Histogram Service 00152 * @param dir directory path in Histogram Data Store 00153 * @param id historgam identifier 00154 * @param hist histogram desctriprion 00155 */ 00156 // ============================================================================ 00157 AIDA::IHistogram1D* 00158 Gaudi::Histos::book 00159 ( IHistogramSvc* svc , 00160 const std::string& dir , 00161 const int id , 00162 const Gaudi::Histo1DDef& hist ) 00163 { 00164 if ( 0 == svc ) { return 0 ; } 00165 return svc -> book 00166 ( dir , id , 00167 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00168 } 00169 // ============================================================================ 00170 00171 00172 00173 00174 // ============================================================================ 00175 // The END 00176 // ============================================================================