ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonByteStreamCnvTest
src
NrpcDigitToNrpcRDO.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
NrpcDigitToNrpcRDO.h
"
6
7
#include <algorithm>
8
#include "GaudiKernel/PhysicalConstants.h"
9
#include "
MuonDigitContainer/RpcDigit.h
"
10
#include "
MuonDigitContainer/RpcDigitCollection.h
"
11
#include "
MuonReadoutGeometry/RpcReadoutElement.h
"
12
#include "
StoreGate/StoreGateSvc.h
"
13
#include "
TrigT1RPClogic/ShowData.h
"
14
#include "
xAODMuonRDO/NRPCRDOAuxContainer.h
"
15
16
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
17
namespace
Muon
{
18
StatusCode
NrpcDigitToNrpcRDO::initialize
() {
19
ATH_MSG_DEBUG
(
" in initialize()"
);
20
21
ATH_CHECK
(
m_idHelperSvc
.retrieve());
22
ATH_CHECK
(
m_NrpcContainerKey
.initialize() );
23
24
ATH_MSG_DEBUG
(
"Tag info filled successfully"
);
25
26
ATH_CHECK
(
m_cablingKey
.initialize());
27
ATH_MSG_DEBUG
(
"Cabling info initialized"
);
28
29
ATH_CHECK
(
m_digitContainerKey
.initialize());
30
ATH_MSG_VERBOSE
(
"Initialized ReadHandleKey: "
<<
m_digitContainerKey
);
31
32
for
(
const
std::string& statName :
m_convStat
){
33
m_selectedStations
.insert(
m_idHelperSvc
->rpcIdHelper().stationNameIndex(statName));
34
}
35
return
StatusCode::SUCCESS;
36
}
37
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
38
StatusCode
NrpcDigitToNrpcRDO::execute
(
const
EventContext& ctx)
const
{
39
ATH_MSG_DEBUG
(
"in execute()"
);
40
41
SG::ReadHandle
container(
m_digitContainerKey
, ctx);
42
if
(!container.isValid()) {
43
ATH_MSG_FATAL
(
"Could not find RpcDigitContainer called "
<< container.name() <<
" in store "
<< container.store());
44
return
StatusCode::FAILURE;
45
}
46
SG::ReadCondHandle
cabling(
m_cablingKey
, ctx);
47
if
(!cabling.isValid()) {
48
ATH_MSG_FATAL
(
"Could not find MuonNRPC_CablingMap "
);
49
return
StatusCode::FAILURE;
50
}
51
ATH_MSG_DEBUG
(
"Found MuonNRPC_CablingMap "
);
52
54
SG::WriteHandle
nrpcRdoData(
m_NrpcContainerKey
, ctx);
55
ATH_CHECK
(nrpcRdoData.
record
(std::make_unique<xAOD::NRPCRDOContainer>(),
56
std::make_unique<xAOD::NRPCRDOAuxContainer>()));
57
58
59
const
IdContext
rpcContext =
m_idHelperSvc
->rpcIdHelper().module_context();
60
61
// loop over digit collections
62
for
(
const
RpcDigitCollection
* rpcCollection : *container) {
63
ATH_MSG_DEBUG
(
"RPC Digit -> Pad loop :: digitCollection at "
<< rpcCollection);
64
65
IdentifierHash
moduleHash = rpcCollection->identifierHash();
66
Identifier
moduleId{0};
67
68
if
(
m_idHelperSvc
->rpcIdHelper().get_id(moduleHash, moduleId, &rpcContext)) {
69
ATH_MSG_WARNING
(
"Failed to translate the "
<<moduleHash<<
" to a valid identifier"
);
70
continue
;
71
}
72
if
(
m_selectedStations
.size() &&
73
!
m_selectedStations
.count(
m_idHelperSvc
->stationName(moduleId))) {
74
ATH_MSG_DEBUG
(
"Detector element "
<<
m_idHelperSvc
->toString(moduleId)
75
<<
" is not considered to be a small gap RPC"
);
76
continue
;
77
}
78
79
// loop over digit
80
for
(
const
RpcDigit
* rpcDigit : *rpcCollection) {
81
const
Identifier
channelId = rpcDigit->identify();
82
83
ATH_MSG_DEBUG
(
"Convert RPC digit "
<<
m_idHelperSvc
->toString(channelId));
84
85
RpcCablingData
translateCache{};
87
if
(!cabling->convert(channelId, translateCache, rpcDigit->
stripSide
())) {
88
ATH_MSG_FATAL
(
"Found a non NRPC identifier "
<<
m_idHelperSvc
->toString(channelId));
89
return
StatusCode::FAILURE;
90
}
91
92
if
(!cabling->getOnlineId(translateCache, msgStream())) {
93
ATH_MSG_ERROR
(
"Offline to Online Id conversion for NRPC chamber."
94
<<
m_idHelperSvc
->toString(channelId) <<
" failed."
);
95
return
StatusCode::FAILURE;
96
}
98
const
float
rdo_time = rpcDigit->time();
99
100
const
float
the_timeoverthr = rpcDigit->ToT();
101
uint32_t the_bcid= rdo_time > 0 ? rdo_time / 25. : 0;
102
103
xAOD::NRPCRDO
* NrpcRdo = nrpcRdoData->push_back(std::make_unique<xAOD::NRPCRDO>());
104
NrpcRdo->
setBcid
(the_bcid);
105
NrpcRdo->
setTime
(rdo_time);
106
NrpcRdo->
setSubdetector
(translateCache.
subDetector
);
107
NrpcRdo->
setBoardsector
(translateCache.
boardSector
);
108
NrpcRdo->
setBoard
(translateCache.
board
);
109
NrpcRdo->
setChannel
(translateCache.
channelId
);
110
NrpcRdo->
setTimeoverthr
(the_timeoverthr);
111
}
112
}
113
return
StatusCode::SUCCESS;
114
}
115
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
RpcReadoutElement.h
NRPCRDOAuxContainer.h
NrpcDigitToNrpcRDO.h
RpcDigitCollection.h
RpcDigit.h
ShowData.h
StoreGateSvc.h
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition
IdContext.h:26
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
Muon::NrpcDigitToNrpcRDO::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
NrpcDigitToNrpcRDO.cxx:38
Muon::NrpcDigitToNrpcRDO::m_NrpcContainerKey
SG::WriteHandleKey< xAOD::NRPCRDOContainer > m_NrpcContainerKey
Definition
NrpcDigitToNrpcRDO.h:38
Muon::NrpcDigitToNrpcRDO::m_digitContainerKey
SG::ReadHandleKey< RpcDigitContainer > m_digitContainerKey
Definition
NrpcDigitToNrpcRDO.h:35
Muon::NrpcDigitToNrpcRDO::m_idHelperSvc
ServiceHandle< IMuonIdHelperSvc > m_idHelperSvc
Definition
NrpcDigitToNrpcRDO.h:40
Muon::NrpcDigitToNrpcRDO::m_cablingKey
SG::ReadCondHandleKey< RpcCablingMap > m_cablingKey
Definition
NrpcDigitToNrpcRDO.h:33
Muon::NrpcDigitToNrpcRDO::m_selectedStations
std::unordered_set< int > m_selectedStations
Definition
NrpcDigitToNrpcRDO.h:42
Muon::NrpcDigitToNrpcRDO::initialize
virtual StatusCode initialize() override final
Definition
NrpcDigitToNrpcRDO.cxx:18
Muon::NrpcDigitToNrpcRDO::m_convStat
Gaudi::Property< std::vector< std::string > > m_convStat
Definition
NrpcDigitToNrpcRDO.h:30
RpcDigitCollection
Definition
RpcDigitCollection.h:17
RpcDigit
Definition
RpcDigit.h:16
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
xAOD::NRPCRDO_v1::setBoardsector
void setBoardsector(uint16_t Boardsector)
Set the sector of the board within the subdetector.
xAOD::NRPCRDO_v1::setBoard
void setBoard(uint16_t Board)
Set the number of the TDC channel.
xAOD::NRPCRDO_v1::setTimeoverthr
void setTimeoverthr(float Timeoverthr)
Set the time over threshold.
xAOD::NRPCRDO_v1::setSubdetector
void setSubdetector(uint16_t SubDet)
Set the sub detector.
xAOD::NRPCRDO_v1::setChannel
void setChannel(uint16_t Channel)
Set the fire channel number.
xAOD::NRPCRDO_v1::setTime
void setTime(float Time)
Set the trigger time [ns].
xAOD::NRPCRDO_v1::setBcid
void setBcid(uint32_t Bcid)
Set the bunch crossing identifier.
Identifier
Definition
IdentifierFieldParser.cxx:14
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
xAOD::NRPCRDO
NRPCRDO_v1 NRPCRDO
Define the version of the NRPC RDO class.
Definition
NRPCRDO.h:13
Muon::RpcCablingData
Helper struct that is parsed to the cabling map to translate between the offline & online Identifiers...
Definition
RpcCablingData.h:96
Muon::RpcCablingData::channelId
uint8_t channelId
Online board channel number.
Definition
RpcCablingData.h:102
Muon::RpcCablingOfflineID::stripSide
bool stripSide() const
: Is the strip readout on the opposite side
Definition
RpcCablingData.h:61
Muon::RpcCablingOnlineID::board
int16_t & board
Unique identifier of the tdc chip.
Definition
RpcCablingData.h:86
Muon::RpcCablingOnlineID::boardSector
int16_t & boardSector
Unique Identifier of the Rpc chamber from an online perspective.
Definition
RpcCablingData.h:84
Muon::RpcCablingOnlineID::subDetector
int16_t & subDetector
Identifier of the subdetector region in the readout BA / BC etc.
Definition
RpcCablingData.h:82
Generated on
for ATLAS Offline Software by
1.17.0