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< MuonNRPC_CablingMapm_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) {
14  declareInterface<Muon::IMuonRawDataProviderTool>(this);
15 
16 }

◆ ~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 48 of file NRPC_RawDataProviderTool.cxx.

49 {
50  return convert(Gaudi::Hive::currentContext());
51 }

◆ convert() [2/10]

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

for the entire event

Definition at line 53 of file NRPC_RawDataProviderTool.cxx.

55 {
56 
58  const MuonNRPC_CablingMap* readCdo{*readHandle};
59  if (!readCdo) {
60  ATH_MSG_ERROR("Null pointer to the read conditions object");
61  return StatusCode::FAILURE;
62  }
63 
64  const std::vector<uint32_t>& robIds=readCdo->getAllROBId();
65 
66  return convert(robIds, ctx);
67 }

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

103  {
104  return convert(vecRobs, Gaudi::Hive::currentContext());
105 }

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

108  {
109  ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
110 
112  ATH_CHECK(rdoContainerHandle.record(std::make_unique<xAOD::NRPCRDOContainer>(), std::make_unique<xAOD::NRPCRDOAuxContainer>()));
113  xAOD::NRPCRDOContainer* rdoContainer = rdoContainerHandle.ptr();
114 
115  // use the convert function in the NRPC_RawDataProviderTool class
116  ATH_CHECK(convertIntoContainer(vecRobs, *rdoContainer));
117 
118  return StatusCode::SUCCESS;
119 }

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

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

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

99  {
100  return convert(vecRobs, ctx);
101 }

◆ convert() [7/10]

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

Definition at line 69 of file NRPC_RawDataProviderTool.cxx.

69  {
70  return convert(HashVec, Gaudi::Hive::currentContext());
71 }

◆ convert() [8/10]

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

Definition at line 73 of file NRPC_RawDataProviderTool.cxx.

73  {
75  const MuonNRPC_CablingMap* readCdo{*readHandle};
76  if (!readCdo) {
77  ATH_MSG_ERROR("Null pointer to the read conditions object");
78  return StatusCode::FAILURE;
79  }
80  return convert(readCdo->getROBId(HashVec, msgStream()), ctx);
81 }

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

83  {
84  return convert(robIds, Gaudi::Hive::currentContext());
85 }

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

87  {
88  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf;
89  m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
90  return convert(vecOfRobf, ctx);
91 }

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

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

◆ fillCollections()

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

Definition at line 122 of file NRPC_RawDataProviderTool.cxx.

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

◆ initialize()

StatusCode Muon::NRPC_RawDataProviderTool::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 18 of file NRPC_RawDataProviderTool.cxx.

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

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<MuonNRPC_CablingMap> 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_readKey
SG::ReadCondHandleKey< MuonNRPC_CablingMap > m_readKey
Definition: NRPC_RawDataProviderTool.h:106
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
MuonNRPC_CablingMap
Definition: MuonNRPC_CablingMap.h:21
Muon::NRPC_RawDataProviderTool::fillCollections
virtual StatusCode fillCollections(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, xAOD::NRPCRDOContainer &rdoIdc) const
Definition: NRPC_RawDataProviderTool.cxx:122
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:88
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
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
LB_AnalMapSplitter.tot
tot
Definition: LB_AnalMapSplitter.py:46
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:221
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Muon::NRPC_RawDataProviderTool::convert
virtual StatusCode convert() const override
the new ones
Definition: NRPC_RawDataProviderTool.cxx:48
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:32
xAOD::NRPCRDO
NRPCRDO_v1 NRPCRDO
Define the version of the NRPC RDO class.
Definition: NRPCRDO.h:13
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.