1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/****************************************************************************
*
* This is a part of the TOTEM offline software.
* Authors:
* Jan Kašpar (jan.kaspar@gmail.com)
*
****************************************************************************/
#include "EventFilter/CTPPSRawToDigi/interface/SimpleVFATFrameCollection.h"
using namespace std;
SimpleVFATFrameCollection::SimpleVFATFrameCollection() {}
SimpleVFATFrameCollection::~SimpleVFATFrameCollection() { data.clear(); }
const VFATFrame* SimpleVFATFrameCollection::GetFrameByID(unsigned int ID) const {
// first convert ID to 12bit form
ID = ID & 0xFFF;
for (MapType::const_iterator it = data.begin(); it != data.end(); ++it)
if (it->second.getChipID() == ID)
if (it->second.checkFootprint() && it->second.checkCRC())
return &(it->second);
return nullptr;
}
const VFATFrame* SimpleVFATFrameCollection::GetFrameByIndex(TotemFramePosition index) const {
MapType::const_iterator it = data.find(index);
if (it != data.end())
return &(it->second);
else
return nullptr;
}
VFATFrameCollection::value_type SimpleVFATFrameCollection::BeginIterator() const {
MapType::const_iterator it = data.begin();
return (it == data.end()) ? value_type(TotemFramePosition(), nullptr) : value_type(it->first, &it->second);
}
VFATFrameCollection::value_type SimpleVFATFrameCollection::NextIterator(const value_type& value) const {
if (!value.second)
return value;
MapType::const_iterator it = data.find(value.first);
it++;
return (it == data.end()) ? value_type(TotemFramePosition(), nullptr) : value_type(it->first, &it->second);
}
bool SimpleVFATFrameCollection::IsEndIterator(const value_type& value) const { return (value.second == nullptr); }
|