ATLAS Offline Software
Loading...
Searching...
No Matches
PtAbsMassUncertaintyComponent.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace jet
9{
10
12// //
13// Constructor/destructor/initialization //
14// //
16
25
27 : UncertaintyComponent(component)
28 , m_massDef(component.massDef)
29 , m_truthLabelName(component.LargeRJetTruthLabelName)
30 , m_truthLabels(component.LargeRJetTruthLabels)
31{
32 ATH_MSG_DEBUG(Form("Creating PtAbsMassUncertaintyComponent named %s",m_uncHistName.Data()));
33}
34
36 : UncertaintyComponent(toCopy)
37 , m_massDef(toCopy.m_massDef)
40{
41 ATH_MSG_DEBUG(Form("Creating copy of PtAbsMassUncertaintyComponent named %s",m_uncHistName.Data()));
42}
43
48
49
51// //
52// Validity and uncertainty retrieval //
53// //
55
60
62{
63 // Check if we need to do anything at all - this uncertainty may be zero based on the jet truth label
64 // Truth labels are usually not expected for this component, so check if we need to do this
65 if (!m_truthLabels.empty())
66 {
67 // Truth labels are specified, so we need to check if this jet is labelled appropriately or not
69 if (!accTruthLabel.isAvailable(jet) || accTruthLabel(jet) == LargeRJetTruthLabel::UNKNOWN)
70 {
71 ATH_MSG_ERROR("Unable to retrieve the LargeRJetTruthLabel: " << m_truthLabelName << " from the jet. Please use JetTruthLabelingTool before calling this function.");
72 return JESUNC_ERROR_CODE;
73 }
74 const LargeRJetTruthLabel::TypeEnum jetTruthLabel = LargeRJetTruthLabel::intToEnum(accTruthLabel(jet));
75
76 // We now have the truth jet label, check if it matches one of the label(s) assigned to this component
77 // The uncertainty is only applied to same-labelled jets (zero otherwise)
78 bool labelApplies = false;
80 {
81 if (aLabel == jetTruthLabel)
82 {
83 labelApplies = true;
84 break;
85 }
86 }
87 // If the jet is not of the relevant label, then there is no uncertainty for this jet
88 if (!labelApplies)
89 return 0;
90 }
91
93}
94
95} // end jet namespace
96
97
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
std::vector< LargeRJetTruthLabel::TypeEnum > m_truthLabels
PtAbsMassUncertaintyComponent(const ComponentHelper &component)
virtual PtAbsMassUncertaintyComponent * clone() const
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
UncertaintyComponent(const ComponentHelper &component, const size_t numHist=1)
virtual double getAbsMass(const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const
virtual bool getValidBool(const double validity) const
UncertaintyHistogram * m_validHist
UncertaintyHistogram * m_uncHist
TypeEnum intToEnum(const int type)
Jet_v1 Jet
Definition of the current "jet version".
EventInfo_v1 EventInfo
Definition of the latest event info version.