|
Gaudi Framework, version v23r4 |
| Home | Generated: Mon Sep 17 2012 |
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 namespace Gaudi 00113 { 00114 std::ostream& operator<<( std::ostream& o , const Gaudi::Histo1DDef& histo ) 00115 { return histo.fillStream ( o ) ; } 00116 } 00117 // ============================================================================ 00118 00119 00120 00121 00122 00123 // ============================================================================ 00124 /* helper function to book 1D-histogram 00125 * @param svc pointer to Histogram Service 00126 * @param path full path in Histogram Data Store 00127 * @param hist histogram desctriprion 00128 */ 00129 // ============================================================================ 00130 AIDA::IHistogram1D* 00131 Gaudi::Histos::book 00132 ( IHistogramSvc* svc , 00133 const std::string& path , 00134 const Gaudi::Histo1DDef& hist ) 00135 { 00136 if ( 0 == svc ) { return 0 ; } 00137 return svc -> book 00138 ( path , 00139 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00140 } 00141 // ============================================================================ 00142 /* helper function to book 1D-histogram 00143 * @param svc pointer to Histogram Service 00144 * @param dir directory path in Histogram Data Store 00145 * @param id historgam identifier 00146 * @param hist histogram desctriprion 00147 */ 00148 // ============================================================================ 00149 AIDA::IHistogram1D* 00150 Gaudi::Histos::book 00151 ( IHistogramSvc* svc , 00152 const std::string& dir , 00153 const std::string& id , 00154 const Gaudi::Histo1DDef& hist ) 00155 { 00156 if ( 0 == svc ) { return 0 ; } 00157 return svc -> book 00158 ( dir , id , 00159 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00160 } 00161 // ============================================================================ 00162 /* helper function to book 1D-histogram 00163 * @param svc pointer to Histogram Service 00164 * @param dir directory path in Histogram Data Store 00165 * @param id historgam identifier 00166 * @param hist histogram desctriprion 00167 */ 00168 // ============================================================================ 00169 AIDA::IHistogram1D* 00170 Gaudi::Histos::book 00171 ( IHistogramSvc* svc , 00172 const std::string& dir , 00173 const int id , 00174 const Gaudi::Histo1DDef& hist ) 00175 { 00176 if ( 0 == svc ) { return 0 ; } 00177 return svc -> book 00178 ( dir , id , 00179 hist.title() , hist.bins() , hist.lowEdge() , hist.lowEdge() ) ; 00180 } 00181 // ============================================================================ 00182 00183 00184 00185 00186 // ============================================================================ 00187 // The END 00188 // ============================================================================