CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AbsPlan1RechitCombiner.cc
Go to the documentation of this file.
2 
4  const unsigned len,
5  const float valueToReturnOnFailure) {
6  double sum = 0.0, wsum = 0.0;
7  for (unsigned i = 0; i < len; ++i) {
8  const float w = data[i].second;
9  if (w > 0.f) {
10  sum += w * data[i].first;
11  wsum += w;
12  }
13  }
14  if (wsum > 0.0)
15  return sum / wsum;
16  else
17  return valueToReturnOnFailure;
18 }
const double w
Definition: UKUtility.cc:23
static float energyWeightedAverage(const FPair *data, unsigned len, float valueToReturnOnFailure)
std::pair< float, float > FPair
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79