ATLAS Offline Software
Loading...
Searching...
No Matches
HLTResult.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#ifndef TRIGSTEERINGEVENT_HLTResult_H
11#define TRIGSTEERINGEVENT_HLTResult_H
12
13#include <vector>
14#include <map>
15#include <string>
16#include <set>
17#include <stdint.h>
20
21#ifdef XAOD_STANDALONE
23#else
24#include "GaudiKernel/IClassIDSvc.h"
25#endif
26
27#include "xAODCore/CLASS_DEF.h"
28
29/****************************************************************************************
30 * (June 2006; comments on documentation to: Andreas.Hoecker@cern.ch)
31 * Oct 2006; Tomasz.Bold@cern.ch removed most of internal variables, general restructure
32 * removed most of the methods
33 * HLTResult implements a GenericResult which is communcated between PSC and HLT.
34 *
35 ****************************************************************************************/
36namespace HLT {
37
38 class HLTExtraData;
39
48
49 class HLTResult : public GenericResult {
50
51 public:
52 friend void swap(HLTResult& lhs, HLTResult& rhs);
53
54 HLTResult(); //<! Default ctor
55 HLTResult(const HLTResult&);
56 HLTResult(HLTResult&& rhs);
58 ~HLTResult(); //<! Dtor
59
63 virtual inline bool accepted() const { return isAccepted(); }
64
68 virtual bool error() const ;
69
73 virtual uint32_t error_bits() const ;
74
78 bool serialize(std::vector<uint32_t>& output, const unsigned int mod_id);
79
83 bool serialize( std::vector<uint32_t>& output );
84
88 bool serialize( uint32_t*& output, int& data_size, const int max_size = -1, const unsigned int mod_id = 0 );
89
93 bool deserialize( const std::vector<uint32_t>& source );
94
98 bool deserialize( uint32_t* source, const int data_size );
99
100 /*
101 * @brief ---- Trigger masks ----
102 * here fill mask of all chains according to chain counter
103 * best would be to send names of all existing signatures,
104 * their active/inactive flags, and pass-through/prescale information
105 * (need to enumerate chains in configuration)
106 * corresponding functions should contain:
107 * trigger-mask for each step
108 * add chain/retrieve chain/serialize/deserialize
109 */
110
115
119 inline uint32_t getLvl1Id() const { return m_headerResult[IndEventNumber]; }
120
124 inline void setLvl1Id( uint32_t id ) { m_headerResult[IndEventNumber] = id; }
125
129 inline bool isAccepted() const { return (m_headerResult[IndHLTDecision] == 1 ? true : false); }
130
134 inline void setAccepted( bool acc ) { acc ? (m_headerResult[IndHLTDecision] = 1) : (m_headerResult[IndHLTDecision] = 0); }
135
144 inline bool isPassThrough() const { return m_headerResult[IndPassThrough]; }
148 inline void setPassThrough( bool fa ) { fa ? (m_headerResult[IndPassThrough] = 1) : (m_headerResult[IndPassThrough] = 0) ; }
149
157 inline void setHLTStatus( ErrorCode hltStatus ) { m_headerResult[IndHLTStatus] = hltStatus; }
158
167
172 inline void setHLTLevel( HLTLevel hltLevel ) { m_headerResult[IndHLTLevelInfo] = hltLevel; }
173
178 inline bool isValid() const { return (getHLTLevel() != HLT::UNKNOWN); }
179
183 inline uint32_t getNumOfSatisfiedSigs() const { return m_headerResult[IndNumOfSatisfiedSigs]; }
184
188 inline void setNumOfSatisfiedSigs( uint32_t sigs ) { m_headerResult[IndNumOfSatisfiedSigs] = sigs; }
189
196 inline void setErrorCoordinates( unsigned int chainCounter=0, unsigned int step=0 ) {
198
202 inline void getErrorCoordinates( unsigned int & chainCounter, unsigned int & step ) const {
204
205
209 bool isCreatedOutsideHLT() const { return (m_headerResult[IndCreatedOutsideHLT] == 0 ? false: true); } // previously "hasBeenCreated"
211
212
216 void setConfigSuperMasterKey(uint32_t key);
217
222 uint32_t getConfigSuperMasterKey() const;
223
224
228 void setConfigPrescalesKey(uint32_t key);
229
234 uint32_t getConfigPrescalesKey() const;
235
236
240 bool isHLTResultTruncated() const { return (m_headerResult[IndHLTResultTruncated] == 0 ? false : true); }
241 void setHLTResultTruncated( bool truncated) {
242 m_headerResult[IndHLTResultTruncated] = truncated ? 1 : 0;
243 }
244
248 const std::vector<uint32_t>& getNavigationResult() const { return m_navigationResult; }
249 const std::vector<uint32_t>& getNavigationResult_DSonly() const { return m_navigationResult_DSonly; }
250 const std::vector<uint32_t>& getChainResult () const { return m_chainsResult; }
251 const std::vector<uint32_t>& getExtras() const { return m_extras; }
252
256 std::vector<unsigned int>& getNavigationResultCuts() { return m_navigationResultCuts; }
257 const std::vector<unsigned int>& getNavigationResultCuts() const { return m_navigationResultCuts; }
258
262 std::vector<unsigned int>& getNavigationResultCuts_DSonly() { return m_navigationResultCuts_DSonly; }
263 const std::vector<unsigned int>& getNavigationResultCuts_DSonly() const { return m_navigationResultCuts_DSonly; }
264
268 std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName() { return m_id_name; }
269 const std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName() const { return m_id_name; }
273 std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName_DSonly() { return m_id_name_DSonly; }
274 const std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName_DSonly() const { return m_id_name_DSonly; }
275
279 std::vector<uint32_t>& getNavigationResult() { return m_navigationResult; }
280
284 std::vector<uint32_t>& getNavigationResult_DSonly() { return m_navigationResult_DSonly; }
285
289 std::vector<uint32_t>& getChainResult () { return m_chainsResult; }
290
291
292 /*
293 * @brief gets piece of extra information
294 * @warning This method should not be used. Use getExtraData() to modify the payload object.
295 */
296 std::vector<uint32_t>& getExtras() { return m_extras; }
297
301 std::map<unsigned int, std::set<std::pair<CLID, std::string> > >& getScoutingMap() {return m_modID_id_name;}
302 const std::map<unsigned int, std::set<std::pair<CLID, std::string> > >& getScoutingMap() const {return m_modID_id_name;}
303
304 void setScoutingMap(const std::map<unsigned int, std::set<std::pair<CLID, std::string> > >& map_modid_clid_name) {m_modID_id_name = map_modid_clid_name;}
305
306 /*
307 * @brief Return object representing the extra payload
308 */
310
311 /*
312 * @brief gets size of the rawResult (in words)
313 */
314 unsigned int size() const;
315
316 /*
317 * @brief gets sizes of 3 main parts of the result (in words)
318 */
319 std::vector<unsigned int> partSizes() const;
320
324 bool isEmpty() const;
325
332 // std::vector<std::pair<unsigned int, std::string> > getSatisfiedSigs();
333
339 void listOfModIDs(std::vector<unsigned int>& mod_ids) const;
340
344 std::vector<unsigned int> listOfModIDs() const;
345
346
347 private:
348 friend class HLTResultCnv_p1;
349
368 };
369
370 using CutPairs = std::vector<std::pair<unsigned int, unsigned int>>;
371 using CutPairVecs = std::pair<CutPairs, CutPairs>;
372
373 /*
374 * Serialize the regular result
375 */
376 bool serialize_regular(uint32_t*& output,
377 int& data_size,
378 int max_size);
379
380 /*
381 * Serialize the DS result corresponding to the given mod_id
382 */
383 bool serialize_DS(uint32_t*& output,
384 int& data_size,
385 int max_size,
386 unsigned int mod_id);
387
388 /*
389 * Bootstrap the serialization by serializing an initial portion of the end
390 * result which is common to both regular and DS results
391 */
392 bool serialize_bootstrap(uint32_t*& output,
393 int& data_size,
394 bool& truncating,
395 int max_size,
396 unsigned int estimated_size);
397
398 /*
399 * Serialize the body of the regular result, that is, everything after the
400 * bootstrap part
401 */
402 bool serialize_body_regular(uint32_t* output,
403 int& data_size,
404 unsigned int umax_size,
405 bool truncating) const;
406
407 /*
408 * Serialize the body of a DS result, that is, everything after the
409 * bootstrap part
410 */
411 bool serialize_body_DS(uint32_t* output,
412 int& data_size,
413 unsigned int max_size,
414 unsigned int nav_size,
415 const CutPairVecs& dscuts,
416 bool truncating) const;
417
418 /*
419 * Serialize the navigation part of the regular result
420 */
421 bool serialize_navigation_reg(uint32_t* output,
422 int& data_size,
423 unsigned int umax_size,
424 bool truncating) const;
425
426 /*
427 * Serialize the navigation part of a DS result
428 */
429 bool serialize_navigation_DS(uint32_t* output,
430 int& data_size,
431 unsigned int umax_size,
432 unsigned int nav_size,
433 const CutPairVecs& dscuts,
434 bool truncating) const;
435
436 /*
437 * Update serialized extra data
438 */
439 void updateExtras();
440
444 unsigned int estimateSize() const;
445
449 static unsigned int calc_total_size_DS(unsigned int ds_nav_size);
450
458 CutPairVecs findDSCuts(unsigned int) const;
459
463 bool unpackFromStorable(const std::vector<uint32_t>& raw);
464
468 static const uint32_t m_HLTResultClassVersion;
469
473
474 std::vector<uint32_t> m_headerResult;
475 std::vector<uint32_t> m_chainsResult;
476 std::vector<uint32_t> m_navigationResult;
477 std::vector<uint32_t> m_navigationResult_DSonly;
478 std::vector<uint32_t> m_extras;
479
480 std::vector< std::pair < CLID, std::string > > m_id_name;
481
482 std::vector< std::pair < CLID, std::string > > m_id_name_DSonly;
483
484 std::map<unsigned int, std::set<std::pair<CLID, std::string> > > m_modID_id_name; // map from rob module ID to class ID and collection name
485
486 std::vector<unsigned int> m_navigationResultCuts;
487
488 std::vector<unsigned int> m_navigationResultCuts_DSonly;
489
491
492 };
493
494 void swap(HLTResult& lhs, HLTResult& rhs);
495
496} // end namespace
497
498CLASS_DEF(HLT::HLTResult, 107385089, 1)
499
500#endif
501
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
File providing the different SG_BASE macros.
File providing the ClassID_traits traits class.
Class representing the HLT extra payload stored in HLT::HLTResult::getExtras()
HLT::HLTResult is sumarising result of trigger decision evaluation (online/offline) It contains basic...
Definition HLTResult.h:49
void setCreatedOutsideHLT(bool created)
Definition HLTResult.h:210
void setNumOfSatisfiedSigs(uint32_t sigs)
sget number of satisfied signatures
Definition HLTResult.h:188
bool isCreatedOutsideHLT() const
is HLTResult created externally, in PSC in example
Definition HLTResult.h:209
std::vector< std::pair< CLID, std::string > > & getNavigationResultIDName_DSonly()
gets ref to the internal vector of pairs of CLID and collection name
Definition HLTResult.h:273
const std::vector< unsigned int > & getNavigationResultCuts_DSonly() const
Definition HLTResult.h:263
uint32_t getNumOfSatisfiedSigs() const
get number of satisfied signatures
Definition HLTResult.h:183
virtual uint32_t error_bits() const
bit flags to explain problems during processing
ErrorCode getLvlConverterStatus() const
overall hlt status: if StatusCode::isFailure(), event should be discarded from physics stream (and,...
Definition HLTResult.h:165
std::vector< uint32_t > & getChainResult()
gets ref to the internal array holding serialized chains
Definition HLTResult.h:289
bool isAccepted() const
gets HLT decision
Definition HLTResult.h:129
HLTResult & operator=(HLTResult rhs)
unified assignement operator
Definition HLTResult.cxx:76
std::map< unsigned int, std::set< std::pair< CLID, std::string > > > & getScoutingMap()
methods to get and set the Scouting Map saved into HLTResult
Definition HLTResult.h:301
std::vector< uint32_t > m_headerResult
the full payload, and sub-payloads
Definition HLTResult.h:474
std::vector< std::pair< unsigned int, unsigned int > > CutPairs
Definition HLTResult.h:370
std::vector< uint32_t > m_extras
extra storeage (which can be used to store some operational infos)
Definition HLTResult.h:478
bool serialize_body_DS(uint32_t *output, int &data_size, unsigned int max_size, unsigned int nav_size, const CutPairVecs &dscuts, bool truncating) const
bool isPassThrough() const
forced-accepted (FA) event configuration the FA request(s) are set per chain and hlt level by the tig...
Definition HLTResult.h:144
const std::vector< uint32_t > & getNavigationResult_DSonly() const
Definition HLTResult.h:249
friend void swap(HLTResult &lhs, HLTResult &rhs)
void setLvl1Id(uint32_t id)
sets event number (Lvl1-id)
Definition HLTResult.h:124
void getErrorCoordinates(unsigned int &chainCounter, unsigned int &step) const
get error coordinates
Definition HLTResult.h:202
bool serialize(std::vector< uint32_t > &output, const unsigned int mod_id)
void setHLTLevel(HLTLevel hltLevel)
Definition HLTResult.h:172
static unsigned int calc_total_size_DS(unsigned int ds_nav_size)
Calculate the size of a DS result, given the size of its navigation.
void setScoutingMap(const std::map< unsigned int, std::set< std::pair< CLID, std::string > > > &map_modid_clid_name)
Definition HLTResult.h:304
std::vector< unsigned int > listOfModIDs() const
return the rob module ID vector
Definition HLTResult.cxx:94
~HLTResult()
destructor
Definition HLTResult.cxx:83
std::vector< unsigned int > & getNavigationResultCuts()
gets ref to the internal array holding places for safe navigation truncations
Definition HLTResult.h:256
uint32_t getConfigSuperMasterKey() const
gets the key of the menu which was used to trigger this event
bool serialize_bootstrap(uint32_t *&output, int &data_size, bool &truncating, int max_size, unsigned int estimated_size)
std::vector< std::pair< CLID, std::string > > m_id_name
Definition HLTResult.h:480
void setConfigSuperMasterKey(uint32_t key)
sets the key of the menu which was used to trigger this event
void setHLTStatus(ErrorCode hltStatus)
Definition HLTResult.h:157
std::map< unsigned int, std::set< std::pair< CLID, std::string > > > m_modID_id_name
Definition HLTResult.h:484
std::vector< unsigned int > m_navigationResultCuts_DSonly
Definition HLTResult.h:488
bool serialize_DS(uint32_t *&output, int &data_size, int max_size, unsigned int mod_id)
std::vector< std::pair< CLID, std::string > > m_id_name_DSonly
Definition HLTResult.h:482
std::vector< std::pair< CLID, std::string > > & getNavigationResultIDName()
gets ref to the internal vector of pairs of CLID and collection name
Definition HLTResult.h:268
const std::vector< std::pair< CLID, std::string > > & getNavigationResultIDName() const
Definition HLTResult.h:269
HLTResult()
constructor
Definition HLTResult.cxx:24
void updateExtras()
ErrorCode getHLTStatus() const
overall hlt status: if StatusCode::isFailure(), event should be discarded from physics stream (and,...
Definition HLTResult.h:156
friend class HLTResultCnv_p1
Definition HLTResult.h:348
uint32_t getConfigPrescalesKey() const
gets the key of the prescales config which was used to trigger this event
unsigned int estimateSize() const
Estimate the size this HLTResult would ocuppy once serialized.
bool serialize_body_regular(uint32_t *output, int &data_size, unsigned int umax_size, bool truncating) const
virtual bool error() const
problems during processing
const std::vector< uint32_t > & getNavigationResult() const
retrieve the sub-payloads (can be used to retrieve/write data)
Definition HLTResult.h:248
static const uint32_t m_HLTResultClassVersion
the version of this HLTResult class
Definition HLTResult.h:468
std::vector< uint32_t > & getExtras()
Definition HLTResult.h:296
HLTLevel getHLTLevel() const
hlt level (L2 or EF)
Definition HLTResult.h:171
std::vector< uint32_t > m_navigationResult
storage of navigation (serialized also)
Definition HLTResult.h:476
HLTExtraData & getExtraData()
bool serialize_navigation_reg(uint32_t *output, int &data_size, unsigned int umax_size, bool truncating) const
bool isEmpty() const
true if result is empty
CutPairVecs findDSCuts(unsigned int) const
Find the pairs of cut points that mark the boundaries of DS collections for the given module id.
std::vector< uint32_t > m_navigationResult_DSonly
storage of navigation (serialized also) for DataScouting
Definition HLTResult.h:477
bool serialize_regular(uint32_t *&output, int &data_size, int max_size)
std::vector< unsigned int > & getNavigationResultCuts_DSonly()
gets ref to the internal array holding places for safe navigation truncations
Definition HLTResult.h:262
HLTExtraData * m_extraData
object for m_extras deserialization (on demand)
Definition HLTResult.h:490
unsigned int size() const
void setErrorCoordinates(unsigned int chainCounter=0, unsigned int step=0)
sets the information about the error, namely chain in which the error happened and the step
Definition HLTResult.h:196
bool isValid() const
is the result valid
Definition HLTResult.h:178
const std::vector< uint32_t > & getExtras() const
Definition HLTResult.h:251
std::vector< uint32_t > & getNavigationResult()
gets ref to the internal array holding serialized navigation
Definition HLTResult.h:279
std::vector< unsigned int > partSizes() const
std::pair< CutPairs, CutPairs > CutPairVecs
Definition HLTResult.h:371
uint32_t getLvl1Id() const
gets event number (Lvl1-id)
Definition HLTResult.h:119
bool serialize_navigation_DS(uint32_t *output, int &data_size, unsigned int umax_size, unsigned int nav_size, const CutPairVecs &dscuts, bool truncating) const
bool deserialize(const std::vector< uint32_t > &source)
GenericResult::deserialize( const std::vector<uint32_t>& source )
std::vector< uint32_t > m_chainsResult
storege of serialized chains
Definition HLTResult.h:475
InitBits
fixed bits; general trigger and status information
Definition HLTResult.h:353
@ IndCreatedOutsideHLT
also an error identifier
Definition HLTResult.h:363
@ IndEventNumber
event number (from EventInfo::EventID::event_number())
Definition HLTResult.h:354
@ IndHLTResultTruncated
the serialize function could not fit everything into the given max data_size
Definition HLTResult.h:364
@ IndLvlConverterStatus
LvlConverter status corresponding to ErrorCode enums.
Definition HLTResult.h:358
@ IndHLTDecision
HLT decision (== 0 if event has been rejected at HLT)
Definition HLTResult.h:355
@ IndHLTResultClassVersion
Definition HLTResult.h:353
@ IndConfigPrescalesKey
configuration key for prescales
Definition HLTResult.h:366
@ IndNumOfFixedBit
total number of fixed bits
Definition HLTResult.h:367
@ IndErrorInStep
step number in which error occured, in normal conditions sbould be 0
Definition HLTResult.h:362
@ IndHLTStatus
HLT status corresponding to ErrorCode enums.
Definition HLTResult.h:357
@ IndNumOfSatisfiedSigs
number of satisfied signatures
Definition HLTResult.h:360
@ IndErrorInChain
chain ID in which the error occured, in normal conditions sbould be 0
Definition HLTResult.h:361
@ IndConfigSuperMasterKey
configuration key for the menu
Definition HLTResult.h:365
@ IndHLTLevelInfo
the HLT level
Definition HLTResult.h:359
@ IndPassThrough
has the event been forced (passed through)
Definition HLTResult.h:356
const std::vector< unsigned int > & getNavigationResultCuts() const
Definition HLTResult.h:257
uint32_t getHLTResultClassVersion() const
HLTResult version (set accessor is private)
Definition HLTResult.h:114
const std::vector< uint32_t > & getChainResult() const
Definition HLTResult.h:250
void setAccepted(bool acc)
sets HLT decision
Definition HLTResult.h:134
bool isHLTResultTruncated() const
is serialized HLTResult truncated
Definition HLTResult.h:240
void setLvlConverterStatus(ErrorCode status)
Definition HLTResult.h:166
void setConfigPrescalesKey(uint32_t key)
sets the key of the prescales config which was used to trigger this event
void setHLTResultTruncated(bool truncated)
Definition HLTResult.h:241
bool unpackFromStorable(const std::vector< uint32_t > &raw)
split the rawResult vector into rawPartialResult's
void setPassThrough(bool fa)
set passTrough flag
Definition HLTResult.h:148
const std::vector< std::pair< CLID, std::string > > & getNavigationResultIDName_DSonly() const
Definition HLTResult.h:274
const std::map< unsigned int, std::set< std::pair< CLID, std::string > > > & getScoutingMap() const
Definition HLTResult.h:302
std::vector< unsigned int > m_navigationResultCuts
Definition HLTResult.h:486
virtual bool accepted() const
reject or accept
Definition HLTResult.h:63
std::vector< uint32_t > & getNavigationResult_DSonly()
gets ref to the internal array holding serialized navigation
Definition HLTResult.h:284
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
void swap(HLTExtraData &, HLTExtraData &)