ATLAS Offline Software
Chain.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 /**********************************************************************************
7  * @Project: HLT SteeringEvent
8  * @Package: TrigSteeringEvent
9  * @class : Chain
10  *
11  * @brief chain of signatures
12  *
13  * @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland
14  * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN
15  * moved from TrigSteering package
16  *
17  * File and Version Information:
18  **********************************************************************************/
19 
20 #ifndef TRIGSTEERINGEVENT_CHAIN_H
21 #define TRIGSTEERINGEVENT_CHAIN_H
22 
23 #include <vector>
24 #include <stdint.h>
25 #include <iomanip>
26 
29 
30 #ifdef XAOD_STANDALONE
31 #include "AsgMessaging/MsgStream.h"
33 #endif
34 #ifndef XAOD_STANDALONE
35 #include "GaudiKernel/MsgStream.h"
37 #endif
38 
39 //#include "TrigSteeringEvent/GenericResult.h"
40 
41 #include <iosfwd>
42 
43 class MsgStream;
44 
45 
46 namespace HLT {
47 
48  static const std::string no_config = "no config";
49 
50  // taht is for backward compatibility of TDT, once new TDT will be available it can be removed from steering
52 
63  class Chain
64  {
65 
66  public:
67 
68 
69  //Chain( const std::vector<uint32_t>& serialData ); //!< constructor from serialized data
70 
71  Chain( uint32_t serialData );
72 
73  Chain(const TrigConf::HLTChain* configChain);
74 
75  ~Chain(){}
76 
77 
78  const TrigConf::HLTChain* getConfigChain() const { return m_configChain; }
79 
80 
81  bool chainPassedRaw() const { return m_passedRaw; }
82  bool chainPassed() const;
83 
84 
85  bool isPassedThrough() const { return m_passThrough; }
86  bool isPrescaled() const { return m_prescaled; }
87  bool isResurrected() const { return m_resurrected; }
88 
89  // For Lvl Converters
90 
91  float prescaleFactor() const { return (m_configChain ? m_configChain->prescale() : -1.); }
92  float passThroughFactor() const { return (m_configChain ? m_configChain->pass_through() : -1.); }
93  unsigned int getChainCounter() const { return m_chain_counter; }
94  const std::string& getChainName() const { return (m_configChain ? m_configChain->chain_name(): no_config); }
95  const std::string& getLowerChainName() const { return (m_configChain ? m_configChain->lower_chain_name(): no_config); }
96  int getEBAfterStep() const { return (m_configChain ? m_configChain->EB_after_step() : -1.); }
97  std::vector<size_t> getLegMultiplicities() const { return (m_configChain ? m_configChain->leg_multiplicities() : std::vector<size_t>()); }
98  bool nextStepAfterEB() const { return ((getChainStep()+1) > getEBAfterStep()) && (getEBAfterStep()>0.); }
99  bool isMerged() const { return (m_configChain ? (m_configChain->level()=="HLT") : false);};
100 
101  unsigned int getChainHashId() const { return (m_configChain ? m_configChain->chain_hash_id() : 0); }
103  int getChainStep() const { return m_currentStep; }
104 
105 
111  template <class stream>
112  void print(stream& os) const
113  {
114  os << "Counter = " << std::setw(4) <<getChainCounter()
115  << " success (raw) = " << chainPassedRaw()
116  << " EBstep = " << getEBAfterStep()
117  << " pass-through = " << isPassedThrough()
118  << " prescaled = " << isPrescaled()
119  << " rerun = " << isResurrected()
120  << " lastActiveStep = " << getChainStep()
121  << " name = " << std::setw(35) << getChainName()
122  << " EC = "<< strErrorCode(getErrorCode()) ;
123  }
124 
125  ErrorCode serialize( std::vector<uint32_t>& output ) const;
126 
127  ErrorCode deserialize(uint32_t chainWord);
128 
129  ErrorCode setDecisions(bool passedraw, bool passedthrough, bool prescaled, bool resurrected);
130 
131 
132  static unsigned int inquireChainCounter(uint32_t chainWord);
133 
134  ChainStatus getStatus() const { return m_status; }
135 
136  bool reset();
137 
138  protected:
139 
140 
142 
144  unsigned int m_chain_counter;
148  bool m_prescaled;
151 
152  private:
154 
155  };
156 
157 
161 MsgStream& operator << (MsgStream&, const Chain&);
162 std::ostream& operator << (std::ostream&, const Chain&);
163 
164 } // end of namespace
165 
166 
167 #endif
HLT::Chain::getChainCounter
unsigned int getChainCounter() const
return the unique identifier of this Chain (uint)
Definition: Chain.h:93
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
HLT::Chain::getLegMultiplicities
std::vector< size_t > getLegMultiplicities() const
get per leg multiplicity (Run3 only)
Definition: Chain.h:97
HLT::Chain::getEBAfterStep
int getEBAfterStep() const
get EB_after_step
Definition: Chain.h:96
HLT::Chain::getChainHashId
unsigned int getChainHashId() const
< return whether is a merged L2+EF chain
Definition: Chain.h:101
TrigConf::HLTChain::level
const std::string & level() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:75
AthMsgStreamMacros.h
TrigConf::HLTChain::chain_name
const std::string & chain_name() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:72
HLT::Chain::reset
bool reset()
restes the bits to the basic state
Definition: Chain.cxx:127
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
HLT::Chain::deserialize
ErrorCode deserialize(uint32_t chainWord)
deserialize this Chain from given vector of uint's
Definition: Chain.cxx:101
HLT::ErrorCode
The definition of error codes in HLT. This is a class (note; before was simple enum) to enable safer ...
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/Enums.h:80
TrigConf::HLTChain::prescale
float prescale() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:141
HLT::ChainInvalid
@ ChainInvalid
Definition: Chain.h:51
HLTChain.h
TrigConf::HLTChain::lower_chain_name
const std::string & lower_chain_name() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:77
HLT::Chain::m_passedRaw
bool m_passedRaw
Definition: Chain.h:146
HLT::Chain::m_prescaled
bool m_prescaled
Flagged as "prescaled" for this event ?
Definition: Chain.h:148
HLT::Chain::setDecisions
ErrorCode setDecisions(bool passedraw, bool passedthrough, bool prescaled, bool resurrected)
set bool decisions directly
Definition: Chain.cxx:85
HLT::Chain::getConfigChain
const TrigConf::HLTChain * getConfigChain() const
get underlying ConfigChain
Definition: Chain.h:78
Enums.h
HLT::Chain::getLowerChainName
const std::string & getLowerChainName() const
return the Chain name (string)
Definition: Chain.h:95
HLT::Chain::isPrescaled
bool isPrescaled() const
is chain prescaled ?
Definition: Chain.h:86
HLT::Chain::nextStepAfterEB
bool nextStepAfterEB() const
return whether next step requires EB (-1 means no EB called)
Definition: Chain.h:98
HLT::Chain::inquireChainCounter
static unsigned int inquireChainCounter(uint32_t chainWord)
unpack chain counter from the serialized word
Definition: Chain.cxx:123
TrigConf::HLTChain
HLT chain configuration information.
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:35
HLT::Chain::chainPassed
bool chainPassed() const
Definition: Chain.cxx:46
HLT::Chain::isMerged
bool isMerged() const
Definition: Chain.h:99
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
HLT::operator<<
MsgStream & operator<<(MsgStream &m, const Navigation &nav)
Definition: Navigation.cxx:168
HLT::Chain::Chain
Chain(uint32_t serialData)
constructor from serialized data
Definition: Chain.cxx:27
HLT::Chain::getStatus
ChainStatus getStatus() const
return Chain status
Definition: Chain.h:134
HLT::strErrorCode
std::string strErrorCode(const ErrorCode code)
Definition: Enums.cxx:99
HLT::Chain::passThroughFactor
float passThroughFactor() const
get pass-through factor
Definition: Chain.h:92
HLT::ChainOK
@ ChainOK
Definition: Chain.h:51
HLT::Chain::print
void print(stream &os) const
templated print stream method so that one can simply write std::cout << myChain << std::endl; or with...
Definition: Chain.h:112
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
HLT::Chain::serialize
ErrorCode serialize(std::vector< uint32_t > &output) const
serialize this Chain into the given vector of uint's
Definition: Chain.cxx:52
HLT::Chain::m_currentStep
int m_currentStep
Current step of this chain.
Definition: Chain.h:150
HLT::Chain::m_chain_counter
unsigned int m_chain_counter
chain counter from configuration (copied here for speed)
Definition: Chain.h:144
HLT::Chain::getChainStep
int getChainStep() const
return the current step of execution
Definition: Chain.h:103
HLT::Chain::setStatus
void setStatus(ChainStatus s)
Definition: Chain.h:141
HLT::Chain::getErrorCode
HLT::ErrorCode getErrorCode() const
return this Chain's most severe error code (from execution)
Definition: Chain.h:102
TrigConf::HLTChain::EB_after_step
int EB_after_step() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:81
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
HLT::Chain
Definition: Chain.h:64
merge.output
output
Definition: merge.py:17
HLT::Chain::prescaleFactor
float prescaleFactor() const
get prescale factor
Definition: Chain.h:91
HLT::Chain::isResurrected
bool isResurrected() const
is chain resurrected ?
Definition: Chain.h:87
TrigConf::HLTChain::chain_hash_id
unsigned int chain_hash_id() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:79
HLT::Chain::m_resurrected
bool m_resurrected
flag to mar that chain was originally prescalled but is reexecuted
Definition: Chain.h:149
HLT::ChainStatus
ChainStatus
Definition: Chain.h:51
HLT::Chain::m_passThrough
bool m_passThrough
Flagged as "passedThrough" for this event ?
Definition: Chain.h:147
HLT::Chain::m_errorCode
ErrorCode m_errorCode
most severe error code of execution
Definition: Chain.h:145
MsgStreamMacros.h
HLT::Chain::~Chain
~Chain()
Definition: Chain.h:75
HLT::Chain::getChainName
const std::string & getChainName() const
return the Chain name (string)
Definition: Chain.h:94
HLT::ConfigOnlyChain
@ ConfigOnlyChain
Definition: Chain.h:51
TrigConf::HLTChain::pass_through
float pass_through() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:142
HLT::Chain::m_configChain
const TrigConf::HLTChain * m_configChain
underlying Config Chain
Definition: Chain.h:143
TrigConf::HLTChain::leg_multiplicities
const std::vector< size_t > leg_multiplicities() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:82
HLT::Chain::chainPassedRaw
bool chainPassedRaw() const
Definition: Chain.h:81
HLT::Chain::m_status
ChainStatus m_status
Chain status, enum {ChainInvalid, ConfigOnlyChain, ChainOK }.
Definition: Chain.h:153
HLT::Chain::isPassedThrough
bool isPassedThrough() const
is chain passed through ?
Definition: Chain.h:85
MsgStream.h