ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::detail Namespace Reference

Internal implementation details and type concepts for container merging. More...

Concepts

concept  AuxContainerConcept
 Define that the templated class needs to inherit from the AuxContainerBase class.
concept  DataVectorConcept
 Define a data vector.
concept  isMuonMeasurement
 Concept that verifies a type is derived from xAOD::MuonMeasurement.
concept  isMuonMeasurementCont
 Concept that verifies a type is a valid MuonMeasurement container.
concept  PrimaryContainerConcept
 Define the primary container.

Functions

template<class T>
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainerImpl (const T &cont, DataLink< SG::IConstAuxStore > &link)
 Impl function for shallow copy container.
template<class VARTYPE, class AUXBASE>
VARTYPE initAuxVar2 (AUXBASE *auxcont, std::true_type)
template<class VARTYPE, class AUXBASE>
VARTYPE initAuxVar2 (AUXBASE *, std::false_type)
template<class VARTYPE, class AUXBASE>
VARTYPE initAuxVar1 (AUXBASE *auxcont)
template<const char * NAME, class AUXBASE, class VARTYPE>
VARTYPE initAuxVar (AUXBASE *auxcont, VARTYPE &var, SG::AuxVarFlags flags=SG::AuxVarFlags::None)
template<class ELT, const char * NAME, class AUXBASE, class LINKS, class LINKED>
LINKED initLinkedVar (AUXBASE *auxcont, LINKS &links, LINKED &linked)

Detailed Description

Internal implementation details and type concepts for container merging.

Auxiliary class to create a xAOD container together with its associated AuxContainer without manually instantiating the corresponding pointers.

Further, methods are provided to write the container to store gate using a passed WriteHandle key object

Function Documentation

◆ initAuxVar()

template<const char * NAME, class AUXBASE, class VARTYPE>
VARTYPE xAOD::detail::initAuxVar ( AUXBASE * auxcont,
VARTYPE & var,
SG::AuxVarFlags flags = SG::AuxVarFlags::None )

Definition at line 82 of file AuxVariable.h.

85{
86 static const SG::auxid_t auxid = auxcont->getAuxID( NAME, var, flags );
87 auxcont->regAuxVar (auxid, NAME, var);
88 return initAuxVar1<VARTYPE>( auxcont );
89}
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
VARTYPE initAuxVar1(AUXBASE *auxcont)
Definition AuxVariable.h:75

◆ initAuxVar1()

template<class VARTYPE, class AUXBASE>
VARTYPE xAOD::detail::initAuxVar1 ( AUXBASE * auxcont)

Definition at line 75 of file AuxVariable.h.

76{
77 return initAuxVar2<VARTYPE> ( auxcont, std::is_constructible<VARTYPE, std::pmr::memory_resource*>() );
78}
VARTYPE initAuxVar2(AUXBASE *auxcont, std::true_type)
Definition AuxVariable.h:59

◆ initAuxVar2() [1/2]

template<class VARTYPE, class AUXBASE>
VARTYPE xAOD::detail::initAuxVar2 ( AUXBASE * ,
std::false_type  )

Definition at line 67 of file AuxVariable.h.

69{
70 return VARTYPE();
71}

◆ initAuxVar2() [2/2]

template<class VARTYPE, class AUXBASE>
VARTYPE xAOD::detail::initAuxVar2 ( AUXBASE * auxcont,
std::true_type  )

Definition at line 59 of file AuxVariable.h.

61{
62 return VARTYPE (auxcont->memResource());
63}

◆ initLinkedVar()

template<class ELT, const char * NAME, class AUXBASE, class LINKS, class LINKED>
LINKED xAOD::detail::initLinkedVar ( AUXBASE * auxcont,
LINKS & links,
LINKED & linked )

Definition at line 97 of file AuxVariable.h.

100{
101 // Use the @c ConstAccessor specialization to get the variable
102 // declared properly.
103 static const SG::ConstAccessor<ELT> acc( NAME );
104 auxcont->regAuxVar( acc.linkedAuxid(), SG::AuxTypeRegistry::linkedName (NAME), linked );
105 auxcont->regAuxVar( acc.auxid(), NAME, links );
106 return xAOD::detail::initAuxVar1<LINKED>( auxcont );
107}
static std::string linkedName(const std::string &name)
Given a variable name, return the name of the corresponding linked variable.
Helper class to provide constant type-safe access to aux data.
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.

◆ shallowCopyContainerImpl()

template<class T>
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > xAOD::detail::shallowCopyContainerImpl ( const T & cont,
DataLink< SG::IConstAuxStore > & link )

Impl function for shallow copy container.

Parameters
contThe container to make a shallow copy of
ctxThe currentEventContext
Returns
A pair of unique_ptr to the created objects.

Definition at line 145 of file ShallowCopy.h.

146 {
147
148 if (!link.cptr()) {
149 // This can happen when we read the input file in standalone
150 // mode in branch access mode. That's unfortunately not
151 // compatible with using a shallow copy auxiliary store.
152 std::cout << "xAOD::shallowCopyContainer ERROR Couldn't set up "
153 << "DataLink to the original container's auxiliary store"
154 << std::endl;
155 std::cout << "xAOD::shallowCopyContainer ERROR Are you using the "
156 << "xAOD::TEvent::kBranchAccess access mode?" << std::endl;
157 return {};
158 }
159
160 // Create the new DV container:
161 auto newCont = std::make_unique<T>();
162
163 // Add the required number of elements to it:
164 newCont->reserve(cont.size());
165 for (size_t i = 0; i < cont.size(); ++i) {
166 newCont->push_back(prepareElementForShallowCopy(cont[i]));
167 }
168
169 // Create a new shallow auxiliary container:
170 auto aux = std::make_unique<ShallowAuxContainer>(link);
171
172 // Connect it to the interface container:
173 newCont->setStore(aux.get());
174
175 // Return the new objects:
176 return std::make_pair(std::move(newCont), std::move(aux));
177 }
std::unique_ptr< CaloCluster > prepareElementForShallowCopy(const CaloCluster *orgCluster)