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 NULL;
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 NULL;
51 }
52 
53 //----------------------------------------------------------------------------------------------------
54 
56 {
57  MapType::const_iterator it = data.begin();
58  return (it == data.end()) ? value_type(TotemFramePosition(), NULL) : 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(), NULL) : value_type(it->first, &it->second);
72 }
73 
74 //----------------------------------------------------------------------------------------------------
75 
77 {
78  return (value.second == NULL);
79 }
const VFATFrame * GetFrameByID(unsigned int ID) const
returns pointer to frame with ID, performs NO duplicity check (if there is precisely one frame with t...
uint32_t ID
Definition: Definitions.h:26
#define NULL
Definition: scimark2.h:8
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
const VFATFrame * GetFrameByIndex(TotemFramePosition index) const
returns frame at given position in Slink frame
Definition: value.py:1
virtual value_type NextIterator(const value_type &) const
shifts the iterator
virtual bool IsEndIterator(const value_type &) const
checks whether the iterator points over the end of the collection
virtual value_type BeginIterator() const
returns the beginning of the collection
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82