Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:45

0001 /****************************************************************************
0002 *
0003 * This is a part of the TOTEM offline software.
0004 * Authors: 
0005 *   Mate Csanad (mate.csanad@cern.ch)
0006 *   Jan Kašpar (jan.kaspar@gmail.com) 
0007 *    
0008 ****************************************************************************/
0009 
0010 #ifndef EventFilter_CTPPSRawToDigi_SimpleVFATFrameCollection
0011 #define EventFilter_CTPPSRawToDigi_SimpleVFATFrameCollection
0012 
0013 #include "EventFilter/CTPPSRawToDigi/interface/VFATFrameCollection.h"
0014 
0015 #include <map>
0016 
0017 /**
0018  * A basic implementation of VFAT frame collection, as map: TotemFramePosition --> VFATFrame.
0019 **/
0020 class SimpleVFATFrameCollection : public VFATFrameCollection {
0021 protected:
0022   typedef std::map<TotemFramePosition, VFATFrame> MapType;
0023 
0024   MapType data;
0025 
0026   value_type BeginIterator() const override;
0027   value_type NextIterator(const value_type&) const override;
0028   bool IsEndIterator(const value_type&) const override;
0029 
0030 public:
0031   SimpleVFATFrameCollection();
0032   ~SimpleVFATFrameCollection() override;
0033 
0034   const VFATFrame* GetFrameByID(unsigned int ID) const override;
0035   const VFATFrame* GetFrameByIndex(TotemFramePosition index) const override;
0036 
0037   unsigned int Size() const override { return data.size(); }
0038 
0039   bool Empty() const override { return (data.empty()); }
0040 
0041   void Insert(const TotemFramePosition& index, const VFATFrame& frame) { data.insert({index, frame}); }
0042 
0043   /// inserts an empty (default) frame to the given position and returns pointer to the frame
0044   VFATFrame* InsertEmptyFrame(TotemFramePosition index) { return &data.insert({index, VFATFrame()}).first->second; }
0045 
0046   /// cleans completely the collection
0047   void Clear() { data.clear(); }
0048 };
0049 
0050 #endif