ATLAS Offline Software
Loading...
Searching...
No Matches
HLTResult.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#pragma once
6// emacs -*- c++ -*-
11
12#ifndef TRIGSTEERINGEVENT_HLTResult_H
13#define TRIGSTEERINGEVENT_HLTResult_H
14
15#include <vector>
16#include <map>
17#include <string>
18#include <set>
19#include <stdint.h>
22
23#ifdef XAOD_STANDALONE
25#else
26#include "GaudiKernel/IClassIDSvc.h"
27#endif
28
29#include "xAODCore/CLASS_DEF.h"
30
31/****************************************************************************************
32 * (June 2006; comments on documentation to: Andreas.Hoecker@cern.ch)
33 * Oct 2006; Tomasz.Bold@cern.ch removed most of internal variables, general restructure
34 * removed most of the methods
35 * HLTResult implements a GenericResult which is communcated between PSC and HLT.
36 *
37 ****************************************************************************************/
38namespace HLT {
39
40 class HLTExtraData;
41
50
51 class HLTResult : public GenericResult {
52
53 public:
54 friend void swap(HLTResult& lhs, HLTResult& rhs);
55
56 HLTResult(); //<! Default ctor
57 HLTResult(const HLTResult&);
58 HLTResult(HLTResult&& rhs);
60 ~HLTResult(); //<! Dtor
61
65 virtual inline bool accepted() const { return isAccepted(); }
66
70 virtual bool error() const ;
71
75 virtual uint32_t error_bits() const ;
76
80 bool serialize(std::vector<uint32_t>& output, const unsigned int mod_id);
81
85 bool serialize( std::vector<uint32_t>& output );
86
90 bool serialize( uint32_t*& output, int& data_size, const int max_size = -1, const unsigned int mod_id = 0 );
91
95 bool deserialize( const std::vector<uint32_t>& source );
96
100 bool deserialize( uint32_t* source, const int data_size );
101
102 /*
103 * @brief ---- Trigger masks ----
104 * here fill mask of all chains according to chain counter
105 * best would be to send names of all existing signatures,
106 * their active/inactive flags, and pass-through/prescale information
107 * (need to enumerate chains in configuration)
108 * corresponding functions should contain:
109 * trigger-mask for each step
110 * add chain/retrieve chain/serialize/deserialize
111 */
112
117
121 inline uint32_t getLvl1Id() const { return m_headerResult[IndEventNumber]; }
122
126 inline void setLvl1Id( uint32_t id ) { m_headerResult[IndEventNumber] = id; }
127
131 inline bool isAccepted() const { return (m_headerResult[IndHLTDecision] == 1 ? true : false); }
132
136 inline void setAccepted( bool acc ) { acc ? (m_headerResult[IndHLTDecision] = 1) : (m_headerResult[IndHLTDecision] = 0); }
137
146 inline bool isPassThrough() const { return m_headerResult[IndPassThrough]; }
150 inline void setPassThrough( bool fa ) { fa ? (m_headerResult[IndPassThrough] = 1) : (m_headerResult[IndPassThrough] = 0) ; }
151
159 inline void setHLTStatus( ErrorCode hltStatus ) { m_headerResult[IndHLTStatus] = hltStatus; }
160
169
174 inline void setHLTLevel( HLTLevel hltLevel ) { m_headerResult[IndHLTLevelInfo] = hltLevel; }
175
180 inline bool isValid() const { return (getHLTLevel() != HLT::UNKNOWN); }
181
185 inline uint32_t getNumOfSatisfiedSigs() const { return m_headerResult[IndNumOfSatisfiedSigs]; }
186
190 inline void setNumOfSatisfiedSigs( uint32_t sigs ) { m_headerResult[IndNumOfSatisfiedSigs] = sigs; }
191
198 inline void setErrorCoordinates( unsigned int chainCounter=0, unsigned int step=0 ) {
200
204 inline void getErrorCoordinates( unsigned int & chainCounter, unsigned int & step ) const {
206
207
211 bool isCreatedOutsideHLT() const { return (m_headerResult[IndCreatedOutsideHLT] == 0 ? false: true); } // previously "hasBeenCreated"
213
214
218 void setConfigSuperMasterKey(uint32_t key);
219
224 uint32_t getConfigSuperMasterKey() const;
225
226
230 void setConfigPrescalesKey(uint32_t key);
231
236 uint32_t getConfigPrescalesKey() const;
237
238
242 bool isHLTResultTruncated() const { return (m_headerResult[IndHLTResultTruncated] == 0 ? false : true); }
243 void setHLTResultTruncated( bool truncated) {
244 m_headerResult[IndHLTResultTruncated] = truncated ? 1 : 0;
245 }
246
250 const std::vector<uint32_t>& getNavigationResult() const { return m_navigationResult; }
251 const std::vector<uint32_t>& getNavigationResult_DSonly() const { return m_navigationResult_DSonly; }
252 const std::vector<uint32_t>& getChainResult () const { return m_chainsResult; }
253 const std::vector<uint32_t>& getExtras() const { return m_extras; }
254
258 std::vector<unsigned int>& getNavigationResultCuts() { return m_navigationResultCuts; }
259 const std::vector<unsigned int>& getNavigationResultCuts() const { return m_navigationResultCuts; }
260
264 std::vector<unsigned int>& getNavigationResultCuts_DSonly() { return m_navigationResultCuts_DSonly; }
265 const std::vector<unsigned int>& getNavigationResultCuts_DSonly() const { return m_navigationResultCuts_DSonly; }
266
270 std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName() { return m_id_name; }
271 const std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName() const { return m_id_name; }
275 std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName_DSonly() { return m_id_name_DSonly; }
276 const std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName_DSonly() const { return m_id_name_DSonly; }
277
281 std::vector<uint32_t>& getNavigationResult() { return m_navigationResult; }
282
286 std::vector<uint32_t>& getNavigationResult_DSonly() { return m_navigationResult_DSonly; }
287
291 std::vector<uint32_t>& getChainResult () { return m_chainsResult; }
292
293
294 /*
295 * @brief gets piece of extra information
296 * @warning This method should not be used. Use getExtraData() to modify the payload object.
297 */
298 std::vector<uint32_t>& getExtras() { return m_extras; }
299
303 std::map<unsigned int, std::set<std::pair<CLID, std::string> > >& getScoutingMap() {return m_modID_id_name;}
304 const std::map<unsigned int, std::set<std::pair<CLID, std::string> > >& getScoutingMap() const {return m_modID_id_name;}
305
306 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;}
307
308 /*
309 * @brief Return object representing the extra payload
310 */
312
313 /*
314 * @brief gets size of the rawResult (in words)
315 */
316 unsigned int size() const;
317
318 /*
319 * @brief gets sizes of 3 main parts of the result (in words)
320 */
321 std::vector<unsigned int> partSizes() const;
322
326 bool isEmpty() const;
327
334 // std::vector<std::pair<unsigned int, std::string> > getSatisfiedSigs();
335
341 void listOfModIDs(std::vector<unsigned int>& mod_ids) const;
342
346 std::vector<unsigned int> listOfModIDs() const;
347
348
349 private:
350 friend class HLTResultCnv_p1;
351
370 };
371
372 using CutPairs = std::vector<std::pair<unsigned int, unsigned int>>;
373 using CutPairVecs = std::pair<CutPairs, CutPairs>;
374
375 /*
376 * Serialize the regular result
377 */
378 bool serialize_regular(uint32_t*& output,
379 int& data_size,
380 int max_size);
381
382 /*
383 * Serialize the DS result corresponding to the given mod_id
384 */
385 bool serialize_DS(uint32_t*& output,
386 int& data_size,
387 int max_size,
388 unsigned int mod_id);
389
390 /*
391 * Bootstrap the serialization by serializing an initial portion of the end
392 * result which is common to both regular and DS results
393 */
394 bool serialize_bootstrap(uint32_t*& output,
395 int& data_size,
396 bool& truncating,
397 int max_size,
398 unsigned int estimated_size);
399
400 /*
401 * Serialize the body of the regular result, that is, everything after the
402 * bootstrap part
403 */
404 bool serialize_body_regular(uint32_t* output,
405 int& data_size,
406 unsigned int umax_size,
407 bool truncating) const;
408
409 /*
410 * Serialize the body of a DS result, that is, everything after the
411 * bootstrap part
412 */
413 bool serialize_body_DS(uint32_t* output,
414 int& data_size,
415 unsigned int max_size,
416 unsigned int nav_size,
417 const CutPairVecs& dscuts,
418 bool truncating) const;
419
420 /*
421 * Serialize the navigation part of the regular result
422 */
423 bool serialize_navigation_reg(uint32_t* output,
424 int& data_size,
425 unsigned int umax_size,
426 bool truncating) const;
427
428 /*
429 * Serialize the navigation part of a DS result
430 */
431 bool serialize_navigation_DS(uint32_t* output,
432 int& data_size,
433 unsigned int umax_size,
434 unsigned int nav_size,
435 const CutPairVecs& dscuts,
436 bool truncating) const;
437
438 /*
439 * Update serialized extra data
440 */
441 void updateExtras();
442
446 unsigned int estimateSize() const;
447
451 static unsigned int calc_total_size_DS(unsigned int ds_nav_size);
452
460 CutPairVecs findDSCuts(unsigned int) const;
461
465 bool unpackFromStorable(const std::vector<uint32_t>& raw);
466
470 static const uint32_t m_HLTResultClassVersion;
471
475
476 std::vector<uint32_t> m_headerResult;
477 std::vector<uint32_t> m_chainsResult;
478 std::vector<uint32_t> m_navigationResult;
479 std::vector<uint32_t> m_navigationResult_DSonly;
480 std::vector<uint32_t> m_extras;
481
482 std::vector< std::pair < CLID, std::string > > m_id_name;
483
484 std::vector< std::pair < CLID, std::string > > m_id_name_DSonly;
485
486 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
487
488 std::vector<unsigned int> m_navigationResultCuts;
489
490 std::vector<unsigned int> m_navigationResultCuts_DSonly;
491
493
494 };
495
496 void swap(HLTResult& lhs, HLTResult& rhs);
497
498} // end namespace
499
500CLASS_DEF(HLT::HLTResult, 107385089, 1)
501
502#endif
503
#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:51
void setCreatedOutsideHLT(bool created)
Definition HLTResult.h:212
void setNumOfSatisfiedSigs(uint32_t sigs)
sget number of satisfied signatures
Definition HLTResult.h:190
bool isCreatedOutsideHLT() const
is HLTResult created externally, in PSC in example
Definition HLTResult.h:211
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:275
const std::vector< unsigned int > & getNavigationResultCuts_DSonly() const
Definition HLTResult.h:265
uint32_t getNumOfSatisfiedSigs() const
get number of satisfied signatures
Definition HLTResult.h:185
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:167
std::vector< uint32_t > & getChainResult()
gets ref to the internal array holding serialized chains
Definition HLTResult.h:291
bool isAccepted() const
gets HLT decision
Definition HLTResult.h:131
HLTResult & operator=(HLTResult rhs)
unified assignement operator
Definition HLTResult.cxx:75
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:303
std::vector< uint32_t > m_headerResult
the full payload, and sub-payloads
Definition HLTResult.h:476
std::vector< std::pair< unsigned int, unsigned int > > CutPairs
Definition HLTResult.h:372
std::vector< uint32_t > m_extras
extra storeage (which can be used to store some operational infos)
Definition HLTResult.h:480
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:146
const std::vector< uint32_t > & getNavigationResult_DSonly() const
Definition HLTResult.h:251
friend void swap(HLTResult &lhs, HLTResult &rhs)
void setLvl1Id(uint32_t id)
sets event number (Lvl1-id)
Definition HLTResult.h:126
void getErrorCoordinates(unsigned int &chainCounter, unsigned int &step) const
get error coordinates
Definition HLTResult.h:204
bool serialize(std::vector< uint32_t > &output, const unsigned int mod_id)
void setHLTLevel(HLTLevel hltLevel)
Definition HLTResult.h:174
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:306
std::vector< unsigned int > listOfModIDs() const
return the rob module ID vector
Definition HLTResult.cxx:93
~HLTResult()
destructor
Definition HLTResult.cxx:82
std::vector< unsigned int > & getNavigationResultCuts()
gets ref to the internal array holding places for safe navigation truncations
Definition HLTResult.h:258
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:482
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:159
std::map< unsigned int, std::set< std::pair< CLID, std::string > > > m_modID_id_name
Definition HLTResult.h:486
std::vector< unsigned int > m_navigationResultCuts_DSonly
Definition HLTResult.h:490
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:484
std::vector< std::pair< CLID, std::string > > & getNavigationResultIDName()
gets ref to the internal vector of pairs of CLID and collection name
Definition HLTResult.h:270
const std::vector< std::pair< CLID, std::string > > & getNavigationResultIDName() const
Definition HLTResult.h:271
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:158
friend class HLTResultCnv_p1
Definition HLTResult.h:350
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:250
static const uint32_t m_HLTResultClassVersion
the version of this HLTResult class
Definition HLTResult.h:470
std::vector< uint32_t > & getExtras()
Definition HLTResult.h:298
HLTLevel getHLTLevel() const
hlt level (L2 or EF)
Definition HLTResult.h:173
std::vector< uint32_t > m_navigationResult
storage of navigation (serialized also)
Definition HLTResult.h:478
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:479
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:264
HLTExtraData * m_extraData
object for m_extras deserialization (on demand)
Definition HLTResult.h:492
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:198
bool isValid() const
is the result valid
Definition HLTResult.h:180
const std::vector< uint32_t > & getExtras() const
Definition HLTResult.h:253
std::vector< uint32_t > & getNavigationResult()
gets ref to the internal array holding serialized navigation
Definition HLTResult.h:281
std::vector< unsigned int > partSizes() const
std::pair< CutPairs, CutPairs > CutPairVecs
Definition HLTResult.h:373
uint32_t getLvl1Id() const
gets event number (Lvl1-id)
Definition HLTResult.h:121
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:477
InitBits
fixed bits; general trigger and status information
Definition HLTResult.h:355
@ IndCreatedOutsideHLT
also an error identifier
Definition HLTResult.h:365
@ IndEventNumber
event number (from EventInfo::EventID::event_number())
Definition HLTResult.h:356
@ IndHLTResultTruncated
the serialize function could not fit everything into the given max data_size
Definition HLTResult.h:366
@ IndLvlConverterStatus
LvlConverter status corresponding to ErrorCode enums.
Definition HLTResult.h:360
@ IndHLTDecision
HLT decision (== 0 if event has been rejected at HLT)
Definition HLTResult.h:357
@ IndHLTResultClassVersion
Definition HLTResult.h:355
@ IndConfigPrescalesKey
configuration key for prescales
Definition HLTResult.h:368
@ IndNumOfFixedBit
total number of fixed bits
Definition HLTResult.h:369
@ IndErrorInStep
step number in which error occured, in normal conditions sbould be 0
Definition HLTResult.h:364
@ IndHLTStatus
HLT status corresponding to ErrorCode enums.
Definition HLTResult.h:359
@ IndNumOfSatisfiedSigs
number of satisfied signatures
Definition HLTResult.h:362
@ IndErrorInChain
chain ID in which the error occured, in normal conditions sbould be 0
Definition HLTResult.h:363
@ IndConfigSuperMasterKey
configuration key for the menu
Definition HLTResult.h:367
@ IndHLTLevelInfo
the HLT level
Definition HLTResult.h:361
@ IndPassThrough
has the event been forced (passed through)
Definition HLTResult.h:358
const std::vector< unsigned int > & getNavigationResultCuts() const
Definition HLTResult.h:259
uint32_t getHLTResultClassVersion() const
HLTResult version (set accessor is private)
Definition HLTResult.h:116
const std::vector< uint32_t > & getChainResult() const
Definition HLTResult.h:252
void setAccepted(bool acc)
sets HLT decision
Definition HLTResult.h:136
bool isHLTResultTruncated() const
is serialized HLTResult truncated
Definition HLTResult.h:242
void setLvlConverterStatus(ErrorCode status)
Definition HLTResult.h:168
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:243
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:150
const std::vector< std::pair< CLID, std::string > > & getNavigationResultIDName_DSonly() const
Definition HLTResult.h:276
const std::map< unsigned int, std::set< std::pair< CLID, std::string > > > & getScoutingMap() const
Definition HLTResult.h:304
std::vector< unsigned int > m_navigationResultCuts
Definition HLTResult.h:488
virtual bool accepted() const
reject or accept
Definition HLTResult.h:65
std::vector< uint32_t > & getNavigationResult_DSonly()
gets ref to the internal array holding serialized navigation
Definition HLTResult.h:286
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
void swap(HLTExtraData &, HLTExtraData &)