ATLAS Offline Software
Loading...
Searching...
No Matches
EventHistoVarTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8
9EventHistoVarTool::EventHistoVarTool(const std::string & type, const std::string & name ,const IInterface* parent):
10 AthAlgTool( type, name, parent )
11{
12 declareInterface<IEventHistoVarTool>(this);
13}
14
16
17 if(m_varName=="") m_varName = name();
18
19 size_t pos = (m_attName.key()).find('.');
20 if (pos == std::string::npos){
21 m_attName = "EventInfo."+m_attName.key(); // If no container specified, assuming we want "EventInfo"
22 ATH_MSG_INFO("Updated attribute key to "<<m_attName);
23 }
24 ATH_MSG_INFO("Event info attribute that will be retrieved: "<<m_attName);
25 ATH_CHECK( m_attName.initialize() );
26
27 return StatusCode::SUCCESS;
28
29}
30
31float EventHistoVarTool::value(const xAOD::JetContainer & /*jets not used in this implementation*/) const {
32
34 if(!eiDecor.isPresent()){
35 ATH_MSG_WARNING("Could not access EventInfo variable "<< m_attName << ". Returning default value " << m_defaultValue );
36 return m_defaultValue;
37 }
38 return eiDecor(0);
39}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
Handle class for reading a decoration on an object.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
EventHistoVarTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual float value(const xAOD::JetContainer &) const
the value of the variable for a given Event
SG::ReadDecorHandleKey< xAOD::EventInfo > m_attName
Gaudi::Property< std::string > m_varName
Gaudi::Property< float > m_defaultValue
virtual StatusCode initialize()
Handle class for reading a decoration on an object.
bool isPresent() const
Is the referenced container present in SG?
JetContainer_v1 JetContainer
Definition of the current "jet container version".