ATLAS Offline Software
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 
8 namespace jet
9 {
10 
12 // //
13 // Constructor/destructor/initialization //
14 // //
16 
19  , m_absEta(false)
20  , m_truthLabelName("")
21  , m_truthLabels()
22 {
24 }
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)
38  , m_truthLabelName(toCopy.m_truthLabelName)
39  , m_truthLabels(toCopy.m_truthLabels)
40 {
41  ATH_MSG_DEBUG(Form("Creating copy of LargeRTopologyUncertaintyComponent named %s",m_uncHistName.Data()));
42 }
43 
45 {
46  return new LargeRTopologyUncertaintyComponent(*this);
47 }
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)
74  for (const LargeRJetTruthLabel::TypeEnum aLabel : m_truthLabels)
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 
LargeRJetTruthLabel::TypeEnum
TypeEnum
Definition: LargeRJetLabelEnum.h:14
jet::UncertaintyComponent::m_energyScale
const float m_energyScale
Definition: UncertaintyComponent.h:55
jet::LargeRTopologyUncertaintyComponent::LargeRTopologyUncertaintyComponent
LargeRTopologyUncertaintyComponent(const ComponentHelper &component)
Definition: LargeRTopologyUncertaintyComponent.cxx:26
LargeRJetTruthLabel::UNKNOWN
@ UNKNOWN
Definition: LargeRJetLabelEnum.h:15
jet::LargeRTopologyUncertaintyComponent::clone
virtual LargeRTopologyUncertaintyComponent * clone() const
Definition: LargeRTopologyUncertaintyComponent.cxx:44
jet::ComponentHelper
Definition: ConfigHelper.h:24
jet::UncertaintyComponent::m_uncHistName
const TString m_uncHistName
Definition: UncertaintyComponent.h:51
jet::CompParametrization::isAbsEta
bool isAbsEta(const TypeEnum type)
Definition: UncertaintyEnum.cxx:143
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
jet::LargeRTopologyUncertaintyComponent::getUncertaintyImpl
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition: LargeRTopologyUncertaintyComponent.cxx:61
jet::UncertaintyComponent::getValidBool
virtual bool getValidBool(const double validity) const
Definition: UncertaintyComponent.cxx:301
jet::UncertaintyHistogram::getValue
double getValue(const double var1) const
Definition: UncertaintyHistogram.cxx:141
Helpers.h
jet::UncertaintyComponent
Definition: UncertaintyComponent.h:25
LargeRTopologyUncertaintyComponent.h
JESUNC_ERROR_CODE
#define JESUNC_ERROR_CODE
Definition: Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:23
jet::LargeRTopologyUncertaintyComponent
Definition: LargeRTopologyUncertaintyComponent.h:15
jet::LargeRTopologyUncertaintyComponent::getValidityImpl
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition: LargeRTopologyUncertaintyComponent.cxx:56
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
jet::UncertaintyComponent::m_validHist
UncertaintyHistogram * m_validHist
Definition: UncertaintyComponent.h:61
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
jet::LargeRTopologyUncertaintyComponent::m_truthLabels
std::vector< LargeRJetTruthLabel::TypeEnum > m_truthLabels
Definition: LargeRTopologyUncertaintyComponent.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
jet::LargeRTopologyUncertaintyComponent::m_truthLabelName
std::string m_truthLabelName
Definition: LargeRTopologyUncertaintyComponent.h:32
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
JESUNC_NO_DEFAULT_CONSTRUCTOR
#define JESUNC_NO_DEFAULT_CONSTRUCTOR
Definition: Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:24
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
LargeRJetTruthLabel::intToEnum
TypeEnum intToEnum(const int type)
Definition: LargeRJetLabelEnum.h:57
jet::LargeRTopologyUncertaintyComponent::m_absEta
const bool m_absEta
Definition: LargeRTopologyUncertaintyComponent.h:31
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
jet::UncertaintyComponent::m_uncHist
UncertaintyHistogram * m_uncHist
Definition: UncertaintyComponent.h:60
LArG4GenerateShowerLib.parametrization
parametrization
Definition: LArG4GenerateShowerLib.py:19