ATLAS Offline Software
Loading...
Searching...
No Matches
AccessorMacros.h File Reference
#include "GeoModelKernel/throwExcept.h"
Include dependency graph for AccessorMacros.h:

Go to the source code of this file.

Macros

#define IMPLEMENT_SETTER_GETTER(CLASS_NAME, DTYPE, GETTER, SETTER)
 Macros to implement the scalar variables of the xAOD::MuonPrepData objects.
#define IMPLEMENT_SETTER_GETTER_WITH_CAST(CLASS_NAME, STORE_DTYPE, CAST_DTYPE, GETTER, SETTER)
 Macro to implement the scalar variable of the xAOD::MuonPrepData object which is then casted to an enum type.
#define IMPLEMENT_VECTOR_SETTER_GETTER(CLASS_NAME, DTYPE, GETTER, SETTER)
 Macro to implement vector like variables of the xAOD::MuonPrepData objects.
#define IMPLEMENT_READOUTELEMENT(CLASS_NAME, CACHED_VALUE, READOUT_ELEMENT_TYPE)
 Macro to handle the readoutElement.
#define PRD_AUXVARIABLE(VAR)
 Macro to declare the variables belonging to the AuxElementContainer.

Macro Definition Documentation

◆ IMPLEMENT_READOUTELEMENT

#define IMPLEMENT_READOUTELEMENT ( CLASS_NAME,
CACHED_VALUE,
READOUT_ELEMENT_TYPE )
Value:
void CLASS_NAME::setReadoutElement(const MuonGMR4::READOUT_ELEMENT_TYPE* readoutEle) { \
CACHED_VALUE.set(readoutEle); \
} \
\
const MuonGMR4::READOUT_ELEMENT_TYPE* CLASS_NAME::readoutElement() const { \
if (!CACHED_VALUE.isValid()) { \
ServiceHandle<StoreGateSvc> service{"DetectorStore", #CLASS_NAME}; \
const MuonGMR4::MuonDetectorManager* detMgr{}; \
if (!service.retrieve().isSuccess() || \
!service->retrieve(detMgr).isSuccess()){ \
THROW_EXCEPTION("Failed to retrieve the Run4 muon detector manager. "<< \
"Please schedule the MuonGeometry in your job"); \
} \
const IdentifierHash hash{identifierHash()}; \
const MuonGMR4::READOUT_ELEMENT_TYPE* re = detMgr->get##READOUT_ELEMENT_TYPE(hash); \
if (!re) { \
const Identifier id{static_cast<Identifier::value_type>(identifier())}; \
THROW_EXCEPTION(detMgr->idHelperSvc()->toString(id) \
<<" does not have a readout element."); \
} \
CACHED_VALUE.set(re); \
} \
return (*CACHED_VALUE.ptr()); \
}
const boost::regex re(r_e)
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the central MuonIdHelperSvc.
virtual std::string toString(const Identifier &id) const =0
print all fields to string

Macro to handle the readoutElement.

If the object is created within the RDO -> Prd conversion the method simply returns the pointer to the given readoutElement. In contrast, if the object is created from disk, the readoutElement link is not automatically restored. At the first time, when method is called, the MuonDetectorManager is retrieved from the detector store and the associated readout element is fetched. In Phase II, alignment constants are parsed via the GeometryContext, hence there only exists one instance of the MuonDetectorManager and there's no problem with the scheduler

Definition at line 55 of file AccessorMacros.h.

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); \
58 } \
59 \
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"); \
68 } \
69 const IdentifierHash hash{identifierHash()}; \
70 const MuonGMR4::READOUT_ELEMENT_TYPE* re = detMgr->get##READOUT_ELEMENT_TYPE(hash); \
71 if (!re) { \
72 const Identifier id{static_cast<Identifier::value_type>(identifier())}; \
73 THROW_EXCEPTION(detMgr->idHelperSvc()->toString(id) \
74 <<" does not have a readout element."); \
75 } \
76 CACHED_VALUE.set(re); \
77 } \
78 return (*CACHED_VALUE.ptr()); \
79 }

◆ IMPLEMENT_SETTER_GETTER

#define IMPLEMENT_SETTER_GETTER ( CLASS_NAME,
DTYPE,
GETTER,
SETTER )
Value:
DTYPE CLASS_NAME::GETTER() const { \
static const SG::AuxElement::Accessor<DTYPE> acc{preFixStr + #GETTER}; \
return acc(*this); \
} \
\
void CLASS_NAME::SETTER(DTYPE value) { \
static const SG::AuxElement::Accessor<DTYPE> acc{preFixStr + #GETTER}; \
acc(*this) = value; \
}
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
#define GETTER(_name_)
Macros for plotting.

Macros to implement the scalar variables of the xAOD::MuonPrepData objects.

Definition at line 10 of file AccessorMacros.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}; \
13 return acc(*this); \
14 } \
15 \
16 void CLASS_NAME::SETTER(DTYPE value) { \
17 static const SG::AuxElement::Accessor<DTYPE> acc{preFixStr + #GETTER}; \
18 acc(*this) = value; \
19 }

◆ IMPLEMENT_SETTER_GETTER_WITH_CAST

#define IMPLEMENT_SETTER_GETTER_WITH_CAST ( CLASS_NAME,
STORE_DTYPE,
CAST_DTYPE,
GETTER,
SETTER )
Value:
CAST_DTYPE CLASS_NAME::GETTER() const { \
static const SG::AuxElement::Accessor<STORE_DTYPE> acc{preFixStr + #GETTER}; \
return static_cast<CAST_DTYPE>(acc(*this)); \
} \
\
void CLASS_NAME::SETTER(CAST_DTYPE value) { \
static const SG::AuxElement::Accessor<STORE_DTYPE> acc{preFixStr + #GETTER}; \
acc(*this) = static_cast<STORE_DTYPE>(value); \
}

Macro to implement the scalar variable of the xAOD::MuonPrepData object which is then casted to an enum type.

Definition at line 24 of file AccessorMacros.h.

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)); \
28 } \
29 \
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); \
33 }

◆ IMPLEMENT_VECTOR_SETTER_GETTER

#define IMPLEMENT_VECTOR_SETTER_GETTER ( CLASS_NAME,
DTYPE,
GETTER,
SETTER )
Value:
const std::vector<DTYPE>& CLASS_NAME::GETTER() const { \
static const SG::AuxElement::Accessor<std::vector<DTYPE>> acc{preFixStr + #GETTER}; \
return acc(*this); \
} \
\
void CLASS_NAME::SETTER(const std::vector<DTYPE>& value) { \
acc(*this) = value; \
}

Macro to implement vector like variables of the xAOD::MuonPrepData objects.

Definition at line 37 of file AccessorMacros.h.

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}; \
40 return acc(*this); \
41 } \
42 \
43 void CLASS_NAME::SETTER(const std::vector<DTYPE>& value) { \
44 static const SG::AuxElement::Accessor<std::vector<DTYPE>> acc{preFixStr + #GETTER}; \
45 acc(*this) = value; \
46 }

◆ PRD_AUXVARIABLE

#define PRD_AUXVARIABLE ( VAR)
Value:
do { \
static const std::string varName =preFixStr+#VAR; \
static const auxid_t auxid = getAuxID(varName, VAR); \
regAuxVar(auxid, varName, VAR); \
} while (false);

Macro to declare the variables belonging to the AuxElementContainer.

It's preassumed that a preFixStr is defined at the top of the source file

Definition at line 85 of file AccessorMacros.h.

85#define PRD_AUXVARIABLE(VAR) \
86 do { \
87 static const std::string varName =preFixStr+#VAR; \
88 static const auxid_t auxid = getAuxID(varName, VAR); \
89 regAuxVar(auxid, varName, VAR); \
90 } while (false);