ATLAS Offline Software
Loading...
Searching...
No Matches
MuonVal::EventHashBranch Class Reference

#include <EventHashBranch.h>

Inheritance diagram for MuonVal::EventHashBranch:
Collaboration diagram for MuonVal::EventHashBranch:

Public Types

using DataDependency = SG::VarHandleKey*

Public Member Functions

 ~EventHashBranch ()=default
 EventHashBranch (TTree *tree, const std::string &evtKey="EventInfo")
bool fill (const EventContext &ctx) override final
 The fill method checks if enough information is provided such that the branch is cleared from the information of the prevoius event and in cases of that updates did no happen befure a default value is provided.
bool init () override final
 The init method checks whether the branch name has already registered to the MuonTree and tries then to add the branch to the tree --> return false if the branch has already been defined or the inclusion of the branch to the tree failed or the name of the branch is empty.
std::string name () const override final
 Returns the name of the branch.
std::vector< DataDependencydata_dependencies () override final
 Returns a vector of all Event data dependencies needed by the Branch to work.
TTree * tree () override final
 Returns the pointer to the underlying TTree object.
const TTree * tree () const override final
bool is_dumped (const EventContext &ctx) const
 Returns true whether the current event is dumped to the N-tuple or not.

Private Attributes

ArrayBranch< ULong64_t > m_cache
SG::ReadHandleKey< xAOD::EventInfom_evtKey {"EventInfo"}
const EventContext * m_last_dump {nullptr}

Detailed Description

Definition at line 13 of file EventHashBranch.h.

Member Typedef Documentation

◆ DataDependency

Constructor & Destructor Documentation

◆ ~EventHashBranch()

MuonVal::EventHashBranch::~EventHashBranch ( )
default

◆ EventHashBranch()

MuonVal::EventHashBranch::EventHashBranch ( TTree * tree,
const std::string & evtKey = "EventInfo" )

Definition at line 9 of file EventHashBranch.cxx.

9 :
10 m_cache{tree, "CommonEventHash", 2},
11 m_evtKey{evtKey} {}
ArrayBranch< ULong64_t > m_cache
TTree * tree() override final
Returns the pointer to the underlying TTree object.
SG::ReadHandleKey< xAOD::EventInfo > m_evtKey

Member Function Documentation

◆ data_dependencies()

std::vector< EventHashBranch::DataDependency > MuonVal::EventHashBranch::data_dependencies ( )
finaloverridevirtual

Returns a vector of all Event data dependencies needed by the Branch to work.

Implements MuonVal::IMuonTesterBranch.

Definition at line 14 of file EventHashBranch.cxx.

14 {
15 return {&m_evtKey};
16}

◆ fill()

bool MuonVal::EventHashBranch::fill ( const EventContext & ctx)
finaloverridevirtual

The fill method checks if enough information is provided such that the branch is cleared from the information of the prevoius event and in cases of that updates did no happen befure a default value is provided.

--> returns false if no update is called or the dummy value has not been defined

Implements MuonVal::IMuonTesterBranch.

Definition at line 19 of file EventHashBranch.cxx.

19 {
20 SG::ReadHandle<xAOD::EventInfo> evtInfo{m_evtKey, ctx};
21 if (!evtInfo.isValid()){
22 MsgStream log(Athena::getMessageSvc(), name());
23 log << MSG::ERROR << "Could not retrieve the EventInfo " << m_evtKey.fullKey() << endmsg;
24 return false;
25 }
26 m_cache[0] = evtInfo->eventNumber();
27 if (evtInfo->eventType(xAOD::EventInfo::IS_SIMULATION)) {
28 ULong64_t dsid = evtInfo->mcChannelNumber();
29 dsid = ( (dsid<<32) | evtInfo->runNumber());
30 m_cache[1] = dsid;
31 } else m_cache[1] = evtInfo->runNumber();
32 m_last_dump = &ctx;
33 return m_cache.fill(ctx);
34}
#define endmsg
std::string name() const override final
Returns the name of the branch.
const EventContext * m_last_dump
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ IS_SIMULATION
true: simulation, false: data
IMessageSvc * getMessageSvc(bool quiet=false)

◆ init()

bool MuonVal::EventHashBranch::init ( )
finaloverridevirtual

The init method checks whether the branch name has already registered to the MuonTree and tries then to add the branch to the tree --> return false if the branch has already been defined or the inclusion of the branch to the tree failed or the name of the branch is empty.

Implements MuonVal::IMuonTesterBranch.

Definition at line 12 of file EventHashBranch.cxx.

12{return m_cache.init() && m_evtKey.initialize();}

◆ is_dumped()

bool MuonVal::EventHashBranch::is_dumped ( const EventContext & ctx) const

Returns true whether the current event is dumped to the N-tuple or not.

Definition at line 35 of file EventHashBranch.cxx.

35 {
36 return &ctx == m_last_dump;
37}

◆ name()

std::string MuonVal::EventHashBranch::name ( ) const
finaloverridevirtual

Returns the name of the branch.

Implements MuonVal::IMuonTesterBranch.

Definition at line 13 of file EventHashBranch.cxx.

13{return m_cache.name();}

◆ tree() [1/2]

const TTree * MuonVal::EventHashBranch::tree ( ) const
finaloverridevirtual

Implements MuonVal::IMuonTesterBranch.

Definition at line 18 of file EventHashBranch.cxx.

18{return m_cache.tree();}

◆ tree() [2/2]

TTree * MuonVal::EventHashBranch::tree ( )
finaloverridevirtual

Returns the pointer to the underlying TTree object.

Implements MuonVal::IMuonTesterBranch.

Definition at line 17 of file EventHashBranch.cxx.

17{return m_cache.tree();}

Member Data Documentation

◆ m_cache

ArrayBranch<ULong64_t> MuonVal::EventHashBranch::m_cache
private

Definition at line 30 of file EventHashBranch.h.

◆ m_evtKey

SG::ReadHandleKey<xAOD::EventInfo> MuonVal::EventHashBranch::m_evtKey {"EventInfo"}
private

Definition at line 31 of file EventHashBranch.h.

31{"EventInfo"};

◆ m_last_dump

const EventContext* MuonVal::EventHashBranch::m_last_dump {nullptr}
private

Definition at line 32 of file EventHashBranch.h.

32{nullptr};

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