ATLAS Offline Software
Loading...
Searching...
No Matches
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
17
19
20#include "BCM_RodEncoder.h"
21
22#include <cstdint>
23#include <map>
24
26// constructor
28BCM_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
39
41// initialize
44 ATH_CHECK( AthAlgTool::initialize() );
45 return StatusCode::SUCCESS;
46}
47
49// finalize
52 ATH_CHECK( AthAlgTool::finalize() );
53 return StatusCode::SUCCESS;
54}
55
57// convert
60{
61 FullEventAssembler<SrcIdMap>* fea = nullptr;
62 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea,
63 "BCMRawCont") );
65
66 // set ROD Minor version
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
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
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
114static const InterfaceID IID_IBCM_RawContByteStreamTool("BCM_RawContByteStreamTool", 1, 0);
118
120// getSourceID - convert channelID into ROD source ID
122unsigned 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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static const InterfaceID IID_IBCM_RawContByteStreamTool("BCM_RawContByteStreamTool", 1, 0)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
virtual unsigned int getChannel() const
unsigned int getSourceID(int ChannelID) const
static const InterfaceID & interfaceID()
BCM_RawContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode convert(BCM_RDO_Container *cont) const
virtual StatusCode initialize() override
virtual StatusCode finalize() override
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
Template class for assembling a full atlas raw event from subfragments.
void setRodMinorVersion(uint16_t m)
change the ROD minor version
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
RODDATA * getRodData(uint32_t id)
get a block of ROD data