ATLAS Offline Software
Loading...
Searching...
No Matches
Chain.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5/**********************************************************************************
6 * @Project: HLT Steering
7 * @Package: TrigSteering
8 * @Class : Chain
9 *
10 * @brief chain of signatures
11 *
12 * @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland
13 * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN
14 *
15 * File and Version Information:
16 * $Id: Chain.cxx,v 1.59 2009-02-16 15:47:05 tbold Exp $
17 **********************************************************************************/
18
21
22
23#include <sstream>
24#include <iostream>
25
26using namespace HLT;
27Chain::Chain( uint32_t serialData )
28 : m_configChain(0) {
29 reset();
30 deserialize(serialData);
32}
33
34Chain::Chain(const TrigConf::HLTChain* configChain)
35 : m_configChain(configChain)
37{
38 if (configChain)
39 m_chain_counter = m_configChain->chain_counter();
40
41 reset();
43}
44
45
46bool Chain::chainPassed() const {
47 return (chainPassedRaw() && (!isPrescaled()) && (!isResurrected())) || isPassedThrough();
48}
49
50
51
52HLT::ErrorCode Chain::serialize( std::vector<uint32_t>& output ) const
53{
54 // Chain serialized structure: 1 word per Chain
55 // 1 bit: active ? (before prescale and passThrough)
56 // 1 bit: prescaled ?
57 // 1 bit: passedThrough ?
58 // 7 bit: last active step => [0,127]
59 // 16 bit: chainCounter => [0,65535]
60 // 6 bit: ErrorCode => [0,63]
61
62 // serialize data: first 3 bits for Active, Prescaled, passThrough bits
63 uint32_t chainWord = 0;
64 if (chainPassedRaw()) chainWord |= 0x1;
65 if (isPrescaled()) chainWord |= 0x2;
66 if (isPassedThrough()) chainWord |= 0x4;
67
68 // next, 6 bits for the last active step (64 steps)
69 chainWord |= ((m_currentStep & 0x0000003f) << 3);
70
71
72 if ( isResurrected()) chainWord |= 0x200;
73
74 // next, 16 bits for the chain counter
75 chainWord |= ((getChainCounter() & 0x0000ffff) << (3+6+1));
76
77 // next, 6 bits for the errorCode
78 chainWord |= ((m_errorCode & 0x0000003f) << (3+6+1+16));
79
80 output.push_back(chainWord);
81
82 return HLT::OK;
83}
84
85HLT::ErrorCode Chain::setDecisions(bool passedraw, bool passedthrough, bool prescaled, bool resurrected)
86{
88 m_passedRaw = passedraw;
89 m_passThrough = passedthrough;
90 m_prescaled = prescaled;
91 m_resurrected = resurrected;
92
93 // can't deduce the following
94 // m_currentStep = 0; // can't deduce
95 // m_chain_counter = ( chainWord >> (3+7)) & 0x0000ffff;
96 // m_errorCode = static_cast<HLT::ErrorCode>(( chainWord >> (3+7+16)) & 0x0000003f);
97 return HLT::OK;
98}
99
100
102{
104 m_passedRaw = chainWord & (0x1);
105 m_passThrough = chainWord & (0x4);
106 m_prescaled = chainWord & (0x2);
107 m_resurrected = chainWord & (0x200);
108
109 m_currentStep = ( chainWord >> 3) & 0x0000003f;
110 m_chain_counter = ( chainWord >> (3+7)) & 0x0000ffff;
111 m_errorCode = static_cast<HLT::ErrorCode>(( chainWord >> (3+7+16)) & 0x0000003f);
112 /*
113 // Put m_currentStep signatures in the vector
114 for (unsigned int i = 0; i < static_cast<unsigned int>(m_currentStep); i++) m_signatures.push_back(0);
115
116 // if chain didn't pass, add one more signature...
117 if (!(chainWord & (0x1))) m_signatures.push_back(0);
118 */
119
120 return HLT::OK;
121}
122
123unsigned int HLT::Chain::inquireChainCounter(uint32_t chainWord) {
124 return ( chainWord >> (3+7)) & 0x0000ffff;
125}
126
129 m_passedRaw = false;
130 m_passThrough = false;
131 m_prescaled = false;
132 m_resurrected = false;
133 m_currentStep = 0;
134 return true;
135}
136
137
139std::ostream& HLT::operator << (std::ostream& os, const Chain& c)
140{
141 c.print(os);
142 return os;
143}
144MsgStream& HLT::operator << (MsgStream& msg, const Chain& c)
145{
146 c.print(msg);
147 return msg;
148}
149
This class represents one chain of signatures, i.e.
Definition Chain.h:64
bool m_prescaled
Flagged as "prescaled" for this event ?
Definition Chain.h:148
bool m_passedRaw
Definition Chain.h:146
void setStatus(ChainStatus s)
Definition Chain.h:141
ChainStatus m_status
Chain status, enum {ChainInvalid, ConfigOnlyChain, ChainOK }.
Definition Chain.h:153
Chain(uint32_t serialData)
constructor from serialized data
Definition Chain.cxx:27
ErrorCode m_errorCode
most severe error code of execution
Definition Chain.h:145
int m_currentStep
Current step of this chain.
Definition Chain.h:150
bool m_resurrected
flag to mar that chain was originally prescalled but is reexecuted
Definition Chain.h:149
bool chainPassed() const
Definition Chain.cxx:46
static unsigned int inquireChainCounter(uint32_t chainWord)
unpack chain counter from the serialized word
Definition Chain.cxx:123
const TrigConf::HLTChain * m_configChain
underlying Config Chain
Definition Chain.h:143
ErrorCode deserialize(uint32_t chainWord)
deserialize this Chain from given vector of uint's
Definition Chain.cxx:101
unsigned int getChainCounter() const
return the unique identifier of this Chain (uint)
Definition Chain.h:93
bool reset()
restes the bits to the basic state
Definition Chain.cxx:127
bool isPassedThrough() const
is chain passed through ?
Definition Chain.h:85
bool isPrescaled() const
is chain prescaled ?
Definition Chain.h:86
ErrorCode serialize(std::vector< uint32_t > &output) const
serialize this Chain into the given vector of uint's
Definition Chain.cxx:52
ErrorCode setDecisions(bool passedraw, bool passedthrough, bool prescaled, bool resurrected)
set bool decisions directly
Definition Chain.cxx:85
unsigned int m_chain_counter
chain counter from configuration (copied here for speed)
Definition Chain.h:144
bool m_passThrough
Flagged as "passedThrough" for this event ?
Definition Chain.h:147
bool isResurrected() const
is chain resurrected ?
Definition Chain.h:87
bool chainPassedRaw() const
Definition Chain.h:81
HLT chain configuration information.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
static const ErrorCode OK(Action::CONTINUE)
@ ChainInvalid
Definition Chain.h:51
@ ConfigOnlyChain
Definition Chain.h:51
@ ChainOK
Definition Chain.h:51
MsgStream & operator<<(MsgStream &m, const Navigation &nav)
MsgStream & msg
Definition testRead.cxx:32