ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1ResultByteStream
src
MuCTPIByteStreamTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuCTPIByteStreamTool.h
"
6
#include "
TrigT1Result/MuCTPI_RDO.h
"
7
#include "
TrigT1MuctpiBits/MuCTPI_Bits.h
"
8
9
10
// Unique interface ID of the tool that identifies it to the framweork
11
static
const
InterfaceID
IID_IMuCTPIByteStreamTool
(
"MuCTPIByteStreamTool"
, 1, 1 );
12
17
const
InterfaceID &
MuCTPIByteStreamTool::interfaceID
() {
18
return
IID_IMuCTPIByteStreamTool
;
19
}
20
25
MuCTPIByteStreamTool::MuCTPIByteStreamTool
(
const
std::string&
type
,
const
std::string& name,
26
const
IInterface* parent )
27
:
AthAlgTool
(
type
, name, parent ) {
28
29
declareInterface<MuCTPIByteStreamTool>(
this
);
30
}
31
36
StatusCode
MuCTPIByteStreamTool::convert
(
const
MuCTPI_RDO
* result,
RawEventWrite
*
re
) {
37
38
ATH_MSG_DEBUG
(
"executing convert() from RDO to ROBFragment"
);
39
40
// Clear Event Assembler
41
m_fea
.clear();
42
43
// MIROD
44
FullEventAssembler< MuCTPISrcIdMap >::RODDATA
* theROD;
45
46
// Source ID of MIROD
47
const
uint32_t rodId =
m_srcIdMap
.getRodID();
48
49
// get the ROD data container to be filled
50
theROD =
m_fea
.getRodData( rodId );
51
52
ATH_MSG_VERBOSE
(
" Dumping MuCTPI words:"
);
53
54
// fill Candidate Multiplicity
55
const
std::vector< uint32_t >& multiWord = result->getAllCandidateMultiplicities();
56
std::vector< uint32_t >::const_iterator it = multiWord.begin();
57
std::vector< uint32_t >::const_iterator it_e = multiWord.end();
58
for
( ; it != it_e; ++it ) {
59
theROD->push_back( *it );
60
ATH_MSG_VERBOSE
(
" 0x"
<< MSG::hex << std::setfill(
'0'
)
61
<< std::setw( 8 ) << ( *it ) <<
" (candidate multiplicity)"
);
62
}
63
64
// fill Data Words
65
const
std::vector< uint32_t >& dataWord = result->dataWord();
66
it = dataWord.begin();
67
it_e = dataWord.end();
68
for
( ; it != it_e; ++it ) {
69
theROD->push_back( *it );
70
ATH_MSG_VERBOSE
(
" 0x"
<< MSG::hex << std::setfill(
'0'
)
71
<< std::setw( 8 ) << ( *it ) <<
" (candidate word)"
);
72
}
73
74
// Now fill full event
75
ATH_MSG_DEBUG
(
"Now filling the event with the MuCTPI fragment"
);
76
m_fea
.fill(
re
,
msg
() );
77
78
return
StatusCode::SUCCESS;
79
}
80
85
StatusCode
MuCTPIByteStreamTool::convert
(
const
ROBF
* rob,
MuCTPI_RDO
*& result ) {
86
87
ATH_MSG_DEBUG
(
"executing convert() from ROBFragment to RDO"
);
88
89
// Source ID of MIROD
90
const
uint32_t miRodId =
m_srcIdMap
.getRodID();
91
92
// check ROD source ID
93
const
uint32_t rodId = rob->rod_source_id();
94
95
// check BC ID
96
const
uint32_t
bcId
= rob->rod_bc_id();
97
98
ATH_MSG_DEBUG
(
" expected ROD sub-detector ID: "
<< std::hex << miRodId
99
<<
" ID found: "
<< std::hex << rodId << std::dec);
100
101
if
( rodId == miRodId || rodId == 0x7501 ) {
102
103
ATH_MSG_VERBOSE
(
" ROD Header BCID "
<<
bcId
<<
", dumping MuCTPI words:"
);
104
if
( rodId == 0x7501 ) {
105
ATH_MSG_DEBUG
(
" Deprecated ROD source id found: "
106
<< std::hex << rodId << std::dec);
107
}
108
109
// For generality let's declare the data pointer like this. Altough it's
110
// unlikely to ever change from being a pointer to uint32_t-s.
111
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
it_data;
112
rob->rod_data( it_data );
113
const
uint32_t ndata = rob->rod_ndata();
114
ATH_MSG_VERBOSE
(
" number of data words: "
<< ndata);
115
116
// candidate multiplicity
117
std::vector< uint32_t > candidateMultiplicity;
118
// data words
119
std::vector< uint32_t > dataWord;
120
for
( uint32_t i = 0; i < ndata; ++i, ++it_data ) {
121
if
( *it_data >>
LVL1::MuCTPIBits::MULT_WORD_FLAG_SHIFT
) {
122
candidateMultiplicity.push_back(
static_cast<
uint32_t
>
( *it_data ) );
123
ATH_MSG_VERBOSE
(
" 0x"
<< MSG::hex << std::setw( 8 ) << std::setfill(
'0'
)
124
<< ( *it_data ) <<
" (candidate multiplicity)"
);
125
}
else
{
126
dataWord.push_back(
static_cast<
uint32_t
>
( *it_data ) );
127
ATH_MSG_VERBOSE
(
" 0x"
<< MSG::hex << std::setw( 8 ) << std::setfill(
'0'
)
128
<< ( *it_data ) <<
" (candidate word)"
);
129
}
130
}
131
132
// create MuCTPI RDO
133
result =
new
MuCTPI_RDO
( std::move(candidateMultiplicity), std::move(dataWord) );
134
return
StatusCode::SUCCESS;
135
136
}
137
138
ATH_MSG_ERROR
(
"Wrong ROD ID found in the MuCTPI ROB fragment!"
);
139
return
StatusCode::FAILURE;
140
}
re
const std::regex re(r_e)
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IID_IMuCTPIByteStreamTool
static const InterfaceID IID_IMuCTPIByteStreamTool("MuCTPIByteStreamTool", 1, 1)
MuCTPIByteStreamTool.h
MuCTPI_Bits.h
MuCTPI_RDO.h
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition
RawEvent.h:39
bcId
uint16_t bcId(uint32_t data)
Definition
TgcByteStreamData.h:326
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition
FullEventAssembler.h:52
MuCTPIByteStreamTool::MuCTPIByteStreamTool
MuCTPIByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Definition
MuCTPIByteStreamTool.cxx:25
MuCTPIByteStreamTool::convert
StatusCode convert(const ROBF *rob, MuCTPI_RDO *&result)
Convert ROBFragment to MuCTPI_RDO.
Definition
MuCTPIByteStreamTool.cxx:85
MuCTPIByteStreamTool::m_fea
FullEventAssembler< MuCTPISrcIdMap > m_fea
Object used in creating the MuCTPI ROB fragment.
Definition
MuCTPIByteStreamTool.h:54
MuCTPIByteStreamTool::m_srcIdMap
MuCTPISrcIdMap m_srcIdMap
Object storing the various IDs of the MuCTPI fragment.
Definition
MuCTPIByteStreamTool.h:52
MuCTPIByteStreamTool::ROBF
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
Definition
MuCTPIByteStreamTool.h:35
MuCTPIByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition
MuCTPIByteStreamTool.cxx:17
MuCTPI_RDO
Class representing the readout data of the MuCTPI hardware and simulation.
Definition
MuCTPI_RDO.h:41
LVL1::MuCTPIBits::MULT_WORD_FLAG_SHIFT
static constexpr uint32_t MULT_WORD_FLAG_SHIFT
Position of the bit turned on for the multiplicity words that distinguishes them from the data words.
Definition
MuCTPI_Bits.h:131
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition
RawEvent.h:25
type
Generated on
for ATLAS Offline Software by
1.17.0