ATLAS Offline Software
Loading...
Searching...
No Matches
NavigationCore.h
Go to the documentation of this file.
1// Emacs -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5*/
6
7
8#ifndef TRIGNAVIGATION_HLTNAVIGATIONCORE_H
9#define TRIGNAVIGATION_HLTNAVIGATIONCORE_H
10
11#include <stdint.h>
12#include <set>
13#include <sstream>
14#include <iostream>
15
16#include "GaudiKernel/ClassID.h"
17#include "GaudiKernel/MsgStream.h"
18#include "GaudiKernel/ServiceHandle.h"
19
25
27
30
35
36
38
41
42namespace HLT {
43 namespace TrigNavTools {
44 struct SlimmingHelper;
45 }
46
94
95
97 friend class ::TrigNavigationThinningSvc;
99 friend class ::TrigBStoxAODTool;
100 public:
105 virtual ~NavigationCore() = default;
106
110 virtual void prepare();
114 virtual void reset(bool inFinalize = false);
115
138 virtual bool serialize( std::vector<uint32_t>& output) const;
139 bool serialize( std::vector<uint32_t>& output, std::vector<unsigned int>& cuts ) const;
140 bool serialize( std::vector<uint32_t>& output, std::vector<unsigned int>& cuts, std::vector<std::pair<CLID, std::string> >& clid_name) const;
141 bool serialize_DSonly( std::vector<uint32_t>& output, std::vector<unsigned int>& cuts, std::vector<std::pair<CLID, std::string> >& clid_name) const;
142 bool deserialize( const std::vector<uint32_t>& input );
143
158
159
171 template<class T>
172 bool getFeatures( const TriggerElement* te, std::vector< const T*>& features, const std::string& label="",
173 std::map<const T*, std::string>* labels=0 ) const;
174
175 template<class T>
176 bool getFeature( const TriggerElement* te, const T*& features, const std::string& label="", std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
177
178 template<class T>
179 bool getFeature( const TriggerElement* te,
180 const ConstDataVector<T>*& features,
181 const std::string& label="", std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
182
183 template<class T>
184 const T* featureLink2Object( const TrigFeatureLink& ) const;
185
186 template<class T>
188 const T* obj) const;
189
190
191 template<class C>
193 const typename Container2Object<C>::type * obj,
194 const C* container) const;
195
196 //const TriggerElement* te, const T*& features, const std::string& label="", std::string& sourcelabel = m_unspecifiedLabel);
197
198
199 template<class C, class T>
200 bool getFeaturesLinks( const TriggerElement* te, ElementLinkVector<C>& links, const std::string& label="") const;
201
202
203
217 template<class T>
219 std::vector< const T*>& features, const std::string& label="",
220 std::map<const T*, std::string>* labels=0 ) const;
221
222 template<class T>
224 const T*& feature, const std::string& label="",
225 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
226 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel ) const;
227
228 template<class LinkType>
230 LinkType& link, const std::string& label="",
231 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
232 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
233
234 template<class C, class T>
236 ElementLinkVector<C>& links, const std::string& label="" ) const;
237
238 template<class C, class T>
240 ElementLink<C>& link, const std::string& label="",
241 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
242 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel ) const;
243
244
245
260
261
262 virtual bool getFeatureAccessors( const TriggerElement* te, class_id_type clid,
263 const index_or_label_type& index_or_label,
264 bool only_single_feature,
266 bool travel_backward_recursively,
267 const TriggerElement*& source = m_unspecifiedTE,
268 std::string& sourcelabel = m_unspecifiedLabel) const;
269
270
271 virtual bool getFeatureAccessorsSingleTE( const TriggerElement* te, CLID clid,
272 const index_or_label_type& index_or_label,
273 bool only_single_feature,
275 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
276 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
277
278
290 template<class T> bool getFeaturesInRoI( const TriggerElement* te, std::vector<const T*>& features,
291 const std::string& label="", std::map<const T*, std::string>* labels=0 ) const;
292
293
301 template<class C, class T> bool getAllFeatures( ElementLinkVector<C>& features, const std::string& label="" ) const;
302
303
304
308 template<class T, class C> static void registerFeatureContainer();
309
310
311
315 bool merge(const NavigationCore& l2);
316
322 static uint32_t string2hash( const std::string&, const std::string& category="TE" );
323
324
328 void getAllOfType ( const std::string& id,
329 std::vector< HLT::TriggerElement* >& output,
330 const bool activeOnly=true) const;
331
333
338 return m_storeGate;
339 }
340
341 template<class T> HLTNavDetails::Holder<T>* getHolder ( uint16_t subTypeIndex ) const;
343 protected:
345
346 // private stuff of Navigation class
347
348
349 bool createHolder ( HLTNavDetails::IHolder*& holder, CLID clid, const std::string& label, uint16_t idx ) const;
350 bool registerHolder ( HLTNavDetails::IHolder* holder );
351
352 template<class T> HLTNavDetails::Holder<T>* getHolder ( const std::string& label, uint16_t suggestedIndex ) const;
353
354 HLTNavDetails::IHolder* getHolder ( CLID clid, uint16_t subTypeIndex ) const;
355 HLTNavDetails::IHolder* getHolder ( CLID clid, const std::string& label ) const;
356
357
361 bool addOneLevel(std::vector< std::vector<TriggerElement*> >& currentCombs,
362 std::vector< std::vector<std::pair<unsigned int, unsigned int> > >& currentIdxs,
363 unsigned int type,
364 std::vector< std::vector<TriggerElement*> >& newCombs,
365 std::vector< std::vector<std::pair<unsigned int, unsigned int> > >& newIdxs,
366 unsigned int maxResults = 1000, bool onlyActive = 1);
367
368
369 IConversionSvc* m_serializerSvc;
371 std::string m_objectsKeyPrefix;
373
374
376
377 struct CSPair
378 {
379 CSPair (CLID clid, const std::string& key, xAOD::AuxSelection&& the_sel)
380 : first (clid), second (key), sel (std::move (the_sel))
381 {
382 }
384 std::string second;
386 };
387
388 std::vector<std::string> m_classesToPayloadProperty;
389 std::vector<CSPair> m_classesToPayload;
390
391 std::vector<std::string> m_classesToPayloadProperty_DSonly;
392 std::vector<CSPair> m_classesToPayload_DSonly;
393
394 std::vector<std::string> m_classesFromPayloadIgnoreProperty;
395
396 std::vector<std::string> m_classesToPreregisterProperty;
397 std::vector<CSPair> m_classesToPreregister;
398
399 uint16_t nextSubTypeIndex(CLID clid, const std::string&label) const;
400
401 bool extractBlob(const std::vector<uint32_t>& input,
402 std::vector<uint32_t>::const_iterator& it,
403 std::vector<uint32_t>& blob) const ;
404
405 private:
407
408 // Adapters so we can use ATH_MSG macros
409 MsgStream& msg() const { return m_logger.msg(); }
410 MsgStream& msg(const MSG::Level lvl) const { return msg() << lvl; }
411 bool msgLvl(const MSG::Level lvl) const { return msg().level() <= lvl; }
412
413 HLTNavDetails::IHolder* prepareOneHolder(CLID clid, const std::string& label);
414
415 bool serializeWithHolderSection(const std::vector<uint32_t>& holderdata, const std::vector<unsigned int>& holderblobsizes,
416 std::vector<uint32_t>& output,std::vector<unsigned int>& cuts ,std::vector<std::pair<CLID, std::string> >& clid_name) const;
417
418 bool serializeHoldersWithoutPayload(const std::vector<HLTNavDetails::IHolder*>& holders, std::vector<uint32_t>& output, std::vector<uint32_t>& holderblobsizes,std::vector<std::pair<CLID, std::string> >& clid_name) const;
419
420 bool serializeHoldersWithPayload(const std::vector<CSPair>& payload, std::vector<uint32_t>& output, std::vector<uint32_t>& holderblobsizes,
421 std::vector<std::pair<CLID, std::string> >& clid_name) const;
422
423 };
424
425 MsgStream& operator<< ( MsgStream& m, const NavigationCore& nav ); //<! printing helper
426
427} // eof namespace
428
429#endif //#ifndef HLTNAVIGATION_H
An STL vector of pointers that by default owns its pointed-to elements.
uint32_t CLID
The Class ID type.
DataVector adapter that acts like it holds const pointers.
ElementLinkVector implementation for standalone ROOT.
bool registerHolder(HLTNavDetails::IHolder *holder)
NavigationCore(const AthAlgTool &logger)
constructor with parent AlgTool for printing
bool getFeaturesLinks(const TriggerElement *te, ElementLinkVector< C > &links, const std::string &label="") const
const T * featureLink2Object(const TrigFeatureLink &) const
ITrigHolderFactory * m_holderfactory
std::vector< std::string > m_classesFromPayloadIgnoreProperty
list of classes::keys to ignore on deserialization
bool getFeature(const TriggerElement *te, const ConstDataVector< T > *&features, const std::string &label="", std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
uint16_t nextSubTypeIndex(CLID clid, const std::string &label) const
bool extractBlob(const std::vector< uint32_t > &input, std::vector< uint32_t >::const_iterator &it, std::vector< uint32_t > &blob) const
static void registerFeatureContainer()
Specialized by type and container for this type.
const AthAlgTool & m_logger
std::vector< CSPair > m_classesToPayload_DSonly
classess are put to payload according to that priority list (CLID + key)
static uint32_t string2hash(const std::string &, const std::string &category="TE")
convert strin g to hash.
bool getFeaturesInRoI(const TriggerElement *te, std::vector< const T * > &features, const std::string &label="", std::map< const T *, std::string > *labels=0) const
retrieve features attached to the RoIs seeding this TriggerElement
HLTNavDetails::Holder< T > * getHolder(uint16_t subTypeIndex) const
as above but does not create holder on demand (return 0 if not found)
virtual void reset(bool inFinalize=false)
resets all the navigation, goes to the factory and asks to withdraw all produced objects
IConversionSvc * m_serializerSvc
TrigFeatureLink object2FeatureLink(const TriggerElement *te, const std::string &label, const typename Container2Object< C >::type *obj, const C *container) const
virtual bool serialize(std::vector< uint32_t > &output) const
method serizlizes the navigation structure The structure is serrizlized in following order ....
MemoryManagement
defines 3 possible origins of the objects which are attached to TEs This should be used like this:
bool getRecentFeatureDataOrElementLink(const TriggerElement *te, LinkType &link, const std::string &label="", const TriggerElement *&source=::HLT::TrigNavStructure::m_unspecifiedTE, std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
unsigned m_objectsIndexOffset
small integer used to generate sub type index
virtual bool getFeatureAccessorsSingleTE(const TriggerElement *te, CLID clid, const index_or_label_type &index_or_label, bool only_single_feature, TriggerElement::FeatureVec &features, const TriggerElement *&source=::HLT::TrigNavStructure::m_unspecifiedTE, std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
void getAllOfType(const std::string &id, std::vector< HLT::TriggerElement * > &output, const bool activeOnly=true) const
return trigger elements given the name of TEs
bool serializeHoldersWithPayload(const std::vector< CSPair > &payload, std::vector< uint32_t > &output, std::vector< uint32_t > &holderblobsizes, std::vector< std::pair< CLID, std::string > > &clid_name) const
bool addOneLevel(std::vector< std::vector< TriggerElement * > > &currentCombs, std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &currentIdxs, unsigned int type, std::vector< std::vector< TriggerElement * > > &newCombs, std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &newIdxs, unsigned int maxResults=1000, bool onlyActive=1)
Helper method for "combine": add one "level" of multiplicity to the results.
std::vector< std::string > m_classesToPayloadProperty_DSonly
list of classes::keys to be put to DS payload
bool getFeatures(const TriggerElement *te, std::vector< const T * > &features, const std::string &label="", std::map< const T *, std::string > *labels=0) const
retrieve features attached to given TriggerElement
bool getRecentFeatures(const TriggerElement *te, std::vector< const T * > &features, const std::string &label="", std::map< const T *, std::string > *labels=0) const
retrieve features attached to given TriggerElement or its predecessors the algorithm will go recursiv...
std::vector< std::string > m_classesToPayloadProperty
list of classes::keys to be put to BS payload
StoreGateSvc * m_storeGate
std::vector< std::string > m_classesToPreregisterProperty
as above but for preregistration
std::vector< CSPair > m_classesToPayload
classess are put to payload according to that priority list (CLID + key)
bool getRecentFeatureLink(const TriggerElement *te, ElementLink< C > &link, const std::string &label="", const TriggerElement *&source=::HLT::TrigNavStructure::m_unspecifiedTE, std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
bool getRecentFeaturesLinks(const TriggerElement *te, ElementLinkVector< C > &links, const std::string &label="") const
virtual void prepare()
prepapres the navigation for next event
std::vector< CSPair > m_classesToPreregister
classes mentioned here will be put to SG irrespectively of thier presence in event
TrigFeatureLink object2FeatureLink(const TriggerElement *te, const std::string &label, const T *obj) const
bool getAllFeatures(ElementLinkVector< C > &features, const std::string &label="") const
gets all features of type T atachedd to whichever TE
bool getRecentFeature(const TriggerElement *te, const T *&feature, const std::string &label="", const TriggerElement *&source=::HLT::TrigNavStructure::m_unspecifiedTE, std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
bool msgLvl(const MSG::Level lvl) const
virtual bool getFeatureAccessors(const TriggerElement *te, class_id_type clid, const index_or_label_type &index_or_label, bool only_single_feature, TriggerElement::FeatureVec &features, bool travel_backward_recursively, const TriggerElement *&source=m_unspecifiedTE, std::string &sourcelabel=m_unspecifiedLabel) const
retrieve features accessors according to the requrements This method is actually workhorse for all ab...
bool deserialize(const std::vector< uint32_t > &input)
MsgStream & msg(const MSG::Level lvl) const
bool serializeHoldersWithoutPayload(const std::vector< HLTNavDetails::IHolder * > &holders, std::vector< uint32_t > &output, std::vector< uint32_t > &holderblobsizes, std::vector< std::pair< CLID, std::string > > &clid_name) const
std::string m_objectsKeyPrefix
property setting prefix which is to be given to all trigger EDM objects
bool getFeature(const TriggerElement *te, const T *&features, const std::string &label="", std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
virtual ~NavigationCore()=default
bool serialize_DSonly(std::vector< uint32_t > &output, std::vector< unsigned int > &cuts, std::vector< std::pair< CLID, std::string > > &clid_name) const
HLTNavDetails::Holder< T > * getHolder(const std::string &label, uint16_t suggestedIndex) const
aware holder discovery, creates holder if needed
const AccessProxy * getAccessProxy() const
gets the access proxy
bool serializeWithHolderSection(const std::vector< uint32_t > &holderdata, const std::vector< unsigned int > &holderblobsizes, std::vector< uint32_t > &output, std::vector< unsigned int > &cuts, std::vector< std::pair< CLID, std::string > > &clid_name) const
bool createHolder(HLTNavDetails::IHolder *&holder, CLID clid, const std::string &label, uint16_t idx) const
creates holder for type given by CLID
MsgStream & msg() const
HLTNavDetails::IHolder * prepareOneHolder(CLID clid, const std::string &label)
void getAllOfType(const te_id_type id, std::vector< TriggerElement * > &output, const bool activeOnly=true) const
The query returning a collection of all TriggerElements if name is given.
std::string label(class_id_type clid, const index_or_label_type &sti_or_label) const
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
The Athena Transient Store API.
Utility class (not a tool or so) to serialize strings into stream of 32bit integers.
The TrigNavigationThinningSvc is an athena tool used to slim the trigger Navigation structure in vari...
Class helping in dealing with dynamic branch selection.
static Root::TMsgLogger logger("iLumiCalc")
struct color C
std::string label(const std::string &format, int i)
Definition label.h:19
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
std::variant< sub_index_type, std::string > index_or_label_type
MsgStream & operator<<(MsgStream &m, const Navigation &nav)
StoreGateSvc AccessProxy
Definition AccessProxy.h:17
Definition merge.py:1
STL namespace.
master_search< typenameEDMLIST::map, HLT::TypeInformation::get_cont, CONTAINER >::result::search_result::object type
CSPair(CLID clid, const std::string &key, xAOD::AuxSelection &&the_sel)