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
40
41namespace HLT {
42 namespace TrigNavTools {
43 struct SlimmingHelper;
44 }
45
93
94
96 friend class ::TrigNavigationThinningSvc;
98 public:
103 virtual ~NavigationCore() = default;
104
108 virtual void prepare();
112 virtual void reset(bool inFinalize = false);
113
136 virtual bool serialize( std::vector<uint32_t>& output) const;
137 bool serialize( std::vector<uint32_t>& output, std::vector<unsigned int>& cuts ) const;
138 bool serialize( std::vector<uint32_t>& output, std::vector<unsigned int>& cuts, std::vector<std::pair<CLID, std::string> >& clid_name) const;
139 bool serialize_DSonly( std::vector<uint32_t>& output, std::vector<unsigned int>& cuts, std::vector<std::pair<CLID, std::string> >& clid_name) const;
140 bool deserialize( const std::vector<uint32_t>& input );
141
156
157
169 template<class T>
170 bool getFeatures( const TriggerElement* te, std::vector< const T*>& features, const std::string& label="",
171 std::map<const T*, std::string>* labels=0 ) const;
172
173 template<class T>
174 bool getFeature( const TriggerElement* te, const T*& features, const std::string& label="", std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
175
176 template<class T>
177 bool getFeature( const TriggerElement* te,
178 const ConstDataVector<T>*& features,
179 const std::string& label="", std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
180
181 template<class T>
182 const T* featureLink2Object( const TrigFeatureLink& ) const;
183
184 template<class T>
186 const T* obj) const;
187
188
189 template<class C>
191 const typename Container2Object<C>::type * obj,
192 const C* container) const;
193
194 //const TriggerElement* te, const T*& features, const std::string& label="", std::string& sourcelabel = m_unspecifiedLabel);
195
196
197 template<class C, class T>
198 bool getFeaturesLinks( const TriggerElement* te, ElementLinkVector<C>& links, const std::string& label="") const;
199
200
201
215 template<class T>
217 std::vector< const T*>& features, const std::string& label="",
218 std::map<const T*, std::string>* labels=0 ) const;
219
220 template<class T>
222 const T*& feature, const std::string& label="",
223 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
224 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel ) const;
225
226 template<class LinkType>
228 LinkType& link, const std::string& label="",
229 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
230 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
231
232 template<class C, class T>
234 ElementLinkVector<C>& links, const std::string& label="" ) const;
235
236 template<class C, class T>
238 ElementLink<C>& link, const std::string& label="",
239 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
240 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel ) const;
241
242
243
258
259
260 virtual bool getFeatureAccessors( const TriggerElement* te, class_id_type clid,
261 const index_or_label_type& index_or_label,
262 bool only_single_feature,
264 bool travel_backward_recursively,
265 const TriggerElement*& source = m_unspecifiedTE,
266 std::string& sourcelabel = m_unspecifiedLabel) const;
267
268
269 virtual bool getFeatureAccessorsSingleTE( const TriggerElement* te, CLID clid,
270 const index_or_label_type& index_or_label,
271 bool only_single_feature,
273 const TriggerElement*& source = ::HLT::TrigNavStructure::m_unspecifiedTE,
274 std::string& sourcelabel = ::HLT::TrigNavStructure::m_unspecifiedLabel) const;
275
276
288 template<class T> bool getFeaturesInRoI( const TriggerElement* te, std::vector<const T*>& features,
289 const std::string& label="", std::map<const T*, std::string>* labels=0 ) const;
290
291
299 template<class C, class T> bool getAllFeatures( ElementLinkVector<C>& features, const std::string& label="" ) const;
300
301
302
306 template<class T, class C> static void registerFeatureContainer();
307
308
309
313 bool merge(const NavigationCore& l2);
314
320 static uint32_t string2hash( const std::string&, const std::string& category="TE" );
321
322
326 void getAllOfType ( const std::string& id,
327 std::vector< HLT::TriggerElement* >& output,
328 const bool activeOnly=true) const;
329
331
336 return m_storeGate;
337 }
338
339 template<class T> HLTNavDetails::Holder<T>* getHolder ( uint16_t subTypeIndex ) const;
341 protected:
343
344 // private stuff of Navigation class
345
346
347 bool createHolder ( HLTNavDetails::IHolder*& holder, CLID clid, const std::string& label, uint16_t idx ) const;
348 bool registerHolder ( HLTNavDetails::IHolder* holder );
349
350 template<class T> HLTNavDetails::Holder<T>* getHolder ( const std::string& label, uint16_t suggestedIndex ) const;
351
352 HLTNavDetails::IHolder* getHolder ( CLID clid, uint16_t subTypeIndex ) const;
353 HLTNavDetails::IHolder* getHolder ( CLID clid, const std::string& label ) const;
354
355
359 bool addOneLevel(std::vector< std::vector<TriggerElement*> >& currentCombs,
360 std::vector< std::vector<std::pair<unsigned int, unsigned int> > >& currentIdxs,
361 unsigned int type,
362 std::vector< std::vector<TriggerElement*> >& newCombs,
363 std::vector< std::vector<std::pair<unsigned int, unsigned int> > >& newIdxs,
364 unsigned int maxResults = 1000, bool onlyActive = 1);
365
366
367 IConversionSvc* m_serializerSvc;
369 std::string m_objectsKeyPrefix;
371
372
374
375 struct CSPair
376 {
377 CSPair (CLID clid, const std::string& key, xAOD::AuxSelection&& the_sel)
378 : first (clid), second (key), sel (std::move (the_sel))
379 {
380 }
382 std::string second;
384 };
385
386 std::vector<std::string> m_classesToPayloadProperty;
387 std::vector<CSPair> m_classesToPayload;
388
389 std::vector<std::string> m_classesToPayloadProperty_DSonly;
390 std::vector<CSPair> m_classesToPayload_DSonly;
391
392 std::vector<std::string> m_classesFromPayloadIgnoreProperty;
393
394 std::vector<std::string> m_classesToPreregisterProperty;
395 std::vector<CSPair> m_classesToPreregister;
396
397 uint16_t nextSubTypeIndex(CLID clid, const std::string&label) const;
398
399 bool extractBlob(const std::vector<uint32_t>& input,
400 std::vector<uint32_t>::const_iterator& it,
401 std::vector<uint32_t>& blob) const ;
402
403 private:
405
406 // Adapters so we can use ATH_MSG macros
407 MsgStream& msg() const { return m_logger.msg(); }
408 MsgStream& msg(const MSG::Level lvl) const { return msg() << lvl; }
409 bool msgLvl(const MSG::Level lvl) const { return msg().level() <= lvl; }
410
411 HLTNavDetails::IHolder* prepareOneHolder(CLID clid, const std::string& label);
412
413 bool serializeWithHolderSection(const std::vector<uint32_t>& holderdata, const std::vector<unsigned int>& holderblobsizes,
414 std::vector<uint32_t>& output,std::vector<unsigned int>& cuts ,std::vector<std::pair<CLID, std::string> >& clid_name) const;
415
416 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;
417
418 bool serializeHoldersWithPayload(const std::vector<CSPair>& payload, std::vector<uint32_t>& output, std::vector<uint32_t>& holderblobsizes,
419 std::vector<std::pair<CLID, std::string> >& clid_name) const;
420
421 };
422
423 MsgStream& operator<< ( MsgStream& m, const NavigationCore& nav ); //<! printing helper
424
425} // eof namespace
426
427#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.
EDMLIST::map::template find< CONTAINER, HLT::TypeInformation::MatchContainer >::object type
CSPair(CLID clid, const std::string &key, xAOD::AuxSelection &&the_sel)