ATLAS Offline Software
Loading...
Searching...
No Matches
MdtRDO_Decoder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MdtRDO_Decoder.h"
6
7using namespace Muon;
8
9MdtRDO_Decoder::MdtRDO_Decoder(const std::string& type, const std::string& name, const IInterface* parent) :
10 AthAlgTool(type, name, parent) {
11 declareInterface<IMDT_RDO_Decoder>(this);
12}
13
15 ATH_CHECK(m_idHelperSvc.retrieve());
16 ATH_CHECK(m_readKey.initialize());
17 return StatusCode::SUCCESS;
18}
19
20std::unique_ptr<MdtDigit> MdtRDO_Decoder::getDigit(const EventContext&ctx,
21 const MdtAmtHit& amtHit,
22 uint16_t subdetId, uint16_t mrodId, uint16_t csmId) const {
24 const MuonMDT_CablingMap* readCdo{*readHandle};
25 if (!readCdo) {
26 ATH_MSG_ERROR("Null pointer to the read conditions object");
27 return nullptr;
28 }
30 cabling_data.tdcId = amtHit.tdcId();
31 cabling_data.channelId = amtHit.channelId();
32 cabling_data.subdetectorId = subdetId;
33 cabling_data.mrod = mrodId;
34 cabling_data.csm = csmId;
35
36 uint16_t coarse = amtHit.coarse();
37 uint16_t fine = amtHit.fine();
38 int width = static_cast<int>(amtHit.width());
39
40 if (!readCdo->getOfflineId(cabling_data, msgStream())) return nullptr;
41 Identifier chanId;
42 if (!readCdo->convert(cabling_data, chanId, false)) return nullptr;
43 int tdcCounts = coarse * 32 + fine;
44 return std::make_unique<MdtDigit>(chanId, tdcCounts, width, amtHit.isMasked());
45}
46
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
const double width
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
MDT RDO's : data from a single channel of an AMT Atlas Muon TDC.
Definition MdtAmtHit.h:20
uint16_t fine() const
Definition MdtAmtHit.h:73
uint16_t width() const
Definition MdtAmtHit.h:74
uint16_t tdcId() const
Definition MdtAmtHit.h:70
bool isMasked() const
Definition MdtAmtHit.h:76
uint16_t channelId() const
Definition MdtAmtHit.h:71
uint16_t coarse() const
Definition MdtAmtHit.h:72
MdtCablingData CablingData
bool getOfflineId(CablingData &cabling_data, MsgStream &log) const
return the offline id given the online id
bool convert(const CablingData &cabling_data, Identifier &id, bool check_valid=true) const
converts the cabling data into an identifier.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
std::unique_ptr< MdtDigit > getDigit(const EventContext &ctx, const MdtAmtHit &amtHit, uint16_t subdetId, uint16_t mrodId, uint16_t csmId) const override final
MdtRDO_Decoder(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
StatusCode initialize() override final
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.