ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LVL1::CPMCMXData Class Reference

The CPMCMXData object contains the data transferred from the CPM to one of the CMXes (EM or Tau) in the crate. More...

#include <CPMCMXData.h>

Collaboration diagram for LVL1::CPMCMXData:

Public Member Functions

 CPMCMXData ()
 Constructors. More...
 
 CPMCMXData (int crate, int module, int type, const std::vector< unsigned int > &tobWords)
 
 CPMCMXData (int crate, int module, int type, const DataVector< CPMTobRoI > *tobs)
 
virtual ~CPMCMXData ()
 Destructor. More...
 
int crate () const
 Data accessors. More...
 
int module () const
 module number More...
 
int type () const
 TOB type (EM/Tau) More...
 
unsigned int presenceMap () const
 16 bit presence map More...
 
bool overflow () const
 Report whether TOB overflow occurred. More...
 
std::vector< unsigned int > DataWords () const
 the 4 raw backplane data words More...
 
std::vector< unsigned int > TOBPresenceBits () const
 Locations in Presence Map for up to 5 TOBs. More...
 
std::vector< unsigned int > TOBWords () const
 Data words (2b LC + 5b Isol + 8b ET) for up to 5 TOBs. More...
 
std::vector< unsigned int > TopoTOBs () const
 L1Topo TOB words (1bRO + 4b CPM + 3b Chip + 3b LC + 5b Isol + 8b ET) for up to 5 TOBs. More...
 

Private Attributes

int m_crate
 Internal data. More...
 
int m_module
 
int m_type
 
std::vector< unsigned int > m_DataWords
 

Detailed Description

The CPMCMXData object contains the data transferred from the CPM to one of the CMXes (EM or Tau) in the crate.

This is a transient class, describing backplane data

Definition at line 25 of file CPMCMXData.h.

Constructor & Destructor Documentation

◆ CPMCMXData() [1/3]

LVL1::CPMCMXData::CPMCMXData ( )

Constructors.

Definition at line 10 of file CPMCMXData.cxx.

10  : m_crate(0), m_module(0), m_type(0)
11 {
12  m_DataWords.clear();
13  m_DataWords.resize(4);
14 }

◆ CPMCMXData() [2/3]

LVL1::CPMCMXData::CPMCMXData ( int  crate,
int  module,
int  type,
const std::vector< unsigned int > &  tobWords 
)

Definition at line 17 of file CPMCMXData.cxx.

18  :
19  m_crate(crate),
21  m_type(type),
22  m_DataWords(tobWords)
23 {
24 }

◆ CPMCMXData() [3/3]

LVL1::CPMCMXData::CPMCMXData ( int  crate,
int  module,
int  type,
const DataVector< CPMTobRoI > *  tobs 
)

Step through vector of RoIs. Find those whose crate, module, type match To make backplane data words we need to geographically sort TOBs

Now step though identified TOBs in correct geographical order and fill backplane words

Definition at line 27 of file CPMCMXData.cxx.

28  :
29  m_crate(crate),
31  m_type(type)
32 {
33 
34  m_DataWords.clear();
35  m_DataWords.resize(4);
36 
40  std::vector<unsigned int> allTOBs(16,0);
41 
43  for ( ; itRoI != tobs->end(); ++itRoI) {
44  if ( (*itRoI)->crate() != crate || (*itRoI)->cpm() != module || (*itRoI)->type() != type ) continue;
45 
46  int chip = (*itRoI)->chip();
47  int chipCoord = (*itRoI)->location();
48  int et = (*itRoI)->energy();
49  int isol = (*itRoI)->isolation();
50 
51  int side = (chipCoord >> 2);
52  int lc = chipCoord & 3;
53 
54  // Set flag in presence map
55  unsigned int presence = 2*chip + side;
56  m_DataWords[0] |= ( 1 << presence );
57 
58  // Store TOB data to fill backplane words later
59  unsigned int tobdata = et + (isol<<8) + (lc<<13);
60  allTOBs[presence] = tobdata;
61  }
62 
64  int nTOB = 0;
65  for (int i = 0; i < 16; ++i) {
66  if (allTOBs[i] == 0 ) continue;
67 
68  unsigned int et = allTOBs[i] & 0xff;
69  unsigned int isol = (allTOBs[i] >> 8) & 0x1f;
70  unsigned int lc = (allTOBs[i] >> 13) & 3;
71 
72  switch (nTOB) {
73  case 0:
74  m_DataWords[1] += et;
75  m_DataWords[0] += (isol<<18);
76  m_DataWords[0] += (lc<<16);
77  break;
78  case 1:
79  m_DataWords[1] += (et<<8);
80  m_DataWords[1] += (isol<<18);
81  m_DataWords[1] += (lc<<16);
82  break;
83  case 2:
84  m_DataWords[2] += et;
85  m_DataWords[2] += (isol<<18);
86  m_DataWords[2] += (lc<<16);
87  break;
88  case 3:
89  m_DataWords[2] += (et<<8);
90  m_DataWords[3] += (isol<<10);
91  m_DataWords[3] += (lc<<8);
92  break;
93  case 4:
94  m_DataWords[3] += et;
95  m_DataWords[3] += (isol<<18);
96  m_DataWords[3] += (lc<<16);
97  break;
98  }
99  nTOB++;
100 
101  } // Loop over TOB locations
102 
103  // Finally set parity bits. Will assume we used odd parity here (flip initial assignment to change)
104  for (unsigned int word = 0; word < 4; ++word) {
105  unsigned int parity = 1;
106  for (unsigned int bit = 0; bit < 24; ++bit) if ( ( (m_DataWords[word]>>bit) & 1) > 0 ) parity++;
107  parity &= 1;
108  m_DataWords[word] |= (parity<<23);
109  }
110 
111 }

◆ ~CPMCMXData()

LVL1::CPMCMXData::~CPMCMXData ( )
virtual

Destructor.

Definition at line 114 of file CPMCMXData.cxx.

115 {
116 }

Member Function Documentation

◆ crate()

int LVL1::CPMCMXData::crate ( ) const

Data accessors.

Data access methods.

Crate number

Definition at line 121 of file CPMCMXData.cxx.

121  {
122  return m_crate;
123 }

◆ DataWords()

std::vector< unsigned int > LVL1::CPMCMXData::DataWords ( ) const

the 4 raw backplane data words

Definition at line 142 of file CPMCMXData.cxx.

142  {
143  return m_DataWords;
144 }

◆ module()

int LVL1::CPMCMXData::module ( ) const

module number

Definition at line 126 of file CPMCMXData.cxx.

126  {
127  return m_module;
128 }

◆ overflow()

bool LVL1::CPMCMXData::overflow ( ) const

Report whether TOB overflow occurred.

Don't waste time if PresenceMap empty

Otherwise count non-zero bits in presence map

Definition at line 295 of file CPMCMXData.cxx.

295  {
296 
297  bool overflow = false;
298 
300  if ( (m_DataWords[0] & 0xffff) == 0 ) return overflow;
301 
303  int ntob = 0;
304  for (unsigned int i = 0; i < 16; ++i) {
305 
306  if ( (m_DataWords[0] & (1<<i)) > 0 ) ntob++;
307 
308  } // step through presence map
309 
310  // Set overflow flags if needed
311  if (ntob > 5) overflow = true;
312 
313  return overflow;
314 }

◆ presenceMap()

unsigned int LVL1::CPMCMXData::presenceMap ( ) const

16 bit presence map

Definition at line 136 of file CPMCMXData.cxx.

136  {
137  unsigned int value = (m_DataWords[0] & 0xffff);
138  return value;
139 }

◆ TOBPresenceBits()

std::vector< unsigned int > LVL1::CPMCMXData::TOBPresenceBits ( ) const

Locations in Presence Map for up to 5 TOBs.

Definition at line 148 of file CPMCMXData.cxx.

148  {
149 
150  std::vector<unsigned int> bits;
151 
152  int ntob = 0;
153  for (unsigned int i = 0; i < 16; ++i) {
154 
155  if ( (m_DataWords[0] & (1<<i)) > 0 ) {
156 
157  if (ntob < 5) bits.push_back(i);
158  ntob++;
159 
160  } // bit set in presence map
161 
162  } // step through presence map
163 
164  return bits;
165 }

◆ TOBWords()

std::vector< unsigned int > LVL1::CPMCMXData::TOBWords ( ) const

Data words (2b LC + 5b Isol + 8b ET) for up to 5 TOBs.

If PresenceMap empty just return

Otherwise decode data words

Definition at line 169 of file CPMCMXData.cxx.

169  {
170 
171  std::vector<unsigned int> data;
172 
174  if ( (m_DataWords[0] & 0xffff) == 0 ) return data;
175 
177  unsigned int ntob = 0;
178  for (unsigned int i = 0; i < 16; ++i) {
179 
180  if ( (m_DataWords[0] & (1<<i)) > 0 ) {
181 
182  if (ntob < 5) {
183 
184  unsigned int word = 0;
185  unsigned int coord = 0;
186  unsigned int isol = 0;
187  unsigned int et = 0;
188 
189  switch (ntob) {
190  case 0:
191  coord = (m_DataWords[0] >> 16) & 3;
192  isol = (m_DataWords[0] >> 18) & 0x1f;
193  et = m_DataWords[1] & 0xff;
194  break;
195  case 1:
196  coord = (m_DataWords[1] >> 16) & 3;
197  isol = (m_DataWords[1] >> 18) & 0x1f;
198  et = (m_DataWords[1] >> 8) & 0xff;
199  break;
200  case 2:
201  coord = (m_DataWords[2] >> 16) & 3;
202  isol = (m_DataWords[2] >> 18) & 0x1f;
203  et = m_DataWords[2] & 0xff;
204  break;
205  case 3:
206  coord = (m_DataWords[3] >> 8) & 3;
207  isol = (m_DataWords[3] >> 10) & 0x1f;
208  et = (m_DataWords[2] >> 8) & 0xff;
209  break;
210  case 4:
211  coord = (m_DataWords[3] >> 16) & 3;
212  isol = (m_DataWords[3] >> 18) & 0x1f;
213  et = m_DataWords[3] & 0xff;
214  break;
215  }
216  word = et + (isol<<8) + (coord<<13);
217  data.push_back(word);
218  }
219  ntob++;
220 
221  } // bit set in presence map
222 
223  } // step through presence map
224 
225  return data;
226 }

◆ TopoTOBs()

std::vector< unsigned int > LVL1::CPMCMXData::TopoTOBs ( ) const

L1Topo TOB words (1bRO + 4b CPM + 3b Chip + 3b LC + 5b Isol + 8b ET) for up to 5 TOBs.

If PresenceMap empty just return

Otherwise decode data words

Definition at line 230 of file CPMCMXData.cxx.

230  {
231 
232  std::vector<unsigned int> data;
233 
235  if ( (m_DataWords[0] & 0xffff) == 0 ) return data;
236 
238  unsigned int ntob = 0;
239  for (unsigned int i = 0; i < 16; ++i) {
240 
241  if ( (m_DataWords[0] & (1<<i)) > 0 ) {
242 
243  if (ntob < 5) {
244 
245  unsigned int chip = i/2;
246  unsigned int rl = (i&1) << 2;
247 
248  unsigned int word;
249 
250  unsigned int coord = 0;
251  unsigned int isol = 0;
252  unsigned int et = 0;
253 
254  switch (ntob) {
255  case 0:
256  coord = ((m_DataWords[0] >> 16) & 3) + rl;
257  isol = (m_DataWords[0] >> 18) & 0x1f;
258  et = m_DataWords[1] & 0xff;
259  break;
260  case 1:
261  coord = ((m_DataWords[1] >> 16) & 3) + rl;
262  isol = (m_DataWords[1] >> 18) & 0x1f;
263  et = (m_DataWords[1] >> 8) & 0xff;
264  break;
265  case 2:
266  coord = ((m_DataWords[2] >> 16) & 3) + rl;
267  isol = (m_DataWords[2] >> 18) & 0x1f;
268  et = m_DataWords[2] & 0xff;
269  break;
270  case 3:
271  coord = ((m_DataWords[3] >> 8) & 3) + rl;
272  isol = (m_DataWords[3] >> 10) & 0x1f;
273  et = (m_DataWords[2] >> 8) & 0xff;
274  break;
275  case 4:
276  coord = ((m_DataWords[3] >> 16) & 3) + rl;
277  isol = (m_DataWords[3] >> 18) & 0x1f;
278  et = m_DataWords[3] & 0xff;
279  break;
280  }
281  word = et + (isol<<8) + (coord<<13) + (chip<<16) + (m_module<<19);
282  data.push_back(word);
283  }
284  ntob++;
285 
286  } // bit set in presence map
287 
288  } // step through presence map
289 
290  return data;
291 }

◆ type()

int LVL1::CPMCMXData::type ( ) const

TOB type (EM/Tau)

Definition at line 131 of file CPMCMXData.cxx.

131  {
132  return m_type;
133 }

Member Data Documentation

◆ m_crate

int LVL1::CPMCMXData::m_crate
private

Internal data.

Definition at line 51 of file CPMCMXData.h.

◆ m_DataWords

std::vector<unsigned int> LVL1::CPMCMXData::m_DataWords
private

Definition at line 54 of file CPMCMXData.h.

◆ m_module

int LVL1::CPMCMXData::m_module
private

Definition at line 52 of file CPMCMXData.h.

◆ m_type

int LVL1::CPMCMXData::m_type
private

Definition at line 53 of file CPMCMXData.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
et
Extra patterns decribing particle interation process.
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
LVL1::CPMCMXData::type
int type() const
TOB type (EM/Tau)
Definition: CPMCMXData.cxx:131
LVL1::CPMCMXData::m_crate
int m_crate
Internal data.
Definition: CPMCMXData.h:51
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
LVL1::CPMCMXData::overflow
bool overflow() const
Report whether TOB overflow occurred.
Definition: CPMCMXData.cxx:295
LVL1::CPMCMXData::m_DataWords
std::vector< unsigned int > m_DataWords
Definition: CPMCMXData.h:54
athena.value
value
Definition: athena.py:124
LVL1::CPMCMXData::module
int module() const
module number
Definition: CPMCMXData.cxx:126
python.LumiCalcHtml.lc
lc
Definition: LumiCalcHtml.py:579
LVL1::CPMCMXData::m_type
int m_type
Definition: CPMCMXData.h:53
TRT::Hit::side
@ side
Definition: HitInfo.h:83
LVL1::CPMCMXData::crate
int crate() const
Data accessors.
Definition: CPMCMXData.cxx:121
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1::CPMCMXData::m_module
int m_module
Definition: CPMCMXData.h:52
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
PlotCalibFromCool.rl
rl
Definition: PlotCalibFromCool.py:529
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.