ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ITkStripsRodEncoder Class Reference

Athena Algorithm Tool that provides conversion from ITkStrips RDO to ROD format Bytestream. More...

#include <ITkStripsRodEncoder.h>

Inheritance diagram for ITkStripsRodEncoder:
Collaboration diagram for ITkStripsRodEncoder:

Public Member Functions

 ITkStripsRodEncoder (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor. More...
 
virtual ~ITkStripsRodEncoder ()=default
 Destructor. More...
 
virtual StatusCode initialize () override
 Initialize. More...
 
virtual StatusCode finalize () override
 Finalize. More...
 
virtual void fillROD (std::vector< uint32_t > &vec32Data, const uint32_t &robID, const std::vector< const SCT_RDORawData * > &vecRDOs) const override
 Main Convert method. More...
 

Private Member Functions

void encodeData (const std::vector< int > &vecTimeBins, std::vector< uint16_t > &vec16Words, const SCT_RDORawData *rdo, const int &groupSize, const int &strip) const
 Method to encode RDO data to vector of 16 bin words. More...
 
void packFragments (std::vector< uint16_t > &vec16Words, std::vector< uint32_t > &vec32Words) const
 Method to pack vector of 16 bit words intto a vector of 32 bit words. More...
 
uint32_t set32Bits (const unsigned short int *arr16Words, const unsigned short int *position, const unsigned short int &numWords) const
 @breif Method to set pairs of 16 bit words to a 32 bit word. More...
 
int side (const SCT_RDORawData *rdo) const
 Get the side info from the RDO. More...
 
int getTimeBin (const SCT_RDORawData *rdo) const
 Get the time bin info from the RDO. More...
 
int getStrip (const SCT_RDORawData *rdo) const
 Get the strip number info from the RDO. More...
 
Identifier offlineID (const SCT_RDORawData *rdo) const
 Get the offline Identifier from the RDO. More...
 
uint32_t onlineID (const SCT_RDORawData *rdo) const
 Get the online Identifier from the RDO. More...
 
int getRODLink (const SCT_RDORawData *rdo) const
 Get the ROD link number info in the RDO header data. More...
 
uint16_t getHeaderUsingRDO (const SCT_RDORawData *rdo) const
 Get the 16-bit word for a header for a hit. More...
 
uint16_t getHeaderUsingHash (const IdentifierHash &linkHash, const int &errorWord) const
 Get the 16-bit word for a header for a link with a ByteStream error. More...
 
uint16_t getTrailer (const int &errorWord) const
 Get the 16-bit word for a trailer, with or without ByteStream errors. More...
 

Private Attributes

ToolHandle< ISCT_CablingToolm_cabling
 Providing mappings of online and offline identifiers and also serial numbers. More...
 
const SCT_IDm_itkStripsID {nullptr}
 Identifier helper class for the ITkStrips subdetector that creates compact Identifier objects and IdentifierHash or hash IDs. More...
 
BooleanProperty m_condensed {this, "CondensedMode", false, "Condensed mode (true) or Expanded mode (false)"}
 Example Boolean used to determine decoding mode, maybe unused finally. More...
 
std::set< Identifierm_swapModuleID {}
 Swap Module identifier, set by SCTRawContByteStreamTool. More...
 

Detailed Description

Athena Algorithm Tool that provides conversion from ITkStrips RDO to ROD format Bytestream.

Definition at line 30 of file ITkStripsRodEncoder.h.

Constructor & Destructor Documentation

◆ ITkStripsRodEncoder()

ITkStripsRodEncoder::ITkStripsRodEncoder ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Constructor.

Definition at line 35 of file ITkStripsRodEncoder.cxx.

36  :
37  base_class(type, name, parent){
38  //nop
39 }

◆ ~ITkStripsRodEncoder()

virtual ITkStripsRodEncoder::~ITkStripsRodEncoder ( )
virtualdefault

Destructor.

Member Function Documentation

◆ encodeData()

void ITkStripsRodEncoder::encodeData ( const std::vector< int > &  vecTimeBins,
std::vector< uint16_t > &  vec16Words,
const SCT_RDORawData rdo,
const int &  groupSize,
const int &  strip 
) const
private

Method to encode RDO data to vector of 16 bin words.

Methods used by main convert methods fillROD(...).

Parameters
vecTimeBinsVector of time bins for RDOs.
vec16WordsVector of 16 bit words to filled from encoded RDO data.
rdoRDO raw data object to be encoded.
groupSizeGroup size info from the RDO.
stripStrip number info from the RDO.

code to be filled here

Definition at line 76 of file ITkStripsRodEncoder.cxx.

77  {
79  return;
80 }

◆ fillROD()

void ITkStripsRodEncoder::fillROD ( std::vector< uint32_t > &  vec32Data,
const uint32_t &  robID,
const std::vector< const SCT_RDORawData * > &  vecRDOs 
) const
overridevirtual

Main Convert method.

Converts SCT RDO to a vector of 32 bit words. Starts by retrieving and collecting errors, then loops through RDO's and decode them to 16 bit words, and then finally it packs the 16 bit word into 32 bit words vector.

Parameters
vec32DataVector of 32 bit words to be filled with encoded RDOs from the SCT.
robIDID of the current readout buffer (ROB).
vecRDOsVector containing the RDOs to be coverted to vector of 32 bit words.

Definition at line 68 of file ITkStripsRodEncoder.cxx.

69  {
70  //code to be filled here
71  return;
72 }

◆ finalize()

StatusCode ITkStripsRodEncoder::finalize ( )
overridevirtual

Finalize.

Definition at line 63 of file ITkStripsRodEncoder.cxx.

63  {
64  return StatusCode::SUCCESS;
65 }

◆ getHeaderUsingHash()

uint16_t ITkStripsRodEncoder::getHeaderUsingHash ( const IdentifierHash linkHash,
const int &  errorWord 
) const
private

Get the 16-bit word for a header for a link with a ByteStream error.

Definition at line 167 of file ITkStripsRodEncoder.cxx.

167  {
168  const int rodLink{rodLinkFromOnlineID(m_cabling->getOnlineIdFromHash(linkHash))};
169  const uint16_t linkHeader{static_cast<uint16_t>(0x2000 | errorWord | (m_condensed.value() << 8) | rodLink)};
170  return linkHeader;
171 }

◆ getHeaderUsingRDO()

uint16_t ITkStripsRodEncoder::getHeaderUsingRDO ( const SCT_RDORawData rdo) const
private

Get the 16-bit word for a header for a hit.

Definition at line 160 of file ITkStripsRodEncoder.cxx.

160  {
161  const int rodLink{getRODLink(rdo)};
162  const uint16_t linkHeader{static_cast<uint16_t>(0x2000 | (m_condensed.value() << 8) | rodLink)};
163  return linkHeader;
164 }

◆ getRODLink()

int ITkStripsRodEncoder::getRODLink ( const SCT_RDORawData rdo) const
private

Get the ROD link number info in the RDO header data.

Definition at line 145 of file ITkStripsRodEncoder.cxx.

145  {
146  return rodLinkFromOnlineID(onlineID(rdo));
147 }

◆ getStrip()

int ITkStripsRodEncoder::getStrip ( const SCT_RDORawData rdo) const
private

Get the strip number info from the RDO.

Definition at line 126 of file ITkStripsRodEncoder.cxx.

126  {
127  const Identifier rdoID{rdo->identify()};
128  return m_itkStripsID->strip(rdoID);
129 }

◆ getTimeBin()

int ITkStripsRodEncoder::getTimeBin ( const SCT_RDORawData rdo) const
private

Get the time bin info from the RDO.

◆ getTrailer()

uint16_t ITkStripsRodEncoder::getTrailer ( const int &  errorWord) const
private

Get the 16-bit word for a trailer, with or without ByteStream errors.

Definition at line 174 of file ITkStripsRodEncoder.cxx.

174  {
175  const uint16_t linkTrailer{static_cast<uint16_t>(0x4000 | errorWord)};
176  return linkTrailer;
177 }

◆ initialize()

StatusCode ITkStripsRodEncoder::initialize ( )
overridevirtual

Initialize.

Definition at line 44 of file ITkStripsRodEncoder.cxx.

44  {
45  ATH_MSG_DEBUG("ITkStripsRodEncoder::initialize()");
46 
47  // Retrieve cabling tool
48  ATH_CHECK(m_cabling.retrieve());
49  ATH_MSG_DEBUG("Retrieved tool " << m_cabling);
51  const InDetDD::SCT_DetectorManager* itkStripsDetManager{nullptr};
52  ATH_CHECK(detStore()->retrieve(itkStripsDetManager, "SCT"));
53  const InDetDD::SiDetectorElementCollection* sctDetElementColl{itkStripsDetManager->getDetectorElementCollection()};
54  for (const InDetDD::SiDetectorElement* sctDetElement : *sctDetElementColl) {
55  if (sctDetElement->swapPhiReadoutDirection()) {
56  m_swapModuleID.insert(sctDetElement->identify());
57  }
58  }
59  return StatusCode::SUCCESS;
60 }

◆ offlineID()

Identifier ITkStripsRodEncoder::offlineID ( const SCT_RDORawData rdo) const
private

Get the offline Identifier from the RDO.


Definition at line 132 of file ITkStripsRodEncoder.cxx.

132  {
133  const Identifier rdoId{rdo->identify()};
134  return m_itkStripsID->wafer_id(rdoId);
135 }

◆ onlineID()

uint32_t ITkStripsRodEncoder::onlineID ( const SCT_RDORawData rdo) const
private

Get the online Identifier from the RDO.

Definition at line 138 of file ITkStripsRodEncoder.cxx.

138  {
139  const Identifier waferID{offlineID(rdo)};
140  const IdentifierHash offlineIDHash{m_itkStripsID->wafer_hash(waferID)};
141  return static_cast<uint32_t>(m_cabling->getOnlineIdFromHash(offlineIDHash));
142 }

◆ packFragments()

void ITkStripsRodEncoder::packFragments ( std::vector< uint16_t > &  vec16Words,
std::vector< uint32_t > &  vec32Words 
) const
private

Method to pack vector of 16 bit words intto a vector of 32 bit words.

Method us used by private method encodeData(...).

Parameters
vec16WordsVector containing 16 bit words.
vec32WordsVector for 32 bit words to be packed.

Definition at line 84 of file ITkStripsRodEncoder.cxx.

85  {
86  int num16Words{static_cast<int>(vec16Words.size())};
87  if (isOdd(num16Words)) {
88  // Just add an additional 16bit words to make even size v16 to in the 32 bits word 0x40004000
89  vec16Words.push_back(0x4000);
90  num16Words++;
91  }
92  // Now merge 2 consecutive 16 bit words in 32 bit words
93  const unsigned short int numWords{2};
94  const unsigned short int position[numWords]{0, 16};
95  unsigned short int arr16Words[numWords]{0, 0};
96  for (int i{0}; i<num16Words; i += numWords) {
97  arr16Words[i%numWords] = vec16Words[i+1];
98  arr16Words[(i+1)%numWords] = vec16Words[i];
99  const uint32_t uint32Word{set32Bits(arr16Words, position, numWords)};
100  vec32Words.push_back(uint32Word);
101 #ifdef ITkStripsDEBUG
102  ATH_MSG_INFO("SCT encoder -> PackFragments: Output rod 0x"<<std::hex<<uint32Word<<std::dec);
103 #endif
104  }
105  return;
106 }

◆ set32Bits()

uint32_t ITkStripsRodEncoder::set32Bits ( const unsigned short int *  arr16Words,
const unsigned short int *  position,
const unsigned short int &  numWords 
) const
private

@breif Method to set pairs of 16 bit words to a 32 bit word.

Function used by the packFragments(...) method.

Parameters
arr16WordsPointer to array containing a pair of 16 bit words.
positionPointer to an array that gives the 32 bit starting positions of the 16 bit words and corresponding to arr16Words.
numWordsNumber of word to be set to a 32 bit word.

Definition at line 110 of file ITkStripsRodEncoder.cxx.

112  {
113  uint32_t uint32Word{0};
114  uint32_t pos{0};
115  uint32_t uint16Word{0};
116  for (uint16_t i{0}; i<numWords; i++) {
117  uint16Word = static_cast<uint32_t>(*(arr16Words+i));
118  pos = static_cast<uint32_t>(*(position+i));
119  uint32Word |= (uint16Word<<pos);
120  }
121  return uint32Word;
122 }

◆ side()

int ITkStripsRodEncoder::side ( const SCT_RDORawData rdo) const
private

Get the side info from the RDO.

Definition at line 150 of file ITkStripsRodEncoder.cxx.

150  {
151  const Identifier rdoID{rdo->identify()};
152  int itkSide{m_itkStripsID->side(rdoID)};
153  return itkSide;
154 }

Member Data Documentation

◆ m_cabling

ToolHandle<ISCT_CablingTool> ITkStripsRodEncoder::m_cabling
private
Initial value:
{this,
"SCT_CablingTool",
"SCT_CablingTool",
"Tool to retrieve ITkStrips Cabling"}

Providing mappings of online and offline identifiers and also serial numbers.

Definition at line 129 of file ITkStripsRodEncoder.h.

◆ m_condensed

BooleanProperty ITkStripsRodEncoder::m_condensed {this, "CondensedMode", false, "Condensed mode (true) or Expanded mode (false)"}
private

Example Boolean used to determine decoding mode, maybe unused finally.

Definition at line 139 of file ITkStripsRodEncoder.h.

◆ m_itkStripsID

const SCT_ID* ITkStripsRodEncoder::m_itkStripsID {nullptr}
private

Identifier helper class for the ITkStrips subdetector that creates compact Identifier objects and IdentifierHash or hash IDs.

Also allows decoding of these IDs.

Definition at line 136 of file ITkStripsRodEncoder.h.

◆ m_swapModuleID

std::set<Identifier> ITkStripsRodEncoder::m_swapModuleID {}
private

Swap Module identifier, set by SCTRawContByteStreamTool.

Definition at line 142 of file ITkStripsRodEncoder.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDetDD::SCT_DetectorManager
Definition: SCT_DetectorManager.h:49
ITkStripsRodEncoder::set32Bits
uint32_t set32Bits(const unsigned short int *arr16Words, const unsigned short int *position, const unsigned short int &numWords) const
@breif Method to set pairs of 16 bit words to a 32 bit word.
Definition: ITkStripsRodEncoder.cxx:110
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ITkStripsRodEncoder::m_swapModuleID
std::set< Identifier > m_swapModuleID
Swap Module identifier, set by SCTRawContByteStreamTool.
Definition: ITkStripsRodEncoder.h:142
ITkStripsRodEncoder::onlineID
uint32_t onlineID(const SCT_RDORawData *rdo) const
Get the online Identifier from the RDO.
Definition: ITkStripsRodEncoder.cxx:138
ITkStripsRodEncoder::m_condensed
BooleanProperty m_condensed
Example Boolean used to determine decoding mode, maybe unused finally.
Definition: ITkStripsRodEncoder.h:139
ITkStripsRodEncoder::getRODLink
int getRODLink(const SCT_RDORawData *rdo) const
Get the ROD link number info in the RDO header data.
Definition: ITkStripsRodEncoder.cxx:145
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
lumiFormat.i
int i
Definition: lumiFormat.py:85
ITkStripsRodEncoder::offlineID
Identifier offlineID(const SCT_RDORawData *rdo) const
Get the offline Identifier from the RDO.
Definition: ITkStripsRodEncoder.cxx:132
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SCT_ID::strip
int strip(const Identifier &id) const
Definition: SCT_ID.h:764
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_ID::side
int side(const Identifier &id) const
Definition: SCT_ID.h:752
InDetRawData::identify
virtual Identifier identify() const override final
Definition: InDetRawData.h:41
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
ITkStripsRodEncoder::m_itkStripsID
const SCT_ID * m_itkStripsID
Identifier helper class for the ITkStrips subdetector that creates compact Identifier objects and Ide...
Definition: ITkStripsRodEncoder.h:136
ITkStripsRodEncoder::m_cabling
ToolHandle< ISCT_CablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
Definition: ITkStripsRodEncoder.h:129
Identifier
Definition: IdentifierFieldParser.cxx:14