ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9
10// Unique interface ID of the tool that identifies it to the framweork
11static const InterfaceID IID_IMuCTPIByteStreamTool( "MuCTPIByteStreamTool", 1, 1 );
12
17const InterfaceID & MuCTPIByteStreamTool::interfaceID() {
19}
20
25MuCTPIByteStreamTool::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
37
38 ATH_MSG_DEBUG("executing convert() from RDO to ROBFragment");
39
40 // Clear Event Assembler
41 m_fea.clear();
42
43 // MIROD
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
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.
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 ) {
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}
const boost::regex re(r_e)
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
static const InterfaceID IID_IMuCTPIByteStreamTool("MuCTPIByteStreamTool", 1, 1)
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition RawEvent.h:39
uint16_t bcId(uint32_t data)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
MsgStream & msg() const
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
MuCTPIByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
StatusCode convert(const ROBF *rob, MuCTPI_RDO *&result)
Convert ROBFragment to MuCTPI_RDO.
FullEventAssembler< MuCTPISrcIdMap > m_fea
Object used in creating the MuCTPI ROB fragment.
MuCTPISrcIdMap m_srcIdMap
Object storing the various IDs of the MuCTPI fragment.
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Class representing the readout data of the MuCTPI hardware and simulation.
Definition MuCTPI_RDO.h:41
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.
const DataType * PointerType
Definition RawEvent.h:25