ATLAS Offline Software
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 
9 EventHistoVarTool::EventHistoVarTool(const std::string & type, const std::string & name ,const IInterface* 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 
31 float 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 }
EventHistoVarTool::m_attName
SG::ReadDecorHandleKey< xAOD::EventInfo > m_attName
Definition: EventHistoVarTool.h:55
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
EventHistoVarTool::m_varName
Gaudi::Property< std::string > m_varName
Definition: EventHistoVarTool.h:53
SG::ReadDecorHandle::isPresent
bool isPresent() const
Is the referenced container present in SG?
EventHistoVarTool::value
virtual float value(const xAOD::JetContainer &) const
the value of the variable for a given Event
Definition: EventHistoVarTool.cxx:31
EventHistoVarTool.h
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EventHistoVarTool::EventHistoVarTool
EventHistoVarTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: EventHistoVarTool.cxx:9
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
EventHistoVarTool::m_defaultValue
Gaudi::Property< float > m_defaultValue
Definition: EventHistoVarTool.h:54
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ReadDecorHandle.h
Handle class for reading a decoration on an object.
AthAlgTool
Definition: AthAlgTool.h:26
EventHistoVarTool::initialize
virtual StatusCode initialize()
Definition: EventHistoVarTool.cxx:15