ATLAS Offline Software
Functions
xAOD::detail Namespace Reference

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. More...
 
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)
 

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 }

◆ 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 }

◆ 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 }

◆ 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 54 of file ShallowCopy.h.

55  {
56 
57  if (!link.cptr()) {
58  // This can happen when we read the input file in standalone
59  // mode in branch access mode. That's unfortunately not
60  // compatible with using a shallow copy auxiliary store.
61  std::cout << "xAOD::shallowCopyContainer ERROR Couldn't set up "
62  << "DataLink to the original container's auxiliary store"
63  << std::endl;
64  std::cout << "xAOD::shallowCopyContainer ERROR Are you using the "
65  << "xAOD::TEvent::kBranchAccess access mode?" << std::endl;
66  return {};
67  }
68 
69  // Create the new DV container:
70  auto newCont = std::make_unique<T>();
71 
72  // Add the required number of elements to it:
73  newCont->reserve(cont.size());
74  for (size_t i = 0; i < cont.size(); ++i) {
75  newCont->push_back(prepareElementForShallowCopy(cont[i]));
76  }
77 
78  // Create a new shallow auxiliary container:
79  auto aux = std::make_unique<ShallowAuxContainer>(link);
80 
81  // Connect it to the interface container:
82  newCont->setStore(aux.get());
83 
84  // Return the new objects:
85  return std::make_pair(std::move(newCont), std::move(aux));
86  }
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
xAOD::prepareElementForShallowCopy
std::unique_ptr< T > prepareElementForShallowCopy(const T *)
Function to prepare an object to be stored in a shallow-copy container.
Definition: ShallowCopy.h:43
SG::AuxTypeRegistry::linkedName
static std::string linkedName(const std::string &name)
Given a variable name, return the name of the corresponding linked variable.
Definition: AuxTypeRegistry.cxx:1302
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
DMTest::links
links
Definition: CLinks_v1.cxx:22
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16