ATLAS Offline Software
Loading...
Searching...
No Matches
PMGTruthWeightTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef PMGTOOLS_PMGTRUTHWEIGHTTOOL_H
6#define PMGTOOLS_PMGTRUTHWEIGHTTOOL_H
7
8// EDM include(s):
13
14// Interface include(s):
17
18
19namespace PMGTools
20{
26 {
29
30 public:
32 PMGTruthWeightTool(const std::string& name);
33
36
38 virtual StatusCode initialize() override;
39
41
44
46 virtual const std::vector<std::string>& getWeightNames() const override;
47
49 virtual float getWeight(const xAOD::EventInfo* evtInfo, const std::string& weightName) const override;
50
52 virtual bool hasWeight(const std::string& weightName) const override;
53
55 virtual float getSysWeight(const xAOD::EventInfo* evtInfo, const CP::SystematicSet& sys) const override;
56
58 virtual size_t getSysWeightIndex(const CP::SystematicSet& sys) const override;
59
61
64
66 virtual CP::SystematicSet affectingSystematics() const override;
67
69 virtual CP::SystematicSet recommendedSystematics() const override;
70
72
73 protected:
76
78 virtual StatusCode beginInputFile() override;
79
81
83 StatusCode getMCChannelNumber(uint32_t &mcChannelNumber);
84
86 StatusCode loadMetaData();
87
89 StatusCode loadPOOLMetaData();
90
93
96
98 std::string m_metaName;
99
102
105
108
110 std::vector<std::string> m_weightNames;
111
113 std::unordered_map<std::string, size_t> m_weightIndices;
114
117 };
118} // namespace PMGTools
119
120#endif // PMGTOOLS_PMGTRUTHWEIGHTTOOL_H
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Class to wrap a set of SystematicVariations.
helper class to cache systematics varied calibration constants inside a ISystematicsTool or IRentrant...
Interface for xAOD Truth Weight Tool which retrieves Meta Data from a truth record to interface the e...
virtual CP::SystematicSet affectingSystematics() const override
Implements interface from ISystematicsTool.
void clearWeightLocationCaches()
Clear caches.
virtual float getWeight(const xAOD::EventInfo *evtInfo, const std::string &weightName) const override
Implements interface from IPMGTruthWeightTool.
StatusCode validateWeightLocationCaches()
Validate weight caches.
virtual size_t getSysWeightIndex(const CP::SystematicSet &sys) const override
Implements interface from IPMGTruthWeightTool.
virtual StatusCode beginInputFile() override
Function called when a new input file is opened.
StatusCode loadPOOLMetaData()
Loads weight information from POOL using HepMCWeightNames.
std::unordered_map< std::string, size_t > m_weightIndices
Weight names to indices of available weights in this file.
bool m_useChannelZeroInMetaData
Flag to indicate whether the xAOD::TruthMetaData objects have incorrect McChannelNumber.
std::vector< std::string > m_weightNames
Available weight names for this file.
StatusCode getMCChannelNumber(uint32_t &mcChannelNumber)
Helper function for retrieving MC channel number from file metadata.
StatusCode loadMetaData()
Loads weight information from xAOD::TruthMetaDataContainer.
uint32_t m_mcChannelNumber
Current MC channel number.
std::string m_metaName
Stores the meta data record name.
PMGTruthWeightTool(const std::string &name)
Create a proper constructor for Athena.
CP::SystematicsCache< std::size_t > m_calibCache
Systematics to indices of available weights.
virtual float getSysWeight(const xAOD::EventInfo *evtInfo, const CP::SystematicSet &sys) const override
Implements interface from IPMGTruthWeightTool.
virtual bool hasWeight(const std::string &weightName) const override
Implements interface from IPMGTruthWeightTool.
virtual const std::vector< std::string > & getWeightNames() const override
Implements interface from IPMGTruthWeightTool.
virtual StatusCode initialize() override
Function initialising the tool.
const xAOD::TruthMetaDataContainer * m_metaDataContainer
Ptr to the meta data container for this file.
virtual CP::SystematicSet recommendedSystematics() const override
Implements interface from ISystematicsTool.
Base class for dual-use tools that provide file metadata access.
Tool providing sample cross-sections and k-factors etc.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TruthMetaDataContainer_v1 TruthMetaDataContainer
Declare the latest version of the truth vertex container.