00001 #pragma once
00002
00008 #ifndef TRIGSTEERINGEVENT_HLTResult_H
00009 #define TRIGSTEERINGEVENT_HLTResult_H
00010
00011 #include <vector>
00012 #include <map>
00013 #include <string>
00014 #include <set>
00015 #include <stdint.h>
00016 #include "TrigSteeringEvent/Enums.h"
00017 #include "TrigSteeringEvent/GenericResult.h"
00018 #include "AthenaKernel/IClassIDSvc.h"
00019
00020 #include "CLIDSvc/CLASS_DEF.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029 namespace HLT {
00030
00031 class HLTExtraData;
00032
00042 class HLTResult : public GenericResult {
00043
00044 public:
00045 friend void swap(HLTResult& lhs, HLTResult& rhs);
00046
00047 HLTResult();
00048 HLTResult(const HLTResult&);
00049 HLTResult(HLTResult&& rhs);
00050 HLTResult& operator=(HLTResult rhs);
00051 ~HLTResult();
00052
00056 virtual inline bool accepted() const { return isAccepted(); }
00057
00061 virtual bool error() const ;
00062
00066 virtual uint32_t error_bits() const ;
00067
00071 bool serialize(std::vector<uint32_t>& output, const unsigned int mod_id);
00072
00076 bool serialize( std::vector<uint32_t>& output );
00077
00081 bool serialize( uint32_t*& output, int& data_size, const int max_size = -1, const unsigned int mod_id = 0 );
00082
00086 bool deserialize( const std::vector<uint32_t>& source );
00087
00091 bool deserialize( uint32_t* source, const int data_size );
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00107 uint32_t getHLTResultClassVersion() const { return m_HLTResultClassVersion; }
00108
00112 inline uint32_t getLvl1Id() const { return m_headerResult[IndEventNumber]; }
00113
00117 inline void setLvl1Id( uint32_t id ) { m_headerResult[IndEventNumber] = id; }
00118
00122 inline bool isAccepted() const { return (m_headerResult[IndHLTDecision] == 1 ? true : false); }
00123
00127 inline void setAccepted( bool acc ) { acc ? (m_headerResult[IndHLTDecision] = 1) : (m_headerResult[IndHLTDecision] = 0); }
00128
00137 inline bool isPassThrough() const { return m_headerResult[IndPassThrough]; }
00141 inline void setPassThrough( bool fa ) { fa ? (m_headerResult[IndPassThrough] = 1) : (m_headerResult[IndPassThrough] = 0) ; }
00142
00149 inline ErrorCode getHLTStatus() const { return ErrorCode(m_headerResult[IndHLTStatus]); }
00150 inline void setHLTStatus( ErrorCode hltStatus ) { m_headerResult[IndHLTStatus] = hltStatus; }
00151
00158 inline ErrorCode getLvlConverterStatus() const { return ErrorCode(m_headerResult[IndLvlConverterStatus]); }
00159 inline void setLvlConverterStatus( ErrorCode status ) { m_headerResult[IndLvlConverterStatus] = status; }
00160
00164 inline HLTLevel getHLTLevel() const { return (HLTLevel)m_headerResult[IndHLTLevelInfo]; }
00165 inline void setHLTLevel( HLTLevel hltLevel ) { m_headerResult[IndHLTLevelInfo] = hltLevel; }
00166
00171 inline bool isValid() const { return (getHLTLevel() != HLT::UNKNOWN); }
00172
00176 inline uint32_t getNumOfSatisfiedSigs() const { return m_headerResult[IndNumOfSatisfiedSigs]; }
00177
00181 inline void setNumOfSatisfiedSigs( uint32_t sigs ) { m_headerResult[IndNumOfSatisfiedSigs] = sigs; }
00182
00189 inline void setErrorCoordinates( unsigned int chainCounter=0, unsigned int step=0 ) {
00190 m_headerResult[IndErrorInChain] = chainCounter; m_headerResult[IndErrorInStep] = step; };
00191
00195 inline void getErrorCoordinates( unsigned int & chainCounter, unsigned int & step ) const {
00196 chainCounter = m_headerResult[IndErrorInChain]; step = m_headerResult[IndErrorInStep]; }
00197
00198
00202 bool isCreatedOutsideHLT() const { return (m_headerResult[IndCreatedOutsideHLT] == 0 ? false: true); }
00203 void setCreatedOutsideHLT( bool created ) { created ? (m_headerResult[IndCreatedOutsideHLT] = 1) : (m_headerResult[IndCreatedOutsideHLT] = 0) ; }
00204
00205
00209 void setConfigSuperMasterKey(uint32_t key);
00210
00215 uint32_t getConfigSuperMasterKey() const;
00216
00217
00221 void setConfigPrescalesKey(uint32_t key);
00222
00227 uint32_t getConfigPrescalesKey() const;
00228
00229
00233 bool isHLTResultTruncated() const { return (m_headerResult[IndHLTResultTruncated] == 0 ? false : true); }
00234 void setHLTResultTruncated( bool truncated) {
00235 m_headerResult[IndHLTResultTruncated] = truncated ? 1 : 0;
00236 }
00237
00241 const std::vector<uint32_t>& getNavigationResult() const { return m_navigationResult; }
00242 const std::vector<uint32_t>& getNavigationResult_DSonly() const { return m_navigationResult_DSonly; }
00243 const std::vector<uint32_t>& getChainResult () const { return m_chainsResult; }
00244 const std::vector<uint32_t>& getExtras() const { return m_extras; }
00245
00249 std::vector<unsigned int>& getNavigationResultCuts() { return m_navigationResultCuts; }
00250 const std::vector<unsigned int>& getNavigationResultCuts() const { return m_navigationResultCuts; }
00251
00255 std::vector<unsigned int>& getNavigationResultCuts_DSonly() { return m_navigationResultCuts_DSonly; }
00256 const std::vector<unsigned int>& getNavigationResultCuts_DSonly() const { return m_navigationResultCuts_DSonly; }
00257
00261 std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName() { return m_id_name; }
00262 const std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName() const { return m_id_name; }
00266 std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName_DSonly() { return m_id_name_DSonly; }
00267 const std::vector< std::pair <CLID, std::string> >& getNavigationResultIDName_DSonly() const { return m_id_name_DSonly; }
00268
00272 std::vector<uint32_t>& getNavigationResult() { return m_navigationResult; }
00273
00277 std::vector<uint32_t>& getNavigationResult_DSonly() { return m_navigationResult_DSonly; }
00278
00282 std::vector<uint32_t>& getChainResult () { return m_chainsResult; }
00283
00284
00285
00286
00287
00288
00289 std::vector<uint32_t>& getExtras() { return m_extras; }
00290
00294 std::map<unsigned int, std::set<std::pair<CLID, std::string> > >& getScoutingMap() {return m_modID_id_name;}
00295 const std::map<unsigned int, std::set<std::pair<CLID, std::string> > >& getScoutingMap() const {return m_modID_id_name;}
00296
00297 void setScoutingMap(std::map<unsigned int, std::set<std::pair<CLID, std::string> > > map_modid_clid_name) {m_modID_id_name = map_modid_clid_name;}
00298
00299
00300
00301
00302 HLTExtraData& getExtraData();
00303 inline const HLTExtraData& getExtraData() const {
00304 return const_cast<HLTResult*>(this)->getExtraData();
00305 }
00306
00307
00308
00309
00310 unsigned int size() const;
00311
00312
00313
00314
00315 std::vector<unsigned int> partSizes() const;
00316
00320 bool isEmpty() const;
00321
00328
00329
00335 void listOfModIDs(std::vector<unsigned int>& mod_ids) const;
00336
00340 std::vector<unsigned int> listOfModIDs() const;
00341
00342
00343 private:
00344 friend class HLTResultCnv_p1;
00345
00349 enum InitBits { IndHLTResultClassVersion = 0,
00350 IndEventNumber,
00351 IndHLTDecision,
00352 IndPassThrough,
00353 IndHLTStatus,
00354 IndLvlConverterStatus,
00355 IndHLTLevelInfo,
00356 IndNumOfSatisfiedSigs,
00357 IndErrorInChain,
00358 IndErrorInStep,
00359 IndCreatedOutsideHLT,
00360 IndHLTResultTruncated,
00361 IndConfigSuperMasterKey,
00362 IndConfigPrescalesKey,
00363 IndNumOfFixedBit
00364 };
00365
00366 using CutPairs = std::vector<std::pair<unsigned int, unsigned int>>;
00367 using CutPairVecs = std::pair<CutPairs, CutPairs>;
00368
00369
00370
00371
00372 bool serialize_regular(uint32_t*& output,
00373 int& data_size,
00374 int max_size);
00375
00376
00377
00378
00379 bool serialize_DS(uint32_t*& output,
00380 int& data_size,
00381 int max_size,
00382 unsigned int mod_id);
00383
00384
00385
00386
00387
00388 bool serialize_bootstrap(uint32_t*& output,
00389 int& data_size,
00390 bool& truncating,
00391 int max_size,
00392 unsigned int estimated_size);
00393
00394
00395
00396
00397
00398 bool serialize_body_regular(uint32_t* output,
00399 int& data_size,
00400 unsigned int umax_size,
00401 bool truncating) const;
00402
00403
00404
00405
00406
00407 bool serialize_body_DS(uint32_t* output,
00408 int& data_size,
00409 unsigned int max_size,
00410 unsigned int nav_size,
00411 const CutPairVecs& dscuts,
00412 bool truncating) const;
00413
00414
00415
00416
00417 bool serialize_navigation_reg(uint32_t* output,
00418 int& data_size,
00419 unsigned int umax_size,
00420 bool truncating) const;
00421
00422
00423
00424
00425 bool serialize_navigation_DS(uint32_t* output,
00426 int& data_size,
00427 unsigned int umax_size,
00428 unsigned int nav_size,
00429 const CutPairVecs& dscuts,
00430 bool truncating) const;
00431
00432
00433
00434
00435 void updateExtras();
00436
00440 unsigned int estimateSize() const;
00441
00445 static unsigned int calc_total_size_DS(unsigned int ds_nav_size);
00446
00454 CutPairVecs findDSCuts(unsigned int) const;
00455
00459 bool unpackFromStorable(const std::vector<uint32_t>& raw);
00460
00464 static const uint32_t m_HLTResultClassVersion;
00465
00470 std::vector<uint32_t> m_headerResult;
00471 std::vector<uint32_t> m_chainsResult;
00472 std::vector<uint32_t> m_navigationResult;
00473 std::vector<uint32_t> m_navigationResult_DSonly;
00474 std::vector<uint32_t> m_extras;
00475
00476 std::vector< std::pair < CLID, std::string > > m_id_name;
00477
00478 std::vector< std::pair < CLID, std::string > > m_id_name_DSonly;
00479
00480 std::map<unsigned int, std::set<std::pair<CLID, std::string> > > m_modID_id_name;
00481
00482 mutable std::vector<unsigned int> m_navigationResultCuts;
00483
00484 mutable std::vector<unsigned int> m_navigationResultCuts_DSonly;
00485
00486 mutable HLTExtraData* m_extraData;
00487
00488 };
00489
00490 void swap(HLTResult& lhs, HLTResult& rhs);
00491
00492 }
00493
00494 CLASS_DEF(HLT::HLTResult, 107385089, 1)
00495
00496 #endif
00497