|
ATLAS Offline Software
|
Go to the documentation of this file.
4 #ifndef XAODMUONPREPDATA_ACCESSOR_MACROS_H
5 #define XAODMUONPREPDATA_ACCESSOR_MACROS_H
6 #include "GeoModelHelpers/throwExcept.h"
10 #define IMPLEMENT_SETTER_GETTER( CLASS_NAME, DTYPE, GETTER, SETTER) \
11 DTYPE CLASS_NAME::GETTER() const { \
12 static const SG::AuxElement::Accessor<DTYPE> acc{preFixStr + #GETTER}; \
16 void CLASS_NAME::SETTER(DTYPE value) { \
17 static const SG::AuxElement::Accessor<DTYPE> acc{preFixStr + #GETTER}; \
24 #define IMPLEMENT_SETTER_GETTER_WITH_CAST( CLASS_NAME, STORE_DTYPE, CAST_DTYPE, GETTER, SETTER) \
25 CAST_DTYPE CLASS_NAME::GETTER() const { \
26 static const SG::AuxElement::Accessor<STORE_DTYPE> acc{preFixStr + #GETTER}; \
27 return static_cast<CAST_DTYPE>(acc(*this)); \
30 void CLASS_NAME::SETTER(CAST_DTYPE value) { \
31 static const SG::AuxElement::Accessor<STORE_DTYPE> acc{preFixStr + #GETTER}; \
32 acc(*this) = static_cast<STORE_DTYPE>(value); \
37 #define IMPLEMENT_VECTOR_SETTER_GETTER(CLASS_NAME, DTYPE, GETTER, SETTER) \
38 const std::vector<DTYPE>& CLASS_NAME::GETTER() const { \
39 static const SG::AuxElement::Accessor<std::vector<DTYPE>> acc{preFixStr + #GETTER}; \
43 void CLASS_NAME::SETTER(const std::vector<DTYPE>& value) { \
44 static const SG::AuxElement::Accessor<std::vector<DTYPE>> acc{preFixStr + #GETTER}; \
55 #define IMPLEMENT_READOUTELEMENT(CLASS_NAME, CACHED_VALUE, READOUT_ELEMENT_TYPE) \
56 void CLASS_NAME::setReadoutElement(const MuonGMR4::READOUT_ELEMENT_TYPE* readoutEle) { \
57 CACHED_VALUE.set(readoutEle); \
60 const MuonGMR4::READOUT_ELEMENT_TYPE* CLASS_NAME::readoutElement() const { \
61 if (!CACHED_VALUE.isValid()) { \
62 ServiceHandle<StoreGateSvc> service{"DetectorStore", #CLASS_NAME}; \
63 const MuonGMR4::MuonDetectorManager* detMgr{}; \
64 if (!service.retrieve().isSuccess() || \
65 !service->retrieve(detMgr).isSuccess()){ \
66 THROW_EXCEPTION("Failed to retrieve the Run4 muon detector manager. "<< \
67 "Please schedule the MuonGeometry in your job"); \
69 const IdentifierHash hash{identifierHash()}; \
70 const MuonGMR4::READOUT_ELEMENT_TYPE* re = detMgr->get##READOUT_ELEMENT_TYPE(hash); \
72 const Identifier id{static_cast<Identifier::value_type>(identifier())}; \
73 THROW_EXCEPTION(detMgr->idHelperSvc()->toString(id) \
74 <<" does not have a readout element."); \
76 CACHED_VALUE.set(re); \
78 return (*CACHED_VALUE.ptr()); \
85 #define PRD_AUXVARIABLE(VAR) \
87 static const std::string varName =preFixStr+#VAR; \
88 static const auxid_t auxid = getAuxID(varName, VAR); \
89 regAuxVar(auxid, varName, VAR); \