ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
PMGTools::PMGTruthWeightTool Class Referenceabstract

Implementation for the xAOD truth meta data weight tool. More...

#include <PMGTruthWeightTool.h>

Inheritance diagram for PMGTools::PMGTruthWeightTool:
Collaboration diagram for PMGTools::PMGTruthWeightTool:

Public Member Functions

 PMGTruthWeightTool (const std::string &name)
 Create a proper constructor for Athena. More...
 
virtual void print () const =0
 Print the state of the tool. More...
 
virtual StatusCode sysInitialize ()
 Function initialising the tool in the correct way in Athena. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 
Function(s) implementing the asg::IAsgTool interface
virtual StatusCode initialize () override
 Function initialising the tool. More...
 
Function(s) implementing the IPMGTruthWeightTool interface
virtual const std::vector< std::string > & getWeightNames () const override
 Implements interface from IPMGTruthWeightTool. More...
 
virtual float getWeight (const xAOD::EventInfo *evtInfo, const std::string &weightName) const override
 Implements interface from IPMGTruthWeightTool. More...
 
virtual bool hasWeight (const std::string &weightName) const override
 Implements interface from IPMGTruthWeightTool. More...
 
virtual float getSysWeight (const xAOD::EventInfo *evtInfo, const CP::SystematicSet &sys) const override
 Implements interface from IPMGTruthWeightTool. More...
 
virtual size_t getSysWeightIndex (const CP::SystematicSet &sys) const override
 Implements interface from IPMGTruthWeightTool. More...
 
Function(s) implementing the ISystematicsTool interface
virtual CP::SystematicSet affectingSystematics () const override
 Implements interface from ISystematicsTool. More...
 
virtual CP::SystematicSet recommendedSystematics () const override
 Implements interface from ISystematicsTool. More...
 

Protected Member Functions

StatusCode getMCChannelNumber (uint32_t &mcChannelNumber)
 Helper function for retrieving MC channel number from file metadata. More...
 
StatusCode loadMetaData ()
 Loads weight information from xAOD::TruthMetaDataContainer. More...
 
StatusCode loadPOOLMetaData ()
 Loads weight information from POOL using HepMCWeightNames. More...
 
StatusCode validateWeightLocationCaches ()
 Validate weight caches. More...
 
void clearWeightLocationCaches ()
 Clear caches. More...
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 
Callback function(s) from AsgMetadataTool
virtual StatusCode beginInputFile () override
 Function called when a new input file is opened. More...
 

Protected Attributes

std::string m_metaName
 Stores the meta data record name. More...
 
uint32_t m_mcChannelNumber {}
 Current MC channel number. More...
 
const xAOD::TruthMetaDataContainerm_metaDataContainer {nullptr}
 Ptr to the meta data container for this file. More...
 
bool m_useChannelZeroInMetaData {false}
 Flag to indicate whether the xAOD::TruthMetaData objects have incorrect McChannelNumber. More...
 
std::vector< std::string > m_weightNames
 Available weight names for this file. More...
 
std::unordered_map< std::string, size_t > m_weightIndices
 Weight names to indices of available weights in this file. More...
 
CP::SystematicsCache< std::size_t > m_calibCache {this}
 Systematics to indices of available weights. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

MetaStore_t m_inputMetaStore
 Object accessing the input metadata store. More...
 
MetaStore_t m_outputMetaStore
 Object accessing the output metadata store. More...
 
bool m_beginInputFileCalled
 Flag helping to discover when the tool misses the opening of the first input file. More...
 
bool m_useIncidents
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Callback functions helping in metadata reading/writing

void setUseIncidents (const bool flag)
 
virtual void handle (const Incident &inc)
 Function receiving incidents from IncidentSvc/TEvent. More...
 
virtual StatusCode endInputFile ()
 Function called when the currently open input file got completely processed. More...
 
virtual StatusCode beginEvent ()
 Function called when a new events is loaded. More...
 
virtual StatusCode metaDataStop ()
 Function called when the tool should write out its metadata. More...
 

Detailed Description

Implementation for the xAOD truth meta data weight tool.

Author
James Robinson james.nosp@m..rob.nosp@m.inson.nosp@m.@cer.nosp@m.n.ch

Definition at line 25 of file PMGTruthWeightTool.h.

Member Typedef Documentation

◆ MetaStore_t

Type of the metadata store object in Athena.

Definition at line 66 of file AsgMetadataTool.h.

◆ MetaStorePtr_t

Type of the metadata store pointer in standalone mode.

Definition at line 68 of file AsgMetadataTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ PMGTruthWeightTool()

PMGTools::PMGTruthWeightTool::PMGTruthWeightTool ( const std::string &  name)

Create a proper constructor for Athena.

Create a constructor for standalone usage

Definition at line 24 of file PMGTruthWeightTool.cxx.

26  {
27  declareProperty("MetaObjectName", m_metaName = "TruthMetaData");
28  }

Member Function Documentation

◆ affectingSystematics()

CP::SystematicSet PMGTools::PMGTruthWeightTool::affectingSystematics ( ) const
overridevirtual

Implements interface from ISystematicsTool.

Implements CP::IReentrantSystematicsTool.

Definition at line 156 of file PMGTruthWeightTool.cxx.

157  {
159  }

◆ beginEvent()

StatusCode asg::AsgMetadataTool::beginEvent ( )
protectedvirtualinherited

Function called when a new events is loaded.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in AsgElectronEfficiencyCorrectionTool, TrigConf::xAODConfigTool, TauAnalysisTools::TauSelectionTool, TauAnalysisTools::DiTauSelectionTool, TauAnalysisTools::CommonSmearingTool, TauAnalysisTools::DiTauEfficiencyCorrectionsTool, Trig::TrigDecisionTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, Trig::TrigConfBunchCrossingTool, xAODMaker::TriggerMenuMetaDataTool, and Trig::xAODBunchCrossingTool.

Definition at line 196 of file AsgMetadataTool.cxx.

196  {
197 
198  // Return gracefully:
199  return StatusCode::SUCCESS;
200  }

◆ beginInputFile()

StatusCode PMGTools::PMGTruthWeightTool::beginInputFile ( )
overrideprotectedvirtual

Function called when a new input file is opened.

Reimplemented from asg::AsgMetadataTool.

Definition at line 185 of file PMGTruthWeightTool.cxx.

186  {
187  // Detect possible MC channel number change
190 
192  ATH_MSG_ERROR("MC channel number from a new file does not match the previously processed files.");
193  return StatusCode::FAILURE;
194  }
195 
196  return StatusCode::SUCCESS;
197  }

◆ clearWeightLocationCaches()

void PMGTools::PMGTruthWeightTool::clearWeightLocationCaches ( )
protected

Clear caches.

Definition at line 273 of file PMGTruthWeightTool.cxx.

273  {
274  m_weightNames.clear();
275  m_weightIndices.clear();
276  }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ endInputFile()

StatusCode asg::AsgMetadataTool::endInputFile ( )
protectedvirtualinherited

Function called when the currently open input file got completely processed.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperTool, xAODMaker::FileMetaDataTool, BookkeeperDumperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 188 of file AsgMetadataTool.cxx.

188  {
189 
190  // Return gracefully:
191  return StatusCode::SUCCESS;
192  }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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

◆ 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  }

◆ getMCChannelNumber()

StatusCode PMGTools::PMGTruthWeightTool::getMCChannelNumber ( uint32_t &  mcChannelNumber)
protected

Helper function for retrieving MC channel number from file metadata.

Definition at line 168 of file PMGTruthWeightTool.cxx.

168  {
169  mcChannelNumber = static_cast<uint32_t>(-1);
170 
171  // Try to load MC channel number from file metadata
172  ATH_MSG_INFO("Attempting to retrieve MC channel number...");
173  const xAOD::FileMetaData *fmd = nullptr;
174  if (inputMetaStore()->contains<xAOD::FileMetaData>("FileMetaData")) {
175  ATH_CHECK(inputMetaStore()->retrieve(fmd, "FileMetaData"));
176  float fltChannelNumber(-1);
177  if (fmd->value(xAOD::FileMetaData::mcProcID, fltChannelNumber)) {
178  mcChannelNumber = static_cast<uint32_t>(fltChannelNumber);
179  return StatusCode::SUCCESS;
180  }
181  }
182  return StatusCode::FAILURE;
183  }

◆ getName()

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  }

◆ getProperty()

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

Get one of the tool's properties.

◆ getSysWeight()

float PMGTools::PMGTruthWeightTool::getSysWeight ( const xAOD::EventInfo evtInfo,
const CP::SystematicSet sys 
) const
overridevirtual

Implements interface from IPMGTruthWeightTool.

Implements PMGTools::IPMGTruthWeightTool.

Definition at line 140 of file PMGTruthWeightTool.cxx.

141  {
142  const std::size_t *res;
144  return evtInfo->mcEventWeight(*res);
145  }

◆ getSysWeightIndex()

size_t PMGTools::PMGTruthWeightTool::getSysWeightIndex ( const CP::SystematicSet sys) const
overridevirtual

Implements interface from IPMGTruthWeightTool.

Implements PMGTools::IPMGTruthWeightTool.

Definition at line 148 of file PMGTruthWeightTool.cxx.

149  {
150  const std::size_t *res;
152  return *res;
153  }

◆ getWeight()

float PMGTools::PMGTruthWeightTool::getWeight ( const xAOD::EventInfo evtInfo,
const std::string &  weightName 
) const
overridevirtual

Implements interface from IPMGTruthWeightTool.

Implements PMGTools::IPMGTruthWeightTool.

Definition at line 111 of file PMGTruthWeightTool.cxx.

111  {
112  // Return appropriate weight from EventInfo: this should be identical to the TruthEvent
113  try {
114  return evtInfo->mcEventWeight(m_weightIndices.at(weightName));
115  } catch (const std::out_of_range& e) {
116  // Before throwing an exception, try to recover with bad naming conventions
117  std::string strippedName = std::regex_replace(weightName, std::regex(" "), "_");
118  std::transform(strippedName.begin(), strippedName.end(), strippedName.begin(),
119  [](unsigned char c){ return std::tolower(c); });
120  for (const std::string &weight : m_weightNames) {
121  std::string modifiedName = std::regex_replace(weight, std::regex(" "), "_");
122  std::transform(modifiedName.begin(), modifiedName.end(), modifiedName.begin(),
123  [](unsigned char c){ return std::tolower(c); });
124  if (strippedName == modifiedName){
125  ATH_MSG_WARNING("Using weight name \"" << weight << "\" instead of requested \"" << weightName << "\"");
126  return getWeight(evtInfo, weight);
127  }
128  }
129  ATH_MSG_FATAL("Weight \"" + weightName + "\" could not be found");
130  throw std::runtime_error(name() + ": Weight \"" + weightName + "\" could not be found");
131  }
132  }

◆ getWeightNames()

const std::vector< std::string > & PMGTools::PMGTruthWeightTool::getWeightNames ( ) const
overridevirtual

Implements interface from IPMGTruthWeightTool.

Implements PMGTools::IPMGTruthWeightTool.

Definition at line 106 of file PMGTruthWeightTool.cxx.

106  {
107  return m_weightNames;
108  }

◆ handle()

void asg::AsgMetadataTool::handle ( const Incident &  inc)
protectedvirtualinherited

Function receiving incidents from IncidentSvc/TEvent.

Reimplemented in Trig::TrigDecisionTool.

Definition at line 130 of file AsgMetadataTool.cxx.

130  {
131 
132  // Tell the user what's happening:
133  ATH_MSG_VERBOSE( "Callback received with incident: " << inc.type() );
134 
135  // Call the appropriate member function:
136  if( inc.type() == IncidentType::BeginInputFile ) {
137  m_beginInputFileCalled = true;
138  if( beginInputFile().isFailure() ) {
139  ATH_MSG_FATAL( "Failed to call beginInputFile()" );
140  throw std::runtime_error( "Couldn't call beginInputFile()" );
141  }
142  } else if( inc.type() == IncidentType::EndInputFile ) {
143  if( endInputFile().isFailure() ) {
144  ATH_MSG_FATAL( "Failed to call endInputFile()" );
145  throw std::runtime_error( "Couldn't call endInputFile()" );
146  }
147  } else if( inc.type() == IncidentType::BeginEvent ) {
148  // If the tool didn't catch the begin input file incident for the
149  // first input file of the job, then call the appropriate function
150  // now.
151  if( ! m_beginInputFileCalled ) {
152  m_beginInputFileCalled = true;
153  if( beginInputFile().isFailure() ) {
154  ATH_MSG_FATAL( "Failed to call beginInputFile()" );
155  throw std::runtime_error( "Couldn't call beginInputFile()" );
156  }
157  }
158  if( beginEvent().isFailure() ) {
159  ATH_MSG_FATAL( "Failed to call beginEvent()" );
160  throw std::runtime_error( "Couldn't call beginEvent()" );
161  }
162 
163  #ifdef XAOD_STANDALONE
164  } else if( inc.type() == IncidentType::MetaDataStop ) {
165  if( metaDataStop().isFailure() ) {
166  ATH_MSG_FATAL( "Failed to call metaDataStop()" );
167  throw std::runtime_error( "Couldn't call metaDataStop()" );
168  }
169 
170  #endif // XAOD_STANDALONE
171  } else {
172  ATH_MSG_WARNING( "Unknown incident type received in AsgMetaDataTool: " << inc.type() );
173  }
174 
175  return;
176  }

◆ hasWeight()

bool PMGTools::PMGTruthWeightTool::hasWeight ( const std::string &  weightName) const
overridevirtual

Implements interface from IPMGTruthWeightTool.

Implements PMGTools::IPMGTruthWeightTool.

Definition at line 135 of file PMGTruthWeightTool.cxx.

135  {
136  return (m_weightIndices.count(weightName) > 0);
137  }

◆ initialize()

StatusCode PMGTools::PMGTruthWeightTool::initialize ( )
overridevirtual

Function initialising the tool.

Reimplemented from asg::AsgTool.

Definition at line 31 of file PMGTruthWeightTool.cxx.

32  {
33  ATH_MSG_DEBUG("Initialising...");
34 
35  ATH_MSG_INFO("Attempting to retrieve truth meta data from the first file...");
36 
37  // Clear cached weights
39 
41  m_calibCache.initialize (std::move (affSysts),
42  [this] (const CP::SystematicSet& sys,
43  std::size_t& idx) {
44  ATH_MSG_WARNING("Mapping for " << sys.name() << " missing, setting to index 0.");
45  idx = 0;
46  return StatusCode::SUCCESS;
47  });
48 
49  // Try to load MC channel number from file metadata
51 
52  if (m_mcChannelNumber == uint32_t(-1)) {
53  ATH_MSG_WARNING("... MC channel number could not be loaded");
54  } else {
55  ATH_MSG_INFO("... MC channel number identified as " << m_mcChannelNumber);
56  }
57 
58  // Start by trying to load metadata from the store
59  m_metaDataContainer = nullptr;
60  if (inputMetaStore()->contains<xAOD::TruthMetaDataContainer>(m_metaName)) {
62  ATH_MSG_INFO("Loaded xAOD::TruthMetaDataContainer");
63 
64  // Check for incorrectly stored McChannelNumber
66  for (auto truthMetaData : *m_metaDataContainer) {
67  if (truthMetaData->mcChannelNumber() != 0) { m_useChannelZeroInMetaData = false; }
68  }
69  // If we only have one metadata item take MC channel from there if needed
70  if (m_mcChannelNumber == uint32_t(-1) && m_metaDataContainer->size() == 1) {
71  m_mcChannelNumber = m_metaDataContainer->at(0)->mcChannelNumber();
72  ATH_MSG_WARNING("... MC channel number taken from the metadata as " << m_mcChannelNumber);
73  }
74  if (m_useChannelZeroInMetaData) { ATH_MSG_WARNING("MC channel number in TruthMetaData is invalid - assuming that channel 0 has the correct information."); }
75 
76  // Load metadata from TruthMetaDataContainer if we have a valid channel number or if we're going to use 0 anyway
77  // ... otherwise wait until we can load a channel number from EventInfo
79  if (loadMetaData().isFailure()) {
80  ATH_MSG_ERROR("Could not load metadata for MC channel number " << m_mcChannelNumber);
81  return StatusCode::FAILURE;
82  }
83  }
84  } else {
85  // ... now try to load the weight container using the POOL metadata (not possible in AnalysisBase)
86  // see https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/AthAnalysisBase#How_to_read_the_truth_weight_nam
87  if (loadPOOLMetaData().isFailure()) {
88  ATH_MSG_ERROR("Could not load POOL HepMCWeightNames");
89  return StatusCode::FAILURE;
90  }
91  }
92 
93  // Add the affecting systematics to the global registry
95  if (!registry.registerSystematics(*this)) {
96  ATH_MSG_ERROR("unable to register the systematics");
97  return StatusCode::FAILURE;
98  }
99 
100  ATH_MSG_DEBUG("Successfully initialized!");
101 
102  return StatusCode::SUCCESS;
103  }

◆ 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.

◆ inputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::inputMetaStore ( ) const
inherited

Accessor for the input metadata store.

Definition at line 88 of file AsgMetadataTool.cxx.

88  {
89 
90 #ifdef XAOD_STANDALONE
91  return &m_inputMetaStore;
92 #else // XAOD_STANDALONE
93  return m_inputMetaStore;
94 #endif // XAOD_STANDALONE
95  }

◆ loadMetaData()

StatusCode PMGTools::PMGTruthWeightTool::loadMetaData ( )
protected

Loads weight information from xAOD::TruthMetaDataContainer.

Definition at line 200 of file PMGTruthWeightTool.cxx.

200  {
201  // Find the correct truth meta data object
202  uint32_t targetChannelNumber = (m_useChannelZeroInMetaData ? 0 : m_mcChannelNumber);
203  ATH_MSG_INFO("Attempting to load weight meta data from xAOD TruthMetaData for channel " << targetChannelNumber);
204  auto itTruthMetaDataPtr = std::find_if(m_metaDataContainer->begin(), m_metaDataContainer->end(),
205  [targetChannelNumber] (const auto& it) { return it->mcChannelNumber() == targetChannelNumber; }
206  );
207 
208  // If no such object is found then return
209  if (itTruthMetaDataPtr == m_metaDataContainer->end()) {
210  ATH_MSG_ERROR("Could not load weight meta data!");
211  return StatusCode::FAILURE;
212  }
213 
214  // Update cached weight data
215  const std::vector<std::string> &truthWeightNames = (*itTruthMetaDataPtr)->weightNames();
216  for(std::size_t idx = 0; idx < truthWeightNames.size(); ++idx ) {
217  m_weightNames.push_back(truthWeightNames.at(idx));
218  m_weightIndices[truthWeightNames.at(idx)] = idx;
219 
220  std::string sysName = weightNameWithPrefix(truthWeightNames.at(idx));
221  if (!sysName.empty()) {
223  }
224 
225  ANA_MSG_VERBOSE(" " << truthWeightNames.at(idx) << " " << sysName);
226  }
227  return this->validateWeightLocationCaches();
228  }

◆ loadPOOLMetaData()

StatusCode PMGTools::PMGTruthWeightTool::loadPOOLMetaData ( )
protected

Loads weight information from POOL using HepMCWeightNames.

Definition at line 231 of file PMGTruthWeightTool.cxx.

231  {
232  // AnalysisBase can only use the xAOD::TruthMetaDataContainer, so skip this
233 #ifdef XAOD_STANDALONE
234  return StatusCode::SUCCESS;
235 #else
236  ATH_MSG_INFO("Looking for POOL HepMC IOVMetaData...");
237  std::map<std::string, int> hepMCWeightNamesMap;
238  if (AAH::retrieveMetadata("/Generation/Parameters", "HepMCWeightNames", hepMCWeightNamesMap, inputMetaStore()).isFailure()) {
239  ATH_MSG_FATAL("Cannot access metadata " << m_metaName << " and failed to get names from IOVMetadata");
240  return StatusCode::FAILURE;
241  }
242 
243  // Use input map to fill the index map and the weight names
244  ATH_MSG_INFO("Attempting to load weight meta data from HepMC IOVMetaData container");
245  for (auto& kv : hepMCWeightNamesMap) {
246  m_weightNames.push_back(kv.first);
247  m_weightIndices[kv.first] = kv.second;
248 
249  std::string sysName = weightNameWithPrefix(kv.first);
250  if (!sysName.empty()) {
252  }
253 
254  ANA_MSG_VERBOSE(" " << kv.first << " " << sysName);
255  }
256  return this->validateWeightLocationCaches();
257 #endif // XAOD_STANDALONE
258  }

◆ metaDataStop()

StatusCode asg::AsgMetadataTool::metaDataStop ( )
protectedvirtualinherited

Function called when the tool should write out its metadata.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in xAODMaker::FileMetaDataTool, BookkeeperTool, BookkeeperDumperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 204 of file AsgMetadataTool.cxx.

204  {
205 
206  // Return gracefully:
207  return StatusCode::SUCCESS;
208  }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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  }

◆ 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.

◆ outputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::outputMetaStore ( ) const
inherited

Accessor for the output metadata store.

Definition at line 97 of file AsgMetadataTool.cxx.

97  {
98 
99 #ifdef XAOD_STANDALONE
100  return &m_outputMetaStore;
101 #else // XAOD_STANDALONE
102  return m_outputMetaStore;
103 #endif // XAOD_STANDALONE
104  }

◆ print() [1/2]

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

◆ print() [2/2]

virtual void asg::IAsgTool::print ( ) const
pure virtualinherited

◆ recommendedSystematics()

CP::SystematicSet PMGTools::PMGTruthWeightTool::recommendedSystematics ( ) const
overridevirtual

Implements interface from ISystematicsTool.

Implements CP::IReentrantSystematicsTool.

Definition at line 162 of file PMGTruthWeightTool.cxx.

163  {
164  return affectingSystematics();
165  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ setUseIncidents()

void asg::AsgMetadataTool::setUseIncidents ( const bool  flag)
inlineprotectedinherited

Definition at line 132 of file AsgMetadataTool.h.

133  {
135  }

◆ sysInitialize()

StatusCode asg::AsgMetadataTool::sysInitialize ( )
virtualinherited

Function initialising the tool in the correct way in Athena.

This function is used to set up the callbacks from IncidentSvc in Athena at the right time during initialisation, without the user having to do anything special in his/her code.

Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.

Definition at line 110 of file AsgMetadataTool.cxx.

110  {
111 
112 #ifndef XAOD_STANDALONE
113  if (m_useIncidents) {
114  // Connect to the IncidentSvc:
115  ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
116  ATH_CHECK( incSvc.retrieve() );
117 
118  // Set up the right callbacks: don't rethrow exceptions, any failure and we should end
119  incSvc->addListener( this, IncidentType::BeginEvent, 0, false );
120  }
121  // Let the base class do its thing:
122  ATH_CHECK( AlgTool::sysInitialize() );
123 
124 #endif // not XAOD_STANDALONE
125 
126  // Return gracefully:
127  return StatusCode::SUCCESS;
128  }

◆ 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.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

◆ validateWeightLocationCaches()

StatusCode PMGTools::PMGTruthWeightTool::validateWeightLocationCaches ( )
protected

Validate weight caches.

Definition at line 261 of file PMGTruthWeightTool.cxx.

261  {
262  // Validate weight caches against one another
263  if (m_weightNames.size() != m_weightIndices.size()) {
264  ATH_MSG_ERROR("Found " << m_weightNames.size() << " but " << m_weightIndices.size() << " weight indices!");
265  return StatusCode::FAILURE;
266  }
267 
268  ATH_MSG_INFO("Successfully loaded information about " << m_weightNames.size() << " weights");
269  return StatusCode::SUCCESS;
270  }

Member Data Documentation

◆ m_beginInputFileCalled

bool asg::AsgMetadataTool::m_beginInputFileCalled
privateinherited

Flag helping to discover when the tool misses the opening of the first input file.

Definition at line 126 of file AsgMetadataTool.h.

◆ m_calibCache

CP::SystematicsCache<std::size_t> PMGTools::PMGTruthWeightTool::m_calibCache {this}
protected

Systematics to indices of available weights.

Definition at line 116 of file PMGTruthWeightTool.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_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_inputMetaStore

MetaStore_t asg::AsgMetadataTool::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 119 of file AsgMetadataTool.h.

◆ m_mcChannelNumber

uint32_t PMGTools::PMGTruthWeightTool::m_mcChannelNumber {}
protected

Current MC channel number.

Definition at line 101 of file PMGTruthWeightTool.h.

◆ m_metaDataContainer

const xAOD::TruthMetaDataContainer* PMGTools::PMGTruthWeightTool::m_metaDataContainer {nullptr}
protected

Ptr to the meta data container for this file.

Definition at line 104 of file PMGTruthWeightTool.h.

◆ m_metaName

std::string PMGTools::PMGTruthWeightTool::m_metaName
protected

Stores the meta data record name.

Definition at line 98 of file PMGTruthWeightTool.h.

◆ m_outputMetaStore

MetaStore_t asg::AsgMetadataTool::m_outputMetaStore
privateinherited

Object accessing the output metadata store.

Definition at line 121 of file AsgMetadataTool.h.

◆ m_useChannelZeroInMetaData

bool PMGTools::PMGTruthWeightTool::m_useChannelZeroInMetaData {false}
protected

Flag to indicate whether the xAOD::TruthMetaData objects have incorrect McChannelNumber.

Definition at line 107 of file PMGTruthWeightTool.h.

◆ m_useIncidents

bool asg::AsgMetadataTool::m_useIncidents
privateinherited

Definition at line 128 of file AsgMetadataTool.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.

◆ m_weightIndices

std::unordered_map<std::string, size_t> PMGTools::PMGTruthWeightTool::m_weightIndices
protected

Weight names to indices of available weights in this file.

Definition at line 113 of file PMGTruthWeightTool.h.

◆ m_weightNames

std::vector<std::string> PMGTools::PMGTruthWeightTool::m_weightNames
protected

Available weight names for this file.

Definition at line 110 of file PMGTruthWeightTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
CaloCondBlobAlgs_fillNoiseFromASCII.sysName
sysName
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:93
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
asg::AsgMetadataTool::beginEvent
virtual StatusCode beginEvent()
Function called when a new events is loaded.
Definition: AsgMetadataTool.cxx:196
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::SystematicsCache::initialize
void initialize(CP::SystematicSet val_affectingSystematics, std::function< StatusCode(const CP::SystematicSet &sys, CalibData &result)> val_calc) noexcept
initialize with the list of affecting systematics and a function to calculate the calibration data fo...
Definition: SystematicsCache.h:158
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
skel.it
it
Definition: skel.GENtoEVGEN.py:396
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
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
asg::AsgMetadataTool::inputMetaStore
MetaStorePtr_t inputMetaStore() const
Accessor for the input metadata store.
Definition: AsgMetadataTool.cxx:88
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
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
asg::AsgMetadataTool::m_beginInputFileCalled
bool m_beginInputFileCalled
Flag helping to discover when the tool misses the opening of the first input file.
Definition: AsgMetadataTool.h:126
asg::AsgMetadataTool::endInputFile
virtual StatusCode endInputFile()
Function called when the currently open input file got completely processed.
Definition: AsgMetadataTool.cxx:188
asg::AsgMetadataTool::m_outputMetaStore
MetaStore_t m_outputMetaStore
Object accessing the output metadata store.
Definition: AsgMetadataTool.h:121
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
CP::SystematicVariation
Definition: SystematicVariation.h:47
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
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
xAOD::FileMetaData_v1::value
bool value(MetaDataType type, std::string &val) const
Get a pre-defined string value out of the object.
Definition: FileMetaData_v1.cxx:195
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
ANA_CHECK_THROW
#define ANA_CHECK_THROW(EXP)
check whether the given expression was successful, throwing an exception on failure
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:339
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
PMGTools::PMGTruthWeightTool::getMCChannelNumber
StatusCode getMCChannelNumber(uint32_t &mcChannelNumber)
Helper function for retrieving MC channel number from file metadata.
Definition: PMGTruthWeightTool.cxx:168
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PMGTools::PMGTruthWeightTool::m_useChannelZeroInMetaData
bool m_useChannelZeroInMetaData
Flag to indicate whether the xAOD::TruthMetaData objects have incorrect McChannelNumber.
Definition: PMGTruthWeightTool.h:107
asg::AsgMetadataTool::beginInputFile
virtual StatusCode beginInputFile()
Function called when a new input file is opened.
Definition: AsgMetadataTool.cxx:180
master.flag
bool flag
Definition: master.py:29
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
asg::AsgMetadataTool::metaDataStop
virtual StatusCode metaDataStop()
Function called when the tool should write out its metadata.
Definition: AsgMetadataTool.cxx:204
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
xAOD::FileMetaData_v1::mcProcID
@ mcProcID
Same as mc_channel_number [float].
Definition: FileMetaData_v1.h:74
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
PMGTools::weightNameWithPrefix
std::string weightNameWithPrefix(const std::string &name)
cleanup the weight name and add prefix
Definition: WeightHelpers.cxx:72
xAOD::FileMetaData_v1
Class holding file-level metadata about an xAOD file.
Definition: FileMetaData_v1.h:34
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
PMGTools::PMGTruthWeightTool::m_metaName
std::string m_metaName
Stores the meta data record name.
Definition: PMGTruthWeightTool.h:98
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
PMGTools::PMGTruthWeightTool::loadPOOLMetaData
StatusCode loadPOOLMetaData()
Loads weight information from POOL using HepMCWeightNames.
Definition: PMGTruthWeightTool.cxx:231
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
asg::AsgMetadataTool::m_inputMetaStore
MetaStore_t m_inputMetaStore
Object accessing the input metadata store.
Definition: AsgMetadataTool.h:119
ANA_MSG_VERBOSE
#define ANA_MSG_VERBOSE(xmsg)
Macro printing verbose messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:286
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
PMGTools::PMGTruthWeightTool::m_metaDataContainer
const xAOD::TruthMetaDataContainer * m_metaDataContainer
Ptr to the meta data container for this file.
Definition: PMGTruthWeightTool.h:104
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
PMGTools::PMGTruthWeightTool::m_mcChannelNumber
uint32_t m_mcChannelNumber
Current MC channel number.
Definition: PMGTruthWeightTool.h:101
a
TList * a
Definition: liststreamerinfos.cxx:10
h
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
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CP::SystematicRegistry
This module implements the central registry for handling systematic uncertainties with CP tools.
Definition: SystematicRegistry.h:25
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
PMGTools::PMGTruthWeightTool::validateWeightLocationCaches
StatusCode validateWeightLocationCaches()
Validate weight caches.
Definition: PMGTruthWeightTool.cxx:261
xAOD::EventInfo_v1::mcEventWeight
float mcEventWeight(size_t i=0) const
The weight of one specific MC event used in the simulation.
Definition: EventInfo_v1.cxx:203
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
CP::SystematicsCache::affectingSystematics
const CP::SystematicSet & affectingSystematics() const noexcept
the list of affecting systematics
Definition: SystematicsCache.h:170
CP::SystematicsCache::add
StatusCode add(const CP::SystematicSet &sys, CalibData value)
add an individual systematic variation
Definition: SystematicsCache.h:255
CP::SystematicsCache::get
StatusCode get(const CP::SystematicSet &sys, const CalibData *&result) const
get the pointer to the cached calibration data for the given systematic, calculating it if necessary
Definition: SystematicsCache.h:189
SG::DataProxy
Definition: DataProxy.h:44
python.compressB64.c
def c
Definition: compressB64.py:93
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
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
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
CP::SystematicRegistry::getInstance
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Definition: SystematicRegistry.cxx:25
AthAnalysisHelper::retrieveMetadata
static std::string retrieveMetadata(const std::string &folder, const std::string &key, const ServiceHandle< StoreGateSvc > &inputMetaStore)
method that always returns as a string you can use from, e.g, pyROOT with evt = ROOT....
Definition: AthAnalysisHelper.h:254
ServiceHandle< IIncidentSvc >
asg::AsgMetadataTool::m_useIncidents
bool m_useIncidents
Definition: AsgMetadataTool.h:128