ATLAS Offline Software
Loading...
Searching...
No Matches
RpcPadContByteStreamTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <map>
8
10#include "GaudiKernel/MsgStream.h"
11#include "MuonRDO/RpcPad.h"
13#include "RPC_Hid2RESrcID.h"
14#include "RpcROD_Encoder.h"
15
16static const InterfaceID IID_IRpcPadContByteStreamTool("Muon::RpcPadContByteStreamTool", 1, 0);
17
19
20Muon::RpcPadContByteStreamTool::RpcPadContByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent) :
21 AthAlgTool(type, name, parent) {
22 declareInterface<IRPC_RDOtoByteStreamTool>(this);
23}
24
26 ATH_CHECK(AlgTool::initialize());
27 ATH_CHECK(m_readKey.initialize());
28 ATH_CHECK(m_idHelperSvc.retrieve());
29 m_hid2re.set(&m_idHelperSvc->rpcIdHelper());
30
31 ATH_CHECK(m_byteStreamCnvSvc.retrieve());
32
33 return StatusCode::SUCCESS;
34}
35
38 ATH_CHECK(m_byteStreamCnvSvc->getFullEventAssembler(fea, "RpcRdoContByteStream"));
39
40 fea->idMap().set(&m_idHelperSvc->rpcIdHelper());
41
43
44 RpcPadContainer::const_iterator it_coll = cont->begin();
45 RpcPadContainer::const_iterator it_coll_end = cont->end();
46
47 std::map<uint32_t, RpcROD_Encoder> mapEncoder;
48
49 for (; it_coll != it_coll_end; ++it_coll) {
50 const RpcPad* coll = (*it_coll);
51
52 int sector = coll->sector();
53 uint32_t rodId = m_hid2re.getRodID(sector);
54 mapEncoder[rodId].add(coll);
55 }
56
57 std::map<uint32_t, RpcROD_Encoder>::iterator it = mapEncoder.begin();
58 std::map<uint32_t, RpcROD_Encoder>::iterator it_end = mapEncoder.end();
59
60 // RpcROD_Encoder has collected all the pads, now can fill the
61 // ROD block data.
62 for (; it != it_end; ++it) {
63 theROD = fea->getRodData((*it).first);
64 ((*it).second).set(&m_hid2re);
65 ((*it).second).fillROD(*theROD);
66 }
67
68 return StatusCode::SUCCESS;
69}
#define ATH_CHECK
Evaluate an expression and check for errors.
static const InterfaceID IID_IRpcPadContByteStreamTool("Muon::RpcPadContByteStreamTool", 1, 0)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Template class for assembling a full atlas raw event from subfragments.
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
RODDATA * getRodData(uint32_t id)
get a block of ROD data
IDMAP_t & idMap()
Return reference to IDMAP.
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
SG::ReadCondHandleKey< RpcCablingCondData > m_readKey
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
RpcPadContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual StatusCode initialize() override
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
virtual StatusCode convert(RpcPadContainer *cont) const override
Conversion method, which takes the RDO container and converts it into raw data, filled into RawEventW...
Use IdentifiableContainer with RpcPad.
int sector() const
Definition RpcPad.h:112
STL class.
singleton-like access to IMessageSvc via open function and helper