ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
BCM_RawDataByteStreamCnv
src
BCM_RawContByteStreamTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// BCM_RawContByteStreamTool.cxx
7
// Implementation file for class BCM_RawContByteStreamTool
9
// (c) ATLAS Detector software
12
// Version 00-00-02 05/03/2007 Daniel Dobos for pixels
13
// Version 00-00-11 05/02/2009 Daniel Dobos for BCM
15
16
#include "
BCM_RawContByteStreamTool.h
"
17
18
#include "
InDetBCM_RawData/InDetBCM_RawDataCLASS_DEF.h
"
19
20
#include "
BCM_RodEncoder.h
"
21
22
#include <cstdint>
23
#include <map>
24
26
// constructor
28
BCM_RawContByteStreamTool::BCM_RawContByteStreamTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent):
AthAlgTool
(
type
,name,parent) {
29
declareInterface<BCM_RawContByteStreamTool>(
this
);
30
declareProperty
(
"RodBlockVersion"
,
m_RodBlockVersion
=0);
31
declareProperty
(
"BCs_per_LVL1ID"
,
m_BCs_per_LVL1ID
=1);
32
}
33
35
// destructor
37
BCM_RawContByteStreamTool::~BCM_RawContByteStreamTool
() {
38
}
39
41
// initialize
43
StatusCode
BCM_RawContByteStreamTool::initialize
() {
44
ATH_CHECK
( AthAlgTool::initialize() );
45
return
StatusCode::SUCCESS;
46
}
47
49
// finalize
51
StatusCode
BCM_RawContByteStreamTool::finalize
() {
52
ATH_CHECK
( AthAlgTool::finalize() );
53
return
StatusCode::SUCCESS;
54
}
55
57
// convert
59
StatusCode
BCM_RawContByteStreamTool::convert
(
BCM_RDO_Container
* cont)
const
60
{
61
FullEventAssembler<SrcIdMap>
* fea =
nullptr
;
62
ATH_CHECK
(
m_byteStreamCnvSvc
->getFullEventAssembler (fea,
63
"BCMRawCont"
) );
64
FullEventAssembler<SrcIdMap>::RODDATA
* theROD;
65
66
// set ROD Minor version
67
fea->
setRodMinorVersion
(
m_RodBlockVersion
);
68
ATH_MSG_DEBUG
(
"Setting ROD Minor Version Number to: "
<<
m_RodBlockVersion
);
69
70
// a map for ROD ID onto Encoder
71
std::map<uint32_t, BCM_RodEncoder> mapEncoder;
72
73
// loop over the BCM RDO collections
74
BCM_RDO_Container::const_iterator
it_coll = cont->
begin
();
75
BCM_RDO_Container::const_iterator
it_coll_end = cont->
end
();
76
ATH_MSG_DEBUG
(
"Found "
<< cont->
size
() <<
" BCM RDO collections"
);
77
78
for
( ; it_coll!=it_coll_end; ++it_coll) {
79
const
BCM_RDO_Collection
* coll = (*it_coll);
80
81
// get OfflineId (channel number) and RODID
82
if
(coll !=
nullptr
) {
83
unsigned
int
offlineId = coll->
getChannel
();
84
uint32_t rodId =
getSourceID
(offlineId);
85
if
( offlineId >= 16 ) {
86
ATH_MSG_ERROR
(
"Didn't find RODID for OfflineID: "
<< offlineId );
87
}
88
89
mapEncoder[rodId].setRodMinorVersion(
m_RodBlockVersion
);
90
91
// loop over the RDOs
92
BCM_RDO_Collection::const_iterator
it_b = coll->
begin
();
93
BCM_RDO_Collection::const_iterator
it_e = coll->
end
();
94
95
for
(; it_b!=it_e; ++it_b){
96
const
BCM_RawData
* d = *it_b;
97
mapEncoder[rodId].addRdo(d);
98
}
99
}
100
else
101
ATH_MSG_WARNING
(
"Container contains NULLpointer to collection, skipping collection"
);
102
}
103
104
// Fill the ROD Data into Full Event loop over Encoder map and fill all ROD Data Blocks
105
std::map<uint32_t,BCM_RodEncoder>::iterator it_map = mapEncoder.begin();
106
std::map<uint32_t,BCM_RodEncoder>::iterator it_map_end = mapEncoder.end();
107
for
(; it_map != it_map_end; ++it_map) {
108
theROD = fea->
getRodData
((*it_map).first);
109
((*it_map).second).fillROD(*theROD,
m_BCs_per_LVL1ID
);
110
}
111
return
StatusCode::SUCCESS;
112
}
113
114
static
const
InterfaceID
IID_IBCM_RawContByteStreamTool
(
"BCM_RawContByteStreamTool"
, 1, 0);
115
const
InterfaceID&
BCM_RawContByteStreamTool::interfaceID
() {
116
return
IID_IBCM_RawContByteStreamTool
;
117
}
118
120
// getSourceID - convert channelID into ROD source ID
122
unsigned
int
BCM_RawContByteStreamTool::getSourceID
(
int
ChannelID)
const
123
{
124
// CHANGED TO NEW SOURCE ID 0x0081000A -> 0x0081004A and 0x0081000C -> 0x0081004C
125
switch
(ChannelID) {
126
case
0:
127
return
0x0081004A;
128
case
1:
129
return
0x0081004C;
130
case
2:
131
return
0x0081004A;
132
case
3:
133
return
0x0081004C;
134
case
4:
135
return
0x0081004A;
136
case
5:
137
return
0x0081004C;
138
case
6:
139
return
0x0081004A;
140
case
7:
141
return
0x0081004C;
142
case
8:
143
return
0x0081004C;
144
case
9:
145
return
0x0081004A;
146
case
10:
147
return
0x0081004C;
148
case
11:
149
return
0x0081004A;
150
case
12:
151
return
0x0081004C;
152
case
13:
153
return
0x0081004A;
154
case
14:
155
return
0x0081004C;
156
case
15:
157
return
0x0081004A;
158
default
:
159
return
0xffffffff;
160
}
161
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IID_IBCM_RawContByteStreamTool
static const InterfaceID IID_IBCM_RawContByteStreamTool("BCM_RawContByteStreamTool", 1, 0)
BCM_RawContByteStreamTool.h
BCM_RodEncoder.h
InDetBCM_RawDataCLASS_DEF.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
BCM_RDO_Collection
Definition
BCM_RDO_Collection.h:27
BCM_RDO_Collection::getChannel
virtual unsigned int getChannel() const
Definition
BCM_RDO_Collection.h:33
BCM_RDO_Container
Definition
BCM_RDO_Container.h:27
BCM_RawContByteStreamTool::m_BCs_per_LVL1ID
int m_BCs_per_LVL1ID
Definition
BCM_RawContByteStreamTool.h:52
BCM_RawContByteStreamTool::getSourceID
unsigned int getSourceID(int ChannelID) const
Definition
BCM_RawContByteStreamTool.cxx:122
BCM_RawContByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
Definition
BCM_RawContByteStreamTool.cxx:115
BCM_RawContByteStreamTool::BCM_RawContByteStreamTool
BCM_RawContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
BCM_RawContByteStreamTool.cxx:28
BCM_RawContByteStreamTool::m_RodBlockVersion
unsigned short m_RodBlockVersion
Definition
BCM_RawContByteStreamTool.h:51
BCM_RawContByteStreamTool::~BCM_RawContByteStreamTool
virtual ~BCM_RawContByteStreamTool()
Definition
BCM_RawContByteStreamTool.cxx:37
BCM_RawContByteStreamTool::convert
StatusCode convert(BCM_RDO_Container *cont) const
Definition
BCM_RawContByteStreamTool.cxx:59
BCM_RawContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition
BCM_RawContByteStreamTool.cxx:43
BCM_RawContByteStreamTool::finalize
virtual StatusCode finalize() override
Definition
BCM_RawContByteStreamTool.cxx:51
BCM_RawContByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition
BCM_RawContByteStreamTool.h:48
BCM_RawData
Definition
BCM_RawData.h:36
DataVector< BCM_RDO_Collection >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition
FullEventAssembler.h:38
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition
FullEventAssembler.h:52
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
type
Generated on
for ATLAS Offline Software by
1.17.0