ATLAS Offline Software
Loading...
Searching...
No Matches
HolderImp< STORED, CONTAINER > Class Template Referenceabstract

This is an implementation class for all Holders It is templated with 2 arguments STORED which is type of stored objects Another type is CONTAINER for that type. More...

#include <Holder.h>

Inheritance diagram for HolderImp< STORED, CONTAINER >:
Collaboration diagram for HolderImp< STORED, CONTAINER >:

Classes

struct  MemoryMgr

Public Types

typedef Holder< STORED > base_type
typedef STORED stored_type
typedef CONTAINER container_type
typedef HLTNavDetails::TypeProxy< STORED > FeatureProxy
typedef HLTNavDetails::TypeProxy< CONTAINER > ContainerProxy
typedef std::multimap< HLT::TriggerElement::ObjectIndex, MemoryMgrMemoryMgrMap

Public Member Functions

 HolderImp ()
 HolderImp (const std::string &prefix, const std::string &label, uint16_t idx)
virtual ~HolderImp ()
virtual IHolderclone (const std::string &prefix, const std::string &label, uint16_t idx) const
virtual HLT::TriggerElement::ObjectIndex add (const STORED *f, bool inSG=false, const std::string &="")
 adds object(s) to be holded
virtual bool get (const STORED *&dest, HLT::TriggerElement::ObjectIndex idx)
 gets object(s) holded
virtual bool contains (const STORED *obj, HLT::TriggerElement::ObjectIndex &idx)
 check if object(s) in dest are held by this holder
bool getElementLinks (ElementLinkVector< CONTAINER > &cont, HLT::TriggerElement::ObjectIndex idx)
bool getElementLinks (ElementLinkVector< CONTAINER > &cont)
bool getWithLink (typename set_link< STORED, CONTAINER, std::is_same< STORED, CONTAINER >::value >::type &link, HLT::TriggerElement::ObjectIndex &idx)
virtual std::string getUniqueKey ()
virtual std::string getNextKey ()
virtual void prepare (const asg::AsgMessaging &logger, HLT::AccessProxy *sg, IConversionSvc *objSerializer, bool readonly=false)
 prepares this holder by setting messaging, StoreGate access and providing serializer
virtual bool syncWithSG (SG::OwnershipPolicy policy=SG::OWN_ELEMENTS)
virtual bool checkAndSetOwnership (SG::OwnershipPolicy policy)
virtual bool serialize (std::vector< uint32_t > &output) const
 serializes this Holder
virtual const std::string & key () const
 returns the containers StoreGate key
virtual void print (MsgStream &m) const
virtual DataObject * getDataObject ()
virtual DataObject * getAuxDataObject ()
virtual bool setDataObject (DataObject *dobj)
virtual bool setAuxDataObject (DataObject *dobjaux)
virtual CLID typeClid () const
 returns the CLID of objects stores by this holder
virtual const std::string & typeName () const
 returns the object's name stored by this holder
virtual CLID containerClid () const
virtual const std::string & collectionName () const
 returns the collection's name stored by this holder
virtual CLID auxClidOrZero () const
virtual const ITypeProxy & containerTypeProxy () const
 Get the proxy for the container.
virtual HLT::TriggerElement::ObjectIndex add ATLAS_NOT_THREAD_SAFE (const STORED *f, bool inSG, const std::string &="")=0
 saved object in this holder
template<class CONTAINER2>
bool get (ElementLinkVector< CONTAINER2 > &cont)
template<class CONTAINER2>
bool get (ElementLinkVector< CONTAINER2 > &cont, HLT::TriggerElement::ObjectIndex idx)
template<class CONTAINER2>
bool getWithLink (typename set_link< STORED, CONTAINER2, std::is_same< STORED, CONTAINER2 >::value >::type &link, HLT::TriggerElement::ObjectIndex &idx)
const std::string & label () const
 returns the label of objects stores by this holder
virtual const std::string & prefix () const
 returns the containers StoreGate prefix
uint16_t subTypeIndex () const
 returns the index (short number used when linking object to the TE) of objects stores by this holder
std::string generateAliasKey (CLID c, uint16_t sti, const std::string &label, unsigned size)
bool serializeWithPayload (const xAOD::AuxSelection &sel, std::vector< uint32_t > &output, size_t &payloadsize)
 serializes this Holder including payload
bool serializePayload (std::vector< uint32_t > &dataBlob, const xAOD::AuxSelection &sel)
 serializes the payload of this Holder
bool deserializePayload (const std::vector< uint32_t > &dataBlob, int version)
 deserialization of holder payload

Static Public Member Functions

static bool enquireSerialized (std::vector< uint32_t >::const_iterator &fromHere, const std::vector< uint32_t >::const_iterator &end, class_id_type &c, std::string &label, sub_index_type &subtypeIndex)

Public Attributes

ContainerProxy m_containerProxy
MemoryMgrMap m_memMgr

Protected Member Functions

MsgStream & msg () const
MsgStream & msg (const MSG::Level lvl) const
bool msgLvl (const MSG::Level lvl) const

Protected Attributes

const asg::AsgMessagingm_logger {0}
IConversionSvc * m_objectserializerSvc {0}
 pointer to object serializer
HLT::AccessProxym_storeGate {0}
 pointer to SG
bool m_readonly {false}
std::unique_ptr< ITypeProxy > m_aux

Private Member Functions

bool serializeDynVars (const SG::IAuxStoreIO &iio, const xAOD::AuxSelection &sel, std::vector< uint32_t > &dataBlob)
 Serialize all selected dynamic variables for an xAOD object.
bool deserializeDynVars (const std::vector< uint32_t > &dataBlob, size_t offs, SG::IAuxStore &store)
 Read dynamic auxiliary variables from a serialized buffer.
std::unique_ptr< SG::IAuxStoredeserializeDynVars (const std::vector< uint32_t > &dataBlob, size_t offs)
 Read dynamic auxiliary variables from a serialized buffer.
const std::type_info * getElementType (const std::string &tname, std::string &elementTypeName) const
 Find the type of an element of a vector.

Private Attributes

std::string m_key
std::string m_prefix
 prefix for key given to the objects
std::string m_label
 label given to the objects in this holder (labels given at attachFeature)
uint16_t m_subTypeIndex {0}
 index to notify how many objects of given type we have (we need to record it in case of slimming will be done latter)
int m_uniqueCounter {0}
ToolHandle< ITrigSerializerToolBasem_serializer
 Serializer tool; used for dynamic variables.

Detailed Description

template<class STORED, class CONTAINER>
class HolderImp< STORED, CONTAINER >

This is an implementation class for all Holders It is templated with 2 arguments STORED which is type of stored objects Another type is CONTAINER for that type.

Examples when it works are: HolderImp<A, DataVector > — typical HolderImp< A, Acontainer> > — as above, Acontainer is either typedef for DataVector or inherits from it HolderImp< DataVector, DataVector > — when both are of the same type HolderImp< Acontainer, Acontainer> > — as above

Definition at line 329 of file Holder.h.

Member Typedef Documentation

◆ base_type

template<class STORED, class CONTAINER>
typedef Holder<STORED> HLTNavDetails::HolderImp< STORED, CONTAINER >::base_type

Definition at line 331 of file Holder.h.

◆ container_type

template<class STORED, class CONTAINER>
typedef CONTAINER HLTNavDetails::HolderImp< STORED, CONTAINER >::container_type

Definition at line 333 of file Holder.h.

◆ ContainerProxy

template<class STORED, class CONTAINER>
typedef HLTNavDetails::TypeProxy<CONTAINER> HLTNavDetails::HolderImp< STORED, CONTAINER >::ContainerProxy

Definition at line 335 of file Holder.h.

◆ FeatureProxy

template<class STORED, class CONTAINER>
typedef HLTNavDetails::TypeProxy<STORED> HLTNavDetails::HolderImp< STORED, CONTAINER >::FeatureProxy

Definition at line 334 of file Holder.h.

◆ MemoryMgrMap

template<class STORED, class CONTAINER>
typedef std::multimap<HLT::TriggerElement::ObjectIndex, MemoryMgr> HLTNavDetails::HolderImp< STORED, CONTAINER >::MemoryMgrMap

Definition at line 400 of file Holder.h.

◆ stored_type

template<class STORED, class CONTAINER>
typedef STORED HLTNavDetails::HolderImp< STORED, CONTAINER >::stored_type

Definition at line 332 of file Holder.h.

Constructor & Destructor Documentation

◆ HolderImp() [1/2]

template<class STORED, class CONTAINER>
HLTNavDetails::HolderImp< STORED, CONTAINER >::HolderImp ( )

◆ HolderImp() [2/2]

template<class STORED, class CONTAINER>
HLTNavDetails::HolderImp< STORED, CONTAINER >::HolderImp ( const std::string & prefix,
const std::string & label,
uint16_t idx )

◆ ~HolderImp()

template<class STORED, class CONTAINER>
virtual HLTNavDetails::HolderImp< STORED, CONTAINER >::~HolderImp ( )
virtual

Member Function Documentation

◆ add()

template<class STORED, class CONTAINER>
virtual HLT::TriggerElement::ObjectIndex HLTNavDetails::HolderImp< STORED, CONTAINER >::add ( const STORED * f,
bool inSG = false,
const std::string & = "" )
virtual

adds object(s) to be holded

◆ ATLAS_NOT_THREAD_SAFE()

template<class STORED>
virtual HLT::TriggerElement::ObjectIndex add HLTNavDetails::Holder< STORED >::ATLAS_NOT_THREAD_SAFE ( const STORED * f,
bool inSG,
const std::string & = "" )
pure virtualinherited

saved object in this holder

◆ auxClidOrZero()

template<class STORED, class CONTAINER>
virtual CLID HLTNavDetails::HolderImp< STORED, CONTAINER >::auxClidOrZero ( ) const
virtual

◆ checkAndSetOwnership()

template<class STORED, class CONTAINER>
virtual bool HLTNavDetails::HolderImp< STORED, CONTAINER >::checkAndSetOwnership ( SG::OwnershipPolicy policy)
virtual

◆ clone()

template<class STORED, class CONTAINER>
virtual IHolder * HLTNavDetails::HolderImp< STORED, CONTAINER >::clone ( const std::string & prefix,
const std::string & label,
uint16_t idx ) const
virtual

◆ collectionName()

template<class STORED, class CONTAINER>
virtual const std::string & HLTNavDetails::HolderImp< STORED, CONTAINER >::collectionName ( ) const
inlinevirtual

returns the collection's name stored by this holder

Implements HLTNavDetails::IHolder.

Definition at line 384 of file Holder.h.

◆ containerClid()

template<class STORED, class CONTAINER>
virtual CLID HLTNavDetails::HolderImp< STORED, CONTAINER >::containerClid ( ) const
inlinevirtual

Implements HLTNavDetails::IHolder.

Definition at line 383 of file Holder.h.

◆ containerTypeProxy()

template<class STORED, class CONTAINER>
virtual const ITypeProxy & HLTNavDetails::HolderImp< STORED, CONTAINER >::containerTypeProxy ( ) const
inlinevirtual

Get the proxy for the container.

Implements HLTNavDetails::IHolder.

Definition at line 387 of file Holder.h.

387{ return m_containerProxy; }
ContainerProxy m_containerProxy
Definition Holder.h:398

◆ contains()

template<class STORED, class CONTAINER>
virtual bool HLTNavDetails::HolderImp< STORED, CONTAINER >::contains ( const STORED * obj,
HLT::TriggerElement::ObjectIndex & idx )
virtual

check if object(s) in dest are held by this holder

Implements HLTNavDetails::Holder< STORED >.

◆ deserializeDynVars() [1/2]

std::unique_ptr< SG::IAuxStore > IHolder::deserializeDynVars ( const std::vector< uint32_t > & dataBlob,
size_t offs )
privateinherited

Read dynamic auxiliary variables from a serialized buffer.

Parameters
dataBlobSerialized data.
offsOffset in dataBlob where dynamic variables start.
szNumber of elements in the xAOD container.

dataBlob should be formatted as described in the documentation for serializeDynVars starting at offs. Returns a new dynamic store.

Definition at line 451 of file Holder.cxx.

453{
454 StringSerializer ss;
455 SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
456
457 // New dynamic store.
458 auto store = std::make_unique<HLTNavDetails::TrigAuxStore>();
459
460 // Read through the buffer starting at @c offs.
461 std::vector<uint32_t>::const_iterator it = dataBlob.begin() + offs;
462 while (it < dataBlob.end()) {
463 // Read the attribute and type names from the buffer.
464 size_t name_size = *it++;
465 std::string name;
466 ss.deserialize (it, it+name_size, name);
467 it += name_size;
468
469 size_t tname_size = *it++;
470 std::string tname;
471 ss.deserialize (it, it+tname_size, tname);
472 it += tname_size;
473
474 // Object size.
475 size_t var_size = *it++;
476
477 const static char* const packed_pref = "SG::PackedContainer<";
478 const static unsigned int packed_preflen = strlen(packed_pref);
479 std::string vecname = tname;
480 if (strncmp (vecname.c_str(), packed_pref, packed_preflen) == 0) {
481 // Convert from SG::PackedContainer<T> to vector<T>.
482 // Also strip out a std::allocator<T> argument, but leave
483 // any other allocator.
484 auto makeRules = []() {
485 CxxUtils::ClassName::Rules rules;
486 rules.add ("SG::PackedContainer<$T, std::allocator<$T> >",
487 "vector<$T>");
488 rules.add ("SG::PackedContainer<$T, allocator<$T> >",
489 "vector<$T>");
490 rules.add ("SG::PackedContainer<$T, $ALLOC>",
491 "vector<$T, $ALLOC>");
492 return rules;
493 };
494 const static CxxUtils::ClassName::Rules rules = makeRules();
495 vecname = rules.apply (vecname);
496 }
497
498 // Handle schema evolution. If we're expecting a different
499 // type for the variable, then use that name instead.
500 SG::auxid_t id = r.findAuxID (name);
501 if (id != SG::null_auxid && stripStdVec(r.getVecTypeName(id)) != stripStdVec(vecname)) {
502 vecname = r.getVecTypeName (id);
503 tname = vecname;
504 }
505
506 // Handle the case where we don't have a registered type for this
507 // auxiliary variable.
508 if (id == SG::null_auxid)
509 {
510 std::string elementTypeName;
511 const std::type_info* elt_tinfo = getElementType (vecname, elementTypeName);
512 if (elt_tinfo)
513 id = SG::getDynamicAuxID (*elt_tinfo, name, elementTypeName, tname, false, SG::null_auxid);
514 if (id == SG::null_auxid) {
515 ATH_MSG_ERROR("deserialize aux dyn var failed; can't find auxid for:" << name);
516 return std::unique_ptr<SG::IAuxStore> (std::move(store));
517 }
518 }
519
520 // Read the object from the buffer.
521 std::vector<uint32_t> buf (it, it+var_size);
522 void* obj = m_serializer->deserialize (tname, buf);
523 it += var_size;
524
525 bool isPacked = (strncmp (tname.c_str(), packed_pref, packed_preflen) == 0);
526 std::unique_ptr<SG::IAuxTypeVector> vec
527 (r.makeVectorFromData (id, obj, nullptr, isPacked, true));
528 store->addVector (std::move(vec), false);
529 }
530
531 return std::unique_ptr<SG::IAuxStore> (std::move(store));
532}
#define ATH_MSG_ERROR(x)
std::vector< size_t > vec
static Double_t ss
std::string apply(const std::string &name) const
Apply transformations to a class name.
void add(const ClassName &pattern, const ClassName &replacement)
Add a new transformation rule.
ToolHandle< ITrigSerializerToolBase > m_serializer
Serializer tool; used for dynamic variables.
Definition Holder.h:248
const std::type_info * getElementType(const std::string &tname, std::string &elementTypeName) const
Find the type of an element of a vector.
Definition Holder.cxx:543
static AuxTypeRegistry & instance()
Return the singleton registry instance.
int r
Definition globals.cxx:22
TestStore store
Definition TestStore.cxx:23
static const auxid_t null_auxid
To signal no aux data item.
Definition AuxTypes.h:30
SG::auxid_t getDynamicAuxID(const std::type_info &ti, const std::string &name, const std::string &elementTypeName, const std::string &branch_type_name, bool standalone, SG::auxid_t linked_auxid)
Find the auxid for a dynamic branch.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27

◆ deserializeDynVars() [2/2]

bool IHolder::deserializeDynVars ( const std::vector< uint32_t > & dataBlob,
size_t offs,
SG::IAuxStore & store )
privateinherited

Read dynamic auxiliary variables from a serialized buffer.

Parameters
dataBlobSerialized data.
offsOffset in dataBlob where dynamic variables start.
[out]storeAuxiliary store for the object being read.

dataBlob should be formatted as described in the documentation for serializeDynVars starting at offs. store should be convertable to IAuxStoreHolder. A new dynamic store will be created and registered with store via setStore.

Returns true on success, false on failure.

Definition at line 404 of file Holder.cxx.

407{
408 SG::IAuxStoreHolder* holder = dynamic_cast<SG::IAuxStoreHolder*> (&store);
409 if (!holder) {
410 ATH_MSG_ERROR("deserialize aux dyn vars failed: can't convert to IAuxStoreHolder.");
411 return false;
412 }
413
414 std::unique_ptr<SG::IAuxStore> newstore = deserializeDynVars (dataBlob, offs);
415 if (!newstore) return false;
416 holder->setStore (newstore.release());
417 return true;
418}
bool deserializeDynVars(const std::vector< uint32_t > &dataBlob, size_t offs, SG::IAuxStore &store)
Read dynamic auxiliary variables from a serialized buffer.
Definition Holder.cxx:404
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.

◆ deserializePayload()

bool HLTNavDetails::IHolder::deserializePayload ( const std::vector< uint32_t > & dataBlob,
int version )
inherited

deserialization of holder payload

Definition at line 147 of file Holder.cxx.

147 {
148 const std::string sgkey = key();
149 ::HLT::class_id_type feature_clid = typeClid();
150 ::HLT::class_id_type container_clid = containerClid();
151 const std::string container_typename = collectionName();
152
153 if ( m_storeGate->transientContains(container_clid, sgkey) ) {
154 ATH_MSG_VERBOSE("deserialize: while working on: " << container_typename << " and key: " << sgkey
155 << " from serialized form found it in SG already, sync with it");
156 syncWithSG();
157 }
158
159 ATH_MSG_VERBOSE("deserializing a data blob of size " << dataBlob.size() << " navi version is " << version);
160 ATH_MSG_DEBUG("holder type clid " << feature_clid<< " collection clid: " << container_clid);
161
162 if (container_clid<1){
163 ATH_MSG_WARNING("holder type clid " << feature_clid << " collection clid: " << container_clid);
164 }
165
166 typedef std::vector<uint32_t>::const_iterator it_type;
167 it_type it = std::begin(dataBlob);
168
169 if(!dataBlob.size()) return false;
170
171 std::vector<uint32_t> first, second;
172
173 if(version == 4){
174 auto firstsize = *(it++);
175 ATH_MSG_VERBOSE("first part has size: " << firstsize);
176
177 first = std::vector<uint32_t>(it,it+firstsize);
178
179 std::advance(it,firstsize);
180
181 if(!(it!=dataBlob.end())){
182 ATH_MSG_VERBOSE("this datablob only has a first part (non xAOD case)");
183 }
184 else{
185 auto secondsize = *(it++);
186 ATH_MSG_VERBOSE("second part has size: " << secondsize);
187 second = std::vector<uint32_t>(it,it+secondsize);
188 std::advance(it,secondsize);
189 }
190 }
191 else{
192 first = std::vector<uint32_t>(dataBlob.begin(),dataBlob.end());
193 }
194
195 TrigStreamAddress addr(container_clid, sgkey, "", 0, 0);
196 addr.add(first);
197 DataObject* dobj(0);
198
199 if (m_objectserializerSvc->createObj(&addr, dobj).isFailure() ){
200 ATH_MSG_WARNING("deserialize main: failed");
201 return false;
202 }
203
204 bool setcontainer = setDataObject(dobj);
205 if (DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (dobj)) {
206 dbb->relinquish();
207 delete dbb;
208 }
209 if(!setcontainer) return false;
210
211 DataObject* dobjaux(0);
212 if(!second.empty()){
213 std::string sgkeyaux = sgkey+"Aux.";
214 ATH_MSG_VERBOSE("aux clid was deduced to be: " << auxClidOrZero());
215 TrigStreamAddress auxaddr(auxClidOrZero(), sgkeyaux, "", 0, 0);
216 auxaddr.add(second);
217
218 if (m_objectserializerSvc->createObj(&auxaddr, dobjaux).isFailure() ){
219 ATH_MSG_WARNING("Aux Store deserialization failed");
220 return false;
221 }
222
223 // Handle dynamic variables.
224 if (it != dataBlob.end()) {
225 DataBucketBase* dobjBaseAux = static_cast<DataBucketBase*>(dobjaux);
226
227 SG::IAuxStore* istore = nullptr;
228 if (xAOD::AuxContainerBase* auxstore =
229 dobjBaseAux->template cast<xAOD::AuxContainerBase> (nullptr, false))
230 {
231 istore = auxstore;
232 }
233
234 if (!istore || !deserializeDynVars (dataBlob,
235 it - dataBlob.begin(),
236 *istore))
237 {
238 ATH_MSG_WARNING("Aux Store dynamic var deserialization failed");
239 return false;
240 }
241 }
242
243 bool setaux = setAuxDataObject(dobjaux);
244 if (DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (dobjaux)) {
245 dbb->relinquish();
246 delete dbb;
247 }
248 if(!setaux) return false;
249 }
250 return true;
251}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
virtual const std::string & key() const =0
returns the containers StoreGate key
virtual CLID containerClid() const =0
virtual bool syncWithSG(SG::OwnershipPolicy policy=SG::OWN_ELEMENTS)=0
virtual bool setDataObject(DataObject *dobj)=0
HLT::AccessProxy * m_storeGate
pointer to SG
Definition Holder.h:164
virtual CLID auxClidOrZero() const =0
IConversionSvc * m_objectserializerSvc
pointer to object serializer
Definition Holder.h:163
virtual CLID typeClid() const =0
returns the CLID of objects stores by this holder
virtual const std::string & collectionName() const =0
returns the collection's name stored by this holder
virtual bool setAuxDataObject(DataObject *dobjaux)=0
bool first
Definition DeMoScan.py:534
sgkey(tool)
Definition common.py:1027

◆ enquireSerialized()

bool BaseHolder::enquireSerialized ( std::vector< uint32_t >::const_iterator & fromHere,
const std::vector< uint32_t >::const_iterator & end,
class_id_type & c,
std::string & label,
sub_index_type & subtypeIndex )
staticinherited

Definition at line 12 of file BaseHolder.cxx.

15 {
16 using namespace std;
17 if ( fromHere == end ) return false;
18
19 c = *fromHere++;
20 if ( fromHere == end ) return false;
21
22 subtypeIndex = *fromHere++;
23 if ( fromHere == end ) return false;
24
25 unsigned labelSize = *fromHere++;
26 if ( fromHere == end ) return false;
27 if ( fromHere+labelSize > end ) return false;
28
29 std::vector<uint32_t>::const_iterator stringEnd = fromHere+labelSize;
30 HLT::StringSerializer::deserialize(fromHere, stringEnd, label);
31
32 //advance iterator to end of label
33 std::advance(fromHere,labelSize);
34
35 return true;
36}
virtual const std::string & label() const =0
std::size_t deserialize(std::vector< uint32_t >::const_iterator first, std::vector< uint32_t >::const_iterator last, std::vector< std::string > &strings)

◆ generateAliasKey()

std::string IHolder::generateAliasKey ( CLID c,
uint16_t sti,
const std::string & label,
unsigned size )
inherited

Definition at line 97 of file Holder.cxx.

97 {
98 std::ostringstream ss;
99 ss << "HLTAutoKey_" << label << "_" << c << "_" << sti << "_" << (size == 0xffffffff ? "back" : "to") << "_" << m_uniqueCounter;
100 std::string st = ss.str();
101 ATH_MSG_DEBUG("IHolder::generateAliasKey generated key: " << st);
103 return st;
104}
const std::string & label() const
returns the label of objects stores by this holder
Definition Holder.h:86

◆ get() [1/3]

template<class STORED>
template<class CONTAINER2>
bool HLTNavDetails::Holder< STORED >::get ( ElementLinkVector< CONTAINER2 > & cont)
inherited

◆ get() [2/3]

template<class STORED>
template<class CONTAINER2>
bool HLTNavDetails::Holder< STORED >::get ( ElementLinkVector< CONTAINER2 > & cont,
HLT::TriggerElement::ObjectIndex idx )
inherited

◆ get() [3/3]

template<class STORED, class CONTAINER>
virtual bool HLTNavDetails::HolderImp< STORED, CONTAINER >::get ( const STORED *& dest,
HLT::TriggerElement::ObjectIndex idx )
virtual

gets object(s) holded

Implements HLTNavDetails::Holder< STORED >.

◆ getAuxDataObject()

template<class STORED, class CONTAINER>
virtual DataObject * HLTNavDetails::HolderImp< STORED, CONTAINER >::getAuxDataObject ( )
virtual

◆ getDataObject()

template<class STORED, class CONTAINER>
virtual DataObject * HLTNavDetails::HolderImp< STORED, CONTAINER >::getDataObject ( )
virtual

◆ getElementLinks() [1/2]

template<class STORED, class CONTAINER>
bool HLTNavDetails::HolderImp< STORED, CONTAINER >::getElementLinks ( ElementLinkVector< CONTAINER > & cont)

◆ getElementLinks() [2/2]

template<class STORED, class CONTAINER>
bool HLTNavDetails::HolderImp< STORED, CONTAINER >::getElementLinks ( ElementLinkVector< CONTAINER > & cont,
HLT::TriggerElement::ObjectIndex idx )

◆ getElementType()

const std::type_info * IHolder::getElementType ( const std::string & tname,
std::string & elementTypeName ) const
privateinherited

Find the type of an element of a vector.

Parameters
tnameThe name of the type to analyze.
[out[elementTypeName The name of the type of an element of the vector.

Returns the type_info for an element of the vector.

Parameters
tname_inThe name of the type to analyze.
[out]elementTypeNameThe name of the type of an element of the vector.

Returns the type_info for an element of the vector.

Definition at line 543 of file Holder.cxx.

545{
546 TClass* cls = TClass::GetClass (tname.c_str());
547 if (!cls) return nullptr;
548 TVirtualCollectionProxy* prox = cls->GetCollectionProxy();
549 if (!prox) return nullptr;
550 if (prox->GetValueClass()) {
551 elementTypeName = prox->GetValueClass()->GetName();
552 return prox->GetValueClass()->GetTypeInfo();
553 }
554 RootUtils::Type typ (prox->GetType());
555 elementTypeName = typ.getTypeName();
556 return typ.getTypeInfo();
557}

◆ getNextKey()

template<class STORED, class CONTAINER>
virtual std::string HLTNavDetails::HolderImp< STORED, CONTAINER >::getNextKey ( )
virtual

◆ getUniqueKey()

template<class STORED, class CONTAINER>
virtual std::string HLTNavDetails::HolderImp< STORED, CONTAINER >::getUniqueKey ( )
virtual

◆ getWithLink() [1/2]

template<class STORED>
template<class CONTAINER2>
bool HLTNavDetails::Holder< STORED >::getWithLink ( typename set_link< STORED, CONTAINER2, std::is_same< STORED, CONTAINER2 >::value >::type & link,
HLT::TriggerElement::ObjectIndex & idx )
inlineinherited

Definition at line 306 of file Holder.h.

307 {
308
309 bool result = static_cast<HolderImp<STORED,CONTAINER2>*>(this)->getWithLink(link,idx);
310 return result;
311 }
bool getWithLink(typename set_link< STORED, CONTAINER2, std::is_same< STORED, CONTAINER2 >::value >::type &link, HLT::TriggerElement::ObjectIndex &idx)
Definition Holder.h:306

◆ getWithLink() [2/2]

template<class STORED, class CONTAINER>
bool HLTNavDetails::HolderImp< STORED, CONTAINER >::getWithLink ( typename set_link< STORED, CONTAINER, std::is_same< STORED, CONTAINER >::value >::type & link,
HLT::TriggerElement::ObjectIndex & idx )

◆ key()

template<class STORED, class CONTAINER>
virtual const std::string & HLTNavDetails::HolderImp< STORED, CONTAINER >::key ( ) const
inlinevirtual

returns the containers StoreGate key

Implements HLTNavDetails::IHolder.

Definition at line 373 of file Holder.h.

373{ return m_key; }
std::string m_key
Definition Holder.h:404

◆ label()

const std::string & HLTNavDetails::IHolder::label ( ) const
inlinevirtualinherited

returns the label of objects stores by this holder

Implements HLT::BaseHolder.

Definition at line 86 of file Holder.h.

86{ return m_label; }
std::string m_label
label given to the objects in this holder (labels given at attachFeature)
Definition Holder.h:243

◆ msg() [1/2]

MsgStream & HLTNavDetails::IHolder::msg ( ) const
inlineprotectedinherited

Definition at line 170 of file Holder.h.

170{ return m_logger->msg(); }
const asg::AsgMessaging * m_logger
Definition Holder.h:162

◆ msg() [2/2]

MsgStream & HLTNavDetails::IHolder::msg ( const MSG::Level lvl) const
inlineprotectedinherited

Definition at line 171 of file Holder.h.

171{ return msg() << lvl; }
MsgStream & msg() const
Definition Holder.h:170

◆ msgLvl()

bool HLTNavDetails::IHolder::msgLvl ( const MSG::Level lvl) const
inlineprotectedinherited

Definition at line 172 of file Holder.h.

172{ return msg().level() <= lvl; }

◆ prefix()

virtual const std::string & HLTNavDetails::IHolder::prefix ( ) const
inlinevirtualinherited

returns the containers StoreGate prefix

Definition at line 91 of file Holder.h.

91{ return m_prefix; }
std::string m_prefix
prefix for key given to the objects
Definition Holder.h:242

◆ prepare()

template<class STORED, class CONTAINER>
virtual void HLTNavDetails::HolderImp< STORED, CONTAINER >::prepare ( const asg::AsgMessaging & logger,
HLT::AccessProxy * sg,
IConversionSvc * objSerializer,
bool readonly = false )
virtual

prepares this holder by setting messaging, StoreGate access and providing serializer

Reimplemented from HLTNavDetails::IHolder.

◆ print()

template<class STORED, class CONTAINER>
virtual void HLTNavDetails::HolderImp< STORED, CONTAINER >::print ( MsgStream & m) const
virtual

Reimplemented from HLTNavDetails::IHolder.

◆ serialize()

template<class STORED, class CONTAINER>
virtual bool HLTNavDetails::HolderImp< STORED, CONTAINER >::serialize ( std::vector< uint32_t > & output) const
virtual

serializes this Holder

Reimplemented from HLTNavDetails::IHolder.

◆ serializeDynVars()

bool IHolder::serializeDynVars ( const SG::IAuxStoreIO & iio,
const xAOD::AuxSelection & sel,
std::vector< uint32_t > & dataBlob )
privateinherited

Serialize all selected dynamic variables for an xAOD object.

Parameters
iioThe auxiliary store for the xAOD object.
selSelection object for variables to write.
[out]dataBlobSerialized data.

Returns true on success, false on failure.

Each selected dynamic variable is concatenated to dataBlob as follows.

  • Length serialized name data (1 word).
  • Serialized name data.
  • Length of serialized type name (1 word).
  • Serialized type name data.
  • Length of serialized variable data (1 word).
  • Serialized data for the variable, as produced by TrigTSerializer.

Definition at line 344 of file Holder.cxx.

347{
348 // Loop over all selected variables.
349 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
350 SG::auxid_set_t auxids = sel.getSelectedAuxIDs (iio.getDynamicAuxIDs());
351 for (SG::auxid_t id : auxids) {
352 // Get the TClass of the object being saved.
353 const std::type_info* tinfo = iio.getIOType (id);
354 if (!tinfo) {
355 ATH_MSG_ERROR("serialize aux dyn vars failed: can't get type_info.");
356 return false;
357 }
358 TClass* cls = TClass::GetClass (*tinfo);
359 if (!cls) {
360 ATH_MSG_ERROR("serialize aux dyn vars failed: can't get TClass.");
361 return false;
362 }
363
364 // Serialize the object data to a temp buffer.
365 std::vector<uint32_t> serialized =
366 m_serializer->serialize (cls->GetName(), iio.getIOData (id));
367
368 // Concatenate header header information to the output buffer:
369 // attribute name and data type.
370 StringSerializer ss;
371 std::vector<uint32_t> serializedName;
372 ss.serialize (r.getName(id), serializedName); // FIXME: handle class part?
373 dataBlob.push_back (serializedName.size());
374 dataBlob.insert(dataBlob.end(), serializedName.begin(), serializedName.end());
375
376 std::vector<uint32_t> serializedType;
377 ss.serialize (cls->GetName(), serializedType);
378 dataBlob.push_back (serializedType.size());
379 dataBlob.insert(dataBlob.end(), serializedType.begin(), serializedType.end());
380
381 // Add the object data itself to the output buffer.
382 dataBlob.push_back (serialized.size());
383 dataBlob.insert(dataBlob.end(), serialized.begin(), serialized.end());
384 }
385
386 return true;
387}
virtual const std::type_info * getIOType(SG::auxid_t auxid) const =0
Return the type of the data to be stored for one aux data item.
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
virtual const SG::auxid_set_t & getDynamicAuxIDs() const =0
Get the list of all dynamically created variables.

◆ serializePayload()

bool HLTNavDetails::IHolder::serializePayload ( std::vector< uint32_t > & dataBlob,
const xAOD::AuxSelection & sel )
inherited

serializes the payload of this Holder

Definition at line 253 of file Holder.cxx.

254 {
255 DataObject* dobj = getDataObject();
256
257 if(!dobj){
258 ATH_MSG_WARNING("data object points to null. can't serialize");
259 }
260
261 ATH_MSG_VERBOSE("creating serialized representation for " << dobj);
262
263
264 TrigStreamAddress* addr(0);
265 if ( m_objectserializerSvc->createRep(dobj, *pp_cast<IOpaqueAddress>(&addr) ).isSuccess() ) {
266 ATH_MSG_VERBOSE("serialization of feature (object) successful, blob size: " << addr->get().size());
267 dataBlob.push_back(addr->get().size());
268 dataBlob.insert(dataBlob.end(), addr->get().begin(), addr->get().end());
269 // above should be optimized (need to know if in case of failed serialization addr->get() contains empty data vector)
270 }
271 else{
272 ATH_MSG_ERROR("Container serialization Failure");
273 return false;
274 }
275 DataBucketBase* dobjBase = static_cast<DataBucketBase*>(dobj);
276 if ( dobjBase ) {
277 dobjBase->relinquish();
278 ATH_MSG_VERBOSE("serialization giving up the ownership");
279 }
280 delete dobj;
281 delete addr;
282
283 DataObject* dobjaux = getAuxDataObject();
284
285 ATH_MSG_VERBOSE("aux object: " << dobjaux);
286
287 TrigStreamAddress* auxaddr(0);
288 if(dobjaux){
289 ATH_MSG_VERBOSE("AuxStore serialization");
290 if(m_objectserializerSvc->createRep(dobjaux,*pp_cast<IOpaqueAddress>(&auxaddr) ).isSuccess() ){
291 ATH_MSG_VERBOSE("aux conversion success! aux blob has size: " << auxaddr->get().size());
292 dataBlob.push_back(auxaddr->get().size());
293 dataBlob.insert(dataBlob.end(), auxaddr->get().begin(), auxaddr->get().end());
294 }
295 else{
296 ATH_MSG_ERROR("AuxStore serialization Failure");
297 return false;
298 }
299 DataBucketBase* dobjBaseAux = static_cast<DataBucketBase*>(dobjaux);
300
301 const SG::IAuxStoreIO* iio = nullptr;
302 if (const xAOD::AuxContainerBase* auxstore =
303 dobjBaseAux->template cast<xAOD::AuxContainerBase> (nullptr, true))
304 {
305 iio = auxstore;
306 }
307
308 dobjBaseAux->relinquish();
309 ATH_MSG_VERBOSE("serialization giving up the ownership of Aux");
310 delete dobjaux;
311 delete auxaddr;
312
313 // Handle dynamic variables.
314 if (iio) {
315 if (!serializeDynVars (*iio, sel, dataBlob)) {
316 ATH_MSG_ERROR("Serialization of dynamic aux variables failed.");
317 return false;
318 }
319 }
320 }
321 ATH_MSG_VERBOSE("finished serializing payload. size: " << dataBlob.size());
322
323 return true;
324}
virtual void relinquish()=0
Give up ownership of the DataBucket contents.
virtual DataObject * getAuxDataObject()=0
bool serializeDynVars(const SG::IAuxStoreIO &iio, const xAOD::AuxSelection &sel, std::vector< uint32_t > &dataBlob)
Serialize all selected dynamic variables for an xAOD object.
Definition Holder.cxx:344
virtual DataObject * getDataObject()=0

◆ serializeWithPayload()

bool IHolder::serializeWithPayload ( const xAOD::AuxSelection & sel,
std::vector< uint32_t > & output,
size_t & payloadsize )
inherited

serializes this Holder including payload

Definition at line 78 of file Holder.cxx.

80 {
81 bool header_ser = serialize(output);
82 if(!header_ser){
83 ATH_MSG_ERROR(" header serialization failed ");
84 return false;
85 }
86 std::vector<uint32_t> payload;
87 bool payload_ser = serializePayload(payload, sel);
88 if(!payload_ser){
89 ATH_MSG_ERROR(" payload serialization failed ");
90 return false;
91 }
92 payloadsize = payload.size();
93 output.insert(output.end(), payload.begin(), payload.end());
94 return true;
95}
virtual bool serialize(std::vector< uint32_t > &output) const
serializes this Holder
Definition Holder.cxx:61
bool serializePayload(std::vector< uint32_t > &dataBlob, const xAOD::AuxSelection &sel)
serializes the payload of this Holder
Definition Holder.cxx:253
output
Definition merge.py:16

◆ setAuxDataObject()

template<class STORED, class CONTAINER>
virtual bool HLTNavDetails::HolderImp< STORED, CONTAINER >::setAuxDataObject ( DataObject * dobjaux)
virtual

◆ setDataObject()

template<class STORED, class CONTAINER>
virtual bool HLTNavDetails::HolderImp< STORED, CONTAINER >::setDataObject ( DataObject * dobj)
virtual

◆ subTypeIndex()

uint16_t HLTNavDetails::IHolder::subTypeIndex ( ) const
inlinevirtualinherited

returns the index (short number used when linking object to the TE) of objects stores by this holder

Implements HLT::BaseHolder.

Definition at line 112 of file Holder.h.

112{ return m_subTypeIndex; }
uint16_t m_subTypeIndex
index to notify how many objects of given type we have (we need to record it in case of slimming will...
Definition Holder.h:244

◆ syncWithSG()

template<class STORED, class CONTAINER>
virtual bool HLTNavDetails::HolderImp< STORED, CONTAINER >::syncWithSG ( SG::OwnershipPolicy policy = SG::OWN_ELEMENTS)
virtual

◆ typeClid()

template<class STORED, class CONTAINER>
virtual CLID HLTNavDetails::HolderImp< STORED, CONTAINER >::typeClid ( ) const
inlinevirtual

returns the CLID of objects stores by this holder

Implements HLTNavDetails::IHolder.

Definition at line 381 of file Holder.h.

381{ return ClassID_traits<STORED>::ID(); }

◆ typeName()

template<class STORED, class CONTAINER>
virtual const std::string & HLTNavDetails::HolderImp< STORED, CONTAINER >::typeName ( ) const
inlinevirtual

returns the object's name stored by this holder

Implements HLTNavDetails::IHolder.

Definition at line 382 of file Holder.h.

Member Data Documentation

◆ m_aux

std::unique_ptr<ITypeProxy> HLTNavDetails::IHolder::m_aux
protectedinherited

Definition at line 167 of file Holder.h.

◆ m_containerProxy

template<class STORED, class CONTAINER>
ContainerProxy HLTNavDetails::HolderImp< STORED, CONTAINER >::m_containerProxy

Definition at line 398 of file Holder.h.

◆ m_key

template<class STORED, class CONTAINER>
std::string HLTNavDetails::HolderImp< STORED, CONTAINER >::m_key
private

Definition at line 404 of file Holder.h.

◆ m_label

std::string HLTNavDetails::IHolder::m_label
privateinherited

label given to the objects in this holder (labels given at attachFeature)

Definition at line 243 of file Holder.h.

◆ m_logger

const asg::AsgMessaging* HLTNavDetails::IHolder::m_logger {0}
protectedinherited

Definition at line 162 of file Holder.h.

162{0};

◆ m_memMgr

template<class STORED, class CONTAINER>
MemoryMgrMap HLTNavDetails::HolderImp< STORED, CONTAINER >::m_memMgr

Definition at line 401 of file Holder.h.

◆ m_objectserializerSvc

IConversionSvc* HLTNavDetails::IHolder::m_objectserializerSvc {0}
protectedinherited

pointer to object serializer

Definition at line 163 of file Holder.h.

163{0};

◆ m_prefix

std::string HLTNavDetails::IHolder::m_prefix
privateinherited

prefix for key given to the objects

Definition at line 242 of file Holder.h.

◆ m_readonly

bool HLTNavDetails::IHolder::m_readonly {false}
protectedinherited

Definition at line 166 of file Holder.h.

166{false};

◆ m_serializer

ToolHandle<ITrigSerializerToolBase> HLTNavDetails::IHolder::m_serializer
privateinherited

Serializer tool; used for dynamic variables.

Definition at line 248 of file Holder.h.

◆ m_storeGate

HLT::AccessProxy* HLTNavDetails::IHolder::m_storeGate {0}
protectedinherited

pointer to SG

Definition at line 164 of file Holder.h.

164{0};

◆ m_subTypeIndex

uint16_t HLTNavDetails::IHolder::m_subTypeIndex {0}
privateinherited

index to notify how many objects of given type we have (we need to record it in case of slimming will be done latter)

Definition at line 244 of file Holder.h.

244{0};

◆ m_uniqueCounter

int HLTNavDetails::IHolder::m_uniqueCounter {0}
privateinherited

Definition at line 245 of file Holder.h.

245{0};

The documentation for this class was generated from the following file: