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

#include <EventInfoAttListTool.h>

Inheritance diagram for EventInfoAttListTool:
Collaboration diagram for EventInfoAttListTool:

Public Member Functions

virtual StatusCode initialize () override
 Overriding initialize, finalize and execute.
virtual StatusCode finalize () override
 finalize - called once at the end
bool isValid () const
const coral::AttributeListSpecification & getAttributeSpecification () const
std::unique_ptr< AthenaAttributeListgetAttributeListPtr (const xAOD::EventInfo &einfo) const
 AthAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor.
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

Protected Member Functions

StatusCode eventTag (AthenaAttributeList &eventTagCol, const xAOD::EventInfo &eventInfo) const
 the various components to build their own fragments of tag
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.

Protected Attributes

coral::AttributeListSpecification * m_attribListSpec {}

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

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

Definition at line 24 of file EventInfoAttListTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ AthAlgTool()

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

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

◆ eventTag()

StatusCode EventInfoAttListTool::eventTag ( AthenaAttributeList & eventTagCol,
const xAOD::EventInfo & eventInfo ) const
protected

the various components to build their own fragments of tag

build the tag associate to the event information

Event Type

Definition at line 65 of file EventInfoAttListTool.cxx.

67{
68 // Note: for any attribute added here, please confirm the corresponding EventInfo member being
69 // retained in DAOD smart slimming:
70 // PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/EventInfoContent.py
71
73 bool isSimulation = eventInfo.eventType(xAOD::EventInfo::IS_SIMULATION);
74 bool isTestBeam = eventInfo.eventType(xAOD::EventInfo::IS_TESTBEAM);
75 bool isCalibration = eventInfo.eventType(xAOD::EventInfo::IS_CALIBRATION);
76 eventTag["IsSimulation"] .data<bool>() = isSimulation;
77 eventTag["IsCalibration"].data<bool>() = isCalibration;
78 eventTag["IsTestBeam"] .data<bool>() = isTestBeam;
79
80 // run number and Event number
81 unsigned int runNumber = eventInfo.runNumber();
82 unsigned int condRunNumber = runNumber;
83 unsigned long long eventNumber = eventInfo.eventNumber();
84 unsigned int lumiBlock = eventInfo.lumiBlock();
85 unsigned int mcChannel = 0;
86 if (isSimulation) mcChannel = eventInfo.mcChannelNumber();
87 eventTag["McChannel"] .data<unsigned int>() = mcChannel;
88 eventTag["RunNumber"] .data<unsigned int>() = runNumber;
89 eventTag["EventNumber"] .data<unsigned long long>() = eventNumber;
90 eventTag["LumiBlockN"] .data<unsigned int>() = lumiBlock;
91 eventTag["ConditionsRun"].data<unsigned int>() = condRunNumber;
92
93 unsigned long timeStamp = eventInfo.timeStamp();
94 unsigned long timeStampNS = eventInfo.timeStampNSOffset();
95 unsigned long bunchId = eventInfo.bcid();
96 eventTag["EventTime"] .data<unsigned int>() = timeStamp;
97 eventTag["EventTimeNanoSec"].data<unsigned int>() = timeStampNS;
98 eventTag["BunchId"] .data<unsigned int>() = bunchId;
99
100 // event weight
101 // used for event weighting in monte carlo or just an event count in data
102 float evweight = 1;
103 if (isSimulation) evweight = eventInfo.mcEventWeight();
104 eventTag["EventWeight"].data<float>() = evweight;
105
106 return StatusCode::SUCCESS;
107
108}
StatusCode eventTag(AthenaAttributeList &eventTagCol, const xAOD::EventInfo &eventInfo) const
the various components to build their own fragments of tag
uint32_t lumiBlock() const
The current event's luminosity block number.
bool eventType(EventType type) const
Check for one particular bitmask value.
uint32_t bcid() const
The bunch crossing ID of the event.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
@ IS_CALIBRATION
true: calibration, false: physics
@ IS_SIMULATION
true: simulation, false: data
@ IS_TESTBEAM
true: testbeam, false: full detector
uint32_t runNumber() const
The current event's run number.
uint32_t mcChannelNumber() const
The MC generator's channel number.
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
uint64_t eventNumber() const
The current event's event number.
float mcEventWeight(size_t i=0) const
The weight of one specific MC event used in the simulation.
setEventNumber timeStamp
setTeId lumiBlock

◆ 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

◆ finalize()

StatusCode EventInfoAttListTool::finalize ( )
overridevirtual

finalize - called once at the end

Definition at line 112 of file EventInfoAttListTool.cxx.

112 {
113 ATH_MSG_DEBUG("in finalize()");
114 m_attribListSpec->release();
115 m_attribListSpec = nullptr;
116 return AthAlgTool::finalize();
117}
#define ATH_MSG_DEBUG(x)
coral::AttributeListSpecification * m_attribListSpec

◆ getAttributeListPtr()

std::unique_ptr< AthenaAttributeList > EventInfoAttListTool::getAttributeListPtr ( const xAOD::EventInfo & einfo) const

Definition at line 47 of file EventInfoAttListTool.cxx.

48{
49 // Create attributeList with appropriate attributes
50 const coral::AttributeListSpecification& specRef = *m_attribListSpec;
51 auto eventTag = std::make_unique<AthenaAttributeList> ( specRef );
52
53 StatusCode sc = this->eventTag (*eventTag, eventInfo);
54 if (sc.isFailure()) {
55 ATH_MSG_WARNING("Unable to build Tag Fragments for the Event");
56 }
57
58 ATH_MSG_DEBUG("EventInfoAttListTool - getAttributeList() return success");
59
60 return eventTag;
61}
#define ATH_MSG_WARNING(x)
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ getAttributeSpecification()

const coral::AttributeListSpecification & EventInfoAttListTool::getAttributeSpecification ( ) const

◆ initialize()

StatusCode EventInfoAttListTool::initialize ( )
overridevirtual

Overriding initialize, finalize and execute.

initialization - called once at the beginning

Definition at line 22 of file EventInfoAttListTool.cxx.

22 {
23 ATH_MSG_DEBUG("in initialize()");
24
25 m_attribListSpec = new coral::AttributeListSpecification();
26 // Note: for any attribute added here, please confirm the corresponding EventInfo member being
27 // retained in DAOD smart slimming:
28 // PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/EventInfoContent.py
29 m_attribListSpec->extend("IsSimulation", "bool");
30 m_attribListSpec->extend("IsCalibration", "bool");
31 m_attribListSpec->extend("IsTestBeam", "bool");
32 m_attribListSpec->extend("McChannel", "unsigned int");
33 m_attribListSpec->extend("RunNumber", "unsigned int");
34 m_attribListSpec->extend("EventNumber", "unsigned long long");
35 m_attribListSpec->extend("LumiBlockN", "unsigned int");
36 m_attribListSpec->extend("ConditionsRun", "unsigned int");
37 m_attribListSpec->extend("EventTime", "unsigned int");
38 m_attribListSpec->extend("EventTimeNanoSec","unsigned int");
39 m_attribListSpec->extend("BunchId", "unsigned int");
40 m_attribListSpec->extend("EventWeight", "float");
41
42 return AthAlgTool::initialize();
43}

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

◆ isValid()

bool EventInfoAttListTool::isValid ( ) const

◆ 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

Member Data Documentation

◆ m_attribListSpec

coral::AttributeListSpecification* EventInfoAttListTool::m_attribListSpec {}
protected

Definition at line 45 of file EventInfoAttListTool.h.

45{};

◆ 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_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: