00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id:$ 00028 // GEANT4 tag $Name: not supported by cvs2svn $ 00029 // 00030 // 00031 // ---------------------------------------------------------------------- 00032 // Class G4StatDouble 00033 // 00034 // Class description: 00035 // 00036 // Class providing simple "one variable statistics" capability. 00037 00038 // Original Author: Giovanni Santin (ESA) - October 2005 in GRAS tool 00039 // Adaptation and comments by: John Apostolakis (CERN) - November 2011 00040 00041 #ifndef G4StatDouble_h 00042 #define G4StatDouble_h 1 00043 00044 #include "globals.hh" 00045 00046 class G4StatDouble 00047 { 00048 00049 public: 00050 G4StatDouble(); 00051 virtual ~G4StatDouble(); 00052 00053 public: 00054 00055 void reset(); 00056 void fill(G4double x, G4double weight=1.); 00057 // Add new data point: value "x" with weight 00058 void scale(G4double); 00059 // Reset scale 00060 00061 G4double mean() const; 00062 G4double rms(); 00063 // The moments 00064 00065 G4double mean(G4double ext_sum_w) const; 00066 // Mean scaled to sum of weights 00067 G4double rms(G4double ext_sum_w, G4int ext_n); 00068 // RMS scaled to sum of weights 00069 00070 inline G4int n() const { return m_n; } 00071 inline G4double sum_w() const { return m_sum_w; } 00072 inline G4double sum_w2() const { return m_sum_w2; } 00073 inline G4double sum_wx() const { return m_sum_wx; } 00074 inline G4double sum_wx2() const { return m_sum_wx2; } 00075 00076 protected: 00077 00078 G4double rms(G4double sum_wx, G4double sum_wx2, G4double sum_w, G4int n); 00079 00080 protected: 00081 00082 G4double m_sum_wx; 00083 G4double m_sum_wx2; 00084 G4int m_n; 00085 G4double m_sum_w; 00086 G4double m_sum_w2; 00087 G4double m_scale; 00088 }; 00089 00090 #endif