22 , m_combMassType(CombMassComp::UNKNOWN)
23 , m_setWeightMassDefs(false)
24 , m_caloMassComp(nullptr)
25 , m_TAMassComp(nullptr)
26 , m_caloMassWeight(nullptr)
27 , m_TAMassWeight(nullptr)
28 , m_caloMassScale_weights(
"")
29 , m_TAMassScale_weights(
"")
30 , m_weightParam(CompParametrization::UNKNOWN)
31 , m_truthLabelName(
"")
39 , m_combMassType(component.combMassType)
40 , m_setWeightMassDefs(false)
41 , m_caloMassComp(nullptr)
42 , m_TAMassComp(nullptr)
43 , m_caloMassWeight(nullptr)
44 , m_TAMassWeight(nullptr)
45 , m_caloMassScale_weights(
"")
46 , m_TAMassScale_weights(
"")
47 , m_weightParam(CompParametrization::UNKNOWN)
48 , m_truthLabelName(component.LargeRJetTruthLabelName)
49 , m_truthLabels(component.LargeRJetTruthLabels)
56 , m_combMassType(toCopy.m_combMassType)
57 , m_setWeightMassDefs(toCopy.m_setWeightMassDefs)
58 , m_caloMassComp(nullptr)
59 , m_TAMassComp(nullptr)
60 , m_caloMassWeight(toCopy.m_caloMassWeight)
61 , m_TAMassWeight(toCopy.m_TAMassWeight)
62 , m_caloMassScale_weights(toCopy.m_caloMassScale_weights)
63 , m_TAMassScale_weights(toCopy.m_TAMassScale_weights)
64 , m_weightParam(toCopy.m_weightParam)
65 , m_truthLabelName(toCopy.m_truthLabelName)
66 , m_truthLabels(toCopy.m_truthLabels)
91 return StatusCode::FAILURE;
95 ATH_MSG_ERROR(
"Calo mass term has already been set, blocking double-init: " <<
getName().Data());
96 return StatusCode::FAILURE;
100 return StatusCode::SUCCESS;
108 return StatusCode::FAILURE;
113 return StatusCode::FAILURE;
117 return StatusCode::SUCCESS;
124 ATH_MSG_ERROR(
"Can only set the calo mass weights before initialization: " <<
getName().Data());
125 return StatusCode::FAILURE;
129 ATH_MSG_ERROR(
"Calo mass weights has already been set, blocking double-init: " <<
getName().Data());
130 return StatusCode::FAILURE;
134 return StatusCode::SUCCESS;
142 return StatusCode::FAILURE;
146 ATH_MSG_ERROR(
"TA mass weights has already been set, blocking double-init: " <<
getName().Data());
147 return StatusCode::FAILURE;
151 return StatusCode::SUCCESS;
158 ATH_MSG_ERROR(
"Can only set the weight mass definitions before initialization: " <<
getName().Data());
159 return StatusCode::FAILURE;
164 return StatusCode::FAILURE;
173 ATH_MSG_ERROR(
"Unsupported mass parametrization for the combined mass calo weights: " <<
getName().Data());
174 return StatusCode::FAILURE;
183 ATH_MSG_ERROR(
"Unsupported mass parametrization for the combined mass TA weights: " <<
getName().Data());
184 return StatusCode::FAILURE;
188 return StatusCode::SUCCESS;
195 ATH_MSG_ERROR(
"Can only set the weight parametrization before initialization: " <<
getName().Data());
196 return StatusCode::FAILURE;
200 return StatusCode::SUCCESS;
212 return StatusCode::FAILURE;
219 return StatusCode::FAILURE;
224 return StatusCode::FAILURE;
230 ATH_MSG_ERROR(
"The mass definitions for the combination weight factors were not set: " <<
getName().Data());
231 return StatusCode::FAILURE;
238 return StatusCode::FAILURE;
245 ATH_MSG_ERROR(
"Calo mass term was not specified for a CombMass_calo component: " <<
getName().Data());
246 return StatusCode::FAILURE;
250 ATH_MSG_ERROR(
"TA mass term was specified for a CombMass_calo component: " <<
getName().Data());
251 return StatusCode::FAILURE;
259 ATH_MSG_ERROR(
"Calo mass term was specified for a CombMass_TA component: " <<
getName().Data());
260 return StatusCode::FAILURE;
264 ATH_MSG_ERROR(
"TA mass term was not specified for a CombMass_TA component: " <<
getName().Data());
265 return StatusCode::FAILURE;
273 ATH_MSG_ERROR(
"Calo mass term was not specified for a CombMass_both component: " <<
getName().Data());
274 return StatusCode::FAILURE;
278 ATH_MSG_ERROR(
"TA mass term was not specified for a CombMass_both component: " <<
getName().Data());
279 return StatusCode::FAILURE;
286 ATH_MSG_ERROR(
"Failed to initialize calo mass portion of a comb mass uncertainty: " <<
getName().Data());
287 return StatusCode::FAILURE;
291 ATH_MSG_ERROR(
"Failed to initialize TA mass portion of a comb mass uncertainty: " <<
getName().Data());
292 return StatusCode::FAILURE;
298 return StatusCode::SUCCESS;
325 if (factorCalo+factorTA == 0)
327 if (combMassScale.m(
jet) == 0)
332 return StatusCode::SUCCESS;
339 ATH_MSG_ERROR(
"Encountered division by zero when calculating weights: mCalo = " << caloMassScale.m(
jet) <<
", mTA = " << TAMassScale.m(
jet) <<
", mComb = " << combMassScale.m(
jet));
340 return StatusCode::FAILURE;
345 const double caloWeight = factorCalo/(factorCalo+factorTA);
346 const double TAWeight = factorTA/(factorCalo+factorTA);
351 if (caloMassScale.m(
jet) == 0)
352 combMass = TAMassScale.m(
jet)*shiftFactorTA;
353 else if (TAMassScale.m(
jet) == 0)
354 combMass = caloMassScale.m(
jet)*shiftFactorCalo;
356 combMass = (caloMassScale.m(
jet)*shiftFactorCalo*caloWeight) + (TAMassScale.m(
jet)*shiftFactorTA*TAWeight);
358 return StatusCode::SUCCESS;
371 ATH_MSG_ERROR(
"Unable to retrieve the LargeRJetTruthLabel: " <<
m_truthLabelName <<
" from the jet. Please use JetTruthLabelingTool before calling this function.");
378 bool labelApplies =
false;
381 if (aLabel == jetTruthLabel)
397 ATH_MSG_ERROR(
"Combined mass is outside of the validity range (calo part)");
404 ATH_MSG_ERROR(
"Combined mass is outside of the validity range (TA part)");
414 double massDefault = 0;
416 if (massDefault == 0)
return 0;
422 const double massUncUp = fabs((massUp-massDefault)/massDefault);
423 const double massUncDown = fabs((massDown-massDefault)/massDefault);
425 return (massUncUp+massUncDown)/2.;