00001 #pragma once 00002 /********************************************************************************** 00003 * @Project: HLT SteeringEvent 00004 * @Package: TrigSteeringEvent 00005 * @Class : Chain 00006 * 00007 * @brief chain of signatures 00008 * 00009 * @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland 00010 * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN 00011 * moved from TrigSteering package 00012 * 00013 * File and Version Information: 00014 * $Id: Chain.h,v 1.44 2009-02-16 15:47:04 tbold Exp $ 00015 **********************************************************************************/ 00016 00017 #ifndef TRIGSTEERINGEVENT_CHAIN_H 00018 #define TRIGSTEERINGEVENT_CHAIN_H 00019 00020 #include <vector> 00021 #include <stdint.h> 00022 #include <iostream> 00023 #include <iomanip> 00024 00025 #include "TrigSteeringEvent/Enums.h" 00026 #include "TrigConfHLTData/HLTChain.h" 00027 00028 #include "AsgTools/AsgToolsConf.h" 00029 #ifdef ASGTOOL_STANDALONE 00030 #include "AsgTools/MsgStream.h" 00031 #include "AsgTools/MsgStreamMacros.h" 00032 #endif 00033 #ifdef ASGTOOL_ATHENA 00034 #include "GaudiKernel/MsgStream.h" 00035 #include "AthenaBaseComps/AthMsgStreamMacros.h" 00036 #endif 00037 00038 //#include "TrigSteeringEvent/GenericResult.h" 00039 00040 #include <iosfwd> 00041 00042 class MsgStream; 00043 class TrigTimer; 00044 00045 namespace HLT { 00046 00047 // taht is for backward compatibility of TDT, once new TDT will be available it can be removed from steering 00048 enum ChainStatus { ChainInvalid=0, ConfigOnlyChain, ChainOK }; 00049 00060 class Chain 00061 { 00062 00063 public: 00064 00065 00066 //Chain( const std::vector<uint32_t>& serialData ); //!< constructor from serialized data 00067 00068 Chain( uint32_t serialData ); 00069 00070 Chain(const TrigConf::HLTChain* configChain); 00071 00072 ~Chain(){} 00073 00074 00075 const TrigConf::HLTChain* getConfigChain() const { return m_configChain; } 00076 00077 00078 bool chainPassedRaw() const { return m_passedRaw; } 00079 bool chainPassed() const; 00080 00081 00082 bool isPassedThrough() const { return m_passThrough; } 00083 bool isPrescaled() const { return m_prescaled; } 00084 bool isResurrected() const { return m_resurrected; } 00085 00086 // For Lvl Converters 00087 00088 float prescaleFactor() const { return (m_configChain ? m_configChain->prescale() : -1.); } 00089 float passThroughFactor() const { return (m_configChain ? m_configChain->pass_through() : -1.); } 00090 unsigned int getChainCounter() const { return m_chain_counter; } 00091 std::string getChainName() const { return (m_configChain ? m_configChain->chain_name(): "no config"); } 00092 std::string getLowerChainName() const { return (m_configChain ? m_configChain->lower_chain_name(): "no config"); } 00093 int getEBAfterStep() const { return (m_configChain ? m_configChain->EB_after_step() : -1.); } 00094 bool nextStepAfterEB() const { return ((getChainStep()+1) > getEBAfterStep()) && (getEBAfterStep()>0.); } 00095 bool isMerged() const { return (m_configChain ? (m_configChain->level()=="HLT") : false);}; 00096 00097 unsigned int getChainHashId() const { return (m_configChain ? m_configChain->chain_hash_id() : 0); } 00098 HLT::ErrorCode getErrorCode() const { return m_errorCode; } 00099 int getChainStep() const { return m_currentStep; } 00100 00101 00107 template <class stream> 00108 void print(stream& os) const 00109 { 00110 os << "Counter = " << std::setw(4) <<getChainCounter() 00111 << " success (raw) = " << chainPassedRaw() 00112 << " EBstep = " << getEBAfterStep() 00113 << " pass-through = " << isPassedThrough() 00114 << " prescaled = " << isPrescaled() 00115 << " rerun = " << isResurrected() 00116 << " lastActiveStep = " << getChainStep() 00117 << " name = " << std::setw(35) << getChainName() 00118 << " EC = "<< strErrorCode(getErrorCode()) ; 00119 } 00120 00121 ErrorCode serialize( std::vector<uint32_t>& output ) const; 00122 00123 ErrorCode deserialize(uint32_t chainWord); 00124 00125 ErrorCode setDecisions(bool passedraw, bool passedthrough, bool prescaled, bool resurrected); 00126 00127 00128 static unsigned int inquireChainCounter(uint32_t chainWord); 00129 00130 ChainStatus getStatus() const { return m_status; } 00131 00132 bool reset(); 00133 00134 protected: 00135 00136 00137 void setStatus(ChainStatus s) { m_status = s; } 00138 00139 const TrigConf::HLTChain* m_configChain; 00140 unsigned int m_chain_counter; 00141 ErrorCode m_errorCode; 00142 bool m_passedRaw; 00143 bool m_passThrough; 00144 bool m_prescaled; 00145 bool m_resurrected; 00146 int m_currentStep; 00147 00148 private: 00149 ChainStatus m_status; 00150 00151 }; 00152 00153 00157 MsgStream& operator << (MsgStream&, const Chain&); 00158 std::ostream& operator << (std::ostream&, const Chain&); 00159 00160 } // end of namespace 00161 00162 00163 #endif