ATLAS Offline Software
Loading...
Searching...
No Matches
JetUncertaintiesTool Class Reference

#include <JetUncertaintiesTool.h>

Inheritance diagram for JetUncertaintiesTool:

Public Member Functions

 JetUncertaintiesTool (const std::string &name="JetUncertaintiesTool")
 JetUncertaintiesTool (const JetUncertaintiesTool &toCopy) ATLAS_CTORDTOR_NOT_THREAD_SAFE
virtual ~JetUncertaintiesTool ()
virtual StatusCode setScaleToMeV ()
virtual StatusCode setScaleToGeV ()
virtual StatusCode initialize ()
 Dummy implementation of the initialisation function.
virtual void setRandomSeed (long long int seed)
virtual std::string getName () const
virtual std::string getRelease () const
virtual std::string getJetDef () const
virtual std::string getMCType () const
virtual std::string getConfigFile () const
virtual std::string getPath () const
virtual std::string getAnalysisFile () const
virtual std::string getAnalysisHistPattern () const
virtual std::string getDefaultAnaFile () const
virtual float getSqrtS () const
virtual float getRefMu () const
virtual float getRefNPV () const
virtual float getRefMu (const xAOD::Jet &jet) const
virtual float getRefNPV (const xAOD::Jet &jet) const
virtual size_t getNumComponents () const
virtual size_t getComponentIndex (const std::string &name) const
virtual size_t getComponentIndex (const TString &name) const
virtual std::string getComponentName (const size_t index) const
virtual std::string getComponentDesc (const size_t index) const
virtual std::string getComponentCategory (const size_t index) const
virtual bool getComponentIsReducible (const size_t index) const
virtual bool getComponentScalesFourVec (const size_t index) const
virtual bool getComponentScalesPt (const size_t index) const
virtual bool getComponentScalesMass (const size_t index) const
virtual bool getComponentScalesD12 (const size_t index) const
virtual bool getComponentScalesD23 (const size_t index) const
virtual bool getComponentScalesTau21 (const size_t index) const
virtual bool getComponentScalesTau32 (const size_t index) const
virtual bool getComponentScalesTau21WTA (const size_t index) const
virtual bool getComponentScalesTau32WTA (const size_t index) const
virtual bool getComponentScalesD2Beta1 (const size_t index) const
virtual bool getComponentScalesC2Beta1 (const size_t index) const
virtual bool getComponentScalesQw (const size_t index) const
virtual bool getComponentScalesTagScaleFactor (const size_t index) const
virtual bool getComponentScalesMultiple (const size_t index) const
virtual std::set< jet::CompScaleVar::TypeEnum > getComponentScaleVars (const size_t index) const
virtual jet::JetTopology::TypeEnum getComponentTopology (const size_t index) const
virtual std::vector< std::string > getComponentCategories () const
virtual std::vector< size_t > getComponentsInCategory (const std::string &category) const
virtual std::vector< std::string > getComponentNamesInCategory (const std::string &category) const
virtual bool getValidity ATLAS_NOT_THREAD_SAFE (size_t index, const xAOD::Jet &jet) const
virtual bool getValidity (size_t index, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual bool getValidity ATLAS_NOT_THREAD_SAFE (size_t index, const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum scaleVar) const
virtual bool getValidity (size_t index, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo, const jet::CompScaleVar::TypeEnum scaleVar) const
virtual double getUncertainty ATLAS_NOT_THREAD_SAFE (size_t index, const xAOD::Jet &jet) const
virtual double getUncertainty (size_t index, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual double getUncertainty ATLAS_NOT_THREAD_SAFE (size_t index, const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum scaleVar) const
virtual double getUncertainty (size_t index, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo, const jet::CompScaleVar::TypeEnum scaleVar) const
virtual bool getValidUncertainty ATLAS_NOT_THREAD_SAFE (size_t index, double &unc, const xAOD::Jet &jet) const
virtual bool getValidUncertainty (size_t index, double &unc, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual bool getValidUncertainty ATLAS_NOT_THREAD_SAFE (size_t index, double &unc, const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum scaleVar) const
virtual bool getValidUncertainty (size_t index, double &unc, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo, const jet::CompScaleVar::TypeEnum scaleVar) const
virtual double getNormalizedCaloMassWeight (const xAOD::Jet &jet) const
virtual double getNormalizedTAMassWeight (const xAOD::Jet &jet) const
virtual double getNominalResolutionMC (const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum smearType, const jet::JetTopology::TypeEnum topology=jet::JetTopology::UNKNOWN) const
virtual double getNominalResolutionData (const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum smearType, const jet::JetTopology::TypeEnum topology=jet::JetTopology::UNKNOWN) const
virtual CP::CorrectionCode applyCorrection ATLAS_NOT_THREAD_SAFE (xAOD::Jet &jet) const
virtual CP::CorrectionCode applyCorrection (xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual CP::CorrectionCode correctedCopy ATLAS_NOT_THREAD_SAFE (const xAOD::Jet &input, xAOD::Jet *&output) const
virtual CP::CorrectionCode correctedCopy (const xAOD::Jet &input, xAOD::Jet *&output, const xAOD::EventInfo &eInfo) const
virtual CP::CorrectionCode applyContainerCorrection ATLAS_NOT_THREAD_SAFE (xAOD::JetContainer &inputs) const
virtual CP::CorrectionCode applyContainerCorrection (xAOD::JetContainer &inputs, const xAOD::EventInfo &eInfo) const
virtual CP::CorrectionCode applyContainerCorrection (xAOD::JetContainer &inputs, const CP::SystematicSet &syst) const
 Reentrant correction: applies syst without mutating shared state.
virtual bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const
 Declare the interface that this class provides.
virtual CP::SystematicSet affectingSystematics () const
 the list of all systematics this tool can be affected by
virtual CP::SystematicSet recommendedSystematics () const
 the list of all systematics this tool recommends to use
virtual CP::SystematicSet appliedSystematics () const
virtual StatusCode applySystematicVariation (const CP::SystematicSet &systConfig)
 effects: configure this tool for the given list of systematic variations.
virtual TH2D *getPtCorrelationMatrix ATLAS_NOT_THREAD_SAFE (const int numBins, const double minPt, const double maxPt, const double valEta)
virtual TH2D *getPtCorrelationMatrix ATLAS_NOT_THREAD_SAFE (const int numBins, const double minPt, const double maxPt, const double valEta1, const double valEta2)
virtual TH2D *getEtaCorrelationMatrix ATLAS_NOT_THREAD_SAFE (const int numBins, const double minEta, const double maxEta, const double valPt)
virtual TH2D *getEtaCorrelationMatrix ATLAS_NOT_THREAD_SAFE (const int numBins, const double minEta, const double maxEta, const double valPt1, const double valPt2)
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

StatusCode addUncertaintyGroup (const jet::ConfigHelper &helper)
StatusCode addUncertaintyComponent (const jet::ConfigHelper &helper)
jet::UncertaintyComponent * buildUncertaintyComponent (const jet::ComponentHelper &component) const
const xAOD::EventInfo *getDefaultEventInfo ATLAS_NOT_THREAD_SAFE () const
StatusCode checkIndexInput (const size_t index) const
double getSmearingFactor (const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum smearType, const double variation) const
double getNominalResolution (const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum smearType, const jet::JetTopology::TypeEnum topology, const bool readMC) const
double readHistoFromParam (const xAOD::Jet &jet, const jet::UncertaintyHistogram &histo, const jet::CompParametrization::TypeEnum param, const jet::CompMassDef::TypeEnum massDef) const
double readHistoFromParam (const xAOD::JetFourMom_t &jet4vec, const jet::UncertaintyHistogram &histo, const jet::CompParametrization::TypeEnum param) const
StatusCode updateSplittingScale12 (xAOD::Jet &jet, const double shift) const
StatusCode updateSplittingScale23 (xAOD::Jet &jet, const double shift) const
StatusCode updateTau21 (xAOD::Jet &jet, const double shift) const
StatusCode updateTau32 (xAOD::Jet &jet, const double shift) const
StatusCode updateTau21WTA (xAOD::Jet &jet, const double shift) const
StatusCode updateTau32WTA (xAOD::Jet &jet, const double shift) const
StatusCode updateD2Beta1 (xAOD::Jet &jet, const double shift) const
StatusCode updateC2Beta1 (xAOD::Jet &jet, const double shift) const
StatusCode updateQw (xAOD::Jet &jet, const double shift) const
StatusCode updateTagScaleFactor (xAOD::Jet &jet, const double shift) const
StatusCode updateTagEfficiency (xAOD::Jet &jet, const double shift) const
bool checkIfRecommendedSystematic (const jet::UncertaintyGroup &systematic) const
virtual StatusCode addAffectingSystematic (const CP::SystematicVariation &systematic, bool recommended)
virtual StatusCode getFilteredSystematicSet (const CP::SystematicSet &systConfig, CP::SystematicSet &filteredSet)
virtual StatusCode getUncertaintySet (const CP::SystematicSet &filteredSet, jet::UncertaintySet *&uncSet)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_isInit
const std::string m_name
float m_energyScale
std::string m_release
std::string m_jetDef
std::string m_mcType
std::string m_configFile
std::string m_calibArea
std::string m_path
std::string m_analysisFile
std::string m_analysisHistPattern
std::string m_NJetAccessorName
std::vector< std::string > m_systFilters
std::string m_name_TagScaleFactor
std::string m_name_EffSF
std::string m_name_SigeffSF
std::string m_name_Efficiency
std::string m_name_TagResult
std::string m_defAnaFile
float m_refNPV
float m_refMu
jet::UncertaintyHistogram * m_refNPVHist
jet::UncertaintyHistogram * m_refMuHist
std::vector< jet::UncertaintyGroup * > m_groups
CP::SystematicSet m_recognizedSystematics
CP::SystematicSet m_recommendedSystematics
CP::SystematicSet m_currentSystSet
jet::UncertaintySet * m_currentUncSet
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilterMap
std::unordered_map< CP::SystematicSet, jet::UncertaintySet * > m_systSetMap
jet::ValidityHistogram * m_fileValidHist
jet::UncertaintyHistogram * m_caloMassWeight
jet::UncertaintyHistogram * m_TAMassWeight
jet::CompMassDef::TypeEnum m_combMassWeightCaloMassDef
jet::CompMassDef::TypeEnum m_combMassWeightTAMassDef
jet::CompParametrization::TypeEnum m_combMassParam
long long int m_userSeed
std::mutex m_reentrantMutex
bool m_isData
jet::ResolutionHelper * m_resHelper
const std::string m_namePrefix
SG::Accessor< float > m_accTagScaleFactor
SG::Accessor< float > m_accEffSF
SG::Accessor< float > m_accSigeffSF
SG::Accessor< float > m_accEfficiency
SG::Accessor< bool > m_accTagResult
bool m_absEtaGluonFraction
bool m_pseudoDataJERsmearingMode
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 40 of file JetUncertaintiesTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetUncertaintiesTool() [1/2]

JetUncertaintiesTool::JetUncertaintiesTool ( const std::string & name = "JetUncertaintiesTool")

Definition at line 65 of file JetUncertaintiesTool.cxx.

66 : asg::AsgTool(name)
67 , m_isInit(false)
68 , m_name(name)
69 , m_energyScale(1.e-3)
70 , m_release("")
71 , m_jetDef("")
72 , m_mcType("")
73 , m_configFile("")
74 , m_calibArea("CalibArea-08")
75 , m_path("")
76 , m_analysisFile("")
78 , m_NJetAccessorName("Njet")
80 , m_defAnaFile("")
81 , m_refNPV(-1)
82 , m_refMu(-1)
83 , m_refNPVHist(nullptr)
84 , m_refMuHist(nullptr)
85 , m_groups()
89 , m_currentUncSet(nullptr)
91 , m_systSetMap()
92 , m_fileValidHist(nullptr)
93 , m_caloMassWeight(nullptr)
94 , m_TAMassWeight(nullptr)
98 , m_userSeed(0)
99 , m_isData(true)
100 , m_resHelper(nullptr)
101 , m_namePrefix("JET_")
102 , m_accTagScaleFactor("temp_SF")
103 , m_accEffSF("temp_effSF")
104 , m_accSigeffSF("temp_sigeffSF")
105 , m_accEfficiency("temp_efficiency")
106 , m_accTagResult("temp_accept")
109{
110 declareProperty("JetDefinition",m_jetDef);
111 declareProperty("MCType",m_mcType);
112 declareProperty("ConfigFile",m_configFile);
113 declareProperty("CalibArea",m_calibArea);
114 declareProperty("Path",m_path);
115 declareProperty("AnalysisFile",m_analysisFile);
116 declareProperty("AnalysisHistPattern",m_analysisHistPattern);
117 declareProperty("NJetAccessorName",m_NJetAccessorName);
118 declareProperty("VariablesToShift",m_systFilters);
119 declareProperty("IsData",m_isData);
120 declareProperty("AbsEtaGluonFraction",m_absEtaGluonFraction);
121 declareProperty("PseudoDataJERsmearingMode",m_pseudoDataJERsmearingMode);
122
123 ATH_MSG_DEBUG("Creating JetUncertaintiesTool named "<<m_name);
124
125 // Set dummy default systematic (do nothing)
126 // Prevents NULL access if user tries to apply correction without first calling function
127 if (JetUncertaintiesTool::applySystematicVariation(CP::SystematicSet()) != StatusCode::SUCCESS)
128 ATH_MSG_ERROR(Form("Failed to pre-set applySystematicVariation to no variation"));
129}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
jet::UncertaintyHistogram * m_caloMassWeight
CP::SystematicSet m_currentSystSet
SG::Accessor< float > m_accSigeffSF
std::vector< jet::UncertaintyGroup * > m_groups
jet::UncertaintyHistogram * m_refMuHist
SG::Accessor< bool > m_accTagResult
jet::CompMassDef::TypeEnum m_combMassWeightTAMassDef
jet::UncertaintyHistogram * m_refNPVHist
std::vector< std::string > m_systFilters
CP::SystematicSet m_recommendedSystematics
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilterMap
CP::SystematicSet m_recognizedSystematics
SG::Accessor< float > m_accEffSF
jet::UncertaintyHistogram * m_TAMassWeight
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig)
effects: configure this tool for the given list of systematic variations.
SG::Accessor< float > m_accEfficiency
const std::string m_namePrefix
std::unordered_map< CP::SystematicSet, jet::UncertaintySet * > m_systSetMap
SG::Accessor< float > m_accTagScaleFactor
jet::ValidityHistogram * m_fileValidHist
jet::CompParametrization::TypeEnum m_combMassParam
jet::ResolutionHelper * m_resHelper
jet::UncertaintySet * m_currentUncSet
jet::CompMassDef::TypeEnum m_combMassWeightCaloMassDef

◆ JetUncertaintiesTool() [2/2]

JetUncertaintiesTool::JetUncertaintiesTool ( const JetUncertaintiesTool & toCopy)

Definition at line 131 of file JetUncertaintiesTool.cxx.

132 : asg::AsgTool(toCopy.m_name+"_copy")
133 , m_isInit(toCopy.m_isInit)
134 , m_name(toCopy.m_name+"_copy")
135 , m_energyScale(1.e-3)
136 , m_release(toCopy.m_release)
137 , m_jetDef(toCopy.m_jetDef)
138 , m_mcType(toCopy.m_mcType)
139 , m_configFile(toCopy.m_configFile)
140 , m_calibArea(toCopy.m_calibArea)
141 , m_path(toCopy.m_path)
146 , m_defAnaFile(toCopy.m_defAnaFile)
147 , m_refNPV(toCopy.m_refNPV)
148 , m_refMu(toCopy.m_refMu)
149 , m_refNPVHist(toCopy.m_refNPVHist?new UncertaintyHistogram(*toCopy.m_refNPVHist):nullptr)
150 , m_refMuHist(toCopy.m_refMuHist?new UncertaintyHistogram(*toCopy.m_refMuHist):nullptr)
151 , m_groups()
155 , m_currentUncSet(nullptr)
157 , m_systSetMap()
159 , m_caloMassWeight(nullptr)
160 , m_TAMassWeight(nullptr)
164 , m_userSeed(toCopy.m_userSeed)
165 , m_isData(toCopy.m_isData)
166 , m_resHelper(new ResolutionHelper(*toCopy.m_resHelper))
167 , m_namePrefix(toCopy.m_namePrefix)
169 , m_accEffSF(toCopy.m_accEffSF)
175{
176 ATH_MSG_DEBUG("Creating copy of JetUncertaintiesTool named "<<m_name);
177
178 for (size_t iGroup = 0; iGroup < toCopy.m_groups.size(); ++iGroup)
179 m_groups.push_back(new UncertaintyGroup(*toCopy.m_groups.at(iGroup)));
180
182 ATH_MSG_ERROR(Form("Failed to re-set applySystematicVariation in new tool copy"));
183}

◆ ~JetUncertaintiesTool()

JetUncertaintiesTool::~JetUncertaintiesTool ( )
virtual

Definition at line 185 of file JetUncertaintiesTool.cxx.

186{
187 ATH_MSG_DEBUG(Form("Deleting JetUncertaintiesTool named %s",m_name.c_str()));
188
189 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
190 JESUNC_SAFE_DELETE(m_groups.at(iGroup));
191 m_groups.clear();
192
198
199 m_currentUncSet = nullptr;
200
201 m_systFilterMap.clear();
202
203 std::unordered_map<CP::SystematicSet,UncertaintySet*>::iterator iter;
204 for (iter = m_systSetMap.begin(); iter != m_systSetMap.end(); ++iter)
205 JESUNC_SAFE_DELETE(iter->second);
206 m_systSetMap.clear();
207
209}

Member Function Documentation

◆ addAffectingSystematic()

StatusCode JetUncertaintiesTool::addAffectingSystematic ( const CP::SystematicVariation & systematic,
bool recommended )
privatevirtual

Definition at line 1291 of file JetUncertaintiesTool.cxx.

1292{
1293 CP::SystematicRegistry& registry = CP::SystematicRegistry::getInstance();
1294 registry.registerSystematic(systematic);
1295 m_recognizedSystematics.insert(systematic);
1296 if (recommended)
1297 {
1298 m_recommendedSystematics.insert(systematic);
1299 if (registry.addSystematicToRecommended(systematic) != StatusCode::SUCCESS)
1300 {
1301 ATH_MSG_ERROR("Failed to add systematic to list of recommended systematics: " << systematic.name());
1302 return StatusCode::FAILURE;
1303 }
1304 }
1305 return StatusCode::SUCCESS;
1306}
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
const std::string & name() const
description: the full systematics name, for use in strings, etc.

◆ addUncertaintyComponent()

StatusCode JetUncertaintiesTool::addUncertaintyComponent ( const jet::ConfigHelper & helper)
private

Definition at line 834 of file JetUncertaintiesTool.cxx.

835{
836 const bool isSimpleGroup = helper.isCompGroup();
837 const ComponentHelper& component = *helper.getComponentInfo();
838 const GroupHelper& group = *helper.getGroupInfo();
839
840 ATH_MSG_DEBUG(Form("Starting to process %s named %s",isSimpleGroup?"simple component group":"standard component",component.name.Data()));
841
842 // Find the group index that this component belongs to
843 // Note that if this is a simple group, we first need to build the associated group
844 if (isSimpleGroup)
845 {
846 UncertaintyGroup* simpleGroup = new UncertaintyGroup(group);
847 if (!simpleGroup)
848 {
849 ATH_MSG_ERROR("Failed to build simple group for component: " << component.name.Data());
850 return StatusCode::FAILURE;
851 }
852 const size_t groupIndex = m_groups.size();
853 m_groups.push_back(simpleGroup);
854 ATH_MSG_DEBUG(Form("Created new group \"%s\" for a simple component at index %zu",simpleGroup->getName().Data(),groupIndex));
855
856 if (!m_groups.back()->getSubgroupNum())
857 {
858 size_t numGroups = 0;
859 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
860 if (!m_groups.at(iGroup)->getSubgroupNum())
861 numGroups++;
862 ATH_MSG_INFO(Form("%5zu. %-40s : %s",numGroups //m_groups.size()
863 ,m_groups.back()->getName().Data()
864 ,m_groups.back()->getDesc().Data() ));
865 }
866
867 // We now have the simple component group
868 // Check if we are in the simple case (one component) or more difficult case (sub components)
869 if (component.subComps.empty())
870 {
871 // Easy case, build the component and add it directly
872 UncertaintyComponent* compObject = buildUncertaintyComponent(component);
873 if (!compObject)
874 return StatusCode::FAILURE;
875
876 if (m_groups.at(groupIndex)->addComponent(compObject).isFailure())
877 return StatusCode::FAILURE;
878 ATH_MSG_DEBUG(Form("Added single component \"%s\" to simple group \"%s\" (index %zu)",compObject->getName().Data(),m_groups.at(groupIndex)->getName().Data(),groupIndex));
879 }
880 else
881 {
882 for (size_t iSubComp = 0; iSubComp < component.subComps.size(); ++iSubComp)
883 {
884 // Build a new ComponentHelper object for each subcomponent
885 ComponentHelper subComp(component);
886 subComp.uncNames.clear();
887 subComp.subComps.clear();
888 subComp.name = component.subComps.at(iSubComp);
889 subComp.uncNames.push_back(component.subComps.at(iSubComp));
890
891 UncertaintyComponent* subCompObject = buildUncertaintyComponent(subComp);
892 if (!subCompObject)
893 return StatusCode::FAILURE;
894
895 if (m_groups.at(groupIndex)->addComponent(subCompObject).isFailure())
896 return StatusCode::FAILURE;
897 ATH_MSG_DEBUG(Form("Added component \"%s\" (%zu of %zu) to simple group \"%s\" (index %zu)",subCompObject->getName().Data(),iSubComp+1,component.subComps.size(),m_groups.at(groupIndex)->getName().Data(),groupIndex));
898 }
899 }
900 }
901 else
902 {
903 size_t groupIndex = 0;
904 if (m_groups.empty())
905 {
906 ATH_MSG_ERROR("No groups exist to add the component to: " << component.name.Data());
907 return StatusCode::FAILURE;
908 }
909 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
910 if (m_groups.at(iGroup)->getGroupNum() == component.groupNum)
911 {
912 groupIndex = iGroup;
913 break;
914 }
915 if (groupIndex == 0 && m_groups.at(0)->getGroupNum() != component.groupNum)
916 {
917 ATH_MSG_ERROR("Failed to find group " << component.groupNum << " for the component: " << component.name.Data());
918 return StatusCode::FAILURE;
919 }
920
921 // We now have the group index where the component belongs
922 // Get the component we want to add (complicated function...)
923 UncertaintyComponent* compObject = buildUncertaintyComponent(component);
924 if (!compObject)
925 return StatusCode::FAILURE;
926
927 if (m_groups.at(groupIndex)->addComponent(compObject).isFailure())
928 return StatusCode::FAILURE;
929 ATH_MSG_DEBUG(Form("Added component \"%s\" to group \"%s\" (index %zu)",compObject->getName().Data(),m_groups.at(groupIndex)->getName().Data(),groupIndex));
930 }
931
932 return StatusCode::SUCCESS;
933}
#define ATH_MSG_INFO(x,...)
jet::UncertaintyComponent * buildUncertaintyComponent(const jet::ComponentHelper &component) const
std::vector< TString > subComps
virtual TString getName() const
virtual TString getName() const

◆ addUncertaintyGroup()

StatusCode JetUncertaintiesTool::addUncertaintyGroup ( const jet::ConfigHelper & helper)
private

Definition at line 795 of file JetUncertaintiesTool.cxx.

796{
797 const GroupHelper& group = *helper.getGroupInfo();
798
799 // Ensure the group number is specified and doesn't conflict with existing groups
800 if (group.groupNum == 0)
801 {
802 ATH_MSG_ERROR("Group number was not specified for group: " << group.name.Data());
803 return StatusCode::FAILURE;
804 }
805 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
806 if (m_groups.at(iGroup)->getGroupNum() == group.groupNum)
807 {
808 ATH_MSG_ERROR("Group number matches previous group (" << m_groups.at(iGroup)->getName().Data() << "): " << group.name.Data());
809 return StatusCode::FAILURE;
810 }
811
812 // Build the new group
813 UncertaintyGroup* toAdd = new UncertaintyGroup(group);
814 if (!toAdd)
815 {
816 ATH_MSG_ERROR("Failed to build new group: " << group.name.Data());
817 return StatusCode::FAILURE;
818 }
819
820 m_groups.push_back(toAdd);
821 if (!m_groups.back()->getSubgroupNum())
822 {
823 size_t numGroups = 0;
824 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
825 if (!m_groups.at(iGroup)->getSubgroupNum())
826 numGroups++;
827 ATH_MSG_INFO(Form("%5zu. %-40s : %s",numGroups //m_groups.size()
828 ,m_groups.back()->getName().Data()
829 ,m_groups.back()->getDesc().Data() ));
830 }
831 return StatusCode::SUCCESS;
832}

◆ affectingSystematics()

CP::SystematicSet JetUncertaintiesTool::affectingSystematics ( ) const
virtual

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 1251 of file JetUncertaintiesTool.cxx.

1252{
1254}

◆ appliedSystematics()

CP::SystematicSet JetUncertaintiesTool::appliedSystematics ( ) const
virtual

Definition at line 1261 of file JetUncertaintiesTool.cxx.

1262{
1263 return m_currentSystSet;
1264}

◆ applyContainerCorrection() [1/2]

CP::CorrectionCode JetUncertaintiesTool::applyContainerCorrection ( xAOD::JetContainer & inputs,
const CP::SystematicSet & syst ) const
virtual

Reentrant correction: applies syst without mutating shared state.

Requires applySystematicVariation(syst) during initialize().

Implements ICPJetUncertaintiesTool.

Definition at line 2311 of file JetUncertaintiesTool.cxx.

2313{
2314 std::lock_guard<std::mutex> lock(m_reentrantMutex);
2316 const_cast<JetUncertaintiesTool*>(this);
2317 if (nc_this->applySystematicVariation(syst) != StatusCode::SUCCESS)
2319 const xAOD::EventInfo* eInfo = nullptr;
2320 if (evtStore()->retrieve(eInfo, "EventInfo").isFailure()) {
2321 ATH_MSG_ERROR("Failed to retrieve EventInfo in applyContainerCorrection");
2323 }
2324 return applyContainerCorrection(inputs, *eInfo);
2325}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
#define ATLAS_THREAD_SAFE
ServiceHandle< StoreGateSvc > & evtStore()
@ Error
Some error happened during the object correction.
virtual CP::CorrectionCode applyContainerCorrection(xAOD::JetContainer &inputs, const xAOD::EventInfo &eInfo) const
JetUncertaintiesTool(const std::string &name="JetUncertaintiesTool")
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ applyContainerCorrection() [2/2]

CP::CorrectionCode JetUncertaintiesTool::applyContainerCorrection ( xAOD::JetContainer & inputs,
const xAOD::EventInfo & eInfo ) const
virtual

Implements ICPJetUncertaintiesTool.

Definition at line 2297 of file JetUncertaintiesTool.cxx.

2298{
2299 CP::CorrectionCode result = CP::CorrectionCode::Ok;
2300
2301 // Loop over the container
2302 for (size_t iJet = 0; iJet < inputs.size(); ++iJet)
2303 {
2304 result = applyCorrection(*inputs.at(iJet),eInfo);
2305 if (result == CP::CorrectionCode::Error)
2306 break;
2307 }
2308 return result;
2309}
@ Ok
The correction was done successfully.
virtual CP::CorrectionCode applyCorrection(xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const

◆ applyCorrection()

CP::CorrectionCode JetUncertaintiesTool::applyCorrection ( xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
virtual

Implements ICPJetUncertaintiesTool.

Definition at line 2090 of file JetUncertaintiesTool.cxx.

2091{
2092 if (!m_isInit)
2093 {
2094 ATH_MSG_FATAL("Tool must be initialized before calling applyCorrection");
2096 }
2097
2098 // Check for a global validity histogram
2099 if (m_fileValidHist && !m_fileValidHist->getValidity(jet)){
2101 }
2102
2103 // Scale the jet and/or its moments by the uncertainty/uncertainties
2104 // Note that uncertainties may be either positive or negative
2105 // Make sure to check the validity at the same time
2106 std::vector< std::pair<CompScaleVar::TypeEnum,double> > uncSet;
2107 const std::vector< std::pair<CompScaleVar::TypeEnum,bool> > validitySet = m_currentUncSet->getValidUncertaintySet(uncSet,jet,eInfo);
2108
2109 // Ensure every case was successful
2110 bool allValid = true;
2111 for (size_t iVar = 0; iVar < validitySet.size(); ++iVar)
2112 {
2113 const bool validity = validitySet.at(iVar).second;
2114
2115 if (!validity)
2116 {
2117 allValid = false;
2118 // Disabled following email from Karsten Koeneke on Jan 28 2016: ATLAS rule is no error messages for out of validity range
2119 //const CompScaleVar::TypeEnum scaleVar = validitySet.at(iVar).first;
2120 //ATH_MSG_ERROR("Uncertainty configuration is not valid for the specified jet when attempting to scale " << CompScaleVar::enumToString(scaleVar).Data() << ". Set: " << m_currentUncSet->getName());
2121 }
2122 }
2123 if (!allValid)
2125
2126 // Ensure that we don't mix relative and absolute resolution uncertainties of the same type
2127 // Such situations violate the current code structure
2128 std::vector<CompScaleVar::TypeEnum> scaleVars = m_currentUncSet->getScaleVars();
2129 bool hasMassRes = false;
2130 bool hasPtRes = false;
2131 bool hasFvRes = false;
2132 for (CompScaleVar::TypeEnum var : scaleVars)
2133 {
2135 {
2136 if (hasMassRes)
2137 {
2138 ATH_MSG_ERROR("Varying both absolute and relative mass resolution components simultaneously is not supported");
2140 }
2141 else
2142 hasMassRes = true;
2143 }
2144 else if (var == CompScaleVar::PtRes || var == CompScaleVar::PtResAbs)
2145 {
2146 if (hasPtRes)
2147 {
2148 ATH_MSG_ERROR("Varying both absolute and relative pT resolution components simultaneously is not supported");
2150 }
2151 else
2152 hasPtRes = true;
2153 }
2154 else if (var == CompScaleVar::FourVecRes || var == CompScaleVar::FourVecResAbs)
2155 {
2156 if (hasFvRes)
2157 {
2158 ATH_MSG_ERROR("Varying both absolute and relative four-vector resolution components simultaneously is not supported");
2160 }
2161 else
2162 hasFvRes = true;
2163 }
2164 }
2165
2166 // Handle each case as needed
2167 for (size_t iVar = 0; iVar < uncSet.size(); ++iVar)
2168 {
2169 const CompScaleVar::TypeEnum scaleVar = uncSet.at(iVar).first;
2170 //const double unc = uncSet.at(iVar).second;
2171 const double shift = 1 + uncSet.at(iVar).second;
2172 const double smear = uncSet.at(iVar).second;
2173
2174 // Careful of const vs non-const objects with accessors
2175 // Can unintentionally create something new which didn't exist, as jet is non-const
2176 double smearingFactor = 1;
2177 switch (scaleVar)
2178 {
2180 jet.setJetP4(xAOD::JetFourMom_t(shift*jet.pt(),jet.eta(),jet.phi(),shift*jet.m()));
2181 break;
2182 case CompScaleVar::Pt:
2183 jet.setJetP4(xAOD::JetFourMom_t(shift*jet.pt(),jet.eta(),jet.phi(),jet.m()));
2184 break;
2185 case CompScaleVar::Mass:
2186 jet.setJetP4(xAOD::JetFourMom_t(jet.pt(),jet.eta(),jet.phi(),shift*jet.m()));
2187 break;
2188 case CompScaleVar::D12:
2189 if (updateSplittingScale12(jet,shift).isFailure())
2191 break;
2192 case CompScaleVar::D23:
2193 if (updateSplittingScale23(jet,shift).isFailure())
2195 break;
2197 if (updateTau21(jet,shift).isFailure())
2199 break;
2201 if (updateTau32(jet,shift).isFailure())
2203 break;
2205 if (updateTau21WTA(jet,shift).isFailure())
2207 break;
2209 if (updateTau32WTA(jet,shift).isFailure())
2211 break;
2213 if (updateD2Beta1(jet,shift).isFailure())
2215 break;
2217 if (updateC2Beta1(jet,shift).isFailure())
2219 break;
2220 case CompScaleVar::Qw:
2221 if (updateQw(jet,shift).isFailure())
2223 break;
2225 if (updateTagScaleFactor(jet,shift).isFailure())
2227 break;
2229 if (updateTagEfficiency(jet,uncSet.at(iVar).second).isFailure())
2231 break;
2234 if (m_currentUncSet->getTopology() == JetTopology::UNKNOWN)
2235 {
2236 // The JMR requires that there is a topology specified
2237 // (JMR uncertainties are topology-specific)
2238 ATH_MSG_ERROR("Smearing the mass without specifying the topology is not supported");
2240 }
2241 if (m_currentUncSet->getTopology() == JetTopology::MIXED)
2242 {
2243 // We can't handle multi-topology JMR uncertainties
2244 ATH_MSG_ERROR("Smearing the mass using multiple topology definitions is not supported");
2246 }
2247 smearingFactor = getSmearingFactor(jet,scaleVar,smear);
2248 jet.setJetP4(xAOD::JetFourMom_t(jet.pt(),jet.eta(),jet.phi(),smearingFactor*jet.m()));
2249 break;
2252 smearingFactor = getSmearingFactor(jet,scaleVar,smear);
2253 jet.setJetP4(xAOD::JetFourMom_t(smearingFactor*jet.pt(),jet.eta(),jet.phi(),jet.m()));
2254 break;
2257 smearingFactor = getSmearingFactor(jet,scaleVar,smear);
2258 jet.setJetP4(xAOD::JetFourMom_t(smearingFactor*jet.pt(),jet.eta(),jet.phi(),smearingFactor*jet.m()));
2259 break;
2260 default:
2261 ATH_MSG_ERROR("Asked to scale an UNKNOWN variable for set: " << m_currentUncSet->getName());
2263 }
2264 }
2265
2267}
#define ATH_MSG_FATAL(x,...)
@ OutOfValidityRange
Input object is out of validity range.
StatusCode updateTau32(xAOD::Jet &jet, const double shift) const
StatusCode updateTagEfficiency(xAOD::Jet &jet, const double shift) const
StatusCode updateC2Beta1(xAOD::Jet &jet, const double shift) const
double getSmearingFactor(const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum smearType, const double variation) const
StatusCode updateTau32WTA(xAOD::Jet &jet, const double shift) const
StatusCode updateTau21(xAOD::Jet &jet, const double shift) const
StatusCode updateSplittingScale12(xAOD::Jet &jet, const double shift) const
StatusCode updateTagScaleFactor(xAOD::Jet &jet, const double shift) const
StatusCode updateSplittingScale23(xAOD::Jet &jet, const double shift) const
StatusCode updateD2Beta1(xAOD::Jet &jet, const double shift) const
StatusCode updateQw(xAOD::Jet &jet, const double shift) const
StatusCode updateTau21WTA(xAOD::Jet &jet, const double shift) const
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the container.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition JetTypes.h:17

◆ applySystematicVariation()

StatusCode JetUncertaintiesTool::applySystematicVariation ( const CP::SystematicSet & systConfig)
virtual

effects: configure this tool for the given list of systematic variations.

any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors

Implements CP::ISystematicsTool.

Definition at line 1308 of file JetUncertaintiesTool.cxx.

1309{
1310 //if (!m_isInit)
1311 //{
1312 // ATH_MSG_FATAL("Tool must be initialized before calling applySystematicVariation");
1313 // return StatusCode::FAILURE;
1314 //}
1315 CP::SystematicSet filteredSet;
1317 std::string remappedName = systConfig.name();
1318 size_t found = remappedName.find("_PseudoData");
1319 if (found != std::string::npos) {
1320 remappedName.erase(found, std::string("_PseudoData").length());
1321 }
1322
1323 CP::SystematicSet altConfig(remappedName);
1324 // Filter the full set of systematics to the set we care about
1325 if (getFilteredSystematicSet(altConfig,filteredSet) != StatusCode::SUCCESS)
1326 return StatusCode::FAILURE;
1327 }
1328 else {
1329 // Filter the full set of systematics to the set we care about
1330 if (getFilteredSystematicSet(systConfig,filteredSet) != StatusCode::SUCCESS)
1331 return StatusCode::FAILURE;
1332 }
1333
1334 // Get the uncertainty set associated to the filtered systematics set
1335 jet::UncertaintySet* uncSet = nullptr;
1336 if (getUncertaintySet(filteredSet,uncSet) != StatusCode::SUCCESS)
1337 return StatusCode::FAILURE;
1338
1339 // Change the current state
1340 m_currentSystSet.swap(filteredSet);
1341 m_currentUncSet = uncSet;
1342 return StatusCode::SUCCESS;
1343}
double length(const pvec &v)
const std::string & name() const
returns: the systematics joined into a single string.
virtual StatusCode getUncertaintySet(const CP::SystematicSet &filteredSet, jet::UncertaintySet *&uncSet)
virtual StatusCode getFilteredSystematicSet(const CP::SystematicSet &systConfig, CP::SystematicSet &filteredSet)

◆ ATLAS_NOT_THREAD_SAFE() [1/14]

const xAOD::EventInfo *getDefaultEventInfo JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( ) const
private

◆ ATLAS_NOT_THREAD_SAFE() [2/14]

virtual TH2D *getEtaCorrelationMatrix JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( const int numBins,
const double minEta,
const double maxEta,
const double valPt )
virtual

◆ ATLAS_NOT_THREAD_SAFE() [3/14]

virtual TH2D *getEtaCorrelationMatrix JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( const int numBins,
const double minEta,
const double maxEta,
const double valPt1,
const double valPt2 )
virtual

◆ ATLAS_NOT_THREAD_SAFE() [4/14]

virtual TH2D *getPtCorrelationMatrix JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( const int numBins,
const double minPt,
const double maxPt,
const double valEta )
virtual

◆ ATLAS_NOT_THREAD_SAFE() [5/14]

virtual TH2D *getPtCorrelationMatrix JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( const int numBins,
const double minPt,
const double maxPt,
const double valEta1,
const double valEta2 )
virtual

◆ ATLAS_NOT_THREAD_SAFE() [6/14]

virtual CP::CorrectionCode correctedCopy JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( const xAOD::Jet & input,
xAOD::Jet *& output ) const
virtual

◆ ATLAS_NOT_THREAD_SAFE() [7/14]

virtual double getUncertainty JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( size_t index,
const xAOD::Jet & jet ) const
virtual

Implements IJetUncertaintiesTool.

◆ ATLAS_NOT_THREAD_SAFE() [8/14]

virtual bool getValidity JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( size_t index,
const xAOD::Jet & jet ) const
virtual

Implements IJetUncertaintiesTool.

◆ ATLAS_NOT_THREAD_SAFE() [9/14]

virtual double getUncertainty JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( size_t index,
const xAOD::Jet & jet,
const jet::CompScaleVar::TypeEnum scaleVar ) const
virtual

◆ ATLAS_NOT_THREAD_SAFE() [10/14]

virtual bool getValidity JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( size_t index,
const xAOD::Jet & jet,
const jet::CompScaleVar::TypeEnum scaleVar ) const
virtual

◆ ATLAS_NOT_THREAD_SAFE() [11/14]

virtual bool getValidUncertainty JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( size_t index,
double & unc,
const xAOD::Jet & jet ) const
virtual

Implements IJetUncertaintiesTool.

◆ ATLAS_NOT_THREAD_SAFE() [12/14]

virtual bool getValidUncertainty JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( size_t index,
double & unc,
const xAOD::Jet & jet,
const jet::CompScaleVar::TypeEnum scaleVar ) const
virtual

◆ ATLAS_NOT_THREAD_SAFE() [13/14]

virtual CP::CorrectionCode applyCorrection JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( xAOD::Jet & jet) const
virtual

◆ ATLAS_NOT_THREAD_SAFE() [14/14]

virtual CP::CorrectionCode applyContainerCorrection JetUncertaintiesTool::ATLAS_NOT_THREAD_SAFE ( xAOD::JetContainer & inputs) const
virtual

◆ buildUncertaintyComponent()

UncertaintyComponent * JetUncertaintiesTool::buildUncertaintyComponent ( const jet::ComponentHelper & component) const
private

Definition at line 935 of file JetUncertaintiesTool.cxx.

936{
937 // Safety checks for required information
938 if (component.name == "")
939 {
940 ATH_MSG_ERROR("Attempting to create a component with no name");
941 return nullptr;
942 }
944 {
945 ATH_MSG_ERROR("Attempting to create a component with no parametrization: " << component.name.Data());
946 return nullptr;
947 }
948 if (component.scaleVar == CompScaleVar::UNKNOWN)
949 {
950 ATH_MSG_ERROR("Attempting to create a component with no variable to scale: " << component.name.Data());
951 return nullptr;
952 }
953
954 // Special cases first
955 if (component.isSpecial)
956 {
957 // First check pileup components
958 if (component.pileupType != PileupComp::UNKNOWN)
959 {
960 // Ensure that the reference values were specified
961 if (m_refNPV < 0 && !m_refNPVHist)
962 {
963 ATH_MSG_ERROR("Attempted to create pileup component without NPV reference value: " << component.name.Data());
964 return nullptr;
965 }
966 if (m_refMu < 0 && !m_refMuHist)
967 {
968 ATH_MSG_ERROR("Attempted to create pileup component without mu reference value: " << component.name.Data());
969 return nullptr;
970 }
971
973 {
975 return new PileupUncertaintyComponent(component,m_refNPVHist,m_refMuHist);
976 else if (!m_refNPVHist && !m_refMuHist)
977 return new PileupUncertaintyComponent(component,m_refNPV,m_refMu);
978 else if (m_refNPVHist && !m_refMuHist)
979 return new PileupUncertaintyComponent(component,m_refNPVHist,m_refMu);
980 else if (!m_refNPVHist && m_refMuHist)
981 return new PileupUncertaintyComponent(component,m_refNPV,m_refMuHist);
982 }
983 else
984 {
985 ATH_MSG_ERROR(Form("Unexpected parametrization of %s for component %s",CompParametrization::enumToString(component.parametrization).Data(),component.name.Data()));
986 return nullptr;
987 }
988 }
989 // Next check flavour components
990 else if (component.flavourType != FlavourComp::UNKNOWN)
991 {
992 if (m_analysisFile.empty())
993 {
994 ATH_MSG_ERROR("Attempting to create a flavour uncertainty component without having specified an AnalysisRootFile");
995 return nullptr;
996 }
998 {
999
1000 if (component.flavourType == FlavourComp::PerJetResponse ||
1005 return new PerJetFlavourUncertaintyComponent(component);
1006 }else
1007 return new FlavourUncertaintyComponent(component,m_jetDef,m_analysisFile.c_str(),m_defAnaFile.c_str(),m_path.c_str(),m_calibArea.c_str(),m_absEtaGluonFraction,m_analysisHistPattern.c_str(),m_NJetAccessorName);
1008
1009 }
1010 else
1011 {
1012 ATH_MSG_ERROR(Form("Unexpected parametrization of %s for component %s",CompParametrization::enumToString(component.parametrization).Data(),component.name.Data()));
1013 return nullptr;
1014 }
1015 }
1016 // Next check punchthrough
1017 else if (component.name.Contains("PunchThrough",TString::kIgnoreCase))
1018 {
1020 return new PunchthroughUncertaintyComponent(component);
1021 else
1022 {
1023 ATH_MSG_ERROR(Form("Unexpected parametrization of %s for component %s",CompParametrization::enumToString(component.parametrization).Data(),component.name.Data()));
1024 return nullptr;
1025 }
1026 }
1027 // Next check closeby
1028 else if (component.name.Contains("Closeby",TString::kIgnoreCase))
1029 {
1031 return new ClosebyUncertaintyComponent(component);
1032 else
1033 {
1034 ATH_MSG_ERROR(Form("Unexpected parametrization of %s for component %s",CompParametrization::enumToString(component.parametrization).Data(),component.name.Data()));
1035 return nullptr;
1036 }
1037 }
1038 // Next check combined mass
1039 else if (component.combMassType != CombMassComp::UNKNOWN)
1040 {
1041 // Ensure we have the weights we need for combined mass uncertainties
1043 {
1044 ATH_MSG_ERROR("Asking to create a combined mass term without specifying weights: " << component.name.Data());
1045 return nullptr;
1046 }
1047
1048 // Create the component
1049 ComponentHelper combComp(component);
1050 combComp.name = component.name;
1051 combComp.uncNames.clear();
1052 CombinedMassUncertaintyComponent* cmuc = new CombinedMassUncertaintyComponent(combComp);
1053
1054 // Set the weights
1055 if (cmuc->setCaloWeights(m_caloMassWeight).isFailure()) return nullptr;
1056 if (cmuc->setTAWeights(m_TAMassWeight).isFailure()) return nullptr;
1058 if (cmuc->setCombWeightParam(m_combMassParam).isFailure()) return nullptr;
1059 if (component.combMassType == CombMassComp::Calo || component.combMassType == CombMassComp::Both)
1060 {
1061 // Define the calorimeter group if applicable
1062 GroupHelper caloGroupH(component.name+"_CaloGroup");
1063 caloGroupH.groupNum = 0;
1064 caloGroupH.subgroupNum = 0;
1065 caloGroupH.category = CompCategory::UNKNOWN;
1066 caloGroupH.correlation = CompCorrelation::Correlated;
1067 caloGroupH.reducible = false;
1068
1069 auto caloGroup = std::make_unique<UncertaintyGroup>(caloGroupH);
1070
1071 // Get the calo terms and calo mass definitions
1072 std::vector<TString> caloComps = jet::utils::vectorize<TString>(component.caloMassTerm,", ");
1073 std::vector<TString> caloMassDefs = jet::utils::vectorize<TString>(component.caloMassDef,", ");
1074 if (caloComps.size() != caloMassDefs.size())
1075 {
1076 ATH_MSG_ERROR("Unbalanced number of calo mass terms and calo mass definitions, " << caloComps.size() << " vs " << caloMassDefs.size() << " for combined mass component: " << component.name.Data());
1077 return nullptr;
1078 }
1079
1080 // Build the component(s) and add them directly
1081 for (size_t iComp = 0; iComp < caloComps.size(); ++iComp)
1082 {
1083 // Prepare the helper
1084 ComponentHelper caloCompH(component);
1085 caloCompH.uncNames.clear();
1086 caloCompH.isSpecial = false;
1087 caloCompH.name = caloComps.at(iComp);
1088 caloCompH.uncNames.push_back(std::string(caloCompH.name)+"_"+m_jetDef);
1089 caloCompH.massDef = CompMassDef::stringToEnum(caloMassDefs.at(iComp));
1090 if (caloCompH.massDef == CompMassDef::UNKNOWN)
1091 {
1092 ATH_MSG_ERROR("Failed to parse calo mass definition " << iComp << " (" << caloMassDefs.at(iComp).Data() << ") for combined mass component: " << component.name.Data());
1093 return nullptr;
1094 }
1095
1096 // Build the component
1097 UncertaintyComponent* caloComp = buildUncertaintyComponent(caloCompH);
1098 if (!caloComp)
1099 return nullptr;
1100
1101 if (caloGroup->addComponent(caloComp).isFailure())
1102 return nullptr;
1103 }
1104
1105 // Done preparations, now set the calo mass group
1106 if (auto p = caloGroup.release(); cmuc->setCaloTerm(p).isFailure()){//passes ownership
1107 delete p;
1108 return nullptr;
1109 }
1110 }
1111 if (component.combMassType == CombMassComp::TA || component.combMassType == CombMassComp::Both)
1112 {
1113 // Define the track-assisted group if applicable
1114 GroupHelper TAGroupH(component.name+"_TAGroup");
1115 TAGroupH.groupNum = 0;
1116 TAGroupH.subgroupNum = 0;
1117 TAGroupH.category = CompCategory::UNKNOWN;
1118 TAGroupH.correlation = CompCorrelation::Correlated;
1119 TAGroupH.reducible = false;
1120
1121 auto TAGroup = std::make_unique<UncertaintyGroup>(TAGroupH);
1122
1123
1124 // Set the TA terms and TA mass definitions
1125 std::vector<TString> TAComps = jet::utils::vectorize<TString>(component.TAMassTerm,", ");
1126 std::vector<TString> TAMassDefs = jet::utils::vectorize<TString>(component.TAMassDef,", ");
1127 if (TAComps.size() != TAMassDefs.size())
1128 {
1129 ATH_MSG_ERROR("Unbalanced number of TA mass terms and TA mass definitions, " << TAComps.size() << " vs " << TAMassDefs.size() << " for combined mass component: " << component.name.Data());
1130 return nullptr;
1131 }
1132
1133 // Build the component(s) and add them directly
1134 for (size_t iComp = 0; iComp < TAComps.size(); ++iComp)
1135 {
1136 // Prepare the helper
1137 ComponentHelper TACompH(component);
1138 TACompH.uncNames.clear();
1139 TACompH.isSpecial = false;
1140 TACompH.name = TAComps.at(iComp);
1141 TACompH.uncNames.push_back(std::string(TACompH.name)+"_"+m_jetDef);
1142 TACompH.massDef = CompMassDef::stringToEnum(TAMassDefs.at(iComp));
1143 if (TACompH.massDef == CompMassDef::UNKNOWN)
1144 {
1145 ATH_MSG_ERROR("Failed to parse TA mass definition " << iComp << " (" << TAMassDefs.at(iComp).Data() << ") for combined mass component: " << component.name.Data());
1146 return nullptr;
1147 }
1148
1149 //ATH_MSG_INFO("Creating TA component \"" << TACompH.name.Data() << "\" for combined mass component: " << component.name.Data());
1150
1151 // Build the component
1152 UncertaintyComponent* TAComp = buildUncertaintyComponent(TACompH);
1153 if (!TAComp)
1154 return nullptr;
1155
1156 if (TAGroup->addComponent(TAComp).isFailure())
1157 return nullptr;
1158 }
1159
1160 // Done preparations, now set the TA mass group
1161 if (auto p = TAGroup.release(); cmuc->setTATerm(p).isFailure()){//transfer ownership
1162 delete p;
1163 return nullptr;
1164 }
1165 }
1166
1167 // Done, return the component
1168 return cmuc;
1169 }
1170 // Next check large-R topology
1171 else if (component.name.Contains("Large",TString::kIgnoreCase) && component.name.Contains("Topology",TString::kIgnoreCase))
1172 {
1174 {
1175 if (!component.LargeRJetTruthLabels.empty())
1176 {
1177 return new LargeRTopologyUncertaintyComponent(component);
1178 }
1179 else
1180 {
1181 ATH_MSG_ERROR(Form("No LargeRJetTruthLabels specified for Large-R jet topology component %s",component.name.Data()));
1182 return nullptr;
1183 }
1184 }
1185 else
1186 {
1187 ATH_MSG_ERROR(Form("Unexpected parametrization of %s for component %s",CompParametrization::enumToString(component.parametrization).Data(),component.name.Data()));
1188 return nullptr;
1189 }
1190 }
1191 else
1192 {
1193 ATH_MSG_ERROR("Unexpected special component: " << component.name.Data());
1194 return nullptr;
1195 }
1196
1197 }
1198 // Standard components
1199 else
1200 {
1201 switch(component.parametrization)
1202 {
1204 return new PtUncertaintyComponent(component);
1207 return new PtEtaUncertaintyComponent(component);
1209 return new PtAbsMassUncertaintyComponent(component);
1211 return new PtMassUncertaintyComponent(component);
1213 return new PtLogPtMassForTagSFUncertaintyComponent(component);
1216 return new PtMassEtaUncertaintyComponent(component);
1219 return new PtAbsMassEtaUncertaintyComponent(component);
1221 return new ELogMassUncertaintyComponent(component);
1224 return new ELogMassEtaUncertaintyComponent(component);
1225 default:
1226 ATH_MSG_ERROR("Encountered unexpected parameter type: " << component.param.Data());
1227 return nullptr;
1228 }
1229 }
1230
1231 ATH_MSG_ERROR("Failed to find the type of component to build: " << component.name.Data());
1232 return nullptr;
1233}
virtual StatusCode setCaloTerm(UncertaintyGroup *caloComp)
virtual StatusCode setCombWeightParam(const CompParametrization::TypeEnum param)
virtual StatusCode setTAWeights(const UncertaintyHistogram *TAWeights)
virtual StatusCode setCombWeightMassDefs(const CompMassDef::TypeEnum caloMassDef, const CompMassDef::TypeEnum TAMassDef)
virtual StatusCode setCaloWeights(const UncertaintyHistogram *caloWeights)
virtual StatusCode setTATerm(UncertaintyGroup *TAComp)
PileupComp::TypeEnum pileupType
CompScaleVar::TypeEnum scaleVar
std::vector< LargeRJetTruthLabel::TypeEnum > LargeRJetTruthLabels
FlavourComp::TypeEnum flavourType
CompParametrization::TypeEnum parametrization
CombMassComp::TypeEnum combMassType
TypeEnum stringToEnum(const TString &type)
TString enumToString(const TypeEnum type)
bool vectorize(const TString &str, const TString &sep, std::vector< T > &result)

◆ checkIfRecommendedSystematic()

bool JetUncertaintiesTool::checkIfRecommendedSystematic ( const jet::UncertaintyGroup & systematic) const
private

Definition at line 1266 of file JetUncertaintiesTool.cxx.

1267{
1268 // Check for things like AFII non-closure in full sim configurations
1269 if (systematic.isAlwaysZero())
1270 return false;
1271
1272 // Check for filters
1273 bool passesFilter = m_systFilters.empty();
1274 const std::set<CompScaleVar::TypeEnum> scaleVars = systematic.getScaleVars();
1275
1276 for (size_t iFilter = 0; iFilter < m_systFilters.size(); ++iFilter)
1277 {
1278 if (scaleVars.count(CompScaleVar::stringToEnum(m_systFilters.at(iFilter))))
1279 {
1280 passesFilter = true;
1281 break;
1282 }
1283 }
1284 if (!passesFilter)
1285 return false;
1286
1287 // All checked, this is a recommended systematic
1288 return true;
1289}
virtual bool isAlwaysZero() const
virtual std::set< CompScaleVar::TypeEnum > getScaleVars() const
TypeEnum stringToEnum(const TString &type)

◆ checkIndexInput()

StatusCode JetUncertaintiesTool::checkIndexInput ( const size_t index) const
private

Definition at line 1552 of file JetUncertaintiesTool.cxx.

1553{
1554 if (!m_isInit)
1555 {
1556 ATH_MSG_FATAL("Tool must be initialized before asking for information pertaining to a given component index");
1557 return StatusCode::FAILURE;
1558 }
1559
1560 if (index >= m_groups.size())
1561 {
1562 ATH_MSG_ERROR(Form("Index out of bounds, asking for %zu in a container of size %zu",index,m_groups.size()));
1563 return StatusCode::FAILURE;
1564 }
1565
1566
1567 return StatusCode::SUCCESS;
1568}

◆ correctedCopy()

CP::CorrectionCode JetUncertaintiesTool::correctedCopy ( const xAOD::Jet & input,
xAOD::Jet *& output,
const xAOD::EventInfo & eInfo ) const
virtual

Implements ICPJetUncertaintiesTool.

Definition at line 2276 of file JetUncertaintiesTool.cxx.

2277{
2278 xAOD::Jet* copy = new xAOD::Jet(input);
2279
2280 // Call the implemented function
2281 if (applyCorrection(*copy,eInfo) != CP::CorrectionCode::Ok)
2282 {
2283 delete copy;
2285 }
2286 output = copy;
2288}
bool copy
Definition calibdata.py:26
output
Definition merge.py:16
Jet_v1 Jet
Definition of the current "jet version".

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getAnalysisFile()

virtual std::string JetUncertaintiesTool::getAnalysisFile ( ) const
inlinevirtual

Implements IJetUncertaintiesTool.

Definition at line 70 of file JetUncertaintiesTool.h.

70{ return m_analysisFile; }

◆ getAnalysisHistPattern()

virtual std::string JetUncertaintiesTool::getAnalysisHistPattern ( ) const
inlinevirtual

Definition at line 71 of file JetUncertaintiesTool.h.

71{ return m_analysisHistPattern; }

◆ getComponentCategories()

std::vector< std::string > JetUncertaintiesTool::getComponentCategories ( ) const
virtual

Definition at line 1966 of file JetUncertaintiesTool.cxx.

1967{
1968 if (!m_isInit)
1969 {
1970 ATH_MSG_FATAL("Tool must be initialized before calling getComponentCategories");
1971 return {};
1972 }
1973
1974 // Internally use a set for speed
1975 // Use std::string rather than CompCategory::TypeEnum because std::string has a hash
1976 // Hashed access should mean there is no speed difference between using the two types
1977 std::unordered_set<std::string> categories;
1978 for (size_t iComp = 0; iComp < m_groups.size(); ++iComp)
1979 categories.insert(CompCategory::enumToString(m_groups.at(iComp)->getCategory()).Data());
1980
1981 // Convert the set to a vector
1982 std::vector<std::string> categoryStrings;
1983 for (std::unordered_set<std::string>::const_iterator iter = categories.begin() ; iter != categories.end(); ++iter)
1984 categoryStrings.push_back(*iter);
1985
1986 return categoryStrings;
1987}
TString enumToString(const TypeEnum type)

◆ getComponentCategory()

std::string JetUncertaintiesTool::getComponentCategory ( const size_t index) const
virtual

Definition at line 1522 of file JetUncertaintiesTool.cxx.

1523{
1524 if (!m_isInit)
1525 {
1526 ATH_MSG_FATAL("Tool must be initialized before calling getComponentCategory");
1527 return "";
1528 }
1529
1530 if (index < m_groups.size())
1531 return CompCategory::enumToString(m_groups.at(index)->getCategory()).Data();
1532
1533 ATH_MSG_ERROR("Index out of bounds for component category: " << index);
1534 return "";
1535}

◆ getComponentDesc()

std::string JetUncertaintiesTool::getComponentDesc ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1507 of file JetUncertaintiesTool.cxx.

1508{
1509 if (!m_isInit)
1510 {
1511 ATH_MSG_FATAL("Tool must be initialized before calling getComponentDesc");
1512 return "";
1513 }
1514
1515 if (index < m_groups.size())
1516 return m_groups.at(index)->getDesc().Data();
1517
1518 ATH_MSG_ERROR("Index out of bounds for component desc: " << index);
1519 return "";
1520}

◆ getComponentIndex() [1/2]

size_t JetUncertaintiesTool::getComponentIndex ( const std::string & name) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1471 of file JetUncertaintiesTool.cxx.

1472{
1473 return getComponentIndex(TString(name.c_str()));
1474}
virtual size_t getComponentIndex(const std::string &name) const

◆ getComponentIndex() [2/2]

size_t JetUncertaintiesTool::getComponentIndex ( const TString & name) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1476 of file JetUncertaintiesTool.cxx.

1477{
1478 if (!m_isInit)
1479 {
1480 ATH_MSG_FATAL("Tool must be initialized before calling getComponentIndex");
1481 return m_groups.size();
1482 }
1483
1484 for (size_t iComp = 0; iComp < m_groups.size(); ++iComp)
1485 if (m_groups.at(iComp)->getName().CompareTo(name,TString::kIgnoreCase) == 0)
1486 return iComp;
1487
1488 ATH_MSG_ERROR("Failed to find index for requested component: " << name.Data());
1489 return m_groups.size();
1490}

◆ getComponentIsReducible()

bool JetUncertaintiesTool::getComponentIsReducible ( const size_t index) const
virtual

Definition at line 1537 of file JetUncertaintiesTool.cxx.

1538{
1539 if (!m_isInit)
1540 {
1541 ATH_MSG_FATAL("Tool must be initialized before calling getComponentIsReducible");
1542 return false;
1543 }
1544
1545 if (index < m_groups.size())
1546 return m_groups.at(index)->getIsReducible();
1547
1548 ATH_MSG_ERROR("Index out of bounds for component category: " << index);
1549 return false;
1550}

◆ getComponentName()

std::string JetUncertaintiesTool::getComponentName ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1492 of file JetUncertaintiesTool.cxx.

1493{
1494 if (!m_isInit)
1495 {
1496 ATH_MSG_FATAL("Tool must be initialized before calling getComponentName");
1497 return "";
1498 }
1499
1500 if (index < m_groups.size())
1501 return m_groups.at(index)->getName().Data();
1502
1503 ATH_MSG_ERROR("Index out of bounds for component name: " << index);
1504 return "";
1505}

◆ getComponentNamesInCategory()

std::vector< std::string > JetUncertaintiesTool::getComponentNamesInCategory ( const std::string & category) const
virtual

Definition at line 2014 of file JetUncertaintiesTool.cxx.

2015{
2016 if (!m_isInit)
2017 {
2018 ATH_MSG_FATAL("Tool must be initialized before calling getComponentNamesInCategory");
2019 return {};
2020 }
2021
2022 std::vector<size_t> components = getComponentsInCategory(category);
2023 std::vector<std::string> names;
2024 for (size_t iComp = 0; iComp < components.size(); ++iComp)
2025 names.push_back(getComponentName(components.at(iComp)));
2026
2027 return names;
2028}
virtual std::string getComponentName(const size_t index) const
virtual std::vector< size_t > getComponentsInCategory(const std::string &category) const

◆ getComponentScalesC2Beta1()

bool JetUncertaintiesTool::getComponentScalesC2Beta1 ( const size_t index) const
virtual

Definition at line 1625 of file JetUncertaintiesTool.cxx.

1626{
1627 if (checkIndexInput(index).isFailure()) return false;
1628 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::C2Beta1);
1629}
bool checkScalesSingleVar(const std::set< CompScaleVar::TypeEnum > &varSet, const CompScaleVar::TypeEnum var)
StatusCode checkIndexInput(const size_t index) const

◆ getComponentScalesD12()

bool JetUncertaintiesTool::getComponentScalesD12 ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1590 of file JetUncertaintiesTool.cxx.

1591{
1592 if (checkIndexInput(index).isFailure()) return false;
1593 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::D12);
1594}

◆ getComponentScalesD23()

bool JetUncertaintiesTool::getComponentScalesD23 ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1595 of file JetUncertaintiesTool.cxx.

1596{
1597 if (checkIndexInput(index).isFailure()) return false;
1598 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::D23);
1599}

◆ getComponentScalesD2Beta1()

bool JetUncertaintiesTool::getComponentScalesD2Beta1 ( const size_t index) const
virtual

Definition at line 1620 of file JetUncertaintiesTool.cxx.

1621{
1622 if (checkIndexInput(index).isFailure()) return false;
1623 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::D2Beta1);
1624}

◆ getComponentScalesFourVec()

bool JetUncertaintiesTool::getComponentScalesFourVec ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1575 of file JetUncertaintiesTool.cxx.

1576{
1577 if (checkIndexInput(index).isFailure()) return false;
1578 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::FourVec);
1579}

◆ getComponentScalesMass()

bool JetUncertaintiesTool::getComponentScalesMass ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1585 of file JetUncertaintiesTool.cxx.

1586{
1587 if (checkIndexInput(index).isFailure()) return false;
1588 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::Mass);
1589}

◆ getComponentScalesMultiple()

bool JetUncertaintiesTool::getComponentScalesMultiple ( const size_t index) const
virtual

Definition at line 1640 of file JetUncertaintiesTool.cxx.

1641{
1642 if (checkIndexInput(index).isFailure()) return false;
1643 return m_groups.at(index)->getScaleVars().size() > 1;
1644}

◆ getComponentScalesPt()

bool JetUncertaintiesTool::getComponentScalesPt ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1580 of file JetUncertaintiesTool.cxx.

1581{
1582 if (checkIndexInput(index).isFailure()) return false;
1583 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::Pt);
1584}

◆ getComponentScalesQw()

bool JetUncertaintiesTool::getComponentScalesQw ( const size_t index) const
virtual

Definition at line 1630 of file JetUncertaintiesTool.cxx.

1631{
1632 if (checkIndexInput(index).isFailure()) return false;
1633 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::Qw);
1634}

◆ getComponentScalesTagScaleFactor()

bool JetUncertaintiesTool::getComponentScalesTagScaleFactor ( const size_t index) const
virtual

Definition at line 1635 of file JetUncertaintiesTool.cxx.

1636{
1637 if (checkIndexInput(index).isFailure()) return false;
1638 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::TagScaleFactor);
1639}

◆ getComponentScalesTau21()

bool JetUncertaintiesTool::getComponentScalesTau21 ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1600 of file JetUncertaintiesTool.cxx.

1601{
1602 if (checkIndexInput(index).isFailure()) return false;
1603 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::Tau21);
1604}

◆ getComponentScalesTau21WTA()

bool JetUncertaintiesTool::getComponentScalesTau21WTA ( const size_t index) const
virtual

Definition at line 1610 of file JetUncertaintiesTool.cxx.

1611{
1612 if (checkIndexInput(index).isFailure()) return false;
1613 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::Tau21WTA);
1614}

◆ getComponentScalesTau32()

bool JetUncertaintiesTool::getComponentScalesTau32 ( const size_t index) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1605 of file JetUncertaintiesTool.cxx.

1606{
1607 if (checkIndexInput(index).isFailure()) return false;
1608 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::Tau32);
1609}

◆ getComponentScalesTau32WTA()

bool JetUncertaintiesTool::getComponentScalesTau32WTA ( const size_t index) const
virtual

Definition at line 1615 of file JetUncertaintiesTool.cxx.

1616{
1617 if (checkIndexInput(index).isFailure()) return false;
1618 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::Tau32WTA);
1619}

◆ getComponentScaleVars()

std::set< CompScaleVar::TypeEnum > JetUncertaintiesTool::getComponentScaleVars ( const size_t index) const
virtual

Definition at line 1645 of file JetUncertaintiesTool.cxx.

1646{
1647 if (checkIndexInput(index).isFailure()) return {};
1648 return m_groups.at(index)->getScaleVars();
1649}

◆ getComponentsInCategory()

std::vector< size_t > JetUncertaintiesTool::getComponentsInCategory ( const std::string & category) const
virtual

Definition at line 1989 of file JetUncertaintiesTool.cxx.

1990{
1991 if (!m_isInit)
1992 {
1993 ATH_MSG_FATAL("Tool must be initialized before calling getComponentsInCategory");
1994 return {};
1995 }
1996
1997 // Internally conver to an enum for both checking and speed of comparison
1998 const CompCategory::TypeEnum categoryEnum = CompCategory::stringToEnum(category.c_str());
1999 if (categoryEnum == CompCategory::UNKNOWN)
2000 {
2001 ATH_MSG_WARNING("Unrecognized category: " << category);
2002 return {};
2003 }
2004
2005 // Now find the components
2006 std::vector<size_t> components;
2007 for (size_t iComp = 0; iComp < m_groups.size(); ++iComp)
2008 if (m_groups.at(iComp)->getCategory() == categoryEnum)
2009 components.push_back(iComp);
2010
2011 return components;
2012}
#define ATH_MSG_WARNING(x,...)
TypeEnum stringToEnum(const TString &type)

◆ getComponentTopology()

JetTopology::TypeEnum JetUncertaintiesTool::getComponentTopology ( const size_t index) const
virtual

Definition at line 1650 of file JetUncertaintiesTool.cxx.

1651{
1652 if (checkIndexInput(index).isFailure()) return JetTopology::UNKNOWN;
1653 return m_groups.at(index)->getTopology();
1654}

◆ getConfigFile()

virtual std::string JetUncertaintiesTool::getConfigFile ( ) const
inlinevirtual

Implements IJetUncertaintiesTool.

Definition at line 68 of file JetUncertaintiesTool.h.

68{ return m_configFile; }

◆ getDefaultAnaFile()

virtual std::string JetUncertaintiesTool::getDefaultAnaFile ( ) const
inlinevirtual

Definition at line 72 of file JetUncertaintiesTool.h.

72{ return m_defAnaFile; }

◆ getFilteredSystematicSet()

StatusCode JetUncertaintiesTool::getFilteredSystematicSet ( const CP::SystematicSet & systConfig,
CP::SystematicSet & filteredSet )
privatevirtual

Definition at line 1345 of file JetUncertaintiesTool.cxx.

1346{
1347 // Check if we have already encountered this set
1348 std::unordered_map<CP::SystematicSet,CP::SystematicSet>::iterator iter = m_systFilterMap.find(systConfig);
1349 if (iter != m_systFilterMap.end())
1350 filteredSet = iter->second;
1351 // Make the filtered set and store it
1352 else
1353 {
1354 if (CP::SystematicSet::filterForAffectingSystematics(systConfig,m_recognizedSystematics,filteredSet) != StatusCode::SUCCESS)
1355 return StatusCode::FAILURE;
1356 m_systFilterMap.insert(std::make_pair(systConfig,filteredSet));
1357 }
1358
1359 return StatusCode::SUCCESS;
1360}
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...

◆ getJetDef()

virtual std::string JetUncertaintiesTool::getJetDef ( ) const
inlinevirtual

Implements IJetUncertaintiesTool.

Definition at line 66 of file JetUncertaintiesTool.h.

66{ return m_jetDef; }

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::Event, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }

◆ getMCType()

virtual std::string JetUncertaintiesTool::getMCType ( ) const
inlinevirtual

Implements IJetUncertaintiesTool.

Definition at line 67 of file JetUncertaintiesTool.h.

67{ return m_mcType; }

◆ getName() [1/2]

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::Event, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getName() [2/2]

virtual std::string JetUncertaintiesTool::getName ( ) const
inlinevirtual

Implements IJetUncertaintiesTool.

Definition at line 64 of file JetUncertaintiesTool.h.

64{ return m_name; }

◆ getNominalResolution()

double JetUncertaintiesTool::getNominalResolution ( const xAOD::Jet & jet,
const jet::CompScaleVar::TypeEnum smearType,
const jet::JetTopology::TypeEnum topology,
const bool readMC ) const
private

Definition at line 1821 of file JetUncertaintiesTool.cxx.

1822{
1823 if (!m_isInit)
1824 {
1825 ATH_MSG_FATAL("Tool must be initialized before calling getNominalResolution");
1826 return JESUNC_ERROR_CODE;
1827 }
1828 if (!m_resHelper)
1829 {
1830 ATH_MSG_ERROR("The ResolutionHelper class was not created");
1831 return JESUNC_ERROR_CODE;
1832 }
1833
1834 // Get the nominal histogram, parametrization, and mass def (if relevant) from the helper
1835 std::tuple<const UncertaintyHistogram*,CompParametrization::TypeEnum,CompMassDef::TypeEnum> resolution = m_resHelper->getNominalResolution(smearType,topology,readMC);
1836
1837 // Check that we retrieved them successfully
1838 if (!std::get<0>(resolution) || std::get<1>(resolution) == CompParametrization::UNKNOWN)
1839 return JESUNC_ERROR_CODE;
1840 if (CompParametrization::includesMass(std::get<1>(resolution)) && std::get<2>(resolution) == CompMassDef::UNKNOWN)
1841 {
1842 // We should never reach this, as it was also checked during initialization
1843 ATH_MSG_ERROR("Parametrization involves mass but mass def is unknown");
1844 return JESUNC_ERROR_CODE;
1845 }
1846
1847 // Now read the uncertainty from the histogram
1848 return readHistoFromParam(jet,*std::get<0>(resolution),std::get<1>(resolution),std::get<2>(resolution));
1849}
double readHistoFromParam(const xAOD::Jet &jet, const jet::UncertaintyHistogram &histo, const jet::CompParametrization::TypeEnum param, const jet::CompMassDef::TypeEnum massDef) const
double resolution[nGasTypes][nParametersResolution]
bool includesMass(const TypeEnum type)

◆ getNominalResolutionData()

double JetUncertaintiesTool::getNominalResolutionData ( const xAOD::Jet & jet,
const jet::CompScaleVar::TypeEnum smearType,
const jet::JetTopology::TypeEnum topology = jet::JetTopology::UNKNOWN ) const
virtual

Definition at line 1816 of file JetUncertaintiesTool.cxx.

1817{
1818 return getNominalResolution(jet,smearType,topology,false);
1819}
double getNominalResolution(const xAOD::Jet &jet, const jet::CompScaleVar::TypeEnum smearType, const jet::JetTopology::TypeEnum topology, const bool readMC) const

◆ getNominalResolutionMC()

double JetUncertaintiesTool::getNominalResolutionMC ( const xAOD::Jet & jet,
const jet::CompScaleVar::TypeEnum smearType,
const jet::JetTopology::TypeEnum topology = jet::JetTopology::UNKNOWN ) const
virtual

Definition at line 1811 of file JetUncertaintiesTool.cxx.

1812{
1813 return getNominalResolution(jet,smearType,topology,true);
1814}

◆ getNormalizedCaloMassWeight()

double JetUncertaintiesTool::getNormalizedCaloMassWeight ( const xAOD::Jet & jet) const
virtual

Definition at line 1919 of file JetUncertaintiesTool.cxx.

1920{
1921 if (!m_caloMassWeight || !m_TAMassWeight) return 0;
1922
1923 static const JetFourMomAccessor caloScale (CompMassDef::getJetScaleString(m_combMassWeightCaloMassDef).Data());
1924 static const JetFourMomAccessor TAScale (CompMassDef::getJetScaleString(m_combMassWeightTAMassDef).Data());
1925
1926 const double caloRes = m_caloMassWeight ? readHistoFromParam(caloScale(jet),*m_caloMassWeight,m_combMassParam) : 0;
1927 const double TARes = m_TAMassWeight ? readHistoFromParam(TAScale(jet),*m_TAMassWeight,m_combMassParam) : 0;
1928
1929 if (caloRes == 0 || TARes == 0) return 0;
1930
1931 const double caloFactor = (caloRes == 0) ? 0 : 1./(caloRes*caloRes);
1932 const double TAFactor = ( TARes == 0) ? 0 : 1./(TARes*TARes);
1933
1934 if (caloFactor + TAFactor == 0) return 0;
1935
1936 return caloFactor/(caloFactor+TAFactor);
1937}
@ Data
Definition BaseObject.h:11
TString getJetScaleString(const TypeEnum type)

◆ getNormalizedTAMassWeight()

double JetUncertaintiesTool::getNormalizedTAMassWeight ( const xAOD::Jet & jet) const
virtual

Definition at line 1939 of file JetUncertaintiesTool.cxx.

1940{
1941 if (!m_caloMassWeight || !m_TAMassWeight) return 0;
1942
1943 static const JetFourMomAccessor caloScale (CompMassDef::getJetScaleString(m_combMassWeightCaloMassDef).Data());
1944 static const JetFourMomAccessor TAScale (CompMassDef::getJetScaleString(m_combMassWeightTAMassDef).Data());
1945
1946
1947 const double caloRes = m_caloMassWeight->getValue(caloScale.pt(jet)*m_energyScale,caloScale.m(jet)/caloScale.pt(jet) );
1948 const double TARes = m_TAMassWeight->getValue(TAScale.pt(jet)*m_energyScale,TAScale.m(jet)/TAScale.pt(jet));
1949
1950 if (caloRes == 0 || TARes == 0) return 0;
1951
1952 const double caloFactor = 1./(caloRes*caloRes);
1953 const double TAFactor = 1./(TARes*TARes);
1954
1955 if (caloFactor + TAFactor == 0) return 0;
1956
1957 return TAFactor/(caloFactor+TAFactor);
1958}

◆ getNumComponents()

size_t JetUncertaintiesTool::getNumComponents ( ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1460 of file JetUncertaintiesTool.cxx.

1461{
1462 if (!m_isInit)
1463 {
1464 ATH_MSG_FATAL("Tool must be initialized before calling getNumComponents");
1465 return 0;
1466 }
1467
1468 return m_groups.size();
1469}

◆ getPath()

virtual std::string JetUncertaintiesTool::getPath ( ) const
inlinevirtual

Implements IJetUncertaintiesTool.

Definition at line 69 of file JetUncertaintiesTool.h.

69{ return m_path; }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getRefMu() [1/2]

float JetUncertaintiesTool::getRefMu ( ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1409 of file JetUncertaintiesTool.cxx.

1410{
1411 if (!m_isInit)
1412 {
1413 ATH_MSG_FATAL("Tool must be initialized before calling getRefMu");
1414 return JESUNC_ERROR_CODE;
1415 }
1416 if (m_refMuHist)
1417 {
1418 ATH_MSG_FATAL("Tool contains a histogram for refMu, cannot return float");
1419 return JESUNC_ERROR_CODE;
1420 }
1421 return m_refMu;
1422}

◆ getRefMu() [2/2]

float JetUncertaintiesTool::getRefMu ( const xAOD::Jet & jet) const
virtual

Definition at line 1439 of file JetUncertaintiesTool.cxx.

1440{
1441 if (!m_isInit)
1442 {
1443 ATH_MSG_FATAL("Tool must be initialized before calling getRefMu");
1444 return JESUNC_ERROR_CODE;
1445 }
1446 return m_refMuHist ? m_refMuHist->getValue(fabs(jet.eta())) : m_refMu;
1447}

◆ getRefNPV() [1/2]

float JetUncertaintiesTool::getRefNPV ( ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1424 of file JetUncertaintiesTool.cxx.

1425{
1426 if (!m_isInit)
1427 {
1428 ATH_MSG_FATAL("Tool must be initialized before calling getRefNPV");
1429 return JESUNC_ERROR_CODE;
1430 }
1431 if (m_refNPVHist)
1432 {
1433 ATH_MSG_FATAL("Tool contains a histogram for refNPV, cannot return float");
1434 return JESUNC_ERROR_CODE;
1435 }
1436 return m_refNPV;
1437}

◆ getRefNPV() [2/2]

float JetUncertaintiesTool::getRefNPV ( const xAOD::Jet & jet) const
virtual

Definition at line 1449 of file JetUncertaintiesTool.cxx.

1450{
1451 if (!m_isInit)
1452 {
1453 ATH_MSG_FATAL("Tool must be initialized before calling getRefNPV");
1454 return JESUNC_ERROR_CODE;
1455 }
1456 return m_refNPVHist ? m_refNPVHist->getValue(fabs(jet.eta())) : m_refNPV;
1457}

◆ getRelease()

virtual std::string JetUncertaintiesTool::getRelease ( ) const
inlinevirtual

Definition at line 65 of file JetUncertaintiesTool.h.

65{ return m_release; }

◆ getSmearingFactor()

double JetUncertaintiesTool::getSmearingFactor ( const xAOD::Jet & jet,
const jet::CompScaleVar::TypeEnum smearType,
const double variation ) const
private

Definition at line 2371 of file JetUncertaintiesTool.cxx.

2372{
2373 /*
2374 Below follows discussion between B Malaescu, C Young, and S Schramm on 14/08/2018
2375
2376 sigma_smear^2 = (sigma_nominal + |n*x + m*y + ...|)^2 - (sigma_nominal)^2
2377 sigma_smear: width of the Gaussian to smear with
2378 sigma_nominal: the nominal resolution in either (pseudo-)data OR mc (see below)
2379 n: #sigma variation for NP1
2380 m: #sigma variation for NP2
2381 x: uncertainty from NP1
2382 y: uncertainty from NP2
2383 Note that n,m,x,y all are signed quantities
2384 n,m are + for upward variations and - for downward variations
2385 x,y are + or - to differentiate regions of anticorrelations within a given NP
2386
2387 As the MC has been smeared to the data in JetCalibTools and we have saved the histograms
2388 before this smearing has been applied we need to take the maximum of the data and MC
2389 resolutions to find the nominal resolution which to smear against. For cases when the data
2390 resolution is better than that in simulation and we additionally are using data as
2391 pseudo-data (extremely rare in analyses) this might result in a slightly more conservative
2392 uncertainty.
2393 sigma_nominal = max(sigma_MC,sigma_data)
2394
2395 In some cases, it is not desireable to smear (pseudo-)data
2396 Result: two correlation smearing options, "full" and "simple"
2397 Full = full correlations preserved, smear both (peudo-)data and MC
2398 Simple = simplified correlations (= loss of correlations), smear only MC
2399
2400 In "simple" case, we are smearing MC even if we should ideally smear (pseudo-)data
2401 sign(nx+my+...) --> no longer matters, always use sigma_nominal^MC
2402 Furthermore, take the absolute value as we are forcing an upward variation
2403 sigma_smear^2 = (sigma_nom^MC + |n*x + m*y + ...|)^2 - (sigma_nom^MC)^2
2404 In the case of 1 NP, analysis gets same result if n is positive or negative
2405 Analysis must symmetrize uncertainties themselves to get downward variations
2406
2407 The above is all for absolute resolution uncertainties
2408 In the case of relative resolution uncertainties, not much changes
2409 n*x --> n*sigma_nominal*x
2410 n: unchanged from before, #sigma variation for NP1
2411 x: now this is a fractional uncertainty, but it is still the value of NP1
2412 sigma_nominal: uncertainty measurement varies (sign unaffected by nominal)
2413 In other words, all of the above is directly extended
2414
2415 This all relies on the fact that absolute and relative resolutions are not mixed
2416 This is enforced by the tool enums, which are one or the other
2417 Asking for both relative and absolute smearing is two separate scale variables
2418 The tool checks for such cases and explicitly blocks them
2419
2420 There is one exception to the above: a "data-MC difference" smearing
2421 If MC is below data, then we smear MC to match data (nominal smearing)
2422 Occurs if (sigma_nom^MC - sigma_nom^data) < 0, or equivalently (sigma_nom^data - sigma_nom^MC) > 0
2423 If data is below MC, we don't want to degrade the resolution of data to match MC
2424 Occurs if (sigma_nom^MC - sigma_nom^data) > 0, or equivalently (sigma_nom^data - sigma_nom^MC) < 0
2425 We also can't anti-smear MC (at least not with Gaussian smearing)
2426 Instead, smear by sigma_smear^2 = (sigma_nom + |Nsigma*[sigma_nom^data - sigma_nom^MC]|)^2 - (sigma_nom)^2
2427 This uses the second form of the above inequalities to stick with convention
2428 This way, we signify that we are smearing data (uncertainty < 0 if Nsigma > 0)
2429 This should be smearing of data (sigma_nom = sigma_nom^data)
2430 However, in the simple scenario, we still only smear MC
2431 Apply the uncertainty as-is, with sigma_nom = sigma_nom^MC
2432 This is actually "conservative" (in magnitude, not necessarily in correlations)
2433 |Nsigma*(sigma_nom^data - sigma_nom^MC)| is a fixed value independent of choice, call it X
2434 sigma_smear^2 = (sigma_nom + X)^2 - (sigma_nom)^2
2435 sigma_smear^2 = sigma_nom^2 [ (1 + X/sigma_nom)^2 - 1 ]
2436 Taylor expand: sigma_smear^2 ~ sigma_nom^2 ( 1 + 2*X/sigma_nom - 1 )
2437 sigma_smear^2 ~ sigma_nom^2 * 2 X / sigma_nom
2438 sigma_smear^2 ~ sigma_nom * 2 X
2439 Therefore, larger sigma_nom --> larger sigma_smear
2440 In this case, we know that sigma_nom^MC > sigma_nom^data (motivation for uncertainty)
2441 As such, sigma_nom = sigma_nom^MC is conservative
2442 This does not need to be handled any different than other uncertainties in the code
2443 However, the inputs will need to be made carefully to do the correct thing
2444 In particular, smear data occurs if sign(unc) < 0
2445 That is why it is written above as (sigma_nom^data - sigma_nom^MC) < 0
2446 In other words, the histogram must be created to be <= 0
2447 It should be <0 when data is below MC, and =0 when data is above MC
2448 This *could* be calculated on-the-fly from the two nominal histograms
2449 This requires substantial code development, as now this one NP is different from all others
2450 In the interest of time and code re-use, instead demand an extra histogram input
2451
2452 In the end, smear by a Gaussian of mean 1 and width sigma_smear
2453
2454 ----------
2455
2456 Given this, the arguments to the function are:
2457 jet: jet to smear, needed for the kinematic dependence of nominal resolutions
2458 smearType: the resolution type to select the relevant nominal resolutions
2459 variation: the signed value of n*x + m*y + ... (for both relative and absolute)
2460
2461 Dedicated class member variables used by this function are:
2462 m_isData: needed to control whether or not to smear the jet
2463 m_resHelper: contains lots of global resolution information
2464 - Whether to smear MC and data, or only MC
2465 - Nominal resolution histograms for data
2466 - Nominal resolution histograms for MC
2467 - Parametrizations of nominal resolution histograms
2468 m_userSeed: the optional user-specified seed to use for the random generator
2469
2470 Technical detail on relative uncertainties:
2471 The input value of "variation" is always n*x + m*y + ...
2472 This is trivially correct for absolute uncertainties, but not relative
2473 However, for relative uncertainties, all NPs are with respect to same nominal
2474 As such, it factors out, and we can take variation*sigma_nominal^data
2475 Furthermore, as it factors out, the nominal doesn't matter to determine the sign
2476 This is important as the sign sets whether data or MC is the nominal
2477 */
2478
2479 // Check if we need to do anything at all
2480 if (variation == 0)
2481 return 1; // No smearing if the variation is 0
2482 else if (m_isData)
2483 {
2484 if (m_resHelper->smearOnlyMC())
2485 return 1; // No smearing if this is data and we are in the simple scenario
2486 if (variation > 0)
2487 return 1; // No smearing if this is data and the sign says to smear MC
2488 }
2489 else if (variation < 0 && !m_resHelper->smearOnlyMC())
2490 return 1; // No smearing if this is MC and the sign says to smear data and this is not the simple scenario
2491
2492 // Get the relevant nominal resolution
2493 const double sigmaMC = getNominalResolution(jet,smearType,m_currentUncSet->getTopology(),true);
2494 const double sigmaData = getNominalResolution(jet,smearType,m_currentUncSet->getTopology(),false);
2495 const double sigmaNom = std::max(sigmaMC,sigmaData);
2496
2497 // If this is a relative uncertainty, get the relevant nominal data histogram
2498 // This is used to scale the input relative variation to get the absolute impact
2499 const double relativeFactor = CompScaleVar::isRelResolutionType(smearType) ? sigmaNom : 1;
2500
2501 // We now have the required information, so let's calculate the smearing factor
2502 // Note that relativeFactor is 1 if this is an absolute uncertainty
2503 const double sigmaSmear = sqrt(pow(sigmaNom + fabs(variation)*relativeFactor,2) - pow(sigmaNom,2));
2504
2505 // Throw an error if the userSeed is set to 1 as this is the seed used in JetCalibTools so leads to correlated smearing
2506 if (m_userSeed == 1){
2507 ATH_MSG_ERROR("A seed of 1e5 times the jet phi is used in JetCalibTools so using it here leads to correlated smearing");
2508 return 0;
2509 }
2510
2511 // We have the smearing factor, so prepare to smear
2512 // If the user specified a seed, then use it times the jet's phi times 1*10^5
2513 // If not, then use the jet's phi times 2*10^5 in MC, 1.23*10^5 in (pseudo-)data
2514 // Difference in seed between allows for easy use of pseudo-data
2515 // TRandom3 takes a 32-bit seed (UInt_t)
2516 UInt_t seed = static_cast<long long int>(m_userSeed != 0 ? m_userSeed*1.00e+5*std::abs(jet.phi()) : (m_isData ? 1.23e+5 : 2.00e+5)*std::abs(jet.phi()));
2517 // a seed of 0 picks a random seed, avoid this
2518 if(seed == 0) seed = m_isData ? 34545654 : 45583453; // arbitrary numbers which the seed couldn't otherwise be
2519 TRandom3 rand (seed);
2520
2521 // Calculate and return the smearing factor
2522 // Force this to be a positive value
2523 // Negative values should be extraordinarily rare, but they do exist
2524 double smearingFactor = -1;
2525 while (smearingFactor < 0)
2526 smearingFactor = rand.Gaus(1.,sigmaSmear);
2527 return smearingFactor;
2528}
Scalar phi() const
phi method
constexpr int pow(int x)
Definition conifer.h:27
bool isRelResolutionType(const TypeEnum type)

◆ getSqrtS()

float JetUncertaintiesTool::getSqrtS ( ) const
virtual

Definition at line 1395 of file JetUncertaintiesTool.cxx.

1396{
1397 float sqrtS = -1;
1398 const TString release = getRelease().c_str();
1399 if (release.BeginsWith("2011_"))
1400 sqrtS = 7000.*m_energyScale;
1401 else if (release.BeginsWith("2012_"))
1402 sqrtS = 8000.*m_energyScale;
1403 else if (release.BeginsWith("2015_") || release.BeginsWith("2016"))
1404 sqrtS = 13000.*m_energyScale;
1405 return sqrtS;
1406}
virtual std::string getRelease() const
static std::string release
Definition computils.h:54

◆ getUncertainty() [1/2]

double JetUncertaintiesTool::getUncertainty ( size_t index,
const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1711 of file JetUncertaintiesTool.cxx.

1712{
1713 return getUncertainty(index,jet,eInfo,CompScaleVar::UNKNOWN);
1714}
virtual double getUncertainty(size_t index, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const

◆ getUncertainty() [2/2]

double JetUncertaintiesTool::getUncertainty ( size_t index,
const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo,
const jet::CompScaleVar::TypeEnum scaleVar ) const
virtual

Definition at line 1721 of file JetUncertaintiesTool.cxx.

1722{
1723 if (!m_isInit)
1724 {
1725 ATH_MSG_FATAL("Tool must be initialized before calling getUncertainty");
1726 return JESUNC_ERROR_CODE;
1727 }
1728
1729 // Ensure we are within bounds
1730 if (index >= m_groups.size())
1731 {
1732 ATH_MSG_ERROR("Index out of bounds for uncertainty: " << index);
1733 return JESUNC_ERROR_CODE;
1734 }
1735
1736 // Watch for a global validity histogram
1737 if (m_fileValidHist && !m_fileValidHist->getValidity(jet))
1738 {
1739 ATH_MSG_ERROR("Jet is out of validity bounds for uncertainty: " << index);
1740 return JESUNC_ERROR_CODE;
1741 }
1742
1743
1744 // Deal with different possible scale types
1745 // If scaleVar is unknown, work if comp is just one type
1746 // If scaleVar is specified, request that specific type regardless
1747 if (scaleVar == CompScaleVar::UNKNOWN)
1748 {
1749 if (m_groups.at(index)->getScaleVars().size() != 1)
1750 {
1751 ATH_MSG_ERROR("Asked for the uncertainty of a set which scales multiple variables without specifying the variable of interest:" << m_groups.at(index)->getName().Data());
1752 return JESUNC_ERROR_CODE;
1753 }
1754 return m_groups.at(index)->getUncertainty(jet,eInfo,*(m_groups.at(index)->getScaleVars().begin()));
1755 }
1756 return m_groups.at(index)->getUncertainty(jet,eInfo,scaleVar);
1757}

◆ getUncertaintySet()

StatusCode JetUncertaintiesTool::getUncertaintySet ( const CP::SystematicSet & filteredSet,
jet::UncertaintySet *& uncSet )
privatevirtual

Definition at line 1362 of file JetUncertaintiesTool.cxx.

1363{
1364 // Check if we have already encountered this set
1365 std::unordered_map<CP::SystematicSet,UncertaintySet*>::iterator iter = m_systSetMap.find(filteredSet);
1366
1367 // If we have dealt with this set previously, we're done
1368 if (iter != m_systSetMap.end())
1369 {
1370 uncSet = iter->second;
1371 }
1372 // Make the new set and store it
1373 else
1374 {
1375 uncSet = new UncertaintySet(filteredSet.name());
1376 if (uncSet == nullptr || uncSet->initialize(filteredSet,m_groups).isFailure())
1377 {
1378 ATH_MSG_ERROR("Failed to create UncertaintySet for filtered CP::SystematicSet: " << filteredSet.name());
1379 JESUNC_SAFE_DELETE(uncSet);
1380 return StatusCode::FAILURE;
1381 }
1382 m_systSetMap.insert(std::make_pair(filteredSet,uncSet));
1383 }
1384
1385 return StatusCode::SUCCESS;
1386}
virtual StatusCode initialize(const CP::SystematicSet &systConfig, const std::vector< UncertaintyGroup * > &groups)

◆ getValidity() [1/2]

bool JetUncertaintiesTool::getValidity ( size_t index,
const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1661 of file JetUncertaintiesTool.cxx.

1662{
1663 return getValidity(index,jet,eInfo,CompScaleVar::UNKNOWN);
1664}
virtual bool getValidity(size_t index, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const

◆ getValidity() [2/2]

bool JetUncertaintiesTool::getValidity ( size_t index,
const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo,
const jet::CompScaleVar::TypeEnum scaleVar ) const
virtual

Definition at line 1671 of file JetUncertaintiesTool.cxx.

1672{
1673 if (!m_isInit)
1674 {
1675 ATH_MSG_FATAL("Tool must be initialized before calling getValidity");
1676 return false;
1677 }
1678
1679 // Ensure we are within bounds
1680 if (index >= m_groups.size())
1681 {
1682 ATH_MSG_ERROR("Index out of bounds for validity: " << index);
1683 return false;
1684 }
1685
1686 // Check for a global validity histogram
1687 if (m_fileValidHist && !m_fileValidHist->getValidity(jet))
1688 return false;
1689
1690 // Deal with different possible scale types
1691 // If scaleVar is unknown, work if comp is just one type
1692 // If scaleVar is specified, request that specific type regardless
1693 if (scaleVar == CompScaleVar::UNKNOWN)
1694 {
1695 if (m_groups.at(index)->getScaleVars().size() != 1)
1696 {
1697 ATH_MSG_ERROR("Asked for the validity of a set which scales multiple variables without specifying the variable of interest:" << m_groups.at(index)->getName().Data());
1698 return false;
1699 }
1700 return m_groups.at(index)->getValidity(jet,eInfo,*(m_groups.at(index)->getScaleVars().begin()));
1701 }
1702 return m_groups.at(index)->getValidity(jet,eInfo,scaleVar);
1703}

◆ getValidUncertainty() [1/2]

bool JetUncertaintiesTool::getValidUncertainty ( size_t index,
double & unc,
const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1765 of file JetUncertaintiesTool.cxx.

1766{
1767 return getValidUncertainty(index, unc, jet, eInfo, CompScaleVar::UNKNOWN);
1768}
virtual bool getValidUncertainty(size_t index, double &unc, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const

◆ getValidUncertainty() [2/2]

bool JetUncertaintiesTool::getValidUncertainty ( size_t index,
double & unc,
const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo,
const jet::CompScaleVar::TypeEnum scaleVar ) const
virtual

Definition at line 1775 of file JetUncertaintiesTool.cxx.

1776{
1777 if (!m_isInit)
1778 {
1779 ATH_MSG_FATAL("Tool must be initialized before calling getValidUncertainty");
1780 return false;
1781 }
1782
1783 // Ensure we are within bounds
1784 if (index >= m_groups.size())
1785 {
1786 ATH_MSG_ERROR("Index out of bounds for valid uncertainty: " << index);
1787 return false;
1788 }
1789
1790 // Check for a global validity histogram
1791 if (m_fileValidHist && !m_fileValidHist->getValidity(jet))
1792 return false;
1793
1794
1795 // Deal with different possible scale types
1796 // If scaleVar is unknown, work if comp is just one type
1797 // If scaleVar is specified, request that specific type regardless
1798 if (scaleVar == CompScaleVar::UNKNOWN)
1799 {
1800 if (m_groups.at(index)->getScaleVars().size() != 1)
1801 {
1802 ATH_MSG_ERROR("Asked for the valid uncertainty of a set which scales multiple variables without specifying the variable of interest:" << m_groups.at(index)->getName().Data());
1803 return JESUNC_ERROR_CODE;
1804 }
1805 return m_groups.at(index)->getValidUncertainty(unc,jet,eInfo,*(m_groups.at(index)->getScaleVars().begin()));
1806 }
1807 return m_groups.at(index)->getValidUncertainty(unc,jet,eInfo,scaleVar);
1808}

◆ initialize()

StatusCode JetUncertaintiesTool::initialize ( void )
virtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 237 of file JetUncertaintiesTool.cxx.

238{
239 // Ensure it hasn't been initialized already
240 if (m_isInit)
241 {
242 ATH_MSG_FATAL(Form("Blocking re-initialization of tool named %s",m_name.c_str()));
243 return StatusCode::FAILURE;
244 }
245
246 ATH_MSG_INFO(Form("Preparing to initialize the JetUncertaintiesTool named %s",m_name.c_str()));
247
248 // Cache the current directory
249 TDirectory* currentDir = gDirectory;
250 gROOT->cd();
251
252 // Read the config file
253 const TString configFilePath = jet::utils::findFilePath(m_configFile.c_str(),m_path.c_str(),m_calibArea.c_str());
254 if (configFilePath == "")
255 {
256 ATH_MSG_ERROR("Cannot find config file: " << m_configFile << " (path is \"" << m_path << "\", CalibArea is \"" << m_calibArea << "\")");
257 return StatusCode::FAILURE;
258 }
259
260 TEnv settings;
261 if (settings.ReadFile(configFilePath.Data(),kEnvGlobal))
262 {
263 ATH_MSG_ERROR("Cannot read config file: " << configFilePath.Data());
264 return StatusCode::FAILURE;
265 }
266
267 // We can read it - start printing
268 ATH_MSG_INFO(Form("================================================"));
269 ATH_MSG_INFO(Form(" Initializing the JetUncertaintiesTool named %s",m_name.c_str()));
270 ATH_MSG_INFO(Form(" Path is: \"%s\"",m_path.c_str()));
271 ATH_MSG_INFO(Form(" CalibArea is: \"%s\"",m_calibArea.c_str()));
272 ATH_MSG_INFO(Form(" IsData is: \"%s\"",m_isData ? "true" : "false"));
273 ATH_MSG_INFO(Form(" Configuration file: \"%s\"",m_configFile.c_str()));
274 ATH_MSG_INFO(Form(" Location: %s",configFilePath.Data()));
275
276
277 // Get the uncertainty release
278 m_release = settings.GetValue("UncertaintyRelease","UNKNOWN");
279 ATH_MSG_INFO(Form(" Uncertainty release: %s",m_release.c_str()));
280
281 // Check the jet definition
282 TString allowedJetDefStr = settings.GetValue("SupportedJetDefs","");
283 if (allowedJetDefStr == "")
284 {
285 ATH_MSG_ERROR("Cannot find supported jet definitions in config");
286 return StatusCode::FAILURE;
287 }
288 std::vector<TString> allowedJetDefs = jet::utils::vectorize<TString>(allowedJetDefStr," ,");
289 bool foundJetDef = false;
290 for (size_t iDef = 0; iDef < allowedJetDefs.size(); ++iDef)
291 if (!allowedJetDefs.at(iDef).CompareTo(m_jetDef.c_str(),TString::kIgnoreCase))
292 {
293 foundJetDef = true;
294 m_jetDef = allowedJetDefs.at(iDef); // To ensure right capitalization
295 break;
296 }
297 if (!foundJetDef)
298 {
299 ATH_MSG_ERROR("Unsupported jet definition: " << m_jetDef);
300 return StatusCode::FAILURE;
301 }
302 ATH_MSG_INFO(Form(" Jet definition: %s",m_jetDef.c_str()));
303
304 // Check the MC type
305 TString allowedMCtypeStr = settings.GetValue("SupportedMCTypes","");
306 if (allowedMCtypeStr == "")
307 {
308 ATH_MSG_ERROR("Cannot find supported MC types in config");
309 return StatusCode::FAILURE;
310 }
311 std::vector<TString> allowedMCtypes = jet::utils::vectorize<TString>(allowedMCtypeStr," ,");
312 bool foundMCtype = false;
313 for (size_t iType = 0; iType < allowedMCtypes.size(); ++iType)
314 if (!allowedMCtypes.at(iType).CompareTo(m_mcType.c_str(),TString::kIgnoreCase))
315 {
316 foundMCtype = true;
317 m_mcType = allowedMCtypes.at(iType); // To ensure right capitalization
318 break;
319 }
320 if (!foundMCtype)
321 {
322 ATH_MSG_ERROR("Unsupported MC type: " << m_mcType);
323 return StatusCode::FAILURE;
324 }
325 ATH_MSG_INFO(Form(" MC type: %s",m_mcType.c_str()));
326
327
328 // Get the file to read uncertainties in from
329 TString histFileName = settings.GetValue("UncertaintyRootFile","");
330 if (histFileName == "")
331 {
332 ATH_MSG_ERROR("Cannot find uncertainty histogram file");
333 return StatusCode::FAILURE;
334 }
335 ATH_MSG_INFO(Form(" UncertaintyFile: \"%s\"",histFileName.Data()));
336
337 // Now find the histogram file
338 const TString histFilePath = utils::findFilePath(histFileName,m_path.c_str(),m_calibArea.c_str());
339 if (histFilePath == "")
340 {
341 ATH_MSG_ERROR("Cannot find the path of the uncertainty histogram file");
342 return StatusCode::FAILURE;
343 }
344 ATH_MSG_INFO(Form(" Location: %s",histFilePath.Data()));
345
346 // Now open the histogram file
347 TFile* histFile = new TFile(histFilePath,"READ");
348 if (!histFile || histFile->IsZombie())
349 {
350 ATH_MSG_ERROR("Cannot open uncertainty histogram file: " << histFileName.Data());
351 return StatusCode::FAILURE;
352 }
353
354
355 // Get the default analysis ROOT file for later use
356 // Overwrite the analysisFile if it wasn't specified
357 m_defAnaFile = settings.GetValue("AnalysisRootFile","");
358 if (m_analysisFile.empty())
360 if (!m_analysisFile.empty())
361 {
362 ATH_MSG_INFO(Form(" AnalysisFile: \"%s\"",m_analysisFile.c_str()));
363 // Ensure that we can find the file
364 const TString analysisFilePath = utils::findFilePath(m_analysisFile.c_str(),m_path.c_str(),m_calibArea.c_str());
365 if (analysisFilePath == "")
366 {
367 ATH_MSG_ERROR("Cannot find the path of the analysis histogram file");
368 return StatusCode::FAILURE;
369 }
370 ATH_MSG_INFO(Form(" Location: %s",analysisFilePath.Data()));
371 }
372 if (m_defAnaFile != m_analysisFile && !m_defAnaFile.empty())
373 {
374 ATH_MSG_INFO(Form(" DefaultAnalysisFile: \"%s\"",m_defAnaFile.c_str()));
375 // Ensure that we can find the file
376 const TString analysisFilePath = utils::findFilePath(m_defAnaFile.c_str(),m_path.c_str(),m_calibArea.c_str());
377 if (analysisFilePath == "")
378 {
379 ATH_MSG_ERROR("Cannot find the path of the default analysis histogram file");
380 return StatusCode::FAILURE;
381 }
382 ATH_MSG_INFO(Form(" Location: %s",analysisFilePath.Data()));
383 // if a histogram pattern was provided, then use it (only if an analysis file is used)
384 if (!m_analysisHistPattern.empty())
385 {
386 ATH_MSG_INFO(Form(" AnalysisHistPattern: \"%s\"",m_analysisHistPattern.c_str()));
387 }
388 }
389
390 // Get a file-wide validity histogram if specified
391 std::string validHistForFile = settings.GetValue("FileValidHistogram","");
392 if (validHistForFile != "")
393 {
394 // Ensure that the parametrization is also specified
395 std::string validHistForFileParam = settings.GetValue("FileValidHistParam","");
396 if (validHistForFileParam == "")
397 {
398 ATH_MSG_ERROR("Specified a FileValidHistogram without an accompanying FileValidHistParam: " << validHistForFile);
399 return StatusCode::FAILURE;
400 }
401
402 // Translate parametrization to enum
403 const CompParametrization::TypeEnum validHistParam = CompParametrization::stringToEnum(validHistForFileParam);
404
405 // Check if a mass def was specified (optional)
406 const CompMassDef::TypeEnum validHistMassDef = CompMassDef::stringToEnum(settings.GetValue("FileValidHistMassDef",""));
407
408 // Create and initialize the validity histogram
409 m_fileValidHist = new ValidityHistogram(validHistForFile+"_"+m_jetDef,validHistParam,m_energyScale,validHistMassDef);
410 if (m_fileValidHist->initialize(histFile).isFailure())
411 return StatusCode::FAILURE;
412
413 ATH_MSG_INFO(Form(" FileValidHistogram: %s (%s)%s",validHistForFile.c_str(),validHistForFileParam.c_str(),validHistMassDef == CompMassDef::UNKNOWN ? "" : Form(" [%s]",CompMassDef::enumToString(validHistMassDef).Data())));
414 }
415
416 // Check if combined mass weights have been specified
417 const TString caloMassWeight = TString(settings.GetValue("CombMassWeightCaloHist",""));
418 const TString TAMassWeight = TString(settings.GetValue("CombMassWeightTAHist",""));
419 if (caloMassWeight != "" && TAMassWeight != "")
420 {
421 m_caloMassWeight = new UncertaintyHistogram(caloMassWeight+"_"+m_jetDef.c_str(),Interpolate::Full);
422 m_TAMassWeight = new UncertaintyHistogram(TAMassWeight+"_"+m_jetDef.c_str(),Interpolate::Full);
423
424 if (m_caloMassWeight->initialize(histFile).isFailure())
425 return StatusCode::FAILURE;
426 if (m_TAMassWeight->initialize(histFile).isFailure())
427 return StatusCode::FAILURE;
428
429 // Get the weight parametrization, defaulting to pT vs m/pT
430 const TString combMassParam = TString(settings.GetValue("CombMassWeightParam","PtMass"));
433 {
434 ATH_MSG_ERROR("Unexpected combined mass parametrization: " << combMassParam.Data());
435 return StatusCode::FAILURE;
436 }
437
438 ATH_MSG_INFO(" Found and loaded combined mass weight factors");
439 ATH_MSG_INFO(" WeightCaloHist = " << m_caloMassWeight->getName());
440 ATH_MSG_INFO(" WeightTAHist = " << m_TAMassWeight->getName());
442
443 // Check for custom mass definitions for the weight factors (not required, defaults exist)
444 const TString caloWeightMassDef = settings.GetValue("CombMassWeightCaloMassDef","Calo");
445 const TString TAWeightMassDef = settings.GetValue("CombMassWeightTAMassDef","TA");
446 if (caloWeightMassDef != "")
447 {
449 ATH_MSG_INFO(" WeightCaloMassDef was set to " << CompMassDef::enumToString(m_combMassWeightCaloMassDef).Data());
450 }
451 if (TAWeightMassDef != "")
452 {
454 ATH_MSG_INFO(" WeightTAMassDef was set to " << CompMassDef::enumToString(m_combMassWeightTAMassDef).Data());
455 }
456 }
457 else if (caloMassWeight != "" && TAMassWeight == "")
458 {
459 ATH_MSG_ERROR(" Found combined mass weight factors for the calo term, but not the TA term");
460 return StatusCode::FAILURE;
461 }
462 else if (caloMassWeight == "" && TAMassWeight != "")
463 {
464 ATH_MSG_ERROR(" Found combined mass weight factors for the TA term, but not the calo term");
465 return StatusCode::FAILURE;
466 }
467
468 // Get name of accessor to SF value
469 m_name_TagScaleFactor = TString(settings.GetValue("TagSFName","temp_SF"));
470 m_name_EffSF = TString(settings.GetValue("TagSFEffName","temp_effSF"));
471 m_name_Efficiency = TString(settings.GetValue("TagEfficiencyName","temp_efficiency"));
472 m_name_TagResult = TString(settings.GetValue("TagResultName","temp_accept")).ReplaceAll("accept", "Tagged");
473 m_name_SigeffSF = TString(m_name_EffSF).ReplaceAll("effSF", "sigeffSF");
474 if ( m_name_TagScaleFactor != "temp_SF") {
475 ATH_MSG_INFO(" accessor of SF is " << m_name_TagScaleFactor);
476 }
477 m_accTagScaleFactor = SG::Accessor<float>(m_name_TagScaleFactor);
478 m_accEffSF = SG::Accessor<float>(m_name_EffSF);
479 m_accSigeffSF = SG::Accessor<float>(m_name_SigeffSF);
480 m_accEfficiency = SG::Accessor<float>(m_name_Efficiency);
481 m_accTagResult = SG::Accessor<bool>(m_name_TagResult);
482
483 // Get the NPV/mu reference values
484 // These may not be set - only needed if a pileup component is requested
485 std::string refNPV = settings.GetValue("Pileup.NPVRef","");
486 std::string refMu = settings.GetValue("Pileup.MuRef","");
487 if ( (refNPV != "" && refMu == "") || (refNPV == "" && refMu != "") )
488 {
489 ATH_MSG_ERROR(Form("Only one of the pileup references was specified: (NPV,mu) = (%.1f,%.1f)",m_refNPV,m_refMu));
490 return StatusCode::FAILURE;
491 }
492 else if ( refNPV != "" && refMu != "")
493 {
494 // Check if these are floating point values for the pileup references
495 // If so, then fill the float, otherwise retrieve the histogram
496 if (utils::isTypeObjFromString<float>(refNPV))
497 m_refNPV = utils::getTypeObjFromString<float>(refNPV);
498 else
499 {
500 m_refNPVHist = new UncertaintyHistogram(refNPV+"_"+m_jetDef,Interpolate::None);
501 if (m_refNPVHist->initialize(histFile).isFailure())
502 return StatusCode::FAILURE;
503 }
504
505 if (utils::isTypeObjFromString<float>(refMu))
506 m_refMu = utils::getTypeObjFromString<float>(refMu);
507 else
508 {
509 m_refMuHist = new UncertaintyHistogram(refMu+"_"+m_jetDef,Interpolate::None);
510 if (m_refMuHist->initialize(histFile).isFailure())
511 return StatusCode::FAILURE;
512 }
513 }
514
515 // If systematic filters were specified, first-order validate them
516 // Then inform the user
517 if (!m_systFilters.empty())
518 {
519 std::string varString = "";
520 for (size_t iFilter = 0; iFilter < m_systFilters.size(); ++iFilter)
521 {
523 {
524 ATH_MSG_ERROR("Unable to parse VariablesToShift due to unknown variable, please check for typos: " << m_systFilters.at(iFilter));
525 return StatusCode::FAILURE;
526 }
527 if (!varString.empty())
528 varString += ", ";
529 varString += m_systFilters.at(iFilter);
530 }
531 ATH_MSG_INFO(Form(" VariablesToShift: %s",varString.c_str()));
532 }
533
534 // Attempt to read in nominal resolution information
535 // There may be no such information - this is perfectly normal
536 m_resHelper = new ResolutionHelper(m_name+"_RH",m_jetDef);
537 if(m_resHelper->initialize(settings,histFile,m_mcType.c_str()).isFailure())
538 return StatusCode::FAILURE;
539
540 // Prepare for reading components and groups
541 // Components can be a group by themself (single component groups) if "Group" == 0
542 // Components can also form simple groups with "SubComp"
543 // Otherwise, need to specify group info separately from component info
544 // As such, start with groups, then handle components
545
546 // Loop over uncertainty components and groups in the config
547 ATH_MSG_INFO("");
548 ATH_MSG_INFO(Form("%6s %-40s : %s","","JES uncert. comp.","Description"));
549 ATH_MSG_INFO(Form("%6s %-40s -%s","","-----------------","-----------"));
550 for (size_t iGroup = 0; iGroup < 999; ++iGroup)
551 {
552 // Format the style
553 const TString prefix = Form("JESGroup.%zu.",iGroup);
554
555 // Read in information in the uncertainty group
556 ConfigHelper helper(prefix,m_mcType.c_str(),m_energyScale);
557 if (helper.initialize(settings).isFailure())
558 return StatusCode::FAILURE;
559
560 // Ignore the group if it's not defined
561 if (!helper.isGroup()) continue;
562
563 // All groups have to follow a given prefix matching ASG conventions
564 // Enforce this condition here where the helper is not yet const
565 if (!m_namePrefix.empty())
566 helper.enforceGroupNamePrefix(m_namePrefix);
567
568 // Call the uncertainty group helper method to add a new group
569 if (addUncertaintyGroup(helper).isFailure())
570 return StatusCode::FAILURE;
571 }
572 for (size_t iComp = 0; iComp < 999; ++iComp)
573 {
574 // Format the style
575 const TString prefix = Form("JESComponent.%zu.",iComp);
576
577 // Read in information on the uncertainty component
578 ConfigHelper helper(prefix,m_mcType.c_str(),m_energyScale);
579 if (helper.initialize(settings).isFailure())
580 return StatusCode::FAILURE;
581
582 // Ignore component if it is not defined
583 if (!helper.isComponent() && !helper.isCompGroup())
584 continue;
585
586 // All groups have to follow a given prefix matching ASG conventions
587 // Enforce this condition here where the helper is not yet const
588 // (Still relevant for components as many will be simple groups)
589 if (!m_namePrefix.empty())
590 helper.enforceGroupNamePrefix(m_namePrefix);
591
592 // Also add the component name suffix for the jet definition
593 helper.setComponentJetDefSuffix(m_jetDef);
594
595 // Call the uncertainty component helper method to add a new component
596 if(addUncertaintyComponent(helper).isFailure())
597 return StatusCode::FAILURE;
598 }
599
600 // Preparing for a sanity check done after group merger
601 // Do this with components rather than groups to make sure totals are the same
602 size_t numCompsBeforeMerger = 0;
603 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup) {
604 numCompsBeforeMerger += m_groups.at(iGroup)->getNumComponents();
605// std::cout << "Beginning group " << m_groups.at(iGroup)->getName() << std::endl;
606// for (int i=0; i<m_groups.at(iGroup)->getComponents().size(); i++) {
607// std::cout << "\t" << m_groups.at(iGroup)->getComponents().at(i)->getName() << std::endl;
608// }
609// for (int i=0; i<m_groups.at(iGroup)->getSubgroups().size(); i++) {
610// for (int j=0; j<m_groups.at(iGroup)->getSubgroups().at(i)->getComponents().size(); j++)
611// std::cout << "\t" << m_groups.at(iGroup)->getSubgroups().at(i)->getComponents().at(j)->getName() << std::endl;
612// }
613 }
614
615 // Merge all of the subgroups into their parent groups
616 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
617 {
618 const int groupNum = m_groups.at(iGroup)->getGroupNum();
619 const int subgroupNum = m_groups.at(iGroup)->getSubgroupNum();
620
621 // groupNum == 0 means this is an independent group (no merging possible)
622 // subgroupNum == 0 means this is not a subgroup of anything (no merging possible)
623 if (!groupNum || !subgroupNum) continue;
624
625 // Ensure we didn't do something silly
626 if (groupNum == subgroupNum)
627 {
628 ATH_MSG_ERROR(Form("Specified group %d (%s) as the parent of itself, blocking for safety",groupNum,m_groups.at(iGroup)->getName().Data()));
629 return StatusCode::FAILURE;
630 }
631
632 // Find the parent group
633 for (size_t iParentGroup = 0; iParentGroup < m_groups.size(); ++iParentGroup)
634 {
635 if (iParentGroup == iGroup) continue;
636
637 const int parentGroupNum = m_groups.at(iParentGroup)->getGroupNum();
638 if (parentGroupNum == subgroupNum)
639 {
640 // Add the subgroup to the parent group
641 if (m_groups.at(iParentGroup)->addSubgroup(m_groups.at(iGroup)).isFailure())
642 {
643 ATH_MSG_ERROR(Form("Failed to add group %d (%s) as a subgroup of group %d (%s)",groupNum,m_groups.at(iGroup)->getName().Data(),parentGroupNum,m_groups.at(iParentGroup)->getName().Data()));
644 return StatusCode::FAILURE;
645 }
646 }
647 }
648 }
649
650 // Remove all of the subgroups from the class vector which contains the outermost groups for users to interact with
651 // Faster to do it this way rather than deleting individual entries of the vector
652 std::vector<UncertaintyGroup*> localGroupVec;
653 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
654 localGroupVec.push_back(m_groups.at(iGroup));
655 m_groups.clear();
656
657 for (size_t iGroup = 0; iGroup < localGroupVec.size(); ++iGroup)
658 {
659 // If the group is not a sub-group, keep it
660 if (!localGroupVec.at(iGroup)->getSubgroupNum())
661 m_groups.push_back(localGroupVec.at(iGroup));
662 }
663
664 // Sanity check that things make sense
665 // Do this with components rather than groups to make sure totals are the same
666 size_t numCompsAfterMerger = 0;
667 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup) {
668 numCompsAfterMerger += m_groups.at(iGroup)->getNumComponents();
669// std::cout << "Beginning group " << m_groups.at(iGroup)->getName() << std::endl;
670// for (int i=0; i<m_groups.at(iGroup)->getComponents().size(); i++) {
671// std::cout << "\t" << m_groups.at(iGroup)->getComponents().at(i)->getName() << std::endl;
672// }
673// for (int i=0; i<m_groups.at(iGroup)->getSubgroups().size(); i++) {
674// for (int j=0; j<m_groups.at(iGroup)->getSubgroups().at(i)->getComponents().size(); j++)
675// std::cout << "\t" << m_groups.at(iGroup)->getSubgroups().at(i)->getComponents().at(j)->getName() << std::endl;
676// }
677 }
678
679 if (numCompsBeforeMerger != numCompsAfterMerger)
680 {
681 ATH_MSG_ERROR(Form("Something went wrong merging groups: %zu before merger and %zu after merger",numCompsBeforeMerger,numCompsAfterMerger));
682 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
683 {
684 ATH_MSG_ERROR(Form("\tFound %zu components in group: %s",m_groups.at(iGroup)->getNumComponents(),m_groups.at(iGroup)->getName().Data()));
685 }
686 return StatusCode::FAILURE;
687 }
688
689
690
691 // Initialize all of the groups (and thus all of the components)
692 // Also ensure that there are no empty groups
693 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
694 {
695 if (m_groups.at(iGroup)->getNumComponents() == 0)
696 {
697 ATH_MSG_ERROR("An empty group was encountered: " << m_groups.at(iGroup)->getName().Data());
698 return StatusCode::FAILURE;
699 }
700 if (m_groups.at(iGroup)->initialize(histFile).isFailure())
701 return StatusCode::FAILURE;
702
703 // Determine if the group is a recommended systematic
704 // Currently, all small-R systematics are recommended with one exception:
705 // MC closure systematics can be zero (when working with the reference MC)
706 // Still, check if the component is always zero and don't recommend if so
707 // For large-R, users are allowed to specify a set of filters for systematics
708 // Done for Moriond2017 as many variables were provided for studies
709 // Allows for users to not run variations of variables they don't use
710 // If unspecified, all variables are systematically shifted by default
711 const bool isRecommended = checkIfRecommendedSystematic(*m_groups.at(iGroup));
712 CP::SystematicVariation systVar(m_groups.at(iGroup)->getName().Data(),CP::SystematicVariation::CONTINUOUS);
713 if (addAffectingSystematic(systVar,isRecommended) != StatusCode::SUCCESS)
714 return StatusCode::FAILURE;
716 if (systVar.basename().find("JER") != std::string::npos) {
717 CP::SystematicVariation systVarPD(systVar.basename()+"_PseudoData",CP::SystematicVariation::CONTINUOUS);
718 if (addAffectingSystematic(systVarPD,isRecommended) != StatusCode::SUCCESS)
719 return StatusCode::FAILURE;
720 }
721 }
722 }
723
724 // Ensure that we have nominal resolutions for any requested resolution uncertainties
725 // Do this at initialization, even if it is also checked in execution
726 // Also ensure that it was specified whether this is data or MC if resolutions are specified
727 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
728 {
729 std::set<CompScaleVar::TypeEnum> scaleVars = m_groups.at(iGroup)->getScaleVars();
730 for (CompScaleVar::TypeEnum var : scaleVars)
731 {
733 {
734 if (!m_resHelper->hasRelevantInfo(var,m_groups.at(iGroup)->getTopology()))
735 {
736 ATH_MSG_ERROR("Config file requests a resolution uncertainty without specifying the corresponding nominal resolution: " << CompScaleVar::enumToString(var).Data());
737 return StatusCode::FAILURE;
738 }
739 }
740 }
741 }
742
743
744 // Ensure that the filters are sane (they are all associated to at least one group)
745 for (size_t iFilter = 0; iFilter < m_systFilters.size(); ++iFilter)
746 {
747 bool filterIsSane = false;
748 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
749 {
750 if (m_groups.at(iGroup)->getScaleVars().count(CompScaleVar::stringToEnum(m_systFilters.at(iFilter))))
751 {
752 filterIsSane = true;
753 break;
754 }
755 }
756 if (!filterIsSane)
757 {
758 ATH_MSG_ERROR(" One of the specified VariablesToShift is not associated with any components, please check for typos: " << m_systFilters.at(iFilter));
759 return StatusCode::FAILURE;
760 }
761 }
762
763
764 // Determine the number of input parameters
765 size_t numCompInGroups = 0;
766 for (size_t iGroup = 0; iGroup < m_groups.size(); ++iGroup)
767 numCompInGroups += m_groups.at(iGroup)->getNumComponents();
768
769 // Summary message
770 ATH_MSG_INFO(Form(" Found and read in %zu individual components into %zu component groups of which %zu are recommended",numCompInGroups,m_groups.size(),m_recommendedSystematics.size()));
771
773 //ATH_MSG_INFO(Form(" Found and read in %zu components%s",m_components.size(),m_groups.size()?Form(" (%zu inputs in %zu groups, %zu independent input%s):",numCompInGroups,m_groups.size(),m_components.size()-m_groups.size(),m_components.size()-m_groups.size()!=1?"s":""):""));
774 //if (m_groups.size())
775 // for (size_t iComp = 0; iComp < m_components.size(); ++iComp)
776 // ATH_MSG_INFO(Form("%5zu. %-35s : %s",iComp+1,m_components.at(iComp)->getName().Data(),m_components.at(iComp)->getDesc().Data()));
777 ATH_MSG_INFO(Form("================================================"));
778
779 // Close the histogram file
780 histFile->Close();
781 // Go back to initial directory
783
784 // Finally done!
785 m_isInit = true;
787}
StatusCode addUncertaintyGroup(const jet::ConfigHelper &helper)
virtual StatusCode addAffectingSystematic(const CP::SystematicVariation &systematic, bool recommended)
StatusCode addUncertaintyComponent(const jet::ConfigHelper &helper)
bool checkIfRecommendedSystematic(const jet::UncertaintyGroup &systematic) const
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition AsgTool.h:133
currentDir
Definition index.py:37
TString enumToString(const TypeEnum type)
TypeEnum stringToEnum(const TString &type)
bool isResolutionType(const TypeEnum type)
TString enumToString(const TypeEnum type)
TString findFilePath(const TString &fileName, const TString &path="", const TString &calibArea="")

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isAffectedBySystematic()

bool JetUncertaintiesTool::isAffectedBySystematic ( const CP::SystematicVariation & systematic) const
virtual

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 1243 of file JetUncertaintiesTool.cxx.

1244{
1245 // Compare using basenames to avoid continious vs fixed value comparisons
1246 const std::set<std::string> baseNames = m_recognizedSystematics.getBaseNames();
1247 return baseNames.find(systematic.basename()) != baseNames.end();
1248 //return m_recognizedSystematics.find(systematic) != m_recognizedSystematics.end();
1249}
std::string basename() const
description: the base name, i.e.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

Print the state of the tool.

Implements asg::IAsgTool.

Reimplemented in AsgHelloTool, HI::HIPileupTool, JetFromPseudojet, JetPileupLabelingTool, JetPseudojetRetriever, JetSubStructureMomentToolsBase, JetTruthLabelingTool, and KtDeltaRTool.

Definition at line 131 of file AsgTool.cxx.

131 {
132
133 ATH_MSG_INFO( "AsgTool " << name() << " @ " << this );
134 return;
135 }

◆ readHistoFromParam() [1/2]

double JetUncertaintiesTool::readHistoFromParam ( const xAOD::Jet & jet,
const jet::UncertaintyHistogram & histo,
const jet::CompParametrization::TypeEnum param,
const jet::CompMassDef::TypeEnum massDef ) const
private

Definition at line 1852 of file JetUncertaintiesTool.cxx.

1853{
1854 // Simple case (no mass dependence)
1856 return readHistoFromParam(jet.jetP4(),histo,param);
1857
1858 // Complex case (need to check the mass type to use)
1859 // Simple four-vector case
1860 if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
1861 return readHistoFromParam(jet.jetP4(),histo,param);
1862 // Special scale case
1863 JetFourMomAccessor massScaleAccessor(CompMassDef::getJetScaleString(massDef).Data());
1864 return readHistoFromParam(massScaleAccessor(jet),histo,param);
1865}

◆ readHistoFromParam() [2/2]

double JetUncertaintiesTool::readHistoFromParam ( const xAOD::JetFourMom_t & jet4vec,
const jet::UncertaintyHistogram & histo,
const jet::CompParametrization::TypeEnum param ) const
private

Definition at line 1867 of file JetUncertaintiesTool.cxx.

1868{
1869 double value = 0;
1870 switch (param)
1871 {
1873 value = histo.getValue(jet4vec.Pt()*m_energyScale);
1874 break;
1876 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.Eta());
1877 break;
1879 value = histo.getValue(jet4vec.Pt()*m_energyScale,fabs(jet4vec.Eta()));
1880 break;
1882 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()*m_energyScale);
1883 break;
1885 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()/jet4vec.Pt());
1886 break;
1888 value = histo.getValue(jet4vec.Pt()*m_energyScale,log(jet4vec.M()/jet4vec.Pt()));
1889 break;
1891 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()/jet4vec.Pt(),jet4vec.Eta());
1892 break;
1894 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()/jet4vec.Pt(),fabs(jet4vec.Eta()));
1895 break;
1897 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()*m_energyScale,jet4vec.Eta());
1898 break;
1900 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()*m_energyScale,fabs(jet4vec.Eta()));
1901 break;
1903 value = histo.getValue(jet4vec.E()*m_energyScale,log(jet4vec.M()/jet4vec.E()));
1904 break;
1906 value = histo.getValue(jet4vec.E()*m_energyScale,log(jet4vec.M()/jet4vec.E()),jet4vec.Eta());
1907 break;
1909 value = histo.getValue(jet4vec.E()*m_energyScale,log(jet4vec.M()/jet4vec.E()),fabs(jet4vec.Eta()));
1910 break;
1911 default:
1912 ATH_MSG_ERROR("Failed to read histogram due to unknown parametrization type in " << getName());
1913 break;
1914 }
1915 return value;
1916}
virtual std::string getName() const

◆ recommendedSystematics()

CP::SystematicSet JetUncertaintiesTool::recommendedSystematics ( ) const
virtual

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 1256 of file JetUncertaintiesTool.cxx.

1257{
1259}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setRandomSeed()

virtual void JetUncertaintiesTool::setRandomSeed ( long long int seed)
inlinevirtual

Definition at line 60 of file JetUncertaintiesTool.h.

60{ m_userSeed = seed; }

◆ setScaleToGeV()

StatusCode JetUncertaintiesTool::setScaleToGeV ( )
virtual

Definition at line 224 of file JetUncertaintiesTool.cxx.

225{
226 // Ensure it hasn't been initialized yet
227 if (m_isInit)
228 {
229 ATH_MSG_FATAL("Cannot set the energy scale after initialization of tool: " << m_name);
230 return StatusCode::FAILURE;
231 }
232
233 m_energyScale = 1;
234 return StatusCode::SUCCESS;
235}

◆ setScaleToMeV()

StatusCode JetUncertaintiesTool::setScaleToMeV ( )
virtual

Definition at line 211 of file JetUncertaintiesTool.cxx.

212{
213 // Ensure it hasn't been initialized yet
214 if (m_isInit)
215 {
216 ATH_MSG_FATAL("Cannot set the energy scale after initialization of tool: " << m_name);
217 return StatusCode::FAILURE;
218 }
219
220 m_energyScale = 1.e-3;
221 return StatusCode::SUCCESS;
222}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateC2Beta1()

StatusCode JetUncertaintiesTool::updateC2Beta1 ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2874 of file JetUncertaintiesTool.cxx.

2875{
2876 static const SG::Accessor<float> accC2("C2");
2877 static const SG::Accessor<float> accECF1("ECF1");
2878 static const SG::Accessor<float> accECF2("ECF2");
2879 static const SG::Accessor<float> accECF3("ECF3");
2880 static const bool C2wasAvailable = accC2.isAvailable(jet);
2881 static const bool ECFwasAvailable = accECF1.isAvailable(jet) && accECF2.isAvailable(jet) && accECF3.isAvailable(jet);
2882
2883 const xAOD::Jet& constJet = jet;
2884 if (C2wasAvailable)
2885 {
2886 if (!accC2.isAvailable(jet))
2887 {
2888 ATH_MSG_ERROR("The C2 moment was previously available but is not available on this jet. This functionality is not supported.");
2889 return StatusCode::FAILURE;
2890 }
2891 const float value = accC2(constJet);
2892 accC2(jet) = shift*value;
2893 return StatusCode::SUCCESS;
2894 }
2895 if (ECFwasAvailable)
2896 {
2897 if (! (accECF1.isAvailable(constJet) && accECF2.isAvailable(constJet) && accECF3.isAvailable(constJet)) )
2898 {
2899 ATH_MSG_ERROR("The ECF1, ECF2, and ECF3 moments were previously available but are not available on this jet. This functionality is not supported.");
2900 return StatusCode::FAILURE;
2901 }
2902 const float ecf1 = accECF1(constJet);
2903 const float ecf2 = accECF2(constJet);
2904 const float ecf3 = accECF3(constJet);
2905 accC2(jet) = fabs(ecf2) > 1.e-6 ? shift * (ecf3*ecf1/pow(ecf2,2)) : -999; // 999 to match JetSubStructureMomentTools/EnergyCorrelatorRatiosTool
2906 return StatusCode::SUCCESS;
2907 }
2908
2909 ATH_MSG_ERROR("Neither C2 nor ECF1+ECF2+ECF3 moments are available on the jet, please make sure one of these options is available before calling the tool");
2910 return StatusCode::FAILURE;
2911}

◆ updateD2Beta1()

StatusCode JetUncertaintiesTool::updateD2Beta1 ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2820 of file JetUncertaintiesTool.cxx.

2821{
2822 static const SG::Accessor<float> accD2("D2");
2823 static const SG::Accessor<float> accECF1("ECF1");
2824 static const SG::Accessor<float> accECF2("ECF2");
2825 static const SG::Accessor<float> accECF3("ECF3");
2826 static const bool D2wasAvailable = accD2.isAvailable(jet);
2827 static const bool ECFwasAvailable = accECF1.isAvailable(jet) && accECF2.isAvailable(jet) && accECF3.isAvailable(jet);
2828
2829 const xAOD::Jet& constJet = jet;
2830 if (D2wasAvailable)
2831 {
2832 if (!accD2.isAvailable(jet))
2833 {
2834 ATH_MSG_ERROR("The D2 moment was previously available but is not available on this jet. This functionality is not supported.");
2835 return StatusCode::FAILURE;
2836 }
2837 const float value = accD2(constJet);
2838 accD2(jet) = shift*value;
2839 return StatusCode::SUCCESS;
2840 }
2841 if (ECFwasAvailable)
2842 {
2843 if (! (accECF1.isAvailable(constJet) && accECF2.isAvailable(constJet) && accECF3.isAvailable(constJet)) )
2844 {
2845 ATH_MSG_ERROR("The ECF1, ECF2, and ECF3 moments were previously available but are not available on this jet. This functionality is not supported.");
2846 return StatusCode::FAILURE;
2847 }
2848 const float ecf1 = accECF1(constJet);
2849 const float ecf2 = accECF2(constJet);
2850 const float ecf3 = accECF3(constJet);
2851 accD2(jet) = fabs(ecf2) > 1.e-6 ? shift * (pow(ecf1/ecf2,3)*ecf3) : -999; // 999 to match JetSubStructureMomentTools/EnergyCorrelatorRatiosTool
2852 return StatusCode::SUCCESS;
2853 }
2854
2855 //if (accD2.isAvailable(constJet))
2856 //{
2857 // const float value = accD2(constJet);
2858 // accD2(jet) = shift*value;
2859 // return StatusCode::SUCCESS;
2860 //}
2861 //if (accECF1.isAvailable(constJet) && accECF2.isAvailable(constJet) && accECF3.isAvailable(constJet))
2862 //{
2863 // const float ecf1 = accECF1(constJet);
2864 // const float ecf2 = accECF2(constJet);
2865 // const float ecf3 = accECF3(constJet);
2866 // accD2(jet) = shift * (pow(ecf1/ecf2,3)*ecf3);
2867 // return StatusCode::SUCCESS;
2868 //}
2869
2870 ATH_MSG_ERROR("Neither D2 nor ECF1+ECF2+ECF3 moments are available on the jet, please make sure one of these options is available before calling the tool");
2871 return StatusCode::FAILURE;
2872}

◆ updateQw()

StatusCode JetUncertaintiesTool::updateQw ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2913 of file JetUncertaintiesTool.cxx.

2914{
2915 static const SG::Accessor<float> accQw("Qw");
2916
2917 const xAOD::Jet& constJet = jet;
2918 if (accQw.isAvailable(constJet))
2919 {
2920 const float value = accQw(constJet);
2921 accQw(jet) = shift*value;
2922 return StatusCode::SUCCESS;
2923 }
2924
2925 ATH_MSG_ERROR("Qw moment is not available on the jet, please make sure to set Qw before calling the tool");
2926 return StatusCode::FAILURE;
2927}

◆ updateSplittingScale12()

StatusCode JetUncertaintiesTool::updateSplittingScale12 ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2537 of file JetUncertaintiesTool.cxx.

2538{
2539 static const SG::Accessor<float> accD12("Split12");
2540
2541 const xAOD::Jet& constJet = jet;
2542 if (accD12.isAvailable(constJet))
2543 {
2544 const float value = accD12(constJet);
2545 accD12(jet) = shift*value;
2546 return StatusCode::SUCCESS;
2547 }
2548
2549 ATH_MSG_ERROR("Split12 moment (D12) is not available on the jet, please make sure to set Split12 before calling the tool");
2550 return StatusCode::FAILURE;
2551}

◆ updateSplittingScale23()

StatusCode JetUncertaintiesTool::updateSplittingScale23 ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2553 of file JetUncertaintiesTool.cxx.

2554{
2555 static const SG::Accessor<float> accD23("Split23");
2556
2557 const xAOD::Jet& constJet = jet;
2558 if (accD23.isAvailable(constJet))
2559 {
2560 const float value = accD23(constJet);
2561 accD23(jet) = shift*value;
2562 return StatusCode::SUCCESS;
2563 }
2564
2565 ATH_MSG_ERROR("Split23 moment (D23) is not available on the jet, please make sure to set Split23 before calling the tool");
2566 return StatusCode::FAILURE;
2567}

◆ updateTagEfficiency()

StatusCode JetUncertaintiesTool::updateTagEfficiency ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2989 of file JetUncertaintiesTool.cxx.

2990{
2991 const bool TagScaleFactorwasAvailable = m_accTagScaleFactor.isAvailable(jet);
2992 const xAOD::Jet& constJet = jet;
2993 if (TagScaleFactorwasAvailable)
2994 {
2995 if (!m_accTagScaleFactor.isAvailable(jet))
2996 {
2997 ATH_MSG_ERROR("TagScaleFactor was previously available but is not available on this jet. This functionality is not supported.");
2998 return StatusCode::FAILURE;
2999 }
3000 const float value = m_accTagScaleFactor(constJet);
3001 if ( value < 1e-5 ) {
3002 // if the central SF is 0, we don't consider any uncertainties
3003 return StatusCode::SUCCESS;
3004 }
3005 if (m_accEffSF.isAvailable(jet)) {
3006 // if efficiency and efficiency SF are available, inefficiency SF will be calculated
3007
3008 const float effSF = m_accEffSF(constJet);
3009 const float efficiency = m_accEfficiency(constJet);
3010 float sigeffSF = 1.0;
3011 float updated_efficiency = efficiency + shift; // efficiency value is varied
3012
3013 if ( updated_efficiency < 1e-5 ) updated_efficiency=1e-5;
3014 if ( updated_efficiency > 1.0-1e-5 ) updated_efficiency=1.0-1e-5;
3015 m_accEfficiency(jet) = updated_efficiency;
3016 if (m_accSigeffSF.isAvailable(jet)) sigeffSF = m_accSigeffSF(constJet);
3017
3018 const bool tagResult = m_accTagResult(constJet);
3019 if ( tagResult ) {
3020 // do nothing, since efficiency variation does not affect the tagged jets
3021 return StatusCode::SUCCESS;
3022 } else {
3023 // this jet is "failed"
3024 // inefficiency SF will be recalculated for given uncertainty
3025 if ( std::abs(effSF - 1.0) < 1e-5 && std::abs(shift)>0 ) {
3026 // For other category, effSF=1.0. So efficiency variation cannot be propagated to the ineffSF i.e. (1 - eff)/(1 - eff) is always 1 not depending on eff value.
3027 // SF for signal (sigeffSF) is used instead of effSF when calculating it
3028 // Relative variation of ineffSF for signal is calculated here and used for the other category
3029 float nominalIneffSFsig = (1. - sigeffSF*efficiency)/(1. - efficiency);
3030 float variatedIneffSFsig = (1. - sigeffSF*updated_efficiency)/(1. - updated_efficiency);
3031 m_accTagScaleFactor(jet) = variatedIneffSFsig/nominalIneffSFsig;
3032 } else {
3033 m_accTagScaleFactor(jet) = (1. - effSF*updated_efficiency) / (1. - updated_efficiency);
3034 }
3035 return StatusCode::SUCCESS;
3036 }
3037 } else {
3038 // if efficiency and efficiency SF are NOT available, inefficiency SF will not be calculated
3039 // do nothing
3040 return StatusCode::SUCCESS;
3041 }
3042 }
3043
3044 ATH_MSG_ERROR("TagScaleFactor is not available on the jet, please make sure you called BoostedJetTaggers tag() function before calling this function.");
3045 return StatusCode::FAILURE;
3046}
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")

◆ updateTagScaleFactor()

StatusCode JetUncertaintiesTool::updateTagScaleFactor ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2929 of file JetUncertaintiesTool.cxx.

2930{
2931 const bool TagScaleFactorwasAvailable = m_accTagScaleFactor.isAvailable(jet);
2932 const xAOD::Jet& constJet = jet;
2933 if (TagScaleFactorwasAvailable)
2934 {
2935 if (!m_accTagScaleFactor.isAvailable(jet))
2936 {
2937 ATH_MSG_ERROR("TagScaleFactor was previously available but is not available on this jet. This functionality is not supported.");
2938 return StatusCode::FAILURE;
2939 }
2940 const float value = m_accTagScaleFactor(constJet);
2941 if ( value < 1e-5 ) {
2942 // if the central SF is 0, we don't consider any uncertainties
2943 return StatusCode::SUCCESS;
2944 }
2945 if (m_accEffSF.isAvailable(jet)) {
2946 // if efficiency and efficiency SF are available, inefficiency SF will be calculated
2947 const float effSF = m_accEffSF(constJet);
2948 const float efficiency = m_accEfficiency(constJet);
2949
2950
2951 const bool tagResult = m_accTagResult(constJet);
2952 if ( tagResult ){
2953 // update the efficiency SF
2954
2955 if ( shift*value < 0.0 ){
2956 m_accTagScaleFactor(jet) = 0.0;
2957 } else {
2959 }
2960 return StatusCode::SUCCESS;
2961 } else {
2962 // this jet is "failed", since SF applied to the event is (1-effSF*efficiency)/(1-efficiency)
2963 // so inefficiency SF will be recalculated for given uncertainty
2964 if ( efficiency < 1.0 ){
2965 if ( shift*value < 0.0 ){
2966 m_accTagScaleFactor(jet) = 1.0/(1. - efficiency);
2967 } else {
2968 m_accTagScaleFactor(jet) = (1. - shift*effSF*efficiency) / (1. - efficiency);
2969 }
2970 }
2971 return StatusCode::SUCCESS;
2972 }
2973 } else {
2974 // if efficiency and efficiency SF are NOT available, inefficiency SF will not be calculated
2975
2976 if ( shift*value < 0.0 ){
2977 m_accTagScaleFactor(jet) = 0.0;
2978 } else {
2980 }
2981 return StatusCode::SUCCESS;
2982 }
2983 }
2984
2985 ATH_MSG_ERROR("TagScaleFactor is not available on the jet, please make sure you called BoostedJetTaggers tag() function before calling this function.");
2986 return StatusCode::FAILURE;
2987}

◆ updateTau21()

StatusCode JetUncertaintiesTool::updateTau21 ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2569 of file JetUncertaintiesTool.cxx.

2570{
2571 static const SG::Accessor<float> accTau1("Tau1");
2572 static const SG::Accessor<float> accTau2("Tau2");
2573 static const SG::Accessor<float> accTau21("Tau21");
2574 static const bool Tau21wasAvailable = accTau21.isAvailable(jet);
2575 static const bool TauNNwasAvailable = accTau2.isAvailable(jet) && accTau1.isAvailable(jet);
2576
2577 const xAOD::Jet& constJet = jet;
2578 if (Tau21wasAvailable)
2579 {
2580 if (!accTau21.isAvailable(jet))
2581 {
2582 ATH_MSG_ERROR("The Tau21 moment was previously available but is not available on this jet. This functionality is not supported.");
2583 return StatusCode::FAILURE;
2584 }
2585 const float value = accTau21(constJet);
2586 accTau21(jet) = shift*value;
2587 return StatusCode::SUCCESS;
2588 }
2589 if (TauNNwasAvailable)
2590 {
2591 if (! (accTau2.isAvailable(jet) && accTau1.isAvailable(jet)) )
2592 {
2593 ATH_MSG_ERROR("The Tau2 and Tau1 moments were previously available but are not available on this jet. This functionality is not supported.");
2594 return StatusCode::FAILURE;
2595 }
2596 const float tau2 = accTau2(constJet);
2597 const float tau1 = accTau1(constJet);
2598 accTau21(jet) = fabs(tau1) > 1.e-6 ? shift*(tau2/tau1) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2599 return StatusCode::SUCCESS;
2600 }
2601 //if (accTau21.isAvailable(constJet))
2602 //{
2603 // const float value = accTau21(constJet);
2604 // accTau21(jet) = shift*value;
2605 // return StatusCode::SUCCESS;
2606 //}
2607 //if (accTau1.isAvailable(constJet) && accTau2.isAvailable(constJet))
2608 //{
2609 // const float value = accTau2(constJet)/accTau1(constJet);
2610 // accTau21(jet) = shift*value;
2611 // return StatusCode::SUCCESS;
2612 //}
2613
2614 ATH_MSG_ERROR("Neither Tau21 nor Tau1+Tau2 moments are available on the jet, please make sure one of these options is available before calling the tool.");
2615 return StatusCode::FAILURE;
2616}

◆ updateTau21WTA()

StatusCode JetUncertaintiesTool::updateTau21WTA ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2667 of file JetUncertaintiesTool.cxx.

2668{
2669 static const SG::Accessor<float> accTau1wta("Tau1_wta");
2670 static const SG::Accessor<float> accTau2wta("Tau2_wta");
2671 static const SG::Accessor<float> accTau21wta("Tau21_wta");
2672 static const SG::Accessor<float> accTau1WTA("Tau1_WTA");
2673 static const SG::Accessor<float> accTau2WTA("Tau2_WTA");
2674 static const SG::Accessor<float> accTau21WTA("Tau21_WTA");
2675 static const bool Tau21wtawasAvailable = accTau21wta.isAvailable(jet);
2676 static const bool Tau21WTAwasAvailable = accTau21WTA.isAvailable(jet);
2677 static const bool TauNNwtawasAvailable = accTau2wta.isAvailable(jet) && accTau1wta.isAvailable(jet);
2678 static const bool TauNNWTAwasAvailable = accTau2WTA.isAvailable(jet) && accTau1WTA.isAvailable(jet);
2679
2680 const xAOD::Jet& constJet = jet;
2681 if (Tau21wtawasAvailable)
2682 {
2683 if (!accTau21wta.isAvailable(jet))
2684 {
2685 ATH_MSG_ERROR("The Tau21_wta moment was previously available but is not available on this jet. This functionality is not supported.");
2686 return StatusCode::FAILURE;
2687 }
2688 const float value = accTau21wta(constJet);
2689 accTau21wta(jet) = shift*value;
2690 return StatusCode::SUCCESS;
2691 }
2692 if (Tau21WTAwasAvailable)
2693 {
2694 if (!accTau21WTA.isAvailable(jet))
2695 {
2696 ATH_MSG_ERROR("The Tau21_WTA moment was previously available but is not available on this jet. This functionality is not supported.");
2697 return StatusCode::FAILURE;
2698 }
2699 const float value = accTau21WTA(constJet);
2700 accTau21WTA(jet) = shift*value;
2701 return StatusCode::SUCCESS;
2702 }
2703 if (TauNNwtawasAvailable)
2704 {
2705 if (! (accTau2wta.isAvailable(jet) && accTau1wta.isAvailable(jet)) )
2706 {
2707 ATH_MSG_ERROR("The Tau2_wta and Tau1_wta moments were previously available but are not available on this jet. This functionality is not supported.");
2708 return StatusCode::FAILURE;
2709 }
2710 const float tau2 = accTau2wta(constJet);
2711 const float tau1 = accTau1wta(constJet);
2712 accTau21wta(jet) = fabs(tau1) > 1.e-6 ? shift*(tau2/tau1) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2713 return StatusCode::SUCCESS;
2714 }
2715 if (TauNNWTAwasAvailable)
2716 {
2717 if (! (accTau2WTA.isAvailable(jet) && accTau1WTA.isAvailable(jet)) )
2718 {
2719 ATH_MSG_ERROR("The Tau2_WTA and Tau1_WTA moments were previously available but are not available on this jet. This functionality is not supported.");
2720 return StatusCode::FAILURE;
2721 }
2722 const float tau2 = accTau2WTA(constJet);
2723 const float tau1 = accTau1WTA(constJet);
2724 accTau21WTA(jet) = fabs(tau1) > 1.e-6 ? shift*(tau2/tau1) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2725 return StatusCode::SUCCESS;
2726 }
2727
2728 ATH_MSG_ERROR("Neither Tau21_wta nor Tau1_wta+Tau2_wta moments are available on the jet, please make sure one of these options is available before calling the tool");
2729 return StatusCode::FAILURE;
2730}

◆ updateTau32()

StatusCode JetUncertaintiesTool::updateTau32 ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2618 of file JetUncertaintiesTool.cxx.

2619{
2620 static const SG::Accessor<float> accTau2("Tau2");
2621 static const SG::Accessor<float> accTau3("Tau3");
2622 static const SG::Accessor<float> accTau32("Tau32");
2623 static const bool Tau32wasAvailable = accTau32.isAvailable(jet);
2624 static const bool TauNNwasAvailable = accTau3.isAvailable(jet) && accTau2.isAvailable(jet);
2625
2626 const xAOD::Jet& constJet = jet;
2627 if (Tau32wasAvailable)
2628 {
2629 if (!accTau32.isAvailable(jet))
2630 {
2631 ATH_MSG_ERROR("The Tau32 moment was previously available but is not available on this jet. This functionality is not supported.");
2632 return StatusCode::FAILURE;
2633 }
2634 const float value = accTau32(constJet);
2635 accTau32(jet) = shift*value;
2636 return StatusCode::SUCCESS;
2637 }
2638 if (TauNNwasAvailable)
2639 {
2640 if (! (accTau3.isAvailable(jet) && accTau2.isAvailable(jet)) )
2641 {
2642 ATH_MSG_ERROR("The Tau3 and Tau2 moments were previously available but are not available on this jet. This functionality is not supported.");
2643 return StatusCode::FAILURE;
2644 }
2645 const float tau3 = accTau3(constJet);
2646 const float tau2 = accTau2(constJet);
2647 accTau32(jet) = fabs(tau2) > 1.e-6 ? shift*(tau3/tau2) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2648 return StatusCode::SUCCESS;
2649 }
2650 //if (accTau32.isAvailable(constJet))
2651 //{
2652 // const float value = accTau32(constJet);
2653 // accTau32(jet) = shift*value;
2654 // return StatusCode::SUCCESS;
2655 //}
2656 //if (accTau2.isAvailable(constJet) && accTau3.isAvailable(constJet))
2657 //{
2658 // const float value = accTau3(constJet)/accTau2(constJet);
2659 // accTau32(jet) = shift*value;
2660 // return StatusCode::SUCCESS;
2661 //}
2662
2663 ATH_MSG_ERROR("Neither Tau32 nor Tau2+Tau3 moments are available on the jet, please make sure one of these options is available before calling the tool");
2664 return StatusCode::FAILURE;
2665}

◆ updateTau32WTA()

StatusCode JetUncertaintiesTool::updateTau32WTA ( xAOD::Jet & jet,
const double shift ) const
private

Definition at line 2731 of file JetUncertaintiesTool.cxx.

2732{
2733 static const SG::Accessor<float> accTau2wta("Tau2_wta");
2734 static const SG::Accessor<float> accTau3wta("Tau3_wta");
2735 static const SG::Accessor<float> accTau32wta("Tau32_wta");
2736 static const SG::Accessor<float> accTau2WTA("Tau2_WTA");
2737 static const SG::Accessor<float> accTau3WTA("Tau3_WTA");
2738 static const SG::Accessor<float> accTau32WTA("Tau32_WTA");
2739 static const bool Tau32wtawasAvailable = accTau32wta.isAvailable(jet);
2740 static const bool Tau32WTAwasAvailable = accTau32WTA.isAvailable(jet);
2741 static const bool TauNNwtawasAvailable = accTau3wta.isAvailable(jet) && accTau2wta.isAvailable(jet);
2742 static const bool TauNNWTAwasAvailable = accTau3WTA.isAvailable(jet) && accTau2WTA.isAvailable(jet);
2743
2744 const xAOD::Jet& constJet = jet;
2745 if (Tau32wtawasAvailable)
2746 {
2747 if (!accTau32wta.isAvailable(jet))
2748 {
2749 ATH_MSG_ERROR("The Tau32_wta moment was previously available but is not available on this jet. This functionality is not supported.");
2750 return StatusCode::FAILURE;
2751 }
2752 const float value = accTau32wta(constJet);
2753 accTau32wta(jet) = shift*value;
2754 return StatusCode::SUCCESS;
2755 }
2756 if (Tau32WTAwasAvailable)
2757 {
2758 if (!accTau32WTA.isAvailable(jet))
2759 {
2760 ATH_MSG_ERROR("The Tau32_WTA moment was previously available but is not available on this jet. This functionality is not supported.");
2761 return StatusCode::FAILURE;
2762 }
2763 const float value = accTau32WTA(constJet);
2764 accTau32WTA(jet) = shift*value;
2765 return StatusCode::SUCCESS;
2766 }
2767 if (TauNNwtawasAvailable)
2768 {
2769 if (! (accTau3wta.isAvailable(jet) && accTau2wta.isAvailable(jet)) )
2770 {
2771 ATH_MSG_ERROR("The Tau3_wta and Tau2_wta moments were previously available but are not available on this jet. This functionality is not supported.");
2772 return StatusCode::FAILURE;
2773 }
2774 const float tau3 = accTau3wta(constJet);
2775 const float tau2 = accTau2wta(constJet);
2776 accTau32wta(jet) = fabs(tau2) > 1.e-6 ? shift*(tau3/tau2) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2777 return StatusCode::SUCCESS;
2778 }
2779 if (TauNNWTAwasAvailable)
2780 {
2781 if (! (accTau3WTA.isAvailable(jet) && accTau2WTA.isAvailable(jet)) )
2782 {
2783 ATH_MSG_ERROR("The Tau3_WTA and Tau2_WTA moments were previously available but are not available on this jet. This functionality is not supported.");
2784 return StatusCode::FAILURE;
2785 }
2786 const float tau3 = accTau3WTA(constJet);
2787 const float tau2 = accTau2WTA(constJet);
2788 accTau32WTA(jet) = fabs(tau2) > 1.e-6 ? shift*(tau3/tau2) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2789 return StatusCode::SUCCESS;
2790 }
2791 //if (accTau32wta.isAvailable(constJet))
2792 //{
2793 // const float value = accTau32wta(constJet);
2794 // accTau32wta(jet) = shift*value;
2795 // return StatusCode::SUCCESS;
2796 //}
2797 //if (accTau32WTA.isAvailable(constJet))
2798 //{
2799 // const float value = accTau32WTA(constJet);
2800 // accTau32WTA(jet) = shift*value;
2801 // return StatusCode::SUCCESS;
2802 //}
2803 //if (accTau2wta.isAvailable(constJet) && accTau3wta.isAvailable(constJet))
2804 //{
2805 // const float value = accTau3wta(constJet)/accTau2wta(constJet);
2806 // accTau32wta(jet) = shift*value;
2807 // return StatusCode::SUCCESS;
2808 //}
2809 //if (accTau2WTA.isAvailable(constJet) && accTau3WTA.isAvailable(constJet))
2810 //{
2811 // const float value = accTau3WTA(constJet)/accTau2WTA(constJet);
2812 // accTau32WTA(jet) = shift*value;
2813 // return StatusCode::SUCCESS;
2814 //}
2815
2816 ATH_MSG_ERROR("Neither Tau32_wta nor Tau2_wta+Tau3_wta moments are available on the jet, please make sure one of these options is available before calling the tool");
2817 return StatusCode::FAILURE;
2818}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_absEtaGluonFraction

bool JetUncertaintiesTool::m_absEtaGluonFraction
private

Definition at line 283 of file JetUncertaintiesTool.h.

◆ m_accEfficiency

SG::Accessor<float> JetUncertaintiesTool::m_accEfficiency
private

Definition at line 279 of file JetUncertaintiesTool.h.

◆ m_accEffSF

SG::Accessor<float> JetUncertaintiesTool::m_accEffSF
private

Definition at line 277 of file JetUncertaintiesTool.h.

◆ m_accSigeffSF

SG::Accessor<float> JetUncertaintiesTool::m_accSigeffSF
private

Definition at line 278 of file JetUncertaintiesTool.h.

◆ m_accTagResult

SG::Accessor<bool> JetUncertaintiesTool::m_accTagResult
private

Definition at line 280 of file JetUncertaintiesTool.h.

◆ m_accTagScaleFactor

SG::Accessor<float> JetUncertaintiesTool::m_accTagScaleFactor
private

Definition at line 276 of file JetUncertaintiesTool.h.

◆ m_analysisFile

std::string JetUncertaintiesTool::m_analysisFile
private

Definition at line 195 of file JetUncertaintiesTool.h.

◆ m_analysisHistPattern

std::string JetUncertaintiesTool::m_analysisHistPattern
private

Definition at line 196 of file JetUncertaintiesTool.h.

◆ m_calibArea

std::string JetUncertaintiesTool::m_calibArea
private

Definition at line 193 of file JetUncertaintiesTool.h.

◆ m_caloMassWeight

jet::UncertaintyHistogram* JetUncertaintiesTool::m_caloMassWeight
private

Definition at line 226 of file JetUncertaintiesTool.h.

◆ m_combMassParam

jet::CompParametrization::TypeEnum JetUncertaintiesTool::m_combMassParam
private

Definition at line 230 of file JetUncertaintiesTool.h.

◆ m_combMassWeightCaloMassDef

jet::CompMassDef::TypeEnum JetUncertaintiesTool::m_combMassWeightCaloMassDef
private

Definition at line 228 of file JetUncertaintiesTool.h.

◆ m_combMassWeightTAMassDef

jet::CompMassDef::TypeEnum JetUncertaintiesTool::m_combMassWeightTAMassDef
private

Definition at line 229 of file JetUncertaintiesTool.h.

◆ m_configFile

std::string JetUncertaintiesTool::m_configFile
private

Definition at line 192 of file JetUncertaintiesTool.h.

◆ m_currentSystSet

CP::SystematicSet JetUncertaintiesTool::m_currentSystSet
private

Definition at line 217 of file JetUncertaintiesTool.h.

◆ m_currentUncSet

jet::UncertaintySet* JetUncertaintiesTool::m_currentUncSet
private

Definition at line 218 of file JetUncertaintiesTool.h.

◆ m_defAnaFile

std::string JetUncertaintiesTool::m_defAnaFile
private

Definition at line 207 of file JetUncertaintiesTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_energyScale

float JetUncertaintiesTool::m_energyScale
private

Definition at line 186 of file JetUncertaintiesTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_fileValidHist

jet::ValidityHistogram* JetUncertaintiesTool::m_fileValidHist
private

Definition at line 223 of file JetUncertaintiesTool.h.

◆ m_groups

std::vector<jet::UncertaintyGroup*> JetUncertaintiesTool::m_groups
private

Definition at line 212 of file JetUncertaintiesTool.h.

◆ m_isData

bool JetUncertaintiesTool::m_isData
private

Definition at line 236 of file JetUncertaintiesTool.h.

◆ m_isInit

bool JetUncertaintiesTool::m_isInit
private

Definition at line 184 of file JetUncertaintiesTool.h.

◆ m_jetDef

std::string JetUncertaintiesTool::m_jetDef
private

Definition at line 190 of file JetUncertaintiesTool.h.

◆ m_mcType

std::string JetUncertaintiesTool::m_mcType
private

Definition at line 191 of file JetUncertaintiesTool.h.

◆ m_name

const std::string JetUncertaintiesTool::m_name
private

Definition at line 185 of file JetUncertaintiesTool.h.

◆ m_name_Efficiency

std::string JetUncertaintiesTool::m_name_Efficiency
private

Definition at line 202 of file JetUncertaintiesTool.h.

◆ m_name_EffSF

std::string JetUncertaintiesTool::m_name_EffSF
private

Definition at line 200 of file JetUncertaintiesTool.h.

◆ m_name_SigeffSF

std::string JetUncertaintiesTool::m_name_SigeffSF
private

Definition at line 201 of file JetUncertaintiesTool.h.

◆ m_name_TagResult

std::string JetUncertaintiesTool::m_name_TagResult
private

Definition at line 203 of file JetUncertaintiesTool.h.

◆ m_name_TagScaleFactor

std::string JetUncertaintiesTool::m_name_TagScaleFactor
private

Definition at line 199 of file JetUncertaintiesTool.h.

◆ m_namePrefix

const std::string JetUncertaintiesTool::m_namePrefix
private

Definition at line 240 of file JetUncertaintiesTool.h.

◆ m_NJetAccessorName

std::string JetUncertaintiesTool::m_NJetAccessorName
private

Definition at line 197 of file JetUncertaintiesTool.h.

◆ m_path

std::string JetUncertaintiesTool::m_path
private

Definition at line 194 of file JetUncertaintiesTool.h.

◆ m_pseudoDataJERsmearingMode

bool JetUncertaintiesTool::m_pseudoDataJERsmearingMode
private

Definition at line 286 of file JetUncertaintiesTool.h.

◆ m_recognizedSystematics

CP::SystematicSet JetUncertaintiesTool::m_recognizedSystematics
private

Definition at line 215 of file JetUncertaintiesTool.h.

◆ m_recommendedSystematics

CP::SystematicSet JetUncertaintiesTool::m_recommendedSystematics
private

Definition at line 216 of file JetUncertaintiesTool.h.

◆ m_reentrantMutex

std::mutex JetUncertaintiesTool::m_reentrantMutex
mutableprivate

Definition at line 235 of file JetUncertaintiesTool.h.

◆ m_refMu

float JetUncertaintiesTool::m_refMu
private

Definition at line 209 of file JetUncertaintiesTool.h.

◆ m_refMuHist

jet::UncertaintyHistogram* JetUncertaintiesTool::m_refMuHist
private

Definition at line 211 of file JetUncertaintiesTool.h.

◆ m_refNPV

float JetUncertaintiesTool::m_refNPV
private

Definition at line 208 of file JetUncertaintiesTool.h.

◆ m_refNPVHist

jet::UncertaintyHistogram* JetUncertaintiesTool::m_refNPVHist
private

Definition at line 210 of file JetUncertaintiesTool.h.

◆ m_release

std::string JetUncertaintiesTool::m_release
private

Definition at line 189 of file JetUncertaintiesTool.h.

◆ m_resHelper

jet::ResolutionHelper* JetUncertaintiesTool::m_resHelper
private

Definition at line 237 of file JetUncertaintiesTool.h.

◆ m_systFilterMap

std::unordered_map<CP::SystematicSet,CP::SystematicSet> JetUncertaintiesTool::m_systFilterMap
private

Definition at line 219 of file JetUncertaintiesTool.h.

◆ m_systFilters

std::vector<std::string> JetUncertaintiesTool::m_systFilters
private

Definition at line 198 of file JetUncertaintiesTool.h.

◆ m_systSetMap

std::unordered_map<CP::SystematicSet,jet::UncertaintySet*> JetUncertaintiesTool::m_systSetMap
private

Definition at line 220 of file JetUncertaintiesTool.h.

◆ m_TAMassWeight

jet::UncertaintyHistogram* JetUncertaintiesTool::m_TAMassWeight
private

Definition at line 227 of file JetUncertaintiesTool.h.

◆ m_userSeed

long long int JetUncertaintiesTool::m_userSeed
private

Definition at line 233 of file JetUncertaintiesTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: