ATLAS Offline Software
Loading...
Searching...
No Matches
LargeRTopologyUncertaintyComponent.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_absEta(CompParametrization::isAbsEta(component.parametrization))
29 , m_truthLabelName(component.LargeRJetTruthLabelName)
30 , m_truthLabels(component.LargeRJetTruthLabels)
31{
32 ATH_MSG_DEBUG(Form("Creating LargeRTopologyUncertaintyComponent named %s",m_uncHistName.Data()));
33}
34
36 : UncertaintyComponent(toCopy)
37 , m_absEta(toCopy.m_absEta)
40{
41 ATH_MSG_DEBUG(Form("Creating copy of LargeRTopologyUncertaintyComponent named %s",m_uncHistName.Data()));
42}
43
48
49
51// //
52// Validity and uncertainty retrieval //
53// //
55
57{
58 return !m_validHist ? true : getValidBool(m_validHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()));
59}
60
62{
63 // Retrieve the truth jet label from the jet
64 static const SG::AuxElement::ConstAccessor<int> accTruthLabel(m_truthLabelName);
65 if (!accTruthLabel.isAvailable(jet) || accTruthLabel(jet) == LargeRJetTruthLabel::UNKNOWN)
66 {
67 ATH_MSG_ERROR("Unable to retrieve the LargeRJetTruthLabel: " << m_truthLabelName << " from the jet. Please use JetTruthLabelingTool before calling this function.");
68 return JESUNC_ERROR_CODE;
69 }
70 const LargeRJetTruthLabel::TypeEnum jetTruthLabel = LargeRJetTruthLabel::intToEnum(accTruthLabel(jet));
71
72 // We now have the truth jet label, check if it matches one of the label(s) assigned to this component
73 // The uncertainty is only applied to same-labelled jets (zero otherwise)
75 {
76 if (aLabel == jetTruthLabel)
77 return m_uncHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta());
78 }
79 return 0;
80}
81
82} // end jet namespace
83
#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
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual LargeRTopologyUncertaintyComponent * clone() const
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
LargeRTopologyUncertaintyComponent(const ComponentHelper &component)
UncertaintyComponent(const ComponentHelper &component, const size_t numHist=1)
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.