ATLAS Offline Software
Loading...
Searching...
No Matches
MeanRMS.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "cmath"
6
7namespace MuonCalib {
8
9 class MeanRMS {
10 public:
11 inline MeanRMS() : m_sum_x(0.), m_sum_x_sq(0.), m_n_ent(0) {}
12 inline void Insert(double x) {
13 m_sum_x += x;
14 m_sum_x_sq += x * x;
15 m_n_ent++;
16 }
17 inline double GetMean() const {
18 if (m_n_ent == 0) return 0;
19 return m_sum_x / static_cast<double>(m_n_ent);
20 }
21 inline double GetRMS() const {
22 if (m_n_ent == 0) return 0;
23 double mean = GetMean();
24 return std::sqrt(m_sum_x_sq / static_cast<double>(m_n_ent) - mean * mean);
25 }
26 inline int GetN() const { return m_n_ent; }
27
28 private:
29 double m_sum_x;
30 double m_sum_x_sq;
32 };
33} // namespace MuonCalib
#define x
double GetMean() const
Definition MeanRMS.h:17
double GetRMS() const
Definition MeanRMS.h:21
int GetN() const
Definition MeanRMS.h:26
double m_sum_x_sq
Definition MeanRMS.h:30
void Insert(double x)
Definition MeanRMS.h:12
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.