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

This class provides conversion from TRT RDO to ROD format. More...

#include <TRT_RodEncoder.h>

Collaboration diagram for TRT_RodEncoder:

Public Types

typedef TRT_RDORawData RDO
 
typedef std::vector< const RDO * > VRDO
 

Public Member Functions

 TRT_RodEncoder ()
 constructor More...
 
 ~TRT_RodEncoder ()
 destructor More...
 
void addRdo (const RDO *rdo)
 add RDO to internal vector More...
 
void set_trt_IdHelper (const TRT_ID *trt_id)
 setId Helper More...
 
void set_trt_cabling (ServiceHandle< ITRT_CablingSvc > trt_CablingSvc)
 setCablingSvc More...
 
void setRodMinorVersion (unsigned short RodBlockVersion)
 setRodMinorVersion More...
 
StatusCode fillROD (std::vector< uint32_t > &v)
 conversion of ROD into ROD fragment More...
 
StatusCode fillROD3 (std::vector< uint32_t > &v)
 conversion of ROD into compressed ROD fragment More...
 

Private Attributes

const TRT_IDm_trt_id
 
ServiceHandle< ITRT_CablingSvcm_CablingSvc
 
unsigned short m_RodBlockVersion
 
VRDO m_RDOs
 

Detailed Description

This class provides conversion from TRT RDO to ROD format.

Definition at line 23 of file TRT_RodEncoder.h.

Member Typedef Documentation

◆ RDO

Definition at line 26 of file TRT_RodEncoder.h.

◆ VRDO

typedef std::vector<const RDO*> TRT_RodEncoder::VRDO

Definition at line 27 of file TRT_RodEncoder.h.

Constructor & Destructor Documentation

◆ TRT_RodEncoder()

TRT_RodEncoder::TRT_RodEncoder ( )

constructor

Definition at line 23 of file TRT_RodEncoder.cxx.

24  :m_trt_id ( nullptr ),
25  m_CablingSvc ( "TRT_CablingSvc", "TRT_RodEncoder" ),
26  m_RodBlockVersion ( 0 )
27 {}

◆ ~TRT_RodEncoder()

TRT_RodEncoder::~TRT_RodEncoder ( )
default

destructor

Member Function Documentation

◆ addRdo()

void TRT_RodEncoder::addRdo ( const RDO rdo)
inline

add RDO to internal vector

Definition at line 36 of file TRT_RodEncoder.h.

36 {m_RDOs.push_back(rdo);}

◆ fillROD()

StatusCode TRT_RodEncoder::fillROD ( std::vector< uint32_t > &  v)

conversion of ROD into ROD fragment

for a given ROD fragment, convert TRT RDOs to a vector of 32bit words

Definition at line 36 of file TRT_RodEncoder.cxx.

37 {
38  if ( ! m_CablingSvc )
39  return StatusCode::FAILURE;
40 
41  int TRT_MaxBufferSize = 120*16;
42  // Make sure vector is big enough, fill it with 0
43  v32rod.resize(TRT_MaxBufferSize,0 );
44 
45  VRDO::iterator rdo_it = m_RDOs.begin();
46  const VRDO::iterator rdo_it_end = m_RDOs.end();
47 
48  const RDO* rawdata;
49  uint32_t StrawWord;
50  Identifier StrawID;
51  uint32_t BufferOffset;
52 
53  while ( rdo_it != rdo_it_end )
54  {
55  rawdata = *rdo_it;
56 
57  StrawWord = rawdata->getWord();
58  StrawID = rawdata->identify();
59 
60  BufferOffset = m_CablingSvc->getBufferOffset( StrawID );
61 
62  // if ( 0 == BufferOffset )
63  // cout << m_trt_id->print_to_string( StrawID ) << " ->"
64  // << BufferOffset << "<- " << endl;
65 
66  v32rod[BufferOffset] = StrawWord;
67 
68  ++rdo_it;
69  }
70 
71  return StatusCode::SUCCESS;
72 } // end of fillROD(...)

◆ fillROD3()

StatusCode TRT_RodEncoder::fillROD3 ( std::vector< uint32_t > &  v)

conversion of ROD into compressed ROD fragment

for a given ROD fragment, compression versions convert TRT RDOs to a vector of 32bit words

Definition at line 77 of file TRT_RodEncoder.cxx.

78 {
79  if ( ! m_CablingSvc )
80  return StatusCode::FAILURE;
81 
82  const int TRT_MaxBufferSize = 120*16;
83  int tmp_data[TRT_MaxBufferSize] = {0}; // does init to 0 for all !
84 
85  std::deque<bool> bitstowrite;
86 
87  VRDO::iterator rdo_it = m_RDOs.begin();
88  const VRDO::iterator rdo_it_end = m_RDOs.end();
89 
90  const RDO* rawdata;
91  uint32_t StrawWord;
92  Identifier StrawID;
93  uint32_t BufferOffset;
94 
95  while ( rdo_it != rdo_it_end )
96  {
97  rawdata = *rdo_it;
98 
99  StrawWord = rawdata->getWord();
100  StrawID = rawdata->identify();
101 
102  BufferOffset = m_CablingSvc->getBufferOffset( StrawID );
103 
104  // if ( 0 == BufferOffset )
105  // cout << m_trt_id->print_to_string( StrawID ) << " ->"
106  // << BufferOffset << "<- " << endl;
107 
108  tmp_data[BufferOffset] = StrawWord;
109 
110  ++rdo_it;
111  }
112 
113  for ( int i=0; i<TRT_MaxBufferSize; i++ )
114  {
115  if ( tmp_data[i] )
116  {
117  /*
118  * Push escape code
119  */
120  bitstowrite.push_back( 0 );
121  bitstowrite.push_back( 0 );
122  bitstowrite.push_back( 0 );
123  bitstowrite.push_back( 0 );
124  bitstowrite.push_back( 0 );
125 
126  /*
127  * Push Straw Word
128  */
129 
130  //for ( int j=27-1; j>=0; j-- )
131  for ( int j=0; j<27; j++ )
132  bitstowrite.push_back( (tmp_data[i] >> j) & 1 );
133  }
134  else
135  bitstowrite.push_back( 1 );
136  }
137 
138 
139 
140  int bit_in_word = 0;
141  int out_word = 0;
142  while ( ! bitstowrite.empty() )
143  {
144  out_word = out_word | ( (bitstowrite.front()?1:0) << bit_in_word );
145  bitstowrite.pop_front();
146  bit_in_word++;
147 
148  if ( bit_in_word > 31 )
149  {
150  v32rod.push_back( out_word );
151  out_word = 0;
152  bit_in_word = 0;
153  }
154  }
155 
156  if ( 0 != bit_in_word )
157  v32rod.push_back( out_word );
158 
159  return StatusCode::SUCCESS;
160 } // end of fillROD(...)

◆ set_trt_cabling()

void TRT_RodEncoder::set_trt_cabling ( ServiceHandle< ITRT_CablingSvc trt_CablingSvc)
inline

setCablingSvc

Definition at line 42 of file TRT_RodEncoder.h.

43  {
44  m_CablingSvc = trt_CablingSvc;
45  }

◆ set_trt_IdHelper()

void TRT_RodEncoder::set_trt_IdHelper ( const TRT_ID trt_id)
inline

setId Helper

Definition at line 39 of file TRT_RodEncoder.h.

39 { m_trt_id = trt_id ; }

◆ setRodMinorVersion()

void TRT_RodEncoder::setRodMinorVersion ( unsigned short  RodBlockVersion)
inline

setRodMinorVersion

Definition at line 48 of file TRT_RodEncoder.h.

48 { m_RodBlockVersion = RodBlockVersion; }

Member Data Documentation

◆ m_CablingSvc

ServiceHandle<ITRT_CablingSvc> TRT_RodEncoder::m_CablingSvc
private

Definition at line 58 of file TRT_RodEncoder.h.

◆ m_RDOs

VRDO TRT_RodEncoder::m_RDOs
private

Definition at line 60 of file TRT_RodEncoder.h.

◆ m_RodBlockVersion

unsigned short TRT_RodEncoder::m_RodBlockVersion
private

Definition at line 59 of file TRT_RodEncoder.h.

◆ m_trt_id

const TRT_ID* TRT_RodEncoder::m_trt_id
private

Definition at line 57 of file TRT_RodEncoder.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TRT_RodEncoder::RDO
TRT_RDORawData RDO
Definition: TRT_RodEncoder.h:26
TRT_RodEncoder::m_trt_id
const TRT_ID * m_trt_id
Definition: TRT_RodEncoder.h:57
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRT_RodEncoder::m_RodBlockVersion
unsigned short m_RodBlockVersion
Definition: TRT_RodEncoder.h:59
TRT_RodEncoder::m_RDOs
VRDO m_RDOs
Definition: TRT_RodEncoder.h:60
TRT_RodEncoder::m_CablingSvc
ServiceHandle< ITRT_CablingSvc > m_CablingSvc
Definition: TRT_RodEncoder.h:58
Identifier
Definition: IdentifierFieldParser.cxx:14