File indexing completed on 2024-04-06 12:10:21
0001 #ifndef EventFilter_CSCRawToDigi_CSCAnodeData2007_h
0002 #define EventFilter_CSCRawToDigi_CSCAnodeData2007_h
0003
0004 #include "EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h"
0005 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
0006 #include <cassert>
0007 class CSCALCTHeader;
0008
0009 class CSCAnodeDataFrame2007 {
0010 public:
0011 explicit CSCAnodeDataFrame2007(unsigned short data) { data_ = data; }
0012 CSCAnodeDataFrame2007() {}
0013
0014
0015 bool isHit(unsigned wireGroup) const {
0016 assert(wireGroup < 12);
0017 return ((data_ >> wireGroup) & 0x1);
0018 }
0019
0020 void addHit(unsigned wireGroup) { data_ |= (1 << wireGroup); }
0021
0022 unsigned short data() const { return data_; }
0023
0024 private:
0025 unsigned short data_ : 12;
0026 unsigned short reserved_ : 3;
0027 unsigned short flag_ : 1;
0028 };
0029
0030 class CSCAnodeData2007 : public CSCAnodeDataFormat {
0031 public:
0032
0033 explicit CSCAnodeData2007(const CSCALCTHeader &);
0034
0035 CSCAnodeData2007(const CSCALCTHeader &, const unsigned short *buf);
0036
0037 unsigned short *data() override { return theDataFrames; }
0038
0039 unsigned short int sizeInWords() const override { return sizeInWords2007_; }
0040
0041
0042 std::vector<CSCWireDigi> wireDigis(int layer) const override;
0043
0044 void add(const CSCWireDigi &, int layer) override;
0045
0046 static void selfTest();
0047
0048 private:
0049 void init(const CSCALCTHeader &);
0050 int index(int tbin, int layer, int layerPart) const;
0051 CSCAnodeDataFrame2007 findFrame(int tbin, int layer, int layerPart) const;
0052
0053
0054 enum { MAXFRAMES = 2700 };
0055 unsigned short theDataFrames[MAXFRAMES];
0056 unsigned short int sizeInWords2007_;
0057 unsigned short int nAFEBs_;
0058 unsigned short int nTimeBins_;
0059
0060 unsigned short int layerParts_;
0061 unsigned short int maxWireGroups_;
0062 unsigned int alctBX_;
0063 };
0064
0065 #endif