ATLAS Offline Software
Loading...
Searching...
No Matches
TesterModuleBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GeoModelKernel/throwExcept.h"
9
10namespace MuonValR4 {
12 const std::string& grp_name,
13 MSG::Level msglvl) :
14 MuonTesterBranch(tree, " R4 tester module " + grp_name) {
15 setLevel(msglvl);
16 m_idHelperSvc.retrieve().ignore();
17 }
22 const ActsTrk::GeometryContext& TesterModuleBase::getGeoCtx(const EventContext& ctx) const {
23 SG::ReadHandle handle{m_geoCtxKey, ctx};
24 if (!handle.isValid()) {
25 THROW_EXCEPTION("Failed to retrieve "<<m_geoCtxKey.fullKey());
26 }
27 return *handle;
28 }
29
31 ServiceHandle<StoreGateSvc> detStore{"StoreGateSvc/DetectorStore", name()};
32 if (!detStore.retrieve().isSuccess() || !detStore->retrieve(m_detMgr).isSuccess()) return false;
33 if (!declare_dependency(m_geoCtxKey)) return false;
34 if (!m_idHelperSvc.retrieve().isSuccess()) return false;
35 return declare_keys();
36 }
37} // namespace MuonPRDTest
Handle class for reading from StoreGate.
void setLevel(MSG::Level lvl)
Change the current logging level.
const Muon::IMuonIdHelperSvc * idHelperSvc() const
virtual bool declare_keys()=0
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
const MuonGMR4::MuonDetectorManager * m_detMgr
TesterModuleBase(MuonTesterTree &tree, const std::string &grp_name, MSG::Level msglvl=MSG::Level::INFO)
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
const MuonGMR4::MuonDetectorManager * getDetMgr() const
bool init() override final
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
const ActsTrk::GeometryContext & getGeoCtx(const EventContext &ctx) const
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
std::string name() const override final
Returns the name of the branch.
TTree * tree() override final
Returns the underlying TTree object.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10