![]() |
ATLAS Offline Software
|
Service to read/write HepMC's WeightContainer key names from/to IOVMetaDataContainers author: will buttinger , NLAA. More...
#include <HepMCWeightSvc.h>
Classes | |
| struct | WeightInfo |
| Cached sets of weights. We retain NWEIGHTS sets of weights. They are overwritten in a round-robin fashion if needed. More... | |
Public Member Functions | |
| virtual StatusCode | initialize () override |
| Standard Gaudi initialize. | |
| virtual StatusCode | setWeightNames (const WeightMap &weightNames, const EventContext &ctx=Gaudi::Hive::currentContext()) override |
| Record weight names to metadata if none have yet been set. | |
| virtual WeightMap | weightNames (const EventContext &ctx=Gaudi::Hive::currentContext()) override |
| Return the current weight names. | |
| virtual std::vector< std::string > | weightNameVec (const EventContext &ctx=Gaudi::Hive::currentContext()) override |
| Return the current weight names. | |
Private Member Functions | |
| unsigned int | loadWeights (unsigned long chanNum) |
| Return the `channel number' for the current event. | |
| unsigned int | getWeightIndex (const EventContext &ctx) |
| Return the index in m_weights for the current event. | |
Private Attributes | |
| PublicToolHandle< IIOVDbMetaDataTool > | m_metaDataTool { this, "IOVDbMetaDataTool", "IOVDbMetaDataTool" } |
| Handle to metadata tool. | |
| Gaudi::Property< bool > | m_enabled { this, "Enable", true, "If false, will return failure on loadWeights" } |
| WeightInfo | m_weights [NWEIGHTS] |
| size_t | m_nextWeight = 0 |
| Index of next set of weights to overwrite. | |
| SG::ReadHandleKey< xAOD::EventInfo > | m_eventInfoKey { this, "EventInfoKey", "EventInfo", "SG key for EventInfo object." } |
| Used to get MC channel for the current event. | |
| std::mutex | m_mutex |
| Serialize access to this service. | |
Static Private Attributes | |
| static const unsigned int | NWEIGHTS = 8 |
| Array of weights. | |
Service to read/write HepMC's WeightContainer key names from/to IOVMetaDataContainers author: will buttinger , NLAA.
Definition at line 24 of file HepMCWeightSvc.h.
|
private |
Return the index in m_weights for the current event.
| ctx | The current event context. |
Returns NWEIGHTS on failure.
Definition at line 225 of file HepMCWeightSvc.cxx.
|
overridevirtual |
Standard Gaudi initialize.
Definition at line 18 of file HepMCWeightSvc.cxx.
|
private |
Return the `channel number' for the current event.
| ctx | Current event context. |
Either the MC channel number or the run number if that hasn't been set. */ unsigned long getChanNum (const EventContext& ctx) const;
/**
Try to load weight names from metadata.
| chanNum | Channel number for which to load weights. |
Returns the index in m_weights of the loaded weights.
| ctx | Current event context. |
Either the MC channel number or the run number if that hasn't been set. */ unsigned long HepMCWeightSvc::getChanNum (const EventContext& ctx) const { Try first to get the MC channel number from EventInfo. SG::ReadHandle ei (m_eventInfoKey, ctx); if (ei.isValid()) { unsigned long chanNum = ei->mcChannelNumber(); if (chanNum > 0) return chanNum; } Fall back to run number. return ctx.eventID().run_number(); }
/**
Try to load weight names from metadata.
| chanNum | Channel number for which to load weights. |
Returns the index in m_weights of the loaded weights.
Definition at line 153 of file HepMCWeightSvc.cxx.
|
overridevirtual |
Record weight names to metadata if none have yet been set.
| weightNames | Map of names to record. |
| ctx | Current event context. |
Does nothing if weight names have already been set or read.
Definition at line 33 of file HepMCWeightSvc.cxx.
|
overridevirtual |
Return the current weight names.
Definition at line 98 of file HepMCWeightSvc.cxx.
|
overridevirtual |
Return the current weight names.
Definition at line 115 of file HepMCWeightSvc.cxx.
|
private |
Definition at line 96 of file HepMCWeightSvc.h.
|
private |
Used to get MC channel for the current event.
Definition at line 126 of file HepMCWeightSvc.h.
|
private |
Handle to metadata tool.
Definition at line 91 of file HepMCWeightSvc.h.
|
private |
Serialize access to this service.
Definition at line 130 of file HepMCWeightSvc.h.
|
private |
Index of next set of weights to overwrite.
Definition at line 123 of file HepMCWeightSvc.h.
|
private |
Definition at line 120 of file HepMCWeightSvc.h.
|
staticprivate |
Array of weights.
Definition at line 119 of file HepMCWeightSvc.h.