ATLAS Offline Software
EventHashBranch.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
6 #include <StoreGate/ReadHandle.h>
7 namespace MuonVal {
8 
9 EventHashBranch::EventHashBranch(TTree* tree, const std::string& evtKey):
10  m_cache{tree, "CommonEventHash", 2},
11  m_evtKey{evtKey} {}
13 std::string EventHashBranch::name() const {return m_cache.name();}
14 std::vector<EventHashBranch::DataDependency> EventHashBranch::data_dependencies() {
15  return {&m_evtKey};
16 }
17 TTree* EventHashBranch::tree() {return m_cache.tree();}
18 const TTree*EventHashBranch::tree() const {return m_cache.tree();}
19 bool EventHashBranch::fill(const EventContext& 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 }
35 bool EventHashBranch::is_dumped(const EventContext& ctx ) const{
36  return &ctx == m_last_dump;
37 }
38 }
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.
MuonVal::EventHashBranch::EventHashBranch
EventHashBranch(TTree *tree, const std::string &evtKey="EventInfo")
Definition: EventHashBranch.cxx:9
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonVal::EventHashBranch::m_cache
ArrayBranch< ULong64_t > m_cache
Definition: EventHashBranch.h:30
tree
TChain * tree
Definition: tile_monitor.h:30
MuonVal::EventHashBranch::data_dependencies
std::vector< DataDependency > data_dependencies() override final
Returns a vector of all Event data dependencies needed by the Branch to work.
Definition: EventHashBranch.cxx:14
MuonVal::EventHashBranch::m_evtKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtKey
Definition: EventHashBranch.h:31
EventHashBranch.h
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::fill
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
Definition: EventHashBranch.cxx:19
MuonVal::EventHashBranch::init
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
Definition: EventHashBranch.cxx:12
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
Class to store array like branches into the n-tuples.
Definition: MuonTPMetaDataAlg.cxx:25
MuonVal::EventHashBranch::m_last_dump
const EventContext * m_last_dump
Definition: EventHashBranch.h:32
MuonVal::EventHashBranch::is_dumped
bool is_dumped(const EventContext &ctx) const
Returns true whether the current event is dumped to the N-tuple or not.
Definition: EventHashBranch.cxx:35
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ReadHandle.h
Handle class for reading from StoreGate.