ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
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. More...
 
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. More...
 
std::string name () const override final
 Returns the name of the branch. More...
 
std::vector< DataDependencydata_dependencies () override final
 Returns a vector of all Event data dependencies needed by the Branch to work. More...
 
TTree * tree () override final
 Returns the pointer to the underlying TTree object. More...
 
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. More...
 

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

Definition at line 39 of file IMuonTesterBranch.h.

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

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

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

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

◆ m_last_dump

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

Definition at line 32 of file EventHashBranch.h.


The documentation for this class was generated from the following files:
MuonVal::ArrayBranch::fill
bool fill(const EventContext &) override final
Returns false if one of the array values is not updated.
MuonVal::ArrayBranch::init
bool init() override final
Connects the branch with the tree.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonVal::EventHashBranch::m_cache
ArrayBranch< ULong64_t > m_cache
Definition: EventHashBranch.h:30
MuonVal::EventHashBranch::m_evtKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtKey
Definition: EventHashBranch.h:31
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonVal::MuonTesterBranch::tree
TTree * tree() override final
Returns the underlying TTree object.
Definition: MuonTesterBranch.cxx:53
MuonVal::EventHashBranch::name
std::string name() const override final
Returns the name of the branch.
Definition: EventHashBranch.cxx:13
Generate_dsid_ranseed.dsid
dsid
Definition: Generate_dsid_ranseed.py:6
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonVal::EventHashBranch::tree
TTree * tree() override final
Returns the pointer to the underlying TTree object.
Definition: EventHashBranch.cxx:17
MuonVal::MuonTesterBranch::name
std::string name() const override final
Returns the name of the branch.
Definition: MuonTesterBranch.cxx:51
MuonVal::EventHashBranch::m_last_dump
const EventContext * m_last_dump
Definition: EventHashBranch.h:32
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20