Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:26

0001 #ifndef CaloSimAlgos_CaloValidationStatistics_h
0002 #define CaloSimAlgos_CaloValidationStatistics_h
0003 
0004 /** For validation purposes.  This program
0005     calculates mean and RMS of a distribution
0006 
0007   \Author Rick Wilkinson
0008 */
0009 #include <iosfwd>
0010 #include <string>
0011 
0012 class CaloValidationStatistics {
0013 public:
0014   CaloValidationStatistics(std::string name, float expectedMean, float expectedRMS);
0015   /// prints to LogInfo upon destruction
0016   ~CaloValidationStatistics();
0017 
0018   void addEntry(float value, float weight = 1.);
0019 
0020   std::string name() const { return name_; }
0021 
0022   float mean() const;
0023 
0024   float RMS() const;
0025 
0026   float weightedMean() const;
0027 
0028   float expectedMean() const { return expectedMean_; }
0029 
0030   float expectedRMS() const { return expectedRMS_; }
0031 
0032   int nEntries() const { return n_; }
0033 
0034 private:
0035   std::string name_;
0036   float expectedMean_;
0037   float expectedRMS_;
0038   float sum_;
0039   float sumOfSquares_;
0040   float weightedSum_;
0041   float sumOfWeights_;
0042   int n_;
0043 };
0044 
0045 std::ostream &operator<<(std::ostream &os, const CaloValidationStatistics &stat);
0046 
0047 #endif