CMS 3D CMS Logo

AbsPlan1RechitCombiner.cc
Go to the documentation of this file.
2 
4  const FPair* data, const unsigned len,
5  const float valueToReturnOnFailure)
6 {
7  double sum = 0.0, wsum = 0.0;
8  for (unsigned i=0; i<len; ++i)
9  {
10  const float w = data[i].second;
11  if (w > 0.f)
12  {
13  sum += w*data[i].first;
14  wsum += w;
15  }
16  }
17  if (wsum > 0.0)
18  return sum/wsum;
19  else
20  return valueToReturnOnFailure;
21 }
const double w
Definition: UKUtility.cc:23
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:82