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::TypeEnumgetComponentScaleVars (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< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode addUncertaintyGroup (const jet::ConfigHelper &helper)
StatusCode addUncertaintyComponent (const jet::ConfigHelper &helper)
jet::UncertaintyComponentbuildUncertaintyComponent (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::UncertaintyHistogramm_refNPVHist
jet::UncertaintyHistogramm_refMuHist
std::vector< jet::UncertaintyGroup * > m_groups
CP::SystematicSet m_recognizedSystematics
CP::SystematicSet m_recommendedSystematics
CP::SystematicSet m_currentSystSet
jet::UncertaintySetm_currentUncSet
std::unordered_map< CP::SystematicSet, CP::SystematicSetm_systFilterMap
std::unordered_map< CP::SystematicSet, jet::UncertaintySet * > m_systSetMap
jet::ValidityHistogramm_fileValidHist
jet::UncertaintyHistogramm_caloMassWeight
jet::UncertaintyHistogramm_TAMassWeight
jet::CompMassDef::TypeEnum m_combMassWeightCaloMassDef
jet::CompMassDef::TypeEnum m_combMassWeightTAMassDef
jet::CompParametrization::TypeEnum m_combMassParam
long long int m_userSeed
TRandom3 m_rand ATLAS_THREAD_SAFE
std::mutex m_reentrantMutex
bool m_isData
jet::ResolutionHelperm_resHelper
const std::string m_namePrefix
SG::AuxElement::Accessor< float > m_accTagScaleFactor
SG::AuxElement::Accessor< float > m_accEffSF
SG::AuxElement::Accessor< float > m_accSigeffSF
SG::AuxElement::Accessor< float > m_accEfficiency
SG::AuxElement::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 42 of file JetUncertaintiesTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetUncertaintiesTool() [1/2]

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

Definition at line 64 of file JetUncertaintiesTool.cxx.

65 : asg::AsgTool(name)
66 , m_isInit(false)
67 , m_name(name)
68 , m_energyScale(1.e-3)
69 , m_release("")
70 , m_jetDef("")
71 , m_mcType("")
72 , m_configFile("")
73 , m_calibArea("CalibArea-08")
74 , m_path("")
75 , m_analysisFile("")
77 , m_NJetAccessorName("Njet")
79 , m_defAnaFile("")
80 , m_refNPV(-1)
81 , m_refMu(-1)
82 , m_refNPVHist(nullptr)
83 , m_refMuHist(nullptr)
84 , m_groups()
88 , m_currentUncSet(nullptr)
90 , m_systSetMap()
91 , m_fileValidHist(nullptr)
92 , m_caloMassWeight(nullptr)
93 , m_TAMassWeight(nullptr)
97 , m_userSeed(0)
98 , m_rand()
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_ERROR(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
jet::UncertaintyHistogram * m_caloMassWeight
CP::SystematicSet m_currentSystSet
std::vector< jet::UncertaintyGroup * > m_groups
jet::UncertaintyHistogram * m_refMuHist
jet::CompMassDef::TypeEnum m_combMassWeightTAMassDef
jet::UncertaintyHistogram * m_refNPVHist
std::vector< std::string > m_systFilters
CP::SystematicSet m_recommendedSystematics
SG::AuxElement::Accessor< float > m_accEfficiency
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilterMap
CP::SystematicSet m_recognizedSystematics
SG::AuxElement::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.
const std::string m_namePrefix
std::unordered_map< CP::SystematicSet, jet::UncertaintySet * > m_systSetMap
SG::AuxElement::Accessor< bool > m_accTagResult
jet::ValidityHistogram * m_fileValidHist
jet::CompParametrization::TypeEnum m_combMassParam
SG::AuxElement::Accessor< float > m_accSigeffSF
jet::ResolutionHelper * m_resHelper
SG::AuxElement::Accessor< float > m_accTagScaleFactor
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_rand(toCopy.m_rand)
166 , m_isData(toCopy.m_isData)
167 , m_resHelper(new ResolutionHelper(*toCopy.m_resHelper))
168 , m_namePrefix(toCopy.m_namePrefix)
170 , m_accEffSF(toCopy.m_accEffSF)
176{
177 ATH_MSG_DEBUG("Creating copy of JetUncertaintiesTool named "<<m_name);
178
179 for (size_t iGroup = 0; iGroup < toCopy.m_groups.size(); ++iGroup)
180 m_groups.push_back(new UncertaintyGroup(*toCopy.m_groups.at(iGroup)));
181
183 ATH_MSG_ERROR(Form("Failed to re-set applySystematicVariation in new tool copy"));
184}

◆ ~JetUncertaintiesTool()

JetUncertaintiesTool::~JetUncertaintiesTool ( )
virtual

Definition at line 186 of file JetUncertaintiesTool.cxx.

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

Member Function Documentation

◆ addAffectingSystematic()

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

Definition at line 1297 of file JetUncertaintiesTool.cxx.

1298{
1299 CP::SystematicRegistry& registry = CP::SystematicRegistry::getInstance();
1300 registry.registerSystematic(systematic);
1301 m_recognizedSystematics.insert(systematic);
1302 if (recommended)
1303 {
1304 m_recommendedSystematics.insert(systematic);
1305 if (registry.addSystematicToRecommended(systematic) != StatusCode::SUCCESS)
1306 {
1307 ATH_MSG_ERROR("Failed to add systematic to list of recommended systematics: " << systematic.name());
1308 return StatusCode::FAILURE;
1309 }
1310 }
1311 return StatusCode::SUCCESS;
1312}
StatusCode addSystematicToRecommended(const SystematicVariation &systematic)
description: add a systematic to the recommended set
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
void registerSystematic(const SystematicVariation &systematic)
description: add a systematic to the global registry set
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 835 of file JetUncertaintiesTool.cxx.

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

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

◆ affectingSystematics()

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

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 1257 of file JetUncertaintiesTool.cxx.

1258{
1260}

◆ appliedSystematics()

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

Definition at line 1267 of file JetUncertaintiesTool.cxx.

1268{
1269 return m_currentSystSet;
1270}

◆ 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 2317 of file JetUncertaintiesTool.cxx.

2319{
2320 std::lock_guard<std::mutex> lock(m_reentrantMutex);
2322 const_cast<JetUncertaintiesTool*>(this);
2323 if (nc_this->applySystematicVariation(syst) != StatusCode::SUCCESS)
2325 const xAOD::EventInfo* eInfo = nullptr;
2326 if (evtStore()->retrieve(eInfo, "EventInfo").isFailure()) {
2327 ATH_MSG_ERROR("Failed to retrieve EventInfo in applyContainerCorrection");
2329 }
2330 return applyContainerCorrection(inputs, *eInfo);
2331}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
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")
TRandom3 m_rand ATLAS_THREAD_SAFE
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 2303 of file JetUncertaintiesTool.cxx.

2304{
2305 CP::CorrectionCode result = CP::CorrectionCode::Ok;
2306
2307 // Loop over the container
2308 for (size_t iJet = 0; iJet < inputs.size(); ++iJet)
2309 {
2310 result = applyCorrection(*inputs.at(iJet),eInfo);
2311 if (result == CP::CorrectionCode::Error)
2312 break;
2313 }
2314 return result;
2315}
@ 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 2096 of file JetUncertaintiesTool.cxx.

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

1315{
1316 //if (!m_isInit)
1317 //{
1318 // ATH_MSG_FATAL("Tool must be initialized before calling applySystematicVariation");
1319 // return StatusCode::FAILURE;
1320 //}
1321 CP::SystematicSet filteredSet;
1323 std::string remappedName = systConfig.name();
1324 size_t found = remappedName.find("_PseudoData");
1325 if (found != std::string::npos) {
1326 remappedName.erase(found, std::string("_PseudoData").length());
1327 }
1328
1329 CP::SystematicSet altConfig(remappedName);
1330 // Filter the full set of systematics to the set we care about
1331 if (getFilteredSystematicSet(altConfig,filteredSet) != StatusCode::SUCCESS)
1332 return StatusCode::FAILURE;
1333 }
1334 else {
1335 // Filter the full set of systematics to the set we care about
1336 if (getFilteredSystematicSet(systConfig,filteredSet) != StatusCode::SUCCESS)
1337 return StatusCode::FAILURE;
1338 }
1339
1340 // Get the uncertainty set associated to the filtered systematics set
1341 jet::UncertaintySet* uncSet = nullptr;
1342 if (getUncertaintySet(filteredSet,uncSet) != StatusCode::SUCCESS)
1343 return StatusCode::FAILURE;
1344
1345 // Change the current state
1346 m_currentSystSet.swap(filteredSet);
1347 m_currentUncSet = uncSet;
1348 return StatusCode::SUCCESS;
1349}
double length(const pvec &v)
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 936 of file JetUncertaintiesTool.cxx.

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

1273{
1274 // Check for things like AFII non-closure in full sim configurations
1275 if (systematic.isAlwaysZero())
1276 return false;
1277
1278 // Check for filters
1279 bool passesFilter = m_systFilters.empty();
1280 const std::set<CompScaleVar::TypeEnum> scaleVars = systematic.getScaleVars();
1281
1282 for (size_t iFilter = 0; iFilter < m_systFilters.size(); ++iFilter)
1283 {
1284 if (scaleVars.count(CompScaleVar::stringToEnum(m_systFilters.at(iFilter))))
1285 {
1286 passesFilter = true;
1287 break;
1288 }
1289 }
1290 if (!passesFilter)
1291 return false;
1292
1293 // All checked, this is a recommended systematic
1294 return true;
1295}
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 1558 of file JetUncertaintiesTool.cxx.

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

◆ correctedCopy()

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

Implements ICPJetUncertaintiesTool.

Definition at line 2282 of file JetUncertaintiesTool.cxx.

2283{
2284 xAOD::Jet* copy = new xAOD::Jet(input);
2285
2286 // Call the implemented function
2287 if (applyCorrection(*copy,eInfo) != CP::CorrectionCode::Ok)
2288 {
2289 delete copy;
2291 }
2292 output = copy;
2294}
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 72 of file JetUncertaintiesTool.h.

72{ return m_analysisFile; }

◆ getAnalysisHistPattern()

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

Definition at line 73 of file JetUncertaintiesTool.h.

73{ return m_analysisHistPattern; }

◆ getComponentCategories()

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

Definition at line 1972 of file JetUncertaintiesTool.cxx.

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

◆ getComponentCategory()

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

Definition at line 1528 of file JetUncertaintiesTool.cxx.

1529{
1530 if (!m_isInit)
1531 {
1532 ATH_MSG_FATAL("Tool must be initialized before calling getComponentCategory");
1533 return "";
1534 }
1535
1536 if (index < m_groups.size())
1537 return CompCategory::enumToString(m_groups.at(index)->getCategory()).Data();
1538
1539 ATH_MSG_ERROR("Index out of bounds for component category: " << index);
1540 return "";
1541}

◆ getComponentDesc()

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

Implements IJetUncertaintiesTool.

Definition at line 1513 of file JetUncertaintiesTool.cxx.

1514{
1515 if (!m_isInit)
1516 {
1517 ATH_MSG_FATAL("Tool must be initialized before calling getComponentDesc");
1518 return "";
1519 }
1520
1521 if (index < m_groups.size())
1522 return m_groups.at(index)->getDesc().Data();
1523
1524 ATH_MSG_ERROR("Index out of bounds for component desc: " << index);
1525 return "";
1526}

◆ getComponentIndex() [1/2]

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

Implements IJetUncertaintiesTool.

Definition at line 1477 of file JetUncertaintiesTool.cxx.

1478{
1479 return getComponentIndex(TString(name.c_str()));
1480}
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 1482 of file JetUncertaintiesTool.cxx.

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

◆ getComponentIsReducible()

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

Definition at line 1543 of file JetUncertaintiesTool.cxx.

1544{
1545 if (!m_isInit)
1546 {
1547 ATH_MSG_FATAL("Tool must be initialized before calling getComponentIsReducible");
1548 return false;
1549 }
1550
1551 if (index < m_groups.size())
1552 return m_groups.at(index)->getIsReducible();
1553
1554 ATH_MSG_ERROR("Index out of bounds for component category: " << index);
1555 return false;
1556}

◆ getComponentName()

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

Implements IJetUncertaintiesTool.

Definition at line 1498 of file JetUncertaintiesTool.cxx.

1499{
1500 if (!m_isInit)
1501 {
1502 ATH_MSG_FATAL("Tool must be initialized before calling getComponentName");
1503 return "";
1504 }
1505
1506 if (index < m_groups.size())
1507 return m_groups.at(index)->getName().Data();
1508
1509 ATH_MSG_ERROR("Index out of bounds for component name: " << index);
1510 return "";
1511}

◆ getComponentNamesInCategory()

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

Definition at line 2020 of file JetUncertaintiesTool.cxx.

2021{
2022 if (!m_isInit)
2023 {
2024 ATH_MSG_FATAL("Tool must be initialized before calling getComponentNamesInCategory");
2025 return {};
2026 }
2027
2028 std::vector<size_t> components = getComponentsInCategory(category);
2029 std::vector<std::string> names;
2030 for (size_t iComp = 0; iComp < components.size(); ++iComp)
2031 names.push_back(getComponentName(components.at(iComp)));
2032
2033 return names;
2034}
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 1631 of file JetUncertaintiesTool.cxx.

1632{
1633 if (checkIndexInput(index).isFailure()) return false;
1634 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::C2Beta1);
1635}
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 1596 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesD23()

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

Implements IJetUncertaintiesTool.

Definition at line 1601 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesD2Beta1()

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

Definition at line 1626 of file JetUncertaintiesTool.cxx.

1627{
1628 if (checkIndexInput(index).isFailure()) return false;
1629 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::D2Beta1);
1630}

◆ getComponentScalesFourVec()

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

Implements IJetUncertaintiesTool.

Definition at line 1581 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesMass()

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

Implements IJetUncertaintiesTool.

Definition at line 1591 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesMultiple()

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

Definition at line 1646 of file JetUncertaintiesTool.cxx.

1647{
1648 if (checkIndexInput(index).isFailure()) return false;
1649 return m_groups.at(index)->getScaleVars().size() > 1;
1650}

◆ getComponentScalesPt()

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

Implements IJetUncertaintiesTool.

Definition at line 1586 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesQw()

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

Definition at line 1636 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesTagScaleFactor()

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

Definition at line 1641 of file JetUncertaintiesTool.cxx.

1642{
1643 if (checkIndexInput(index).isFailure()) return false;
1644 return checkScalesSingleVar(m_groups.at(index)->getScaleVars(),CompScaleVar::TagScaleFactor);
1645}

◆ getComponentScalesTau21()

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

Implements IJetUncertaintiesTool.

Definition at line 1606 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesTau21WTA()

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

Definition at line 1616 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesTau32()

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

Implements IJetUncertaintiesTool.

Definition at line 1611 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScalesTau32WTA()

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

Definition at line 1621 of file JetUncertaintiesTool.cxx.

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

◆ getComponentScaleVars()

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

Definition at line 1651 of file JetUncertaintiesTool.cxx.

1652{
1653 if (checkIndexInput(index).isFailure()) return {};
1654 return m_groups.at(index)->getScaleVars();
1655}

◆ getComponentsInCategory()

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

Definition at line 1995 of file JetUncertaintiesTool.cxx.

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

◆ getComponentTopology()

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

Definition at line 1656 of file JetUncertaintiesTool.cxx.

1657{
1658 if (checkIndexInput(index).isFailure()) return JetTopology::UNKNOWN;
1659 return m_groups.at(index)->getTopology();
1660}

◆ getConfigFile()

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

Implements IJetUncertaintiesTool.

Definition at line 70 of file JetUncertaintiesTool.h.

70{ return m_configFile; }

◆ getDefaultAnaFile()

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

Definition at line 74 of file JetUncertaintiesTool.h.

74{ return m_defAnaFile; }

◆ getFilteredSystematicSet()

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

Definition at line 1351 of file JetUncertaintiesTool.cxx.

1352{
1353 // Check if we have already encountered this set
1354 std::unordered_map<CP::SystematicSet,CP::SystematicSet>::iterator iter = m_systFilterMap.find(systConfig);
1355 if (iter != m_systFilterMap.end())
1356 filteredSet = iter->second;
1357 // Make the filtered set and store it
1358 else
1359 {
1360 if (CP::SystematicSet::filterForAffectingSystematics(systConfig,m_recognizedSystematics,filteredSet) != StatusCode::SUCCESS)
1361 return StatusCode::FAILURE;
1362 m_systFilterMap.insert(std::make_pair(systConfig,filteredSet));
1363 }
1364
1365 return StatusCode::SUCCESS;
1366}
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 68 of file JetUncertaintiesTool.h.

68{ 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::TEvent 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::TEvent, 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 69 of file JetUncertaintiesTool.h.

69{ 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::TEvent 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::TEvent, 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 66 of file JetUncertaintiesTool.h.

66{ 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 1827 of file JetUncertaintiesTool.cxx.

1828{
1829 if (!m_isInit)
1830 {
1831 ATH_MSG_FATAL("Tool must be initialized before calling getNominalResolution");
1832 return JESUNC_ERROR_CODE;
1833 }
1834 if (!m_resHelper)
1835 {
1836 ATH_MSG_ERROR("The ResolutionHelper class was not created");
1837 return JESUNC_ERROR_CODE;
1838 }
1839
1840 // Get the nominal histogram, parametrization, and mass def (if relevant) from the helper
1841 std::tuple<const UncertaintyHistogram*,CompParametrization::TypeEnum,CompMassDef::TypeEnum> resolution = m_resHelper->getNominalResolution(smearType,topology,readMC);
1842
1843 // Check that we retrieved them successfully
1844 if (!std::get<0>(resolution) || std::get<1>(resolution) == CompParametrization::UNKNOWN)
1845 return JESUNC_ERROR_CODE;
1846 if (CompParametrization::includesMass(std::get<1>(resolution)) && std::get<2>(resolution) == CompMassDef::UNKNOWN)
1847 {
1848 // We should never reach this, as it was also checked during initialization
1849 ATH_MSG_ERROR("Parametrization involves mass but mass def is unknown");
1850 return JESUNC_ERROR_CODE;
1851 }
1852
1853 // Now read the uncertainty from the histogram
1854 return readHistoFromParam(jet,*std::get<0>(resolution),std::get<1>(resolution),std::get<2>(resolution));
1855}
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 1822 of file JetUncertaintiesTool.cxx.

1823{
1824 return getNominalResolution(jet,smearType,topology,false);
1825}
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 1817 of file JetUncertaintiesTool.cxx.

1818{
1819 return getNominalResolution(jet,smearType,topology,true);
1820}

◆ getNormalizedCaloMassWeight()

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

Definition at line 1925 of file JetUncertaintiesTool.cxx.

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

◆ getNormalizedTAMassWeight()

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

Definition at line 1945 of file JetUncertaintiesTool.cxx.

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

◆ getNumComponents()

size_t JetUncertaintiesTool::getNumComponents ( ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1466 of file JetUncertaintiesTool.cxx.

1467{
1468 if (!m_isInit)
1469 {
1470 ATH_MSG_FATAL("Tool must be initialized before calling getNumComponents");
1471 return 0;
1472 }
1473
1474 return m_groups.size();
1475}

◆ getPath()

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

Implements IJetUncertaintiesTool.

Definition at line 71 of file JetUncertaintiesTool.h.

71{ 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 1415 of file JetUncertaintiesTool.cxx.

1416{
1417 if (!m_isInit)
1418 {
1419 ATH_MSG_FATAL("Tool must be initialized before calling getRefMu");
1420 return JESUNC_ERROR_CODE;
1421 }
1422 if (m_refMuHist)
1423 {
1424 ATH_MSG_FATAL("Tool contains a histogram for refMu, cannot return float");
1425 return JESUNC_ERROR_CODE;
1426 }
1427 return m_refMu;
1428}

◆ getRefMu() [2/2]

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

Definition at line 1445 of file JetUncertaintiesTool.cxx.

1446{
1447 if (!m_isInit)
1448 {
1449 ATH_MSG_FATAL("Tool must be initialized before calling getRefMu");
1450 return JESUNC_ERROR_CODE;
1451 }
1452 return m_refMuHist ? m_refMuHist->getValue(fabs(jet.eta())) : m_refMu;
1453}

◆ getRefNPV() [1/2]

float JetUncertaintiesTool::getRefNPV ( ) const
virtual

Implements IJetUncertaintiesTool.

Definition at line 1430 of file JetUncertaintiesTool.cxx.

1431{
1432 if (!m_isInit)
1433 {
1434 ATH_MSG_FATAL("Tool must be initialized before calling getRefNPV");
1435 return JESUNC_ERROR_CODE;
1436 }
1437 if (m_refNPVHist)
1438 {
1439 ATH_MSG_FATAL("Tool contains a histogram for refNPV, cannot return float");
1440 return JESUNC_ERROR_CODE;
1441 }
1442 return m_refNPV;
1443}

◆ getRefNPV() [2/2]

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

Definition at line 1455 of file JetUncertaintiesTool.cxx.

1456{
1457 if (!m_isInit)
1458 {
1459 ATH_MSG_FATAL("Tool must be initialized before calling getRefNPV");
1460 return JESUNC_ERROR_CODE;
1461 }
1462 return m_refNPVHist ? m_refNPVHist->getValue(fabs(jet.eta())) : m_refNPV;
1463}

◆ getRelease()

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

Definition at line 67 of file JetUncertaintiesTool.h.

67{ return m_release; }

◆ getSmearingFactor()

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

Definition at line 2377 of file JetUncertaintiesTool.cxx.

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

1402{
1403 float sqrtS = -1;
1404 const TString release = getRelease().c_str();
1405 if (release.BeginsWith("2011_"))
1406 sqrtS = 7000.*m_energyScale;
1407 else if (release.BeginsWith("2012_"))
1408 sqrtS = 8000.*m_energyScale;
1409 else if (release.BeginsWith("2015_") || release.BeginsWith("2016"))
1410 sqrtS = 13000.*m_energyScale;
1411 return sqrtS;
1412}
virtual std::string getRelease() const
static std::string release
Definition computils.h:50

◆ getUncertainty() [1/2]

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

Implements IJetUncertaintiesTool.

Definition at line 1717 of file JetUncertaintiesTool.cxx.

1718{
1719 return getUncertainty(index,jet,eInfo,CompScaleVar::UNKNOWN);
1720}
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 1727 of file JetUncertaintiesTool.cxx.

1728{
1729 if (!m_isInit)
1730 {
1731 ATH_MSG_FATAL("Tool must be initialized before calling getUncertainty");
1732 return JESUNC_ERROR_CODE;
1733 }
1734
1735 // Ensure we are within bounds
1736 if (index >= m_groups.size())
1737 {
1738 ATH_MSG_ERROR("Index out of bounds for uncertainty: " << index);
1739 return JESUNC_ERROR_CODE;
1740 }
1741
1742 // Watch for a global validity histogram
1743 if (m_fileValidHist && !m_fileValidHist->getValidity(jet))
1744 {
1745 ATH_MSG_ERROR("Jet is out of validity bounds for uncertainty: " << index);
1746 return JESUNC_ERROR_CODE;
1747 }
1748
1749
1750 // Deal with different possible scale types
1751 // If scaleVar is unknown, work if comp is just one type
1752 // If scaleVar is specified, request that specific type regardless
1753 if (scaleVar == CompScaleVar::UNKNOWN)
1754 {
1755 if (m_groups.at(index)->getScaleVars().size() != 1)
1756 {
1757 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());
1758 return JESUNC_ERROR_CODE;
1759 }
1760 return m_groups.at(index)->getUncertainty(jet,eInfo,*(m_groups.at(index)->getScaleVars().begin()));
1761 }
1762 return m_groups.at(index)->getUncertainty(jet,eInfo,scaleVar);
1763}

◆ getUncertaintySet()

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

Definition at line 1368 of file JetUncertaintiesTool.cxx.

1369{
1370 // Check if we have already encountered this set
1371 std::unordered_map<CP::SystematicSet,UncertaintySet*>::iterator iter = m_systSetMap.find(filteredSet);
1372
1373 // If we have dealt with this set previously, we're done
1374 if (iter != m_systSetMap.end())
1375 {
1376 uncSet = iter->second;
1377 }
1378 // Make the new set and store it
1379 else
1380 {
1381 uncSet = new UncertaintySet(filteredSet.name());
1382 if (uncSet == nullptr || uncSet->initialize(filteredSet,m_groups).isFailure())
1383 {
1384 ATH_MSG_ERROR("Failed to create UncertaintySet for filtered CP::SystematicSet: " << filteredSet.name());
1385 JESUNC_SAFE_DELETE(uncSet);
1386 return StatusCode::FAILURE;
1387 }
1388 m_systSetMap.insert(std::make_pair(filteredSet,uncSet));
1389 }
1390
1391 return StatusCode::SUCCESS;
1392}
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 1667 of file JetUncertaintiesTool.cxx.

1668{
1669 return getValidity(index,jet,eInfo,CompScaleVar::UNKNOWN);
1670}
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 1677 of file JetUncertaintiesTool.cxx.

1678{
1679 if (!m_isInit)
1680 {
1681 ATH_MSG_FATAL("Tool must be initialized before calling getValidity");
1682 return false;
1683 }
1684
1685 // Ensure we are within bounds
1686 if (index >= m_groups.size())
1687 {
1688 ATH_MSG_ERROR("Index out of bounds for validity: " << index);
1689 return false;
1690 }
1691
1692 // Check for a global validity histogram
1693 if (m_fileValidHist && !m_fileValidHist->getValidity(jet))
1694 return false;
1695
1696 // Deal with different possible scale types
1697 // If scaleVar is unknown, work if comp is just one type
1698 // If scaleVar is specified, request that specific type regardless
1699 if (scaleVar == CompScaleVar::UNKNOWN)
1700 {
1701 if (m_groups.at(index)->getScaleVars().size() != 1)
1702 {
1703 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());
1704 return false;
1705 }
1706 return m_groups.at(index)->getValidity(jet,eInfo,*(m_groups.at(index)->getScaleVars().begin()));
1707 }
1708 return m_groups.at(index)->getValidity(jet,eInfo,scaleVar);
1709}

◆ 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 1771 of file JetUncertaintiesTool.cxx.

1772{
1773 return getValidUncertainty(index, unc, jet, eInfo, CompScaleVar::UNKNOWN);
1774}
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 1781 of file JetUncertaintiesTool.cxx.

1782{
1783 if (!m_isInit)
1784 {
1785 ATH_MSG_FATAL("Tool must be initialized before calling getValidUncertainty");
1786 return false;
1787 }
1788
1789 // Ensure we are within bounds
1790 if (index >= m_groups.size())
1791 {
1792 ATH_MSG_ERROR("Index out of bounds for valid uncertainty: " << index);
1793 return false;
1794 }
1795
1796 // Check for a global validity histogram
1797 if (m_fileValidHist && !m_fileValidHist->getValidity(jet))
1798 return false;
1799
1800
1801 // Deal with different possible scale types
1802 // If scaleVar is unknown, work if comp is just one type
1803 // If scaleVar is specified, request that specific type regardless
1804 if (scaleVar == CompScaleVar::UNKNOWN)
1805 {
1806 if (m_groups.at(index)->getScaleVars().size() != 1)
1807 {
1808 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());
1809 return JESUNC_ERROR_CODE;
1810 }
1811 return m_groups.at(index)->getValidUncertainty(unc,jet,eInfo,*(m_groups.at(index)->getScaleVars().begin()));
1812 }
1813 return m_groups.at(index)->getValidUncertainty(unc,jet,eInfo,scaleVar);
1814}

◆ 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 238 of file JetUncertaintiesTool.cxx.

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

1250{
1251 // Compare using basenames to avoid continious vs fixed value comparisons
1252 const std::set<std::string> baseNames = m_recognizedSystematics.getBaseNames();
1253 return baseNames.find(systematic.basename()) != baseNames.end();
1254 //return m_recognizedSystematics.find(systematic) != m_recognizedSystematics.end();
1255}
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

◆ 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 1858 of file JetUncertaintiesTool.cxx.

1859{
1860 // Simple case (no mass dependence)
1862 return readHistoFromParam(jet.jetP4(),histo,param);
1863
1864 // Complex case (need to check the mass type to use)
1865 // Simple four-vector case
1866 if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
1867 return readHistoFromParam(jet.jetP4(),histo,param);
1868 // Special scale case
1869 JetFourMomAccessor massScaleAccessor(CompMassDef::getJetScaleString(massDef).Data());
1870 return readHistoFromParam(massScaleAccessor(jet),histo,param);
1871}
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
Definition Jet_v1.cxx:76

◆ 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 1873 of file JetUncertaintiesTool.cxx.

1874{
1875 double value = 0;
1876 switch (param)
1877 {
1879 value = histo.getValue(jet4vec.Pt()*m_energyScale);
1880 break;
1882 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.Eta());
1883 break;
1885 value = histo.getValue(jet4vec.Pt()*m_energyScale,fabs(jet4vec.Eta()));
1886 break;
1888 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()*m_energyScale);
1889 break;
1891 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()/jet4vec.Pt());
1892 break;
1894 value = histo.getValue(jet4vec.Pt()*m_energyScale,log(jet4vec.M()/jet4vec.Pt()));
1895 break;
1897 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()/jet4vec.Pt(),jet4vec.Eta());
1898 break;
1900 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()/jet4vec.Pt(),fabs(jet4vec.Eta()));
1901 break;
1903 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()*m_energyScale,jet4vec.Eta());
1904 break;
1906 value = histo.getValue(jet4vec.Pt()*m_energyScale,jet4vec.M()*m_energyScale,fabs(jet4vec.Eta()));
1907 break;
1909 value = histo.getValue(jet4vec.E()*m_energyScale,log(jet4vec.M()/jet4vec.E()));
1910 break;
1912 value = histo.getValue(jet4vec.E()*m_energyScale,log(jet4vec.M()/jet4vec.E()),jet4vec.Eta());
1913 break;
1915 value = histo.getValue(jet4vec.E()*m_energyScale,log(jet4vec.M()/jet4vec.E()),fabs(jet4vec.Eta()));
1916 break;
1917 default:
1918 ATH_MSG_ERROR("Failed to read histogram due to unknown parametrization type in " << getName());
1919 break;
1920 }
1921 return value;
1922}
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 1262 of file JetUncertaintiesTool.cxx.

1263{
1265}

◆ 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 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setRandomSeed()

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

Definition at line 62 of file JetUncertaintiesTool.h.

62{ m_userSeed = seed; }

◆ setScaleToGeV()

StatusCode JetUncertaintiesTool::setScaleToGeV ( )
virtual

Definition at line 225 of file JetUncertaintiesTool.cxx.

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

◆ setScaleToMeV()

StatusCode JetUncertaintiesTool::setScaleToMeV ( )
virtual

Definition at line 212 of file JetUncertaintiesTool.cxx.

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

◆ 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 >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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 2880 of file JetUncertaintiesTool.cxx.

2881{
2882 static const SG::AuxElement::Accessor<float> accC2("C2");
2883 static const SG::AuxElement::Accessor<float> accECF1("ECF1");
2884 static const SG::AuxElement::Accessor<float> accECF2("ECF2");
2885 static const SG::AuxElement::Accessor<float> accECF3("ECF3");
2886 static const bool C2wasAvailable = accC2.isAvailable(jet);
2887 static const bool ECFwasAvailable = accECF1.isAvailable(jet) && accECF2.isAvailable(jet) && accECF3.isAvailable(jet);
2888
2889 const xAOD::Jet& constJet = jet;
2890 if (C2wasAvailable)
2891 {
2892 if (!accC2.isAvailable(jet))
2893 {
2894 ATH_MSG_ERROR("The C2 moment was previously available but is not available on this jet. This functionality is not supported.");
2895 return StatusCode::FAILURE;
2896 }
2897 const float value = accC2(constJet);
2898 accC2(jet) = shift*value;
2899 return StatusCode::SUCCESS;
2900 }
2901 if (ECFwasAvailable)
2902 {
2903 if (! (accECF1.isAvailable(constJet) && accECF2.isAvailable(constJet) && accECF3.isAvailable(constJet)) )
2904 {
2905 ATH_MSG_ERROR("The ECF1, ECF2, and ECF3 moments were previously available but are not available on this jet. This functionality is not supported.");
2906 return StatusCode::FAILURE;
2907 }
2908 const float ecf1 = accECF1(constJet);
2909 const float ecf2 = accECF2(constJet);
2910 const float ecf3 = accECF3(constJet);
2911 accC2(jet) = fabs(ecf2) > 1.e-6 ? shift * (ecf3*ecf1/pow(ecf2,2)) : -999; // 999 to match JetSubStructureMomentTools/EnergyCorrelatorRatiosTool
2912 return StatusCode::SUCCESS;
2913 }
2914
2915 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");
2916 return StatusCode::FAILURE;
2917}

◆ updateD2Beta1()

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

Definition at line 2826 of file JetUncertaintiesTool.cxx.

2827{
2828 static const SG::AuxElement::Accessor<float> accD2("D2");
2829 static const SG::AuxElement::Accessor<float> accECF1("ECF1");
2830 static const SG::AuxElement::Accessor<float> accECF2("ECF2");
2831 static const SG::AuxElement::Accessor<float> accECF3("ECF3");
2832 static const bool D2wasAvailable = accD2.isAvailable(jet);
2833 static const bool ECFwasAvailable = accECF1.isAvailable(jet) && accECF2.isAvailable(jet) && accECF3.isAvailable(jet);
2834
2835 const xAOD::Jet& constJet = jet;
2836 if (D2wasAvailable)
2837 {
2838 if (!accD2.isAvailable(jet))
2839 {
2840 ATH_MSG_ERROR("The D2 moment was previously available but is not available on this jet. This functionality is not supported.");
2841 return StatusCode::FAILURE;
2842 }
2843 const float value = accD2(constJet);
2844 accD2(jet) = shift*value;
2845 return StatusCode::SUCCESS;
2846 }
2847 if (ECFwasAvailable)
2848 {
2849 if (! (accECF1.isAvailable(constJet) && accECF2.isAvailable(constJet) && accECF3.isAvailable(constJet)) )
2850 {
2851 ATH_MSG_ERROR("The ECF1, ECF2, and ECF3 moments were previously available but are not available on this jet. This functionality is not supported.");
2852 return StatusCode::FAILURE;
2853 }
2854 const float ecf1 = accECF1(constJet);
2855 const float ecf2 = accECF2(constJet);
2856 const float ecf3 = accECF3(constJet);
2857 accD2(jet) = fabs(ecf2) > 1.e-6 ? shift * (pow(ecf1/ecf2,3)*ecf3) : -999; // 999 to match JetSubStructureMomentTools/EnergyCorrelatorRatiosTool
2858 return StatusCode::SUCCESS;
2859 }
2860
2861 //if (accD2.isAvailable(constJet))
2862 //{
2863 // const float value = accD2(constJet);
2864 // accD2(jet) = shift*value;
2865 // return StatusCode::SUCCESS;
2866 //}
2867 //if (accECF1.isAvailable(constJet) && accECF2.isAvailable(constJet) && accECF3.isAvailable(constJet))
2868 //{
2869 // const float ecf1 = accECF1(constJet);
2870 // const float ecf2 = accECF2(constJet);
2871 // const float ecf3 = accECF3(constJet);
2872 // accD2(jet) = shift * (pow(ecf1/ecf2,3)*ecf3);
2873 // return StatusCode::SUCCESS;
2874 //}
2875
2876 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");
2877 return StatusCode::FAILURE;
2878}

◆ updateQw()

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

Definition at line 2919 of file JetUncertaintiesTool.cxx.

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

◆ updateSplittingScale12()

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

Definition at line 2543 of file JetUncertaintiesTool.cxx.

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

◆ updateSplittingScale23()

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

Definition at line 2559 of file JetUncertaintiesTool.cxx.

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

◆ updateTagEfficiency()

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

Definition at line 2995 of file JetUncertaintiesTool.cxx.

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

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

◆ updateTau21()

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

Definition at line 2575 of file JetUncertaintiesTool.cxx.

2576{
2577 static const SG::AuxElement::Accessor<float> accTau1("Tau1");
2578 static const SG::AuxElement::Accessor<float> accTau2("Tau2");
2579 static const SG::AuxElement::Accessor<float> accTau21("Tau21");
2580 static const bool Tau21wasAvailable = accTau21.isAvailable(jet);
2581 static const bool TauNNwasAvailable = accTau2.isAvailable(jet) && accTau1.isAvailable(jet);
2582
2583 const xAOD::Jet& constJet = jet;
2584 if (Tau21wasAvailable)
2585 {
2586 if (!accTau21.isAvailable(jet))
2587 {
2588 ATH_MSG_ERROR("The Tau21 moment was previously available but is not available on this jet. This functionality is not supported.");
2589 return StatusCode::FAILURE;
2590 }
2591 const float value = accTau21(constJet);
2592 accTau21(jet) = shift*value;
2593 return StatusCode::SUCCESS;
2594 }
2595 if (TauNNwasAvailable)
2596 {
2597 if (! (accTau2.isAvailable(jet) && accTau1.isAvailable(jet)) )
2598 {
2599 ATH_MSG_ERROR("The Tau2 and Tau1 moments were previously available but are not available on this jet. This functionality is not supported.");
2600 return StatusCode::FAILURE;
2601 }
2602 const float tau2 = accTau2(constJet);
2603 const float tau1 = accTau1(constJet);
2604 accTau21(jet) = fabs(tau1) > 1.e-6 ? shift*(tau2/tau1) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2605 return StatusCode::SUCCESS;
2606 }
2607 //if (accTau21.isAvailable(constJet))
2608 //{
2609 // const float value = accTau21(constJet);
2610 // accTau21(jet) = shift*value;
2611 // return StatusCode::SUCCESS;
2612 //}
2613 //if (accTau1.isAvailable(constJet) && accTau2.isAvailable(constJet))
2614 //{
2615 // const float value = accTau2(constJet)/accTau1(constJet);
2616 // accTau21(jet) = shift*value;
2617 // return StatusCode::SUCCESS;
2618 //}
2619
2620 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.");
2621 return StatusCode::FAILURE;
2622}

◆ updateTau21WTA()

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

Definition at line 2673 of file JetUncertaintiesTool.cxx.

2674{
2675 static const SG::AuxElement::Accessor<float> accTau1wta("Tau1_wta");
2676 static const SG::AuxElement::Accessor<float> accTau2wta("Tau2_wta");
2677 static const SG::AuxElement::Accessor<float> accTau21wta("Tau21_wta");
2678 static const SG::AuxElement::Accessor<float> accTau1WTA("Tau1_WTA");
2679 static const SG::AuxElement::Accessor<float> accTau2WTA("Tau2_WTA");
2680 static const SG::AuxElement::Accessor<float> accTau21WTA("Tau21_WTA");
2681 static const bool Tau21wtawasAvailable = accTau21wta.isAvailable(jet);
2682 static const bool Tau21WTAwasAvailable = accTau21WTA.isAvailable(jet);
2683 static const bool TauNNwtawasAvailable = accTau2wta.isAvailable(jet) && accTau1wta.isAvailable(jet);
2684 static const bool TauNNWTAwasAvailable = accTau2WTA.isAvailable(jet) && accTau1WTA.isAvailable(jet);
2685
2686 const xAOD::Jet& constJet = jet;
2687 if (Tau21wtawasAvailable)
2688 {
2689 if (!accTau21wta.isAvailable(jet))
2690 {
2691 ATH_MSG_ERROR("The Tau21_wta moment was previously available but is not available on this jet. This functionality is not supported.");
2692 return StatusCode::FAILURE;
2693 }
2694 const float value = accTau21wta(constJet);
2695 accTau21wta(jet) = shift*value;
2696 return StatusCode::SUCCESS;
2697 }
2698 if (Tau21WTAwasAvailable)
2699 {
2700 if (!accTau21WTA.isAvailable(jet))
2701 {
2702 ATH_MSG_ERROR("The Tau21_WTA moment was previously available but is not available on this jet. This functionality is not supported.");
2703 return StatusCode::FAILURE;
2704 }
2705 const float value = accTau21WTA(constJet);
2706 accTau21WTA(jet) = shift*value;
2707 return StatusCode::SUCCESS;
2708 }
2709 if (TauNNwtawasAvailable)
2710 {
2711 if (! (accTau2wta.isAvailable(jet) && accTau1wta.isAvailable(jet)) )
2712 {
2713 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.");
2714 return StatusCode::FAILURE;
2715 }
2716 const float tau2 = accTau2wta(constJet);
2717 const float tau1 = accTau1wta(constJet);
2718 accTau21wta(jet) = fabs(tau1) > 1.e-6 ? shift*(tau2/tau1) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2719 return StatusCode::SUCCESS;
2720 }
2721 if (TauNNWTAwasAvailable)
2722 {
2723 if (! (accTau2WTA.isAvailable(jet) && accTau1WTA.isAvailable(jet)) )
2724 {
2725 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.");
2726 return StatusCode::FAILURE;
2727 }
2728 const float tau2 = accTau2WTA(constJet);
2729 const float tau1 = accTau1WTA(constJet);
2730 accTau21WTA(jet) = fabs(tau1) > 1.e-6 ? shift*(tau2/tau1) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2731 return StatusCode::SUCCESS;
2732 }
2733
2734 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");
2735 return StatusCode::FAILURE;
2736}

◆ updateTau32()

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

Definition at line 2624 of file JetUncertaintiesTool.cxx.

2625{
2626 static const SG::AuxElement::Accessor<float> accTau2("Tau2");
2627 static const SG::AuxElement::Accessor<float> accTau3("Tau3");
2628 static const SG::AuxElement::Accessor<float> accTau32("Tau32");
2629 static const bool Tau32wasAvailable = accTau32.isAvailable(jet);
2630 static const bool TauNNwasAvailable = accTau3.isAvailable(jet) && accTau2.isAvailable(jet);
2631
2632 const xAOD::Jet& constJet = jet;
2633 if (Tau32wasAvailable)
2634 {
2635 if (!accTau32.isAvailable(jet))
2636 {
2637 ATH_MSG_ERROR("The Tau32 moment was previously available but is not available on this jet. This functionality is not supported.");
2638 return StatusCode::FAILURE;
2639 }
2640 const float value = accTau32(constJet);
2641 accTau32(jet) = shift*value;
2642 return StatusCode::SUCCESS;
2643 }
2644 if (TauNNwasAvailable)
2645 {
2646 if (! (accTau3.isAvailable(jet) && accTau2.isAvailable(jet)) )
2647 {
2648 ATH_MSG_ERROR("The Tau3 and Tau2 moments were previously available but are not available on this jet. This functionality is not supported.");
2649 return StatusCode::FAILURE;
2650 }
2651 const float tau3 = accTau3(constJet);
2652 const float tau2 = accTau2(constJet);
2653 accTau32(jet) = fabs(tau2) > 1.e-6 ? shift*(tau3/tau2) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2654 return StatusCode::SUCCESS;
2655 }
2656 //if (accTau32.isAvailable(constJet))
2657 //{
2658 // const float value = accTau32(constJet);
2659 // accTau32(jet) = shift*value;
2660 // return StatusCode::SUCCESS;
2661 //}
2662 //if (accTau2.isAvailable(constJet) && accTau3.isAvailable(constJet))
2663 //{
2664 // const float value = accTau3(constJet)/accTau2(constJet);
2665 // accTau32(jet) = shift*value;
2666 // return StatusCode::SUCCESS;
2667 //}
2668
2669 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");
2670 return StatusCode::FAILURE;
2671}

◆ updateTau32WTA()

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

Definition at line 2737 of file JetUncertaintiesTool.cxx.

2738{
2739 static const SG::AuxElement::Accessor<float> accTau2wta("Tau2_wta");
2740 static const SG::AuxElement::Accessor<float> accTau3wta("Tau3_wta");
2741 static const SG::AuxElement::Accessor<float> accTau32wta("Tau32_wta");
2742 static const SG::AuxElement::Accessor<float> accTau2WTA("Tau2_WTA");
2743 static const SG::AuxElement::Accessor<float> accTau3WTA("Tau3_WTA");
2744 static const SG::AuxElement::Accessor<float> accTau32WTA("Tau32_WTA");
2745 static const bool Tau32wtawasAvailable = accTau32wta.isAvailable(jet);
2746 static const bool Tau32WTAwasAvailable = accTau32WTA.isAvailable(jet);
2747 static const bool TauNNwtawasAvailable = accTau3wta.isAvailable(jet) && accTau2wta.isAvailable(jet);
2748 static const bool TauNNWTAwasAvailable = accTau3WTA.isAvailable(jet) && accTau2WTA.isAvailable(jet);
2749
2750 const xAOD::Jet& constJet = jet;
2751 if (Tau32wtawasAvailable)
2752 {
2753 if (!accTau32wta.isAvailable(jet))
2754 {
2755 ATH_MSG_ERROR("The Tau32_wta moment was previously available but is not available on this jet. This functionality is not supported.");
2756 return StatusCode::FAILURE;
2757 }
2758 const float value = accTau32wta(constJet);
2759 accTau32wta(jet) = shift*value;
2760 return StatusCode::SUCCESS;
2761 }
2762 if (Tau32WTAwasAvailable)
2763 {
2764 if (!accTau32WTA.isAvailable(jet))
2765 {
2766 ATH_MSG_ERROR("The Tau32_WTA moment was previously available but is not available on this jet. This functionality is not supported.");
2767 return StatusCode::FAILURE;
2768 }
2769 const float value = accTau32WTA(constJet);
2770 accTau32WTA(jet) = shift*value;
2771 return StatusCode::SUCCESS;
2772 }
2773 if (TauNNwtawasAvailable)
2774 {
2775 if (! (accTau3wta.isAvailable(jet) && accTau2wta.isAvailable(jet)) )
2776 {
2777 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.");
2778 return StatusCode::FAILURE;
2779 }
2780 const float tau3 = accTau3wta(constJet);
2781 const float tau2 = accTau2wta(constJet);
2782 accTau32wta(jet) = fabs(tau2) > 1.e-6 ? shift*(tau3/tau2) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
2783 return StatusCode::SUCCESS;
2784 }
2785 if (TauNNWTAwasAvailable)
2786 {
2787 if (! (accTau3WTA.isAvailable(jet) && accTau2WTA.isAvailable(jet)) )
2788 {
2789 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.");
2790 return StatusCode::FAILURE;
2791 }
2792 const float tau3 = accTau3WTA(constJet);
2793 const float tau2 = accTau2WTA(constJet);
2794 accTau32WTA(jet) = fabs(tau2) > 1.e-6 ? shift*(tau3/tau2) : -999; // 999 to match JetSubStructureMomentTools/NSubjettinessRatiosTool
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 (accTau32WTA.isAvailable(constJet))
2804 //{
2805 // const float value = accTau32WTA(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 //if (accTau2WTA.isAvailable(constJet) && accTau3WTA.isAvailable(constJet))
2816 //{
2817 // const float value = accTau3WTA(constJet)/accTau2WTA(constJet);
2818 // accTau32WTA(jet) = shift*value;
2819 // return StatusCode::SUCCESS;
2820 //}
2821
2822 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");
2823 return StatusCode::FAILURE;
2824}

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ ATLAS_THREAD_SAFE

TRandom3 m_rand JetUncertaintiesTool::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 236 of file JetUncertaintiesTool.h.

◆ m_absEtaGluonFraction

bool JetUncertaintiesTool::m_absEtaGluonFraction
private

Definition at line 285 of file JetUncertaintiesTool.h.

◆ m_accEfficiency

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

Definition at line 281 of file JetUncertaintiesTool.h.

◆ m_accEffSF

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

Definition at line 279 of file JetUncertaintiesTool.h.

◆ m_accSigeffSF

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

Definition at line 280 of file JetUncertaintiesTool.h.

◆ m_accTagResult

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

Definition at line 282 of file JetUncertaintiesTool.h.

◆ m_accTagScaleFactor

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

Definition at line 278 of file JetUncertaintiesTool.h.

◆ m_analysisFile

std::string JetUncertaintiesTool::m_analysisFile
private

Definition at line 197 of file JetUncertaintiesTool.h.

◆ m_analysisHistPattern

std::string JetUncertaintiesTool::m_analysisHistPattern
private

Definition at line 198 of file JetUncertaintiesTool.h.

◆ m_calibArea

std::string JetUncertaintiesTool::m_calibArea
private

Definition at line 195 of file JetUncertaintiesTool.h.

◆ m_caloMassWeight

jet::UncertaintyHistogram* JetUncertaintiesTool::m_caloMassWeight
private

Definition at line 228 of file JetUncertaintiesTool.h.

◆ m_combMassParam

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

Definition at line 232 of file JetUncertaintiesTool.h.

◆ m_combMassWeightCaloMassDef

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

Definition at line 230 of file JetUncertaintiesTool.h.

◆ m_combMassWeightTAMassDef

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

Definition at line 231 of file JetUncertaintiesTool.h.

◆ m_configFile

std::string JetUncertaintiesTool::m_configFile
private

Definition at line 194 of file JetUncertaintiesTool.h.

◆ m_currentSystSet

CP::SystematicSet JetUncertaintiesTool::m_currentSystSet
private

Definition at line 219 of file JetUncertaintiesTool.h.

◆ m_currentUncSet

jet::UncertaintySet* JetUncertaintiesTool::m_currentUncSet
private

Definition at line 220 of file JetUncertaintiesTool.h.

◆ m_defAnaFile

std::string JetUncertaintiesTool::m_defAnaFile
private

Definition at line 209 of file JetUncertaintiesTool.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_energyScale

float JetUncertaintiesTool::m_energyScale
private

Definition at line 188 of file JetUncertaintiesTool.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fileValidHist

jet::ValidityHistogram* JetUncertaintiesTool::m_fileValidHist
private

Definition at line 225 of file JetUncertaintiesTool.h.

◆ m_groups

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

Definition at line 214 of file JetUncertaintiesTool.h.

◆ m_isData

bool JetUncertaintiesTool::m_isData
private

Definition at line 238 of file JetUncertaintiesTool.h.

◆ m_isInit

bool JetUncertaintiesTool::m_isInit
private

Definition at line 186 of file JetUncertaintiesTool.h.

◆ m_jetDef

std::string JetUncertaintiesTool::m_jetDef
private

Definition at line 192 of file JetUncertaintiesTool.h.

◆ m_mcType

std::string JetUncertaintiesTool::m_mcType
private

Definition at line 193 of file JetUncertaintiesTool.h.

◆ m_name

const std::string JetUncertaintiesTool::m_name
private

Definition at line 187 of file JetUncertaintiesTool.h.

◆ m_name_Efficiency

std::string JetUncertaintiesTool::m_name_Efficiency
private

Definition at line 204 of file JetUncertaintiesTool.h.

◆ m_name_EffSF

std::string JetUncertaintiesTool::m_name_EffSF
private

Definition at line 202 of file JetUncertaintiesTool.h.

◆ m_name_SigeffSF

std::string JetUncertaintiesTool::m_name_SigeffSF
private

Definition at line 203 of file JetUncertaintiesTool.h.

◆ m_name_TagResult

std::string JetUncertaintiesTool::m_name_TagResult
private

Definition at line 205 of file JetUncertaintiesTool.h.

◆ m_name_TagScaleFactor

std::string JetUncertaintiesTool::m_name_TagScaleFactor
private

Definition at line 201 of file JetUncertaintiesTool.h.

◆ m_namePrefix

const std::string JetUncertaintiesTool::m_namePrefix
private

Definition at line 242 of file JetUncertaintiesTool.h.

◆ m_NJetAccessorName

std::string JetUncertaintiesTool::m_NJetAccessorName
private

Definition at line 199 of file JetUncertaintiesTool.h.

◆ m_path

std::string JetUncertaintiesTool::m_path
private

Definition at line 196 of file JetUncertaintiesTool.h.

◆ m_pseudoDataJERsmearingMode

bool JetUncertaintiesTool::m_pseudoDataJERsmearingMode
private

Definition at line 288 of file JetUncertaintiesTool.h.

◆ m_recognizedSystematics

CP::SystematicSet JetUncertaintiesTool::m_recognizedSystematics
private

Definition at line 217 of file JetUncertaintiesTool.h.

◆ m_recommendedSystematics

CP::SystematicSet JetUncertaintiesTool::m_recommendedSystematics
private

Definition at line 218 of file JetUncertaintiesTool.h.

◆ m_reentrantMutex

std::mutex JetUncertaintiesTool::m_reentrantMutex
mutableprivate

Definition at line 237 of file JetUncertaintiesTool.h.

◆ m_refMu

float JetUncertaintiesTool::m_refMu
private

Definition at line 211 of file JetUncertaintiesTool.h.

◆ m_refMuHist

jet::UncertaintyHistogram* JetUncertaintiesTool::m_refMuHist
private

Definition at line 213 of file JetUncertaintiesTool.h.

◆ m_refNPV

float JetUncertaintiesTool::m_refNPV
private

Definition at line 210 of file JetUncertaintiesTool.h.

◆ m_refNPVHist

jet::UncertaintyHistogram* JetUncertaintiesTool::m_refNPVHist
private

Definition at line 212 of file JetUncertaintiesTool.h.

◆ m_release

std::string JetUncertaintiesTool::m_release
private

Definition at line 191 of file JetUncertaintiesTool.h.

◆ m_resHelper

jet::ResolutionHelper* JetUncertaintiesTool::m_resHelper
private

Definition at line 239 of file JetUncertaintiesTool.h.

◆ m_systFilterMap

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

Definition at line 221 of file JetUncertaintiesTool.h.

◆ m_systFilters

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

Definition at line 200 of file JetUncertaintiesTool.h.

◆ m_systSetMap

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

Definition at line 222 of file JetUncertaintiesTool.h.

◆ m_TAMassWeight

jet::UncertaintyHistogram* JetUncertaintiesTool::m_TAMassWeight
private

Definition at line 229 of file JetUncertaintiesTool.h.

◆ m_userSeed

long long int JetUncertaintiesTool::m_userSeed
private

Definition at line 235 of file JetUncertaintiesTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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