Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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   /// given a wiregroup between 0 and 11, it tells whether this bit was on
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   /// a blank one, for Monte Carlo
0033   explicit CSCAnodeData2007(const CSCALCTHeader &);
0034   /// fill from a real datastream
0035   CSCAnodeData2007(const CSCALCTHeader &, const unsigned short *buf);
0036 
0037   unsigned short *data() override { return theDataFrames; }
0038   /// the amount of the input binary buffer read, in 16-bit words
0039   unsigned short int sizeInWords() const override { return sizeInWords2007_; }
0040 
0041   /// input layer is from 1 to 6
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   /// we don't know the size at first.  Max should be 7 boards * 32 bins * 6 layers * 2
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_;     ///number of layer parts in the ALCT
0061   unsigned short int maxWireGroups_;  ///number of wiregroups in the ALCT
0062   unsigned int alctBX_;               /// To account BX in wire digis
0063 };
0064 
0065 #endif