ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1ResultByteStream
src
CTPByteStreamTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// CTP data format include(s):
6
#include "CTPfragment/CTPfragment.h"
7
#include "CTPfragment/CTPdataformat.h"
8
#include "CTPfragment/CTPdataformatVersion.h"
9
10
// Trigger include(s):
11
#include "
TrigT1Result/CTP_RDO.h
"
12
13
// Local include(s):
14
#include "
CTPByteStreamTool.h
"
15
17
static
const
InterfaceID
IID_ICTPByteStreamTool
(
"CTPByteStreamTool"
, 1, 0 );
18
23
const
InterfaceID&
CTPByteStreamTool::interfaceID
() {
24
return
IID_ICTPByteStreamTool
;
25
}
26
31
CTPByteStreamTool::CTPByteStreamTool
(
const
std::string&
type
,
const
std::string& name,
32
const
IInterface* parent )
33
:
AthAlgTool
(
type
, name, parent ) {
34
35
declareInterface< CTPByteStreamTool >(
this
);
36
}
37
38
43
StatusCode
CTPByteStreamTool::convert
(
const
CTP_RDO
* result,
RawEventWrite
*
re
) {
44
45
MsgStream log( msgSvc(), name() );
46
ATH_MSG_DEBUG
(
"executing convert() from RDO to ROBFragment"
);
47
48
//get CTP version
49
unsigned
int
ctpVersionNumber = result->getCTPVersionNumber();
50
CTPdataformatVersion ctpVersion(ctpVersionNumber);
51
52
// Clear Event Assembler
53
m_fea
.clear();
54
55
// Reset lumi-block number to 1
56
m_fea
.setDetEvtType( 1 );
57
// Set L1Apos to center of readout window
58
uint16_t minorVersion = ( result->getNumberOfBunches() - 1u ) / 2u;
59
minorVersion &= ctpVersion.getL1APositionMask();
60
minorVersion <<= ctpVersion.getL1APositionShift();
61
m_fea
.setRodMinorVersion( minorVersion );
62
63
FullEventAssembler< CTPSrcIdMap >::RODDATA
* theROD;
64
65
// Source ID of CTP
66
const
uint32_t rodId =
m_srcIdMap
.getRodID();
67
68
ATH_MSG_DEBUG
(
" ROD ID:"
<< MSG::hex << rodId);
69
70
// get the ROD data container to be filled
71
theROD =
m_fea
.getRodData( rodId );
72
73
ATH_MSG_VERBOSE
(
" Dumping CTP words:"
);
74
75
// fill Data Words
76
const
std::vector< uint32_t >& vDataWords = result->getDataWords();
77
std::vector< uint32_t >::const_iterator it = vDataWords.begin();
78
std::vector< uint32_t >::const_iterator end = vDataWords.end();
79
for
( ; it != end; ++it ) {
80
theROD->push_back( *it );
81
ATH_MSG_VERBOSE
(
" 0x"
<< MSG::hex << std::setw( 8 ) << ( *it ));
82
}
83
84
// Now fill full event
85
ATH_MSG_DEBUG
(
"Now filling the event with the CTP fragment"
);
86
m_fea
.fill(
re
, log );
87
88
return
StatusCode::SUCCESS;
89
}
90
91
96
StatusCode
CTPByteStreamTool::convert
(
const
ROBF
* rob,
CTP_RDO
*& result ) {
97
98
MsgStream log( msgSvc(), name() );
99
ATH_MSG_DEBUG
(
"executing convert() from ROBFragment to RDO"
);
100
101
const
uint32_t ctpRodId =
m_srcIdMap
.getRodID();
102
const
uint32_t rodId = rob->rod_source_id();
103
104
ATH_MSG_DEBUG
(
" expected ROD sub-detector ID: "
<< std::hex << ctpRodId
105
<<
" ID found: "
<< std::hex << rodId << std::dec);
106
107
if
( rodId == ctpRodId ) {
108
109
ATH_MSG_VERBOSE
(
" Dumping CTP words:"
);
110
111
// For generality let's declare the data pointer like this. Altough it's
112
// unlikely to ever change from being a pointer to uint32_t-s.
113
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
it_data;
114
rob->rod_data( it_data );
115
const
uint32_t ndata = rob->rod_ndata();
116
117
// data words
118
std::vector<uint32_t> vDataWords;
119
for
( uint32_t i = 0; i < ndata; ++i, ++it_data ) {
120
vDataWords.push_back(
static_cast<
uint32_t
>
( *it_data ) );
121
ATH_MSG_VERBOSE
(
" 0x"
<< MSG::hex << std::setw( 8 ) << *it_data);
122
}
123
124
// create CTP RDO
125
uint32_t nExtraWords=0;
126
nExtraWords=CTPfragment::numberExtraPayloadWords(rob);
127
unsigned
int
ctpVersionNumber = CTPfragment::ctpFormatVersion(rob);
128
result =
new
CTP_RDO
(ctpVersionNumber, std::move(vDataWords) , nExtraWords);
129
130
uint8_t l1apos = CTPfragment::lvl1AcceptBunch(rob);
131
result->setL1AcceptBunchPosition(l1apos);
132
133
uint32_t
tc
= CTPfragment::turnCounter(rob);
134
result->setTurnCounter(
tc
);
135
136
return
StatusCode::SUCCESS;
137
}
138
139
ATH_MSG_ERROR
(
"Wrong ROD ID found in the CTP ROB fragment!"
);
140
return
StatusCode::FAILURE;
141
}
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_ICTPByteStreamTool
static const InterfaceID IID_ICTPByteStreamTool("CTPByteStreamTool", 1, 0)
Unique interface ID of the tool that identifies it to the framweork.
CTPByteStreamTool.h
CTP_RDO.h
tc
static Double_t tc
Definition
LArPhysWaveHECTool.cxx:38
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition
RawEvent.h:39
CTP_RDO
CTP_RDO
Definition
TrigT1EventTPCnv.cxx:102
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
CTPByteStreamTool::convert
StatusCode convert(const ROBF *rob, CTP_RDO *&result)
Convert ROBFragment to CTP_RDO.
Definition
CTPByteStreamTool.cxx:96
CTPByteStreamTool::m_srcIdMap
CTPSrcIdMap m_srcIdMap
Object storing the various IDs of the CTP fragment.
Definition
CTPByteStreamTool.h:53
CTPByteStreamTool::m_fea
FullEventAssembler< CTPSrcIdMap > m_fea
Object used in creating the CTP ROB fragment.
Definition
CTPByteStreamTool.h:55
CTPByteStreamTool::CTPByteStreamTool
CTPByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Definition
CTPByteStreamTool.cxx:31
CTPByteStreamTool::ROBF
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
Definition
CTPByteStreamTool.h:36
CTPByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition
CTPByteStreamTool.cxx:23
CTP_RDO
Definition
CTP_RDO.h:20
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition
FullEventAssembler.h:52
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition
RawEvent.h:25
type
Generated on
for ATLAS Offline Software by
1.17.0