diff --git a/Framework/Core/src/StepTHn.cxx b/Framework/Core/src/StepTHn.cxx index a091c304f425a..ac5da966f6ad4 100644 --- a/Framework/Core/src/StepTHn.cxx +++ b/Framework/Core/src/StepTHn.cxx @@ -441,7 +441,7 @@ void StepTHn::Fill(int iStep, int nParams, double positionAndWeight[]) if (weight != 1.) { // initialize with already filled entries (which have been filled with weight == 1), in this case mSumw2 := mValues if (!mSumw2[iStep]) { - mSumw2[iStep] = createArray(); + mSumw2[iStep] = createArray(mValues[iStep]); LOGF(info, "Created sumw2 container for step %d", iStep); } } @@ -449,7 +449,7 @@ void StepTHn::Fill(int iStep, int nParams, double positionAndWeight[]) // TODO probably slow; add StepTHnT::add ? mValues[iStep]->SetAt(mValues[iStep]->GetAt(bin) + weight, bin); if (mSumw2[iStep]) { - mSumw2[iStep]->SetAt(mSumw2[iStep]->GetAt(bin) + weight, bin); + mSumw2[iStep]->SetAt(mSumw2[iStep]->GetAt(bin) + weight * weight, bin); } }