ATLAS Offline Software
Loading...
Searching...
No Matches
EventHistoVarTool Class Reference

This class is a simple tool to access EventInfo or JetContainer variables within the JetMonitoring environment. More...

#include <EventHistoVarTool.h>

Inheritance diagram for EventHistoVarTool:
Collaboration diagram for EventHistoVarTool:

Public Member Functions

 EventHistoVarTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~EventHistoVarTool ()
virtual StatusCode initialize ()
virtual float value (const xAOD::JetContainer &) const
 the value of the variable for a given Event
virtual std::string varName () const
 a compact description of the variable.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< std::string > m_varName {this,"VarName", ""}
Gaudi::Property< float > m_defaultValue = {this,"Default", -1.}
SG::ReadDecorHandleKey< xAOD::EventInfom_attName {this, "Attribute", "", "Attribute name retrieved from event info container ('<event info name>.<decoration>'). If no container name prefixed, then EventInfo.<Attribute> is used."}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

This class is a simple tool to access EventInfo or JetContainer variables within the JetMonitoring environment.

Definition at line 40 of file EventHistoVarTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ EventHistoVarTool()

EventHistoVarTool::EventHistoVarTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 9 of file EventHistoVarTool.cxx.

9 :
10 AthAlgTool( type, name, parent )
11{
12 declareInterface<IEventHistoVarTool>(this);
13}
AthAlgTool()
Default constructor:

◆ ~EventHistoVarTool()

virtual EventHistoVarTool::~EventHistoVarTool ( )
inlinevirtual

Definition at line 43 of file EventHistoVarTool.h.

43{}

Member Function Documentation

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

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

◆ evtStore()

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.

◆ 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

◆ initialize()

StatusCode EventHistoVarTool::initialize ( )
virtual

Definition at line 15 of file EventHistoVarTool.cxx.

15 {
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
SG::ReadDecorHandleKey< xAOD::EventInfo > m_attName
Gaudi::Property< std::string > m_varName

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

◆ interfaceID()

const InterfaceID & IEventHistoVarTool::interfaceID ( )
inlinestaticinherited

Definition at line 29 of file EventHistoVarTool.h.

29{ return IID_IEventHistoVarTool; }
static const InterfaceID IID_IEventHistoVarTool("IEventHistoVarTool", 1, 0)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

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

◆ 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();
384 }
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)

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

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

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

◆ value()

float EventHistoVarTool::value ( const xAOD::JetContainer & ) const
virtual

the value of the variable for a given Event

Implements IEventHistoVarTool.

Definition at line 31 of file EventHistoVarTool.cxx.

31 {
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}
#define ATH_MSG_WARNING(x)
Gaudi::Property< float > m_defaultValue

◆ varName()

virtual std::string EventHistoVarTool::varName ( ) const
inlinevirtual

a compact description of the variable.

Implements IEventHistoVarTool.

Definition at line 48 of file EventHistoVarTool.h.

48{return m_varName;}

Member Data Documentation

◆ m_attName

SG::ReadDecorHandleKey<xAOD::EventInfo> EventHistoVarTool::m_attName {this, "Attribute", "", "Attribute name retrieved from event info container ('<event info name>.<decoration>'). If no container name prefixed, then EventInfo.<Attribute> is used."}
private

Definition at line 55 of file EventHistoVarTool.h.

55{this, "Attribute", "", "Attribute name retrieved from event info container ('<event info name>.<decoration>'). If no container name prefixed, then EventInfo.<Attribute> is used."};

◆ m_defaultValue

Gaudi::Property<float> EventHistoVarTool::m_defaultValue = {this,"Default", -1.}
private

Definition at line 54 of file EventHistoVarTool.h.

54{this,"Default", -1.};

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

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_varName

Gaudi::Property<std::string> EventHistoVarTool::m_varName {this,"VarName", ""}
private

Definition at line 53 of file EventHistoVarTool.h.

53{this,"VarName", ""};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: