ATLAS Offline Software
MdtCsmContByteStreamTool.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 
8 #include "MdtROD_Encoder.h"
9 #include "MuonRDO/MdtCsm.h"
12 
13 // default constructor
14 Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent) :
15  base_class(type, name, parent) {}
16 
18  ATH_CHECK(m_idHelperSvc.retrieve());
19  m_hid2re = std::make_unique<MDT_Hid2RESrcID>();
20  ATH_CHECK(m_hid2re->set(&m_idHelperSvc->mdtIdHelper()));
21 
22  ATH_CHECK(m_byteStreamCnvSvc.retrieve());
23 
24  return StatusCode::SUCCESS;
25 }
26 
27 StatusCode Muon::MdtCsmContByteStreamTool::finalize() { return StatusCode::SUCCESS; }
28 
29 StatusCode Muon::MdtCsmContByteStreamTool::convert(const MdtCsmContainer* cont, MsgStream& /*log*/) const {
30  // Get the event assembler
32  ATH_CHECK(m_byteStreamCnvSvc->getFullEventAssembler(fea, "MdtCsmContByteStream"));
33 
34  StatusCode status = fea->idMap().set(&m_idHelperSvc->mdtIdHelper());
35  if (status.isFailure()) {
36  ATH_MSG_FATAL("Could not initialize MDT mapping !");
37  return StatusCode::FAILURE;
38  }
39 
41 
42  std::map<uint32_t, MdtROD_Encoder> mapEncoder;
43 
44  ATH_MSG_DEBUG(" number of collections " << cont->size());
45  for (const MdtCsm* csm : *cont) {
46  Identifier coll_id = csm->identify();
47  uint32_t rodId = m_hid2re->getRodID(coll_id);
48  mapEncoder.try_emplace(rodId).first->second.add(csm);
49  }
50 
51  // MdtCsm_Encoder has collected all the csm, now can fill the
52  // ROD block data.
53 
54  ATH_MSG_DEBUG(" start to fill Rod ");
55 
56  for (auto& p : mapEncoder) {
57  theROD = fea->getRodData(p.first);
58  p.second.fillROD(*theROD);
59  }
60 
61  return StatusCode::SUCCESS;
62 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
MdtCsmContByteStreamTool.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:209
MdtCsmContainer
This container provides acces to the MDT RDOs.
Definition: MdtCsmContainer.h:22
MdtCsm
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
Definition: MdtCsm.h:19
MdtCsmContainer.h
MDT_Hid2RESrcID::set
StatusCode set(const MdtIdHelper *mdtId)
intialize the cabling service
Definition: MDT_Hid2RESrcID.cxx:25
Muon::MdtCsmContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: MdtCsmContByteStreamTool.cxx:17
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
RawEvent.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MdtROD_Encoder.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FullEventAssembler::idMap
IDMAP_t & idMap()
Return reference to IDMAP.
Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool
MdtCsmContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: MdtCsmContByteStreamTool.cxx:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MdtCsm.h
MuonDetectorManager.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::MdtCsmContByteStreamTool::convert
virtual StatusCode convert(const MdtCsmContainer *cont, MsgStream &log) const override
Definition: MdtCsmContByteStreamTool.cxx:29
merge.status
status
Definition: merge.py:17
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition: FullEventAssembler.h:54
Muon::MdtCsmContByteStreamTool::finalize
virtual StatusCode finalize() override
Definition: MdtCsmContByteStreamTool.cxx:27
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data