Commit ed1e4bbf authored by Steven Schramm's avatar Steven Schramm
Browse files

Change to JetUncertainties treatment of negative mass

JetCalibTools and JetUncertainties currently have different methods of
treating the combined mass of jets where both of the input masses are
negative.  This is an extreme case, but it should be properly handled in
order to differentiate between input problems vs different conventions.

This MR changes JetUncertainties to now accept events where the two
input mass definitions (calo and TA) are both negative, and the combined
mass value is 0.  In contrast, if the calo and TA masses are both
negative while the combined mass value is non-zero, then this is a
different problem that is unrelated to JetCalibTools and most likely
signifies a problem in the user input file.
parent c04a1565
......@@ -315,6 +315,7 @@ StatusCode CombinedMassUncertaintyComponent::calculateCombinedMass(const xAOD::J
// Accessors for the scales we need
static JetFourMomAccessor caloMassScale(CompMassDef::getJetScaleString(CompMassDef::CaloMass).Data());
static JetFourMomAccessor TAMassScale(CompMassDef::getJetScaleString(CompMassDef::TAMass).Data());
static JetFourMomAccessor combMassScale(CompMassDef::getJetScaleString(CompMassDef::CombMassQCD).Data());
// Get the weight factors
const double factorCalo = getWeightFactorCalo(jet,shiftFactorCalo);
......@@ -323,8 +324,21 @@ StatusCode CombinedMassUncertaintyComponent::calculateCombinedMass(const xAOD::J
// Watch for division by zero
if (factorCalo+factorTA == 0)
ATH_MSG_ERROR("Encountered division by zero when calculating weights: " << getName().Data());
return StatusCode::FAILURE;
if (combMassScale.m(jet) == 0)
// JetCalibTools sets the mass to zero when this situation occurs
// This is therefore not an error state, rather we want to be consistent
combMass = 0;
return StatusCode::SUCCESS;
// We somehow have invalid calo and TA masses, but a "valid" combined mass
// This is an error state that should result in a message to the user
// If this occurs, most likely there is something wrong in the inputs
ATH_MSG_ERROR("Encountered division by zero when calculating weights: mCalo = " << caloMassScale.m(jet) << ", mTA = " << TAMassScale.m(jet) << ", mComb = " << combMassScale.m(jet));
return StatusCode::FAILURE;
// Calculate the weights
......@@ -341,7 +355,7 @@ StatusCode CombinedMassUncertaintyComponent::calculateCombinedMass(const xAOD::J
combMass = (caloMassScale.m(jet)*shiftFactorCalo*caloWeight) + (TAMassScale.m(jet)*shiftFactorTA*TAWeight);
return true;
return StatusCode::SUCCESS;
double CombinedMassUncertaintyComponent::getUncertaintyImpl(const xAOD::Jet& jet, const xAOD::EventInfo& eInfo) const
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment