ATLAS Offline Software
Public Member Functions | Private Types | Private Attributes | List of all members
Muon::NRPC_RawDataProviderTool Class Reference

#include <NRPC_RawDataProviderTool.h>

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

Public Member Functions

 NRPC_RawDataProviderTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~NRPC_RawDataProviderTool ()=default
 default destructor More...
 
virtual StatusCode initialize () override
 standard Athena-Algorithm method More...
 
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs) const override
 Convert method - declared in Muon::IMuonRdoToPrepDataTool. More...
 
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, const std::vector< IdentifierHash > &) const override
 
virtual StatusCode convert () const override
 the new ones More...
 
virtual StatusCode convert (const std::vector< IdentifierHash > &HashVec) const override
 
virtual StatusCode convert (const std::vector< uint32_t > &robIds) const override
 for a particular vector of ROBId's More...
 
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, const EventContext &ctx) const override
 EventContext. More...
 
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, const std::vector< IdentifierHash > &, const EventContext &ctx) const override
 
virtual StatusCode convert (const EventContext &ctx) const override
 for the entire event More...
 
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 More...
 
virtual StatusCode convertIntoContainer (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, xAOD::NRPCRDOContainer &nrpcContainer) const
 Convert method. More...
 
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

Definition at line 97 of file NRPC_RawDataProviderTool.h.

Constructor & Destructor Documentation

◆ NRPC_RawDataProviderTool()

Muon::NRPC_RawDataProviderTool::NRPC_RawDataProviderTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 12 of file NRPC_RawDataProviderTool.cxx.

12  :
13  base_class(t, n, p) {}

◆ ~NRPC_RawDataProviderTool()

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

default destructor

Member Function Documentation

◆ convert() [1/10]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( ) const
overridevirtual

the new ones

for the entire event

Definition at line 45 of file NRPC_RawDataProviderTool.cxx.

46 {
47  return convert(Gaudi::Hive::currentContext());
48 }

◆ convert() [2/10]

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

for the entire event

Definition at line 50 of file NRPC_RawDataProviderTool.cxx.

52 {
53 
54  SG::ReadCondHandle readCdo{m_readKey, ctx};
55  if (!readCdo.isValid()) {
56  ATH_MSG_ERROR("Null pointer to the read conditions object");
57  return StatusCode::FAILURE;
58  }
59  return convert(readCdo->getAllROBId(), ctx);
60 }

◆ convert() [3/10]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &  vecRobs) const
overridevirtual

Convert method - declared in Muon::IMuonRdoToPrepDataTool.

Definition at line 95 of file NRPC_RawDataProviderTool.cxx.

95  {
96  return convert(vecRobs, Gaudi::Hive::currentContext());
97 }

◆ convert() [4/10]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &  vecRobs,
const EventContext &  ctx 
) const
overridevirtual

EventContext.

Definition at line 99 of file NRPC_RawDataProviderTool.cxx.

100  {
101  ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
102 
103  SG::WriteHandle rdoContainer(m_rdoContainerKey, ctx);
104  ATH_CHECK(rdoContainer.record(std::make_unique<xAOD::NRPCRDOContainer>(), std::make_unique<xAOD::NRPCRDOAuxContainer>()));
105  // use the convert function in the NRPC_RawDataProviderTool class
106  ATH_CHECK(convertIntoContainer(vecRobs, *rdoContainer));
107  return StatusCode::SUCCESS;
108 }

◆ convert() [5/10]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &  vecRobs,
const std::vector< IdentifierHash > &   
) const
overridevirtual

Definition at line 85 of file NRPC_RawDataProviderTool.cxx.

86  {
87  return convert(vecRobs, Gaudi::Hive::currentContext());
88 }

◆ convert() [6/10]

StatusCode Muon::NRPC_RawDataProviderTool::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &  vecRobs,
const std::vector< IdentifierHash > &  ,
const EventContext &  ctx 
) const
overridevirtual

Definition at line 90 of file NRPC_RawDataProviderTool.cxx.

91  {
92  return convert(vecRobs, ctx);
93 }

◆ convert() [7/10]

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

Definition at line 62 of file NRPC_RawDataProviderTool.cxx.

62  {
63  return convert(HashVec, Gaudi::Hive::currentContext());
64 }

◆ convert() [8/10]

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

Definition at line 66 of file NRPC_RawDataProviderTool.cxx.

66  {
67  SG::ReadCondHandle readCdo{m_readKey, ctx};
68  if (!readCdo.isValid()) {
69  ATH_MSG_ERROR("Null pointer to the read conditions object");
70  return StatusCode::FAILURE;
71  }
72  return convert(readCdo->getROBId(HashVec, msgStream()), ctx);
73 }

◆ convert() [9/10]

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

for a particular vector of ROBId's

Definition at line 75 of file NRPC_RawDataProviderTool.cxx.

75  {
76  return convert(robIds, Gaudi::Hive::currentContext());
77 }

◆ convert() [10/10]

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 79 of file NRPC_RawDataProviderTool.cxx.

79  {
80  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf;
81  m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
82  return convert(vecOfRobf, ctx);
83 }

◆ convertIntoContainer()

StatusCode Muon::NRPC_RawDataProviderTool::convertIntoContainer ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &  vecRobs,
xAOD::NRPCRDOContainer nrpcContainer 
) const
virtual

Convert method.

Definition at line 29 of file NRPC_RawDataProviderTool.cxx.

30  {
31  ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
32 
33  for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* frag : vecRobs) {
34  // convert only if data payload is delivered
35  if (frag->rod_ndata() != 0) {
36  ATH_CHECK(fillCollections(*frag, nrpcContainer).ignore() );
37  } else {
38  ATH_MSG_DEBUG(" ROB " << MSG::hex << frag->source_id() << " is delivered with an empty payload" );
39  }
40  }
41 
42  return StatusCode::SUCCESS;
43 }

◆ fillCollections()

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

Definition at line 111 of file NRPC_RawDataProviderTool.cxx.

111  {
112 #define WARNING_WITH_LINE(msg) ATH_MSG_WARNING(__FILE__ << ":" << __LINE__<< " " << msg)
113  try {
114  robFrag.check();
115  } catch (eformat::Issue& ex) {
116  ATH_MSG_VERBOSE(ex.what());
117  return StatusCode::SUCCESS; // error in fragment
118  }
119 
120  //uint32_t nstat = robFrag.nstatus();
121  uint32_t version = robFrag.rod_version();
122  uint32_t sourceId = robFrag.source_id();
123  uint32_t rod_sourceId = robFrag.rod_source_id();
124 
125  // Unpack sub-detector and tdc sector from sourceId
126  uint16_t subDetector = sourceId >> 16;
127  uint16_t tdcSector = (sourceId & 0x00ffff);
128 
129  ATH_MSG_VERBOSE("ROD version: " << MSG::hex << version << MSG::dec << " ROB source ID: " << MSG::hex << sourceId << MSG::dec
130  << " ROD source ID: " << MSG::hex << rod_sourceId << MSG::dec << " Subdetector: " << MSG::hex
131  << subDetector << MSG::dec << " tdcSector: " << std::hex
132  << tdcSector << std::dec );
133 
134 
135 
136  // get the pointer to the data
137  BS data;
138  robFrag.rod_data(data);
139 
140  const unsigned int data_size = robFrag.rod_ndata();
141 
142 
143  // Loop on words
144  unsigned int idata=0;
145  while (idata<data_size) {
146  if (data[idata]==6 && data[idata+4]==0xa0 && data[idata+5]==0) {
147  ATH_MSG_DEBUG("NRPC: Empty tdc " << std::hex << data[idata+4] << std::dec << " for " << std::hex << data[idata+1] << std::dec );
148  } else if (data[idata]<6) {
149  WARNING_WITH_LINE("NRPC: Corrupted: Number of words from tdc " << std::hex << data[idata+4] << std::dec << " is <6 :" << data[idata] );
150  break;
151  } else if ( (data[idata+data[idata]-2] & 0x000000ff) != 0xa0) {
152  WARNING_WITH_LINE("NRPC: Missing expected trailer a0" );
153  break;
154  } else {
155 
156  // Bit inversion and manipulation needed to decode nominal BCID
157  uint32_t bcid12 = (data[idata+2] & 0xff000000) >> 24;
158  uint32_t bcid34 = (data[idata+2] & 0x00ff0000) >> 8;
159  uint32_t bcid56 = (data[idata+2] & 0x0000ff00) << 8;
160  uint32_t bcid78 = (data[idata+2] & 0x000000ff) << 24;
161  uint32_t bcid_nom = (bcid12 | bcid34 | bcid56 | bcid78) >> 4;
162 
163  // Decode data
164  for (unsigned int i=0; i<data[idata]-6; i++) {
165  uint16_t tdc = (data[idata+4] & 0x000000ff) ;
166  uint16_t chan = (data[idata+4] & 0x0000ff00) >> 8 ;
167  float tot = ((data[idata+4] & 0x00ff0000) >> 16)*0.4 ;
168  float time = ((data[idata+4] & 0x0f000000) >> 24)*1.6 ;
169  uint32_t bcid_hit = (data[idata+4] & 0xf0000000) >> 28 ;
170 
171  // Compute the BCID of the hit combining the nominal BCID with the last 4 bits from the hit (bcid_hit)
172  uint32_t bcid_nom_4bits = (bcid_nom & 0x0000000f) ;
173  uint32_t bcid = 0 ;
174  if (bcid_hit >= bcid_nom_4bits) { // The BCID of the hit is subsequent to the nominal
175  bcid = ( (bcid_nom & 0xfffffff0) | bcid_hit );
176  } else {
177  bcid = ( (bcid_nom & 0xfffffff0) | bcid_hit ) + 0x00000010;
178  }
179 
180  // Build the RDO
181  xAOD::NRPCRDO* NrpcRdo = rdoIdc.push_back(std::make_unique<xAOD::NRPCRDO>());
182  NrpcRdo->setBcid(bcid);
183  NrpcRdo->setTime(time);
184  NrpcRdo->setSubdetector(subDetector);
185  NrpcRdo->setTdcsector(tdcSector);
186  NrpcRdo->setTdc(tdc);
187  NrpcRdo->setChannel(chan);
188  NrpcRdo->setTimeoverthr(tot);
189  }
190  }
191 
192  idata+=data[idata];
193  }
194 
195 
196  return StatusCode::SUCCESS;
197 
198 } // end fillCollections

◆ initialize()

StatusCode Muon::NRPC_RawDataProviderTool::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 15 of file NRPC_RawDataProviderTool.cxx.

15  {
16 
17  // Get ROBDataProviderSvc
18  ATH_CHECK(m_robDataProvider.retrieve());
19  ATH_CHECK(m_idHelperSvc.retrieve());
20 
21  ATH_CHECK(m_rdoContainerKey.initialize());
22 
23  ATH_CHECK(m_readKey.initialize());
24 
25  ATH_MSG_DEBUG("initialize() successful in " << name());
26  return StatusCode::SUCCESS;
27 }

Member Data Documentation

◆ m_idHelperSvc

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

Definition at line 101 of file NRPC_RawDataProviderTool.h.

◆ m_rdoContainerKey

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

Definition at line 99 of file NRPC_RawDataProviderTool.h.

◆ m_readKey

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

Definition at line 106 of file NRPC_RawDataProviderTool.h.

◆ m_robDataProvider

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

Definition at line 104 of file NRPC_RawDataProviderTool.h.


The documentation for this class was generated from the following files:
xAOD::NRPCRDO_v1::setTdcsector
void setTdcsector(uint16_t Tdcsector)
Set the sector of the tdc within the subdetector.
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Issue
Configuration Issue
Definition: PscIssues.h:31
Muon::NRPC_RawDataProviderTool::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: NRPC_RawDataProviderTool.h:104
xAOD::NRPCRDO_v1
Definition: NRPCRDO_v1.h:14
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon::NRPC_RawDataProviderTool::fillCollections
virtual StatusCode fillCollections(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, xAOD::NRPCRDOContainer &rdoIdc) const
Definition: NRPC_RawDataProviderTool.cxx:111
xAOD::NRPCRDO_v1::setChannel
void setChannel(uint16_t Channel)
Set the fire channel number.
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
xAOD::NRPCRDO_v1::setSubdetector
void setSubdetector(uint16_t SubDet)
Set the sub detector.
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
lumiFormat.i
int i
Definition: lumiFormat.py:85
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::NRPCRDO_v1::setBcid
void setBcid(uint32_t Bcid)
Set the bunch crossing identifier.
Muon::NRPC_RawDataProviderTool::m_rdoContainerKey
SG::WriteHandleKey< xAOD::NRPCRDOContainer > m_rdoContainerKey
Definition: NRPC_RawDataProviderTool.h:99
xAOD::NRPCRDO_v1::setTdc
void setTdc(uint16_t Tdc)
Set the number of the TDC channel.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::NRPC_RawDataProviderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: NRPC_RawDataProviderTool.h:101
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Muon::NRPC_RawDataProviderTool::convert
virtual StatusCode convert() const override
the new ones
Definition: NRPC_RawDataProviderTool.cxx:45
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
Muon::NRPC_RawDataProviderTool::convertIntoContainer
virtual StatusCode convertIntoContainer(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, xAOD::NRPCRDOContainer &nrpcContainer) const
Convert method.
Definition: NRPC_RawDataProviderTool.cxx:29
Muon::NRPC_RawDataProviderTool::m_readKey
SG::ReadCondHandleKey< RpcCablingMap > m_readKey
Definition: NRPC_RawDataProviderTool.h:106
get_generator_info.version
version
Definition: get_generator_info.py:33
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
WARNING_WITH_LINE
#define WARNING_WITH_LINE(msg)
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
Muon::NRPC_RawDataProviderTool::BS
OFFLINE_FRAGMENTS_NAMESPACE::PointerType BS
Definition: NRPC_RawDataProviderTool.h:97
xAOD::NRPCRDO_v1::setTime
void setTime(float Time)
Set the trigger time [ns].
xAOD::NRPCRDO_v1::setTimeoverthr
void setTimeoverthr(float Timeoverthr)
Set the time over threshold.