|
||||
File indexing completed on 2025-01-18 09:57:45
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef GAUDIUTILS_HISTOSTATS_H 0012 #define GAUDIUTILS_HISTOSTATS_H 1 0013 // ============================================================================ 0014 // Include files 0015 // ============================================================================ 0016 // STD & STL 0017 // ============================================================================ 0018 #include <utility> 0019 // ============================================================================ 0020 // Gaudi 0021 // ============================================================================ 0022 #include "GaudiKernel/Kernel.h" 0023 // ============================================================================ 0024 // forward declarations 0025 // ============================================================================ 0026 namespace AIDA { 0027 class IHistogram1D; 0028 class IProfile1D; 0029 } // namespace AIDA 0030 // ============================================================================ 0031 namespace Gaudi { 0032 namespace Utils { 0033 // ======================================================================== 0034 /** @class HistoStats HistoStats.h GaudiUtils/HistoStats.h 0035 * The collection of trivial functions to access the 0036 * statistical information for the histograms 0037 * @author Vanya BELYAEV ibelyaev@physics.syr.edu 0038 * @date 2007-08-06 0039 */ 0040 class GAUDI_API HistoStats { 0041 public: // 1D Histograms 0042 // ====================================================================== 0043 /** get the "bin-by-bin"-moment around the specified "value" 0044 * @param histo histogram 0045 * @param order the moment parameter 0046 * @param value central value 0047 * @return the evaluated moment 0048 */ 0049 static double moment( const AIDA::IHistogram1D* histo, const unsigned int order, const double value = 0 ); 0050 // ====================================================================== 0051 /** evaluate the uncertanty for 'bin-by-bin'-moment 0052 * @param histo histogram 0053 * @param order the moment parameter 0054 * @param value central value 0055 * @return the evaluated uncertanty in the moment 0056 */ 0057 static double momentErr( const AIDA::IHistogram1D* histo, const unsigned int order ); 0058 // ====================================================================== 0059 /** evaluate the 'bin-by-bin'-central moment (around the mean value) 0060 * @param histo histogram 0061 * @param order the moment parameter 0062 * @param value central value 0063 * @return the evaluated central moment 0064 */ 0065 static double centralMoment( const AIDA::IHistogram1D* histo, const unsigned int order ); 0066 // ====================================================================== 0067 /** evaluate the uncertanty for 'bin-by-bin'-central moment 0068 * (around the mean value) 0069 * ( the uncertanty is calculated with O(1/n2) precision) 0070 * @param histo histogram 0071 * @param order the moment parameter 0072 * @param value central value 0073 * @return the evaluated uncertanty in the central moment 0074 */ 0075 static double centralMomentErr( const AIDA::IHistogram1D* histo, const unsigned int order ); 0076 // ====================================================================== 0077 /// get the skewness for the histogram 0078 static double skewness( const AIDA::IHistogram1D* histo ); 0079 // ====================================================================== 0080 /// get the error in skewness for the histogram 0081 static double skewnessErr( const AIDA::IHistogram1D* histo ); 0082 // ====================================================================== 0083 /// get the kurtosis for the histogram 0084 static double kurtosis( const AIDA::IHistogram1D* histo ); 0085 // ====================================================================== 0086 /// get the error in kurtosis for the histogram 0087 static double kurtosisErr( const AIDA::IHistogram1D* histo ); 0088 // ====================================================================== 0089 /// get the mean value for the histogram (just for completeness) 0090 static double mean( const AIDA::IHistogram1D* histo ); 0091 // ====================================================================== 0092 /// get an error in the mean value 0093 static double meanErr( const AIDA::IHistogram1D* histo ); 0094 // ====================================================================== 0095 /// get the rms value for the histogram (just for completeness) 0096 static double rms( const AIDA::IHistogram1D* histo ); 0097 // ====================================================================== 0098 /// get an error in the rms value 0099 static double rmsErr( const AIDA::IHistogram1D* histo ); 0100 // ====================================================================== 0101 /// get the effective entries (just for completeness) 0102 static double nEff( const AIDA::IHistogram1D* histo ); 0103 // ====================================================================== 0104 /// get an error in the sum bin height ("in-range integral") 0105 static double sumBinHeightErr( const AIDA::IHistogram1D* histo ); 0106 // ====================================================================== 0107 /// get an error in the sum of all bin height ("integral") 0108 static double sumAllBinHeightErr( const AIDA::IHistogram1D* histo ); 0109 // ====================================================================== 0110 /// the fraction of overflow entries (useful for shape comparison) 0111 static double overflowEntriesFrac( const AIDA::IHistogram1D* histo ); 0112 /// the fraction of underflow entries (useful for shape comparison) 0113 static double underflowEntriesFrac( const AIDA::IHistogram1D* histo ); 0114 /// error on fraction of overflow entries (useful for shape comparison) 0115 static double overflowEntriesFracErr( const AIDA::IHistogram1D* histo ); 0116 /// the error on fraction of underflow entries (useful for shape comparison) 0117 static double underflowEntriesFracErr( const AIDA::IHistogram1D* histo ); 0118 // ====================================================================== 0119 /// the fraction of overflow intergal (useful for shape comparison) 0120 static double overflowIntegralFrac( const AIDA::IHistogram1D* histo ); 0121 /// the fraction of underflow integral (useful for shape comparison) 0122 static double underflowIntegralFrac( const AIDA::IHistogram1D* histo ); 0123 /// the error on fraction of overflow intergal 0124 static double overflowIntegralFracErr( const AIDA::IHistogram1D* histo ); 0125 /// the error on fraction of underflow integral 0126 static double underflowIntegralFracErr( const AIDA::IHistogram1D* histo ); 0127 // ====================================================================== 0128 /** get number of entries in histogram up to 0129 * the certain bin (not-included) 0130 * @attention underflow bin is included! 0131 * @param histo the pointer to the histogram 0132 * @param imax the bin number (not included) 0133 * @param number of entries 0134 */ 0135 static long nEntries( const AIDA::IHistogram1D* histo, const int imax ); 0136 /** get number of entries in histogram form the certain 0137 * minimal bin up to the certain maximal bin (not-included) 0138 * @param histo the pointer to the histogram 0139 * @param imin the minimal bin number (included) 0140 * @param imax the maximal bin number (not included) 0141 * @param number of entries 0142 */ 0143 static long nEntries( const AIDA::IHistogram1D* histo, 0144 const int imin, // minimal bin number (included) 0145 const int imax ); // maximal bin number (not included) 0146 // ====================================================================== 0147 /** get the fraction of entries in histogram up to 0148 * the certain bin (not-included) 0149 * @attention underflow bin is included! 0150 * @param histo the pointer to the histogram 0151 * @param imax the bin number (not included) 0152 * @param fraction of entries 0153 */ 0154 static double nEntriesFrac( const AIDA::IHistogram1D* histo, const int imax ); 0155 /** get fraction of entries in histogram form the certain 0156 * minimal bin up to the certain maximal bin (not-included) 0157 * @param histo the pointer to the histogram 0158 * @param imin the minimal bin number (included) 0159 * @param imax the maximal bin number (not included) 0160 * @param fraction of entries 0161 */ 0162 static double nEntriesFrac( const AIDA::IHistogram1D* histo, const int imin, const int imax ); 0163 // ====================================================================== 0164 /** get the (binominal) error for the fraction of entries 0165 * in histogram up to the certain bin (not-included) 0166 * @attention underflow bin is included! 0167 * @param histo the pointer to the histogram 0168 * @param imax the bin number (not included) 0169 * @param error for the fraction of entries 0170 */ 0171 static double nEntriesFracErr( const AIDA::IHistogram1D* histo, const int imax ); 0172 /** get the (binomial) error for the fraction of entries in histogram 0173 * from the certain minimal bin up to the certain maximal bin (not-included) 0174 * @param histo the pointer to the histogram 0175 * @param imin the minimal bin number (included) 0176 * @param imax the maximal bin number (not included) 0177 * @param error for the fraction of entries 0178 */ 0179 static double nEntriesFracErr( const AIDA::IHistogram1D* histo, const int imin, const int imax ); 0180 // ====================================================================== 0181 public: // 1D Profile Histograms 0182 // ====================================================================== 0183 /** get the "bin-by-bin"-moment around the specified "value" 0184 * @param histo histogram 0185 * @param order the moment parameter 0186 * @param value central value 0187 * @return the evaluated moment 0188 */ 0189 static double moment( const AIDA::IProfile1D* histo, const unsigned int order, const double value = 0 ); 0190 // ====================================================================== 0191 /** evaluate the uncertanty for 'bin-by-bin'-moment 0192 * @param histo histogram 0193 * @param order the moment parameter 0194 * @param value central value 0195 * @return the evaluated uncertanty in the moment 0196 */ 0197 static double momentErr( const AIDA::IProfile1D* histo, const unsigned int order ); 0198 // ====================================================================== 0199 /** evaluate the 'bin-by-bin'-central moment (around the mean value) 0200 * @param histo histogram 0201 * @param order the moment parameter 0202 * @param value central value 0203 * @return the evaluated central moment 0204 */ 0205 static double centralMoment( const AIDA::IProfile1D* histo, const unsigned int order ); 0206 // ====================================================================== 0207 /** evaluate the uncertanty for 'bin-by-bin'-central moment 0208 * (around the mean value) 0209 * ( the uncertanty is calculated with O(1/n2) precision) 0210 * @param histo histogram 0211 * @param order the moment parameter 0212 * @param value central value 0213 * @return the evaluated uncertanty in the central moment 0214 */ 0215 static double centralMomentErr( const AIDA::IProfile1D* histo, const unsigned int order ); 0216 // ====================================================================== 0217 /// get the skewness for the profile histogram 0218 static double skewness( const AIDA::IProfile1D* histo ); 0219 // ====================================================================== 0220 /// get the error in skewness for the profile histogram 0221 static double skewnessErr( const AIDA::IProfile1D* histo ); 0222 // ====================================================================== 0223 /// get the kurtosis for the profile histogram 0224 static double kurtosis( const AIDA::IProfile1D* histo ); 0225 // ====================================================================== 0226 /// get the error in kurtosis for the profile histogram 0227 static double kurtosisErr( const AIDA::IProfile1D* histo ); 0228 // ====================================================================== 0229 /// get the mean value for the profile histogram (just for completeness) 0230 static double mean( const AIDA::IProfile1D* histo ); 0231 // ====================================================================== 0232 /// get an error in the mean value 0233 static double meanErr( const AIDA::IProfile1D* histo ); 0234 // ====================================================================== 0235 /// get the rms value for the profile histogram (just for completeness) 0236 static double rms( const AIDA::IProfile1D* histo ); 0237 // ====================================================================== 0238 /// get an error in the rms value 0239 static double rmsErr( const AIDA::IProfile1D* histo ); 0240 // ====================================================================== 0241 /// get an error in the sum bin height ("in-range integral") 0242 static double sumBinHeightErr( const AIDA::IProfile1D* histo ); 0243 // ====================================================================== 0244 /// get an error in the sum of all bin height ("integral") 0245 static double sumAllBinHeightErr( const AIDA::IProfile1D* histo ); 0246 // ====================================================================== 0247 /// get the effective entries (just for completeness) 0248 static double nEff( const AIDA::IProfile1D* histo ); 0249 // ====================================================================== 0250 /// the fraction of overflow entries (useful for shape comparison) 0251 static double overflowEntriesFrac( const AIDA::IProfile1D* histo ); 0252 /// the fraction of underflow entries (useful for shape comparison) 0253 static double underflowEntriesFrac( const AIDA::IProfile1D* histo ); 0254 /// error on fraction of overflow entries (useful for shape comparison) 0255 static double overflowEntriesFracErr( const AIDA::IProfile1D* histo ); 0256 /// the error on fraction of underflow entries (useful for shape comparison) 0257 static double underflowEntriesFracErr( const AIDA::IProfile1D* histo ); 0258 // ====================================================================== 0259 /// the fraction of overflow intergal (useful for shape comparison) 0260 static double overflowIntegralFrac( const AIDA::IProfile1D* histo ); 0261 /// the fraction of underflow integral (useful for shape comparison) 0262 static double underflowIntegralFrac( const AIDA::IProfile1D* histo ); 0263 /// the error on fraction of overflow intergal 0264 static double overflowIntegralFracErr( const AIDA::IProfile1D* histo ); 0265 /// the error on fraction of underflow integral 0266 static double underflowIntegralFracErr( const AIDA::IProfile1D* histo ); 0267 // ====================================================================== 0268 /** get number of entries in profile histogram up to 0269 * the certain bin (not-included) 0270 * @attention underflow bin is included! 0271 * @param histo the pointer to the histogram 0272 * @param imax the bin number (not included) 0273 * @param number of entries 0274 */ 0275 static long nEntries( const AIDA::IProfile1D* histo, const int imax ); 0276 /** get number of entries in profile histogram form the certain 0277 * minimal bin up to the certain maximal bin (not-included) 0278 * @param histo the pointer to the histogram 0279 * @param imin the minimal bin number (included) 0280 * @param imax the maximal bin number (not included) 0281 * @param number of entries 0282 */ 0283 static long nEntries( const AIDA::IProfile1D* histo, 0284 const int imin, // minimal bin number (included) 0285 const int imax ); // maximal bin number (not included) 0286 // ====================================================================== 0287 /** get the fraction of entries in profile histogram up to 0288 * the certain bin (not-included) 0289 * @attention underflow bin is included! 0290 * @param histo the pointer to the histogram 0291 * @param imax the bin number (not included) 0292 * @param fraction of entries 0293 */ 0294 static double nEntriesFrac( const AIDA::IProfile1D* histo, const int imax ); 0295 /** get fraction of entries in profile histogram form the certain 0296 * minimal bin up to the certain maximal bin (not-included) 0297 * @param histo the pointer to the histogram 0298 * @param imin the minimal bin number (included) 0299 * @param imax the maximal bin number (not included) 0300 * @param fraction of entries 0301 */ 0302 static double nEntriesFrac( const AIDA::IProfile1D* histo, const int imin, const int imax ); 0303 // ====================================================================== 0304 /** get the (binominal) error for the fraction of entries 0305 * in profile histogram up to the certain bin (not-included) 0306 * @attention underflow bin is included! 0307 * @param histo the pointer to the histogram 0308 * @param imax the bin number (not included) 0309 * @param error for the fraction of entries 0310 */ 0311 static double nEntriesFracErr( const AIDA::IProfile1D* histo, const int imax ); 0312 /** get the (binomial) error for the fraction of entries in the profile histogram 0313 * from the certain minimal bin up to the certain maximal bin (not-included) 0314 * @param histo the pointer to the histogram 0315 * @param imin the minimal bin number (included) 0316 * @param imax the maximal bin number (not included) 0317 * @param error for the fraction of entries 0318 */ 0319 static double nEntriesFracErr( const AIDA::IProfile1D* histo, const int imin, const int imax ); 0320 // ====================================================================== 0321 }; 0322 // ======================================================================== 0323 } // namespace Utils 0324 // ========================================================================== 0325 } // end of namespace Gaudi 0326 // ============================================================================ 0327 // The END 0328 // ============================================================================ 0329 #endif // GAUDIUTILS_HISTOSTATS_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |