Skip to content

Commit

Permalink
Give variables a more meaningful name
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Jul 9, 2013
1 parent 5ce927f commit 6e48ef1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions include/hep/mc/mc_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ template <typename T, typename MCResultIterator>
mc_result<T> cumulative_result(MCResultIterator begin, MCResultIterator end)
{
std::size_t calls = 0;
T value = T();
T error = T();
T estimate = T();
T variance = T();

for (MCResultIterator i = begin; i != end; ++i)
{
T const tmp = T(1.0) / (i->error * i->error);
calls += i->calls;
error += tmp;
value += tmp * i->value;
variance += tmp;
estimate += tmp * i->value;
}

error = T(1.0) / error;
value *= error;
variance = T(1.0) / variance;
estimate *= variance;

return mc_result<T>(
calls,
T(calls) * value,
T(calls) * (value * value + T(calls) * error)
T(calls) * estimate,
T(calls) * (estimate * estimate + T(calls) * variance)
);
}

Expand Down

0 comments on commit 6e48ef1

Please sign in to comment.