ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::NRPC_RawDataProviderTool Class Reference

#include <NRPC_RawDataProviderTool.h>

Inheritance diagram for Muon::NRPC_RawDataProviderTool:
Collaboration diagram for Muon::NRPC_RawDataProviderTool:

Public Member Functions

virtual ~NRPC_RawDataProviderTool ()=default
 default destructor
virtual StatusCode initialize () override
 standard Athena-Algorithm method
virtual StatusCode convert (const EventContext &ctx) const override
 for the entire event
virtual StatusCode convert (const std::vector< IdentifierHash > &HashVec, const EventContext &ctx) const override
virtual StatusCode convert (const std::vector< uint32_t > &robIds, const EventContext &ctx) const override
 for a particular vector of ROBId's
virtual StatusCode convertIntoContainer (const ROBFragmentList &vecRobs, const EventContext &ctx) const
 Convert method.
virtual StatusCode fillCollections (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, xAOD::NRPCRDOContainer &rdoIdc) const

Private Types

typedef OFFLINE_FRAGMENTS_NAMESPACE::PointerType BS

Private Attributes

SG::WriteHandleKey< xAOD::NRPCRDOContainerm_rdoContainerKey {this, "NrpcRdoKey", "NRPCRDO", "WriteHandleKey for Output AOD::NRPCRDOContainer"}
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
ServiceHandle< IROBDataProviderSvcm_robDataProvider {this, "ROBDataProviderSvc", "ROBDataProviderSvc"}
SG::ReadCondHandleKey< RpcCablingMapm_readKey {this, "ReadKey", "MuonNRPC_CablingMap", "Key of MuonNRPC_CablingMap"}

Detailed Description

Definition at line 62 of file NRPC_RawDataProviderTool.h.

Member Typedef Documentation

◆ BS

Constructor & Destructor Documentation

◆ ~NRPC_RawDataProviderTool()

virtual Muon::NRPC_RawDataProviderTool::~NRPC_RawDataProviderTool ( )
virtualdefault

default destructor

Member Function Documentation

◆ convert() [1/3]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( const EventContext & ctx) const
overridevirtual

for the entire event

Definition at line 42 of file NRPC_RawDataProviderTool.cxx.

42 {
43 const RpcCablingMap* cabling{nullptr};
44 ATH_CHECK(SG::get(cabling, m_readKey, ctx));
45 return convert(cabling->getAllROBId(), ctx);
46}
#define ATH_CHECK
Evaluate an expression and check for errors.
virtual StatusCode convert(const EventContext &ctx) const override
for the entire event
SG::ReadCondHandleKey< RpcCablingMap > m_readKey
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

◆ convert() [2/3]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( const std::vector< IdentifierHash > & HashVec,
const EventContext & ctx ) const
overridevirtual

Definition at line 49 of file NRPC_RawDataProviderTool.cxx.

50 {
51 const RpcCablingMap* cabling{nullptr};
52 ATH_CHECK(SG::get(cabling, m_readKey, ctx));
53 return convert(cabling->getROBId(HashVec, msgStream()), ctx);
54}

◆ convert() [3/3]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( const std::vector< uint32_t > & robIds,
const EventContext & ctx ) const
overridevirtual

for a particular vector of ROBId's

Definition at line 56 of file NRPC_RawDataProviderTool.cxx.

57 {
58 ROBFragmentList vecOfRobf;
59 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
60 return convertIntoContainer(vecOfRobf, ctx);
61}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
virtual StatusCode convertIntoContainer(const ROBFragmentList &vecRobs, const EventContext &ctx) const
Convert method.

◆ convertIntoContainer()

StatusCode Muon::NRPC_RawDataProviderTool::convertIntoContainer ( const ROBFragmentList & vecRobs,
const EventContext & ctx ) const
virtual

Convert method.

Definition at line 21 of file NRPC_RawDataProviderTool.cxx.

22 {
23
24 ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
25 SG::WriteHandle rdoContainer(m_rdoContainerKey, ctx);
26 ATH_CHECK(rdoContainer.record(std::make_unique<xAOD::NRPCRDOContainer>(), std::make_unique<xAOD::NRPCRDOAuxContainer>()));
27
28 ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
29
30 for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* frag : vecRobs) {
31 // convert only if data payload is delivered
32 if (frag->rod_ndata() != 0) {
33 ATH_CHECK(fillCollections(*frag, *rdoContainer).ignore() );
34 } else {
35 ATH_MSG_DEBUG(" ROB " << MSG::hex << frag->source_id() << " is delivered with an empty payload" );
36 }
37 }
38
39 return StatusCode::SUCCESS;
40}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode fillCollections(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, xAOD::NRPCRDOContainer &rdoIdc) const
SG::WriteHandleKey< xAOD::NRPCRDOContainer > m_rdoContainerKey
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27

◆ fillCollections()

StatusCode Muon::NRPC_RawDataProviderTool::fillCollections ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
xAOD::NRPCRDOContainer & rdoIdc ) const
virtual

Definition at line 64 of file NRPC_RawDataProviderTool.cxx.

65 {
66#define WARNING_WITH_LINE(msg) ATH_MSG_WARNING(__FILE__ << ":" << __LINE__<< " " << msg)
67 try {
68 robFrag.check();
69 } catch (eformat::Issue& ex) {
70 ATH_MSG_VERBOSE(ex.what());
71 return StatusCode::SUCCESS; // error in fragment
72 }
73
74 //uint32_t nstat = robFrag.nstatus();
75 uint32_t version = robFrag.rod_version();
76 uint32_t sourceId = robFrag.source_id();
77 uint32_t rod_sourceId = robFrag.rod_source_id();
78
79 // Unpack sub-detector and board sector from sourceId
80 uint16_t subDetector = sourceId >> 16;
81 uint16_t boardSector = (sourceId & 0x00ffff);
82
83 ATH_MSG_VERBOSE("ROD version: " << MSG::hex << version << MSG::dec << " ROB source ID: " << MSG::hex << sourceId << MSG::dec
84 << " ROD source ID: " << MSG::hex << rod_sourceId << MSG::dec << " Subdetector: " << MSG::hex
85 << subDetector << MSG::dec << " boardSector: " << std::hex
86 << boardSector << std::dec );
87
88
89
90 // get the pointer to the data
91 BS data;
92 robFrag.rod_data(data);
93
94 const unsigned int data_size = robFrag.rod_ndata();
95
96
97 // Loop on words
98 unsigned int idata=0;
99 while (idata<data_size) {
100 if (data[idata]==6 && data[idata+4]==0xa0 && data[idata+5]==0) {
101 ATH_MSG_DEBUG("NRPC: Empty board " << std::hex << data[idata+4] << std::dec << " for " << std::hex << data[idata+1] << std::dec );
102 } else if (data[idata]<6) {
103 WARNING_WITH_LINE("NRPC: Corrupted: Number of words from board " << std::hex << data[idata+4] << std::dec << " is <6 :" << data[idata] );
104 break;
105 } else if ( idata+data[idata] > data_size) {
106 WARNING_WITH_LINE("NRPC: Corrupted number of words from board " << std::hex << data[idata+4] << std::dec << " is too large :" << std::hex << data[idata] << std::dec );
107 break;
108 } else if ( (data[idata+data[idata]-2] & 0x000000ff) != 0xa0) {
109 WARNING_WITH_LINE("NRPC: Missing expected trailer a0" );
110 break;
111 } else {
112
113 // Bit inversion and manipulation needed to decode nominal BCID
114 uint32_t bcid12 = (data[idata+2] & 0xff000000) >> 24;
115 uint32_t bcid34 = (data[idata+2] & 0x00ff0000) >> 8;
116 uint32_t bcid56 = (data[idata+2] & 0x0000ff00) << 8;
117 uint32_t bcid78 = (data[idata+2] & 0x000000ff) << 24;
118 uint32_t bcid_nom = (bcid12 | bcid34 | bcid56 | bcid78) >> 4;
119
120 // Decode data
121 for (unsigned int i=0; i<data[idata]-6; i++) {
122 uint16_t board = (data[idata+4+i] & 0x000000ff) ;
123 uint16_t chan = (data[idata+4+i] & 0x0000ff00) >> 8 ;
124 float tot = ((data[idata+4+i] & 0x007f0000) >> 16)*0.4 ;
125 float time = ((data[idata+4+i] & 0x0f000000) >> 24)*1.6 ;
126 uint32_t bcid_hit = (data[idata+4+i] & 0xf0000000) >> 28 ;
127
128 // Compute the BCID of the hit combining the nominal BCID with the last 4 bits from the hit (bcid_hit)
129 uint32_t bcid_nom_4bits = (bcid_nom & 0x0000000f) ;
130 uint32_t bcid = 0 ;
131 if (bcid_hit >= bcid_nom_4bits) { // The BCID of the hit is subsequent to the nominal
132 bcid = ( (bcid_nom & 0xfffffff0) | bcid_hit );
133 } else {
134 bcid = ( (bcid_nom & 0xfffffff0) | bcid_hit ) + 0x00000010;
135 }
136
137 // Build the RDO
138 xAOD::NRPCRDO* NrpcRdo = rdoIdc.push_back(std::make_unique<xAOD::NRPCRDO>());
139 NrpcRdo->setBcid(bcid);
140 NrpcRdo->setTime(time);
141 NrpcRdo->setSubdetector(subDetector);
142 NrpcRdo->setBoardsector(boardSector);
143 NrpcRdo->setBoard(board);
144 NrpcRdo->setChannel(chan);
145 NrpcRdo->setTimeoverthr(tot);
146 }
147 }
148
149 idata+=data[idata];
150 }
151
152
153 return StatusCode::SUCCESS;
154
155} // end fillCollections
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define WARNING_WITH_LINE(msg)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType BS
void setBoardsector(uint16_t Boardsector)
Set the sector of the board within the subdetector.
void setBoard(uint16_t Board)
Set the number of the TDC channel.
void setTimeoverthr(float Timeoverthr)
Set the time over threshold.
void setSubdetector(uint16_t SubDet)
Set the sub detector.
void setChannel(uint16_t Channel)
Set the fire channel number.
void setTime(float Time)
Set the trigger time [ns].
void setBcid(uint32_t Bcid)
Set the bunch crossing identifier.
time(flags, cells_name, *args, **kw)
NRPCRDO_v1 NRPCRDO
Define the version of the NRPC RDO class.
Definition NRPCRDO.h:13
setEventNumber setTimeStamp bcid
setWord1 uint16_t
setEventNumber uint32_t

◆ initialize()

StatusCode Muon::NRPC_RawDataProviderTool::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 11 of file NRPC_RawDataProviderTool.cxx.

11 {
12
13 // Get ROBDataProviderSvc
14 ATH_CHECK(m_robDataProvider.retrieve());
15 ATH_CHECK(m_idHelperSvc.retrieve());
16 ATH_CHECK(m_rdoContainerKey.initialize());
17 ATH_CHECK(m_readKey.initialize());
18 return StatusCode::SUCCESS;
19}
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

Member Data Documentation

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::NRPC_RawDataProviderTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 88 of file NRPC_RawDataProviderTool.h.

88{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_rdoContainerKey

SG::WriteHandleKey<xAOD::NRPCRDOContainer> Muon::NRPC_RawDataProviderTool::m_rdoContainerKey {this, "NrpcRdoKey", "NRPCRDO", "WriteHandleKey for Output AOD::NRPCRDOContainer"}
private

Definition at line 86 of file NRPC_RawDataProviderTool.h.

86{this, "NrpcRdoKey", "NRPCRDO", "WriteHandleKey for Output AOD::NRPCRDOContainer"};

◆ m_readKey

SG::ReadCondHandleKey<RpcCablingMap> Muon::NRPC_RawDataProviderTool::m_readKey {this, "ReadKey", "MuonNRPC_CablingMap", "Key of MuonNRPC_CablingMap"}
private

Definition at line 93 of file NRPC_RawDataProviderTool.h.

93{this, "ReadKey", "MuonNRPC_CablingMap", "Key of MuonNRPC_CablingMap"};

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> Muon::NRPC_RawDataProviderTool::m_robDataProvider {this, "ROBDataProviderSvc", "ROBDataProviderSvc"}
private

Definition at line 91 of file NRPC_RawDataProviderTool.h.

91{this, "ROBDataProviderSvc", "ROBDataProviderSvc"};

The documentation for this class was generated from the following files: