ATLAS Offline Software
Loading...
Searching...
No Matches
TgcRdoContByteStreamTool.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
9#include "GaudiKernel/MsgStream.h"
11#include "TgcROD_Encoder.h"
12
13// contructor
15 const std::string& type, const std::string& name, const IInterface* parent)
16 : base_class(type, name, parent) {
17 declareInterface<Muon::ITGC_RDOtoByteStreamTool>(this);
18}
19
20// destructor
22
23// initialize
25 // create TGC RDO ID to source ID mapper
26 m_hid2re = std::make_unique<TGC_Hid2RESrcID>();
27
28 ATH_CHECK(m_byteStreamCnvSvc.retrieve());
29
30 return StatusCode::SUCCESS;
31}
32
33// finalize
35 return AthAlgTool::finalize();
36}
37
38// convert TGC RDO to ByteStream
40 const TgcRdoContainer* cont) const {
41 // Get the event assembler
44 m_byteStreamCnvSvc->getFullEventAssembler(fea, "TgcRdoContByteStream"));
45
46 // event assembler
48
49 // a map for ROD ID onto Encoder
50 std::map<uint32_t, TgcROD_Encoder> mapEncoder;
51
52 // loop over RDO
54 TgcRdoContainer::const_iterator it_col_end = cont->end();
55 for (; it_col != it_col_end; ++it_col) {
56 // get ROD ID
57 const uint32_t rodId = m_hid2re->getRodID(*it_col);
58
59 // map the RDO onto Encoder
60 mapEncoder[rodId].setRdo(*it_col);
61 }
62
63 // loop over map and fill all ROD Data Blocks
64 std::map<uint32_t, TgcROD_Encoder>::iterator it_map = mapEncoder.begin();
65 std::map<uint32_t, TgcROD_Encoder>::iterator it_map_end = mapEncoder.end();
66 for (; it_map != it_map_end; ++it_map) {
67 // get ROD data address
68 theROD = fea->getRodData((*it_map).first);
69
70 // fill ROD data
71 ((*it_map).second).fillROD(*theROD);
72 }
73
74 return StatusCode::SUCCESS;
75}
#define ATH_CHECK
Evaluate an expression and check for errors.
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
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
virtual StatusCode finalize() override
Finalizer.
virtual StatusCode initialize() override
Initializer.
TgcRdoContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
std::unique_ptr< TGC_Hid2RESrcID > m_hid2re
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
virtual ~TgcRdoContByteStreamTool()
Destructor.
virtual StatusCode convert(const TgcRdoContainer *cont) const override
Convert RDO container to Byte Stream.