CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
SimpleVFATFrameCollection Class Reference

#include <SimpleVFATFrameCollection.h>

Inheritance diagram for SimpleVFATFrameCollection:
VFATFrameCollection

Public Member Functions

void Clear ()
 cleans completely the collection More...
 
bool Empty () const override
 returns whether the collection is empty More...
 
const VFATFrameGetFrameByID (unsigned int ID) const override
 returns pointer to frame with ID, performs NO duplicity check (if there is precisely one frame with this 12bit ID) More...
 
const VFATFrameGetFrameByIndex (TotemFramePosition index) const override
 returns frame at given position in Slink frame More...
 
void Insert (const TotemFramePosition &index, const VFATFrame &frame)
 
VFATFrameInsertEmptyFrame (TotemFramePosition index)
 inserts an empty (default) frame to the given position and returns pointer to the frame More...
 
 SimpleVFATFrameCollection ()
 
unsigned int Size () const override
 return the number of VFAT frames in the collection More...
 
 ~SimpleVFATFrameCollection () override
 
- Public Member Functions inherited from VFATFrameCollection
virtual const VFATFrameGetFrameByIndexID (TotemFramePosition index, unsigned int ID)
 returns frame at given position in Slink frame and checks 12bit ID More...
 
 VFATFrameCollection ()
 
virtual ~VFATFrameCollection ()
 

Protected Types

typedef std::map< TotemFramePosition, VFATFrameMapType
 

Protected Member Functions

value_type BeginIterator () const override
 returns the beginning of the collection More...
 
bool IsEndIterator (const value_type &) const override
 checks whether the iterator points over the end of the collection More...
 
value_type NextIterator (const value_type &) const override
 shifts the iterator More...
 

Protected Attributes

MapType data
 

Additional Inherited Members

- Public Types inherited from VFATFrameCollection
typedef std::pair< TotemFramePosition, const VFATFrame * > value_type
 pair: frame DAQ position, frame data More...
 

Detailed Description

A basic implementation of VFAT frame collection, as map: TotemFramePosition –> VFATFrame.

Definition at line 21 of file SimpleVFATFrameCollection.h.

Member Typedef Documentation

Definition at line 24 of file SimpleVFATFrameCollection.h.

Constructor & Destructor Documentation

SimpleVFATFrameCollection::SimpleVFATFrameCollection ( )

Definition at line 16 of file SimpleVFATFrameCollection.cc.

17 {
18 }
SimpleVFATFrameCollection::~SimpleVFATFrameCollection ( )
override

Definition at line 22 of file SimpleVFATFrameCollection.cc.

References data.

23 {
24  data.clear();
25 }

Member Function Documentation

VFATFrameCollection::value_type SimpleVFATFrameCollection::BeginIterator ( ) const
overrideprotectedvirtual

returns the beginning of the collection

Implements VFATFrameCollection.

Definition at line 55 of file SimpleVFATFrameCollection.cc.

References data.

56 {
57  MapType::const_iterator it = data.begin();
58  return (it == data.end()) ? value_type(TotemFramePosition(), nullptr) : value_type(it->first, &it->second);
59 }
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
void SimpleVFATFrameCollection::Clear ( )
inline

cleans completely the collection

Definition at line 61 of file SimpleVFATFrameCollection.h.

62  {
63  data.clear();
64  }
bool SimpleVFATFrameCollection::Empty ( ) const
inlineoverridevirtual

returns whether the collection is empty

Implements VFATFrameCollection.

Definition at line 44 of file SimpleVFATFrameCollection.h.

45  {
46  return (data.empty());
47  }
const VFATFrame * SimpleVFATFrameCollection::GetFrameByID ( unsigned int  ID) const
overridevirtual

returns pointer to frame with ID, performs NO duplicity check (if there is precisely one frame with this 12bit ID)

Implements VFATFrameCollection.

Definition at line 29 of file SimpleVFATFrameCollection.cc.

References data.

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 }
uint32_t ID
Definition: Definitions.h:26
const VFATFrame * SimpleVFATFrameCollection::GetFrameByIndex ( TotemFramePosition  index) const
overridevirtual

returns frame at given position in Slink frame

Implements VFATFrameCollection.

Definition at line 44 of file SimpleVFATFrameCollection.cc.

References data.

45 {
46  MapType::const_iterator it = data.find(index);
47  if (it != data.end())
48  return &(it->second);
49  else
50  return nullptr;
51 }
void SimpleVFATFrameCollection::Insert ( const TotemFramePosition index,
const VFATFrame frame 
)
inline

Definition at line 49 of file SimpleVFATFrameCollection.h.

References diffTreeTool::index.

Referenced by ctpps::RawDataUnpacker::ProcessVFATDataParallel().

50  {
51  data.insert({index, frame});
52  }
VFATFrame* SimpleVFATFrameCollection::InsertEmptyFrame ( TotemFramePosition  index)
inline

inserts an empty (default) frame to the given position and returns pointer to the frame

Definition at line 55 of file SimpleVFATFrameCollection.h.

References plotBeamSpotDB::first, and diffTreeTool::index.

Referenced by ctpps::RawDataUnpacker::ProcessOptoRxFrameSerial().

56  {
57  return &data.insert({index, VFATFrame()}).first->second;
58  }
bool SimpleVFATFrameCollection::IsEndIterator ( const value_type ) const
overrideprotectedvirtual

checks whether the iterator points over the end of the collection

Implements VFATFrameCollection.

Definition at line 76 of file SimpleVFATFrameCollection.cc.

77 {
78  return (value.second == nullptr);
79 }
Definition: value.py:1
VFATFrameCollection::value_type SimpleVFATFrameCollection::NextIterator ( const value_type ) const
overrideprotectedvirtual

shifts the iterator

Implements VFATFrameCollection.

Definition at line 63 of file SimpleVFATFrameCollection.cc.

References data, and relativeConstraints::value.

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 }
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
Definition: value.py:1
unsigned int SimpleVFATFrameCollection::Size ( ) const
inlineoverridevirtual

return the number of VFAT frames in the collection

Implements VFATFrameCollection.

Definition at line 39 of file SimpleVFATFrameCollection.h.

40  {
41  return data.size();
42  }

Member Data Documentation

MapType SimpleVFATFrameCollection::data
protected