ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetMonitoring
src
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
5
#include "
JetMonitoring/EventHistoVarTool.h
"
6
#include "
StoreGate/ReadDecorHandle.h
"
7
8
9
EventHistoVarTool::EventHistoVarTool
(
const
std::string &
type
,
const
std::string & name ,
const
IInterface* parent):
10
AthAlgTool
(
type
, name, parent )
11
{
12
declareInterface<IEventHistoVarTool>(
this
);
13
}
14
15
StatusCode
EventHistoVarTool::initialize
() {
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_DEBUG
(
"Updated attribute key to "
<<
m_attName
);
23
}
24
ATH_MSG_DEBUG
(
"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
33
SG::ReadDecorHandle<xAOD::EventInfo,float>
eiDecor(
m_attName
);
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
EventHistoVarTool.h
ReadDecorHandle.h
Handle class for reading a decoration on an object.
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
EventHistoVarTool::EventHistoVarTool
EventHistoVarTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
EventHistoVarTool.cxx:9
EventHistoVarTool::value
virtual float value(const xAOD::JetContainer &) const
the value of the variable for a given Event
Definition
EventHistoVarTool.cxx:31
EventHistoVarTool::m_attName
SG::ReadDecorHandleKey< xAOD::EventInfo > m_attName
Definition
EventHistoVarTool.h:55
EventHistoVarTool::m_varName
Gaudi::Property< std::string > m_varName
Definition
EventHistoVarTool.h:53
EventHistoVarTool::m_defaultValue
Gaudi::Property< float > m_defaultValue
Definition
EventHistoVarTool.h:54
EventHistoVarTool::initialize
virtual StatusCode initialize()
Definition
EventHistoVarTool.cxx:15
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
SG::ReadDecorHandle::isPresent
bool isPresent() const
Is the referenced container present in SG?
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
type
Generated on
for ATLAS Offline Software by
1.17.0