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 }
mps_fire.i
i
Definition: mps_fire.py:428
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
AbsPlan1RechitCombiner::FPair
std::pair< float, float > FPair
Definition: AbsPlan1RechitCombiner.h:35
w
const double w
Definition: UKUtility.cc:23
AbsPlan1RechitCombiner::energyWeightedAverage
static float energyWeightedAverage(const FPair *data, unsigned len, float valueToReturnOnFailure)
Definition: AbsPlan1RechitCombiner.cc:3
AbsPlan1RechitCombiner.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79