00001 // $Id: Fill.cpp,v 1.1 2007/10/02 14:53:48 marcocle Exp $ 00002 // ============================================================================ 00003 // Include files 00004 // ============================================================================ 00005 // STD& STL 00006 // ============================================================================ 00007 #include <string> 00008 // ============================================================================ 00009 // GaudiAlg 00010 // ============================================================================ 00011 #include "GaudiAlg/Fill.h" 00012 // ============================================================================ 00013 // AIDA 00014 // ============================================================================ 00015 #include "AIDA/IHistogram1D.h" 00016 #include "AIDA/IHistogram2D.h" 00017 #include "AIDA/IHistogram3D.h" 00018 #include "AIDA/IProfile1D.h" 00019 #include "AIDA/IProfile2D.h" 00020 // ============================================================================ 00026 // ============================================================================ 00027 /* simple function to fill AIDA::IHistogram1D objects 00028 * @see AIDA::IHistogram1D 00029 * @param histo pointer to the histogram 00030 * @param value value to be added to the histogram 00031 * @param weight the "weight" assciated with this entry 00032 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 00033 * @date 2007-10-02 00034 */ 00035 // ============================================================================ 00036 void Gaudi::Utils::Histos::fill 00037 ( AIDA::IHistogram1D* histo , 00038 const double value , 00039 const double weight ) 00040 { 00041 if ( 0 != histo ) { histo->fill ( value , weight ) ; } 00042 } 00043 // ============================================================================ 00044 /* simple function to fill AIDA::IHistogram2D objects 00045 * @see AIDA::IHistogram2D 00046 * @param histo pointer to the histogram 00047 * @param valueX value to be added to the histogram 00048 * @param valueY value to be added to the histogram 00049 * @param weight the "weight" assciated with this entry 00050 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 00051 * @date 2007-10-02 00052 */ 00053 // ============================================================================ 00054 void Gaudi::Utils::Histos::fill 00055 ( AIDA::IHistogram2D* histo , 00056 const double valueX , 00057 const double valueY , 00058 const double weight ) 00059 { 00060 if ( 0 != histo ) { histo -> fill ( valueX , valueY , weight ) ; } 00061 } 00062 // ============================================================================ 00063 /* simple function to fill AIDA::IHistogram3D objects 00064 * @see AIDA::IHistogram3D 00065 * @param histo pointer to the histogram 00066 * @param valueX value to be added to the histogram 00067 * @param valueY value to be added to the histogram 00068 * @param valueZ value to be added to the histogram 00069 * @param weight the "weight" assciated with this entry 00070 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 00071 * @date 2007-10-02 00072 */ 00073 // ============================================================================ 00074 void Gaudi::Utils::Histos::fill 00075 ( AIDA::IHistogram3D* histo , 00076 const double valueX , 00077 const double valueY , 00078 const double valueZ , 00079 const double weight ) 00080 { 00081 if ( 0 != histo ) { histo -> fill ( valueX , valueY , valueZ , weight ) ; } 00082 } 00083 // ============================================================================ 00084 /* simple function to fill AIDA::IProfile1D objects 00085 * @see AIDA::IProfile1D 00086 * @param histo pointer to the histogram 00087 * @param valueX value to be added to the histogram 00088 * @param valueY value to be added to the histogram 00089 * @param weight the "weight" assciated with this entry 00090 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 00091 * @date 2007-10-02 00092 */ 00093 // ============================================================================ 00094 void Gaudi::Utils::Histos::fill 00095 ( AIDA::IProfile1D* histo , 00096 const double valueX , 00097 const double valueY , 00098 const double weight ) 00099 { 00100 if ( 0 != histo ) { histo -> fill ( valueX , valueY , weight ) ; } 00101 } 00102 // ============================================================================ 00103 /* simple function to fill AIDA::IProfile2D objects 00104 * @see AIDA::IProfile2D 00105 * @param histo pointer to the histogram 00106 * @param valueX value to be added to the histogram 00107 * @param valueY value to be added to the histogram 00108 * @param valueZ value to be added to the histogram 00109 * @param weight the "weight" assciated with this entry 00110 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 00111 * @date 2007-10-02 00112 */ 00113 // ============================================================================ 00114 void Gaudi::Utils::Histos::fill 00115 ( AIDA::IProfile2D* histo , 00116 const double valueX , 00117 const double valueY , 00118 const double valueZ , 00119 const double weight ) 00120 { 00121 if ( 0 != histo ) { histo -> fill ( valueX , valueY , valueZ , weight ) ; } 00122 } 00123 // ============================================================================ 00124 namespace 00125 { 00126 inline 00127 std::string htitle_ 00128 ( const AIDA::IBaseHistogram* histo , 00129 const std::string& title ) 00130 { 00131 return 00132 ( 0 != histo && title.empty() ) ? histo->title() : title ; 00133 } 00134 } 00135 // ====================================================================== 00136 // get the title 00137 // ====================================================================== 00138 std::string Gaudi::Utils::Histos::htitle 00139 ( const AIDA::IBaseHistogram* histo , 00140 const std::string& title ) 00141 { return htitle_ ( histo , title ) ; } 00142 // ====================================================================== 00143 // get the title 00144 // ====================================================================== 00145 std::string Gaudi::Utils::Histos::htitle 00146 ( const AIDA::IHistogram* histo , 00147 const std::string& title ) 00148 { return htitle_ ( histo , title ) ; } 00149 // ====================================================================== 00150 // get the title 00151 // ====================================================================== 00152 std::string Gaudi::Utils::Histos::htitle 00153 ( const AIDA::IHistogram1D* histo , 00154 const std::string& title ) 00155 { return htitle_ ( histo , title ) ; } 00156 // ====================================================================== 00157 // get the title 00158 // ====================================================================== 00159 std::string Gaudi::Utils::Histos::htitle 00160 ( const AIDA::IHistogram2D* histo , 00161 const std::string& title ) 00162 { return htitle_ ( histo , title ) ; } 00163 // ====================================================================== 00164 // get the title 00165 // ====================================================================== 00166 std::string Gaudi::Utils::Histos::htitle 00167 ( const AIDA::IHistogram3D* histo , 00168 const std::string& title ) 00169 { return htitle_ ( histo , title ) ; } 00170 // ====================================================================== 00171 // get the title 00172 // ====================================================================== 00173 std::string Gaudi::Utils::Histos::htitle 00174 ( const AIDA::IProfile* histo , 00175 const std::string& title ) 00176 { return htitle_ ( histo , title ) ; } 00177 // ====================================================================== 00178 // get the title 00179 // ====================================================================== 00180 std::string Gaudi::Utils::Histos::htitle 00181 ( const AIDA::IProfile1D* histo , 00182 const std::string& title ) 00183 { return htitle_ ( histo , title ) ; } 00184 // ====================================================================== 00185 // get the title 00186 // ====================================================================== 00187 std::string Gaudi::Utils::Histos::htitle 00188 ( const AIDA::IProfile2D* histo , 00189 const std::string& title ) 00190 { return htitle_ ( histo , title ) ; } 00191 // ====================================================================== 00192 AIDA::IBaseHistogram* 00193 Gaudi::Utils::Histos::toBase 00194 ( AIDA::IHistogram1D* histo ) { return histo ; } 00195 // ====================================================================== 00196 AIDA::IBaseHistogram* 00197 Gaudi::Utils::Histos::toBase 00198 ( AIDA::IHistogram2D* histo ) { return histo ; } 00199 // ====================================================================== 00200 AIDA::IBaseHistogram* 00201 Gaudi::Utils::Histos::toBase 00202 ( AIDA::IHistogram3D* histo ) { return histo ; } 00203 // ====================================================================== 00204 AIDA::IBaseHistogram* 00205 Gaudi::Utils::Histos::toBase 00206 ( AIDA::IProfile1D* histo ) { return histo ; } 00207 // ====================================================================== 00208 AIDA::IBaseHistogram* 00209 Gaudi::Utils::Histos::toBase 00210 ( AIDA::IProfile2D* histo ) { return histo ; } 00211 // ====================================================================== 00212 00213 // ============================================================================ 00214 // The END 00215 // ============================================================================