ATLAS Offline Software
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 
19 namespace 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 
84 
87 
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
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
PMGTools::PMGTruthWeightTool::PMGTruthWeightTool
PMGTruthWeightTool(const std::string &name)
Create a proper constructor for Athena.
Definition: PMGTruthWeightTool.cxx:24
PMGTools::PMGTruthWeightTool::hasWeight
virtual bool hasWeight(const std::string &weightName) const override
Implements interface from IPMGTruthWeightTool.
Definition: PMGTruthWeightTool.cxx:135
PMGTools::PMGTruthWeightTool::m_weightIndices
std::unordered_map< std::string, size_t > m_weightIndices
Weight names to indices of available weights in this file.
Definition: PMGTruthWeightTool.h:113
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
PMGTools::PMGTruthWeightTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: PMGTruthWeightTool.cxx:31
PMGTools::PMGTruthWeightTool::m_calibCache
CP::SystematicsCache< std::size_t > m_calibCache
Systematics to indices of available weights.
Definition: PMGTruthWeightTool.h:116
PMGTools::PMGTruthWeightTool::loadMetaData
StatusCode loadMetaData()
Loads weight information from xAOD::TruthMetaDataContainer.
Definition: PMGTruthWeightTool.cxx:200
xAOD::mcChannelNumber
mcChannelNumber
Definition: EventInfo_v1.cxx:197
PMGTools::PMGTruthWeightTool::clearWeightLocationCaches
void clearWeightLocationCaches()
Clear caches.
Definition: PMGTruthWeightTool.cxx:273
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
TruthMetaData.h
PMGTools::PMGTruthWeightTool::beginInputFile
virtual StatusCode beginInputFile() override
Function called when a new input file is opened.
Definition: PMGTruthWeightTool.cxx:185
PMGTools::PMGTruthWeightTool::getMCChannelNumber
StatusCode getMCChannelNumber(uint32_t &mcChannelNumber)
Helper function for retrieving MC channel number from file metadata.
Definition: PMGTruthWeightTool.cxx:168
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PMGTools::PMGTruthWeightTool::m_useChannelZeroInMetaData
bool m_useChannelZeroInMetaData
Flag to indicate whether the xAOD::TruthMetaData objects have incorrect McChannelNumber.
Definition: PMGTruthWeightTool.h:107
PMGTools
Tool providing sample cross-sections and k-factors etc.
Definition: AnalysisCommon/PMGTools/PMGTools/IPMGCrossSectionTool.h:15
PMGTools::PMGTruthWeightTool::getSysWeight
virtual float getSysWeight(const xAOD::EventInfo *evtInfo, const CP::SystematicSet &sys) const override
Implements interface from IPMGTruthWeightTool.
Definition: PMGTruthWeightTool.cxx:140
PMGTools::PMGTruthWeightTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override
Implements interface from ISystematicsTool.
Definition: PMGTruthWeightTool.cxx:162
PMGTools::PMGTruthWeightTool::getSysWeightIndex
virtual size_t getSysWeightIndex(const CP::SystematicSet &sys) const override
Implements interface from IPMGTruthWeightTool.
Definition: PMGTruthWeightTool.cxx:148
IPMGTruthWeightTool.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
PMGTools::PMGTruthWeightTool::m_metaName
std::string m_metaName
Stores the meta data record name.
Definition: PMGTruthWeightTool.h:98
PMGTools::PMGTruthWeightTool::loadPOOLMetaData
StatusCode loadPOOLMetaData()
Loads weight information from POOL using HepMCWeightNames.
Definition: PMGTruthWeightTool.cxx:231
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
PMGTools::PMGTruthWeightTool::m_metaDataContainer
const xAOD::TruthMetaDataContainer * m_metaDataContainer
Ptr to the meta data container for this file.
Definition: PMGTruthWeightTool.h:104
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
PMGTools::PMGTruthWeightTool
Implementation for the xAOD truth meta data weight tool.
Definition: PMGTruthWeightTool.h:26
PMGTools::PMGTruthWeightTool::m_mcChannelNumber
uint32_t m_mcChannelNumber
Current MC channel number.
Definition: PMGTruthWeightTool.h:101
asg::AsgMetadataTool
Base class for dual-use tools that provide file metadata access.
Definition: AsgMetadataTool.h:48
PMGTools::PMGTruthWeightTool::m_weightNames
std::vector< std::string > m_weightNames
Available weight names for this file.
Definition: PMGTruthWeightTool.h:110
AsgMetadataTool.h
CP::SystematicsCache< std::size_t >
PMGTools::PMGTruthWeightTool::validateWeightLocationCaches
StatusCode validateWeightLocationCaches()
Validate weight caches.
Definition: PMGTruthWeightTool.cxx:261
PMGTools::PMGTruthWeightTool::getWeightNames
virtual const std::vector< std::string > & getWeightNames() const override
Implements interface from IPMGTruthWeightTool.
Definition: PMGTruthWeightTool.cxx:106
TruthEventContainer.h
TruthMetaDataContainer.h
SystematicsCache.h
PMGTools::PMGTruthWeightTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override
Implements interface from ISystematicsTool.
Definition: PMGTruthWeightTool.cxx:156
PMGTools::PMGTruthWeightTool::getWeight
virtual float getWeight(const xAOD::EventInfo *evtInfo, const std::string &weightName) const override
Implements interface from IPMGTruthWeightTool.
Definition: PMGTruthWeightTool.cxx:111
PMGTools::IPMGTruthWeightTool
Interface for xAOD Truth Weight Tool which retrieves Meta Data from a truth record to interface the e...
Definition: IPMGTruthWeightTool.h:25