CMS 3D CMS Logo

SimpleVFATFrameCollection.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of the TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 *
7 ****************************************************************************/
8 
9 
11 
12 //----------------------------------------------------------------------------------------------------
13 
14 using namespace std;
15 
17 {
18 }
19 
20 //----------------------------------------------------------------------------------------------------
21 
23 {
24  data.clear();
25 }
26 
27 //----------------------------------------------------------------------------------------------------
28 
30 {
31  // first convert ID to 12bit form
32  ID = ID & 0xFFF;
33 
34  for (MapType::const_iterator it = data.begin(); it != data.end(); ++it)
35  if (it->second.getChipID() == ID)
36  if (it->second.checkFootprint() && it->second.checkCRC())
37  return &(it->second);
38 
39  return nullptr;
40 }
41 
42 //----------------------------------------------------------------------------------------------------
43 
45 {
46  MapType::const_iterator it = data.find(index);
47  if (it != data.end())
48  return &(it->second);
49  else
50  return nullptr;
51 }
52 
53 //----------------------------------------------------------------------------------------------------
54 
56 {
57  MapType::const_iterator it = data.begin();
58  return (it == data.end()) ? value_type(TotemFramePosition(), nullptr) : value_type(it->first, &it->second);
59 }
60 
61 //----------------------------------------------------------------------------------------------------
62 
64 {
65  if (!value.second)
66  return value;
67 
68  MapType::const_iterator it = data.find(value.first);
69  it++;
70 
71  return (it == data.end()) ? value_type(TotemFramePosition(), nullptr) : value_type(it->first, &it->second);
72 }
73 
74 //----------------------------------------------------------------------------------------------------
75 
77 {
78  return (value.second == nullptr);
79 }
const VFATFrame * GetFrameByIndex(TotemFramePosition index) const override
returns frame at given position in Slink frame
uint32_t ID
Definition: Definitions.h:26
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
value_type NextIterator(const value_type &) const override
shifts the iterator
const VFATFrame * GetFrameByID(unsigned int ID) const override
returns pointer to frame with ID, performs NO duplicity check (if there is precisely one frame with t...
Definition: value.py:1
bool IsEndIterator(const value_type &) const override
checks whether the iterator points over the end of the collection
value_type BeginIterator() const override
returns the beginning of the collection
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82