CMS 3D CMS Logo

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 }
T w() const
static float energyWeightedAverage(const FPair *data, unsigned len, float valueToReturnOnFailure)
double f[11][100]
std::pair< float, float > FPair
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80