|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
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 #ifdef __ICC 00088 // disable icc remark #1572: floating-point equality and inequality comparisons are unreliable 00089 #pragma warning(push) 00090 #pragma warning(disable:1572) 00091 #endif 00092 bool Gaudi::Histo1DDef::operator==( const Gaudi::Histo1DDef& right ) const 00093 { 00094 return ( this == &right ) || 00095 ( title () == right.title () && 00096 lowEdge () == right.lowEdge () && 00097 highEdge () == right.highEdge () && 00098 bins () == right.bins () ); 00099 } 00100 #ifdef __ICC 00101 // re-enable icc remark #1572 00102 #pragma warning(pop) 00103 #endif 00104 // ============================================================================ 00105 // non-equality 00106 // ============================================================================ 00107 bool Gaudi::Histo1DDef::operator!=( const Gaudi::Histo1DDef& right ) const 00108 { return !( *this == right ) ; } 00109 // ============================================================================ 00110 // the streamer operator for class Gaudi::Histo1DDef 00111 // ============================================================================ 00112 std::ostream& operator<<( std::ostream& o , const Gaudi::Histo1DDef& histo ) 00113 { return histo.fillStream ( o ) ; } 00114 // ============================================================================ 00115 00116 00117 00118 00119 00120 // ============================================================================ 00121 /* helper function to book 1D-histogram 00122 * @param svc pointer to Histogram Service 00123 * @param path full path in Histogram Data Store 00124 * @param hist histogram desctriprion 00125 */ 00126 // ============================================================================ 00127 AIDA::IHistogram1D* 00128 Gaudi::Histos::book 00129 ( IHistogramSvc* svc , 00130 const std::string& path , 00131 const Gaudi::Histo1DDef& hist ) 00132 { 00133 if ( 0 == svc ) { return 0 ; } 00134 return svc -> book 00135 ( path , 00136 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00137 } 00138 // ============================================================================ 00139 /* helper function to book 1D-histogram 00140 * @param svc pointer to Histogram Service 00141 * @param dir directory path in Histogram Data Store 00142 * @param id historgam identifier 00143 * @param hist histogram desctriprion 00144 */ 00145 // ============================================================================ 00146 AIDA::IHistogram1D* 00147 Gaudi::Histos::book 00148 ( IHistogramSvc* svc , 00149 const std::string& dir , 00150 const std::string& id , 00151 const Gaudi::Histo1DDef& hist ) 00152 { 00153 if ( 0 == svc ) { return 0 ; } 00154 return svc -> book 00155 ( dir , id , 00156 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00157 } 00158 // ============================================================================ 00159 /* helper function to book 1D-histogram 00160 * @param svc pointer to Histogram Service 00161 * @param dir directory path in Histogram Data Store 00162 * @param id historgam identifier 00163 * @param hist histogram desctriprion 00164 */ 00165 // ============================================================================ 00166 AIDA::IHistogram1D* 00167 Gaudi::Histos::book 00168 ( IHistogramSvc* svc , 00169 const std::string& dir , 00170 const int id , 00171 const Gaudi::Histo1DDef& hist ) 00172 { 00173 if ( 0 == svc ) { return 0 ; } 00174 return svc -> book 00175 ( dir , id , 00176 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00177 } 00178 // ============================================================================ 00179 00180 00181 00182 00183 // ============================================================================ 00184 // The END 00185 // ============================================================================