00001 #ifndef CSCAnodeData2007_h 00002 #define CSCAnodeData2007_h 00003 00004 #include "EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h" 00005 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" 00006 #include <cassert> 00007 class CSCALCTHeader; 00008 00009 class CSCAnodeDataFrame2007 { 00010 public: 00011 explicit CSCAnodeDataFrame2007(unsigned short data) {data_ = data;} 00012 CSCAnodeDataFrame2007() {} 00013 00015 bool isHit(unsigned wireGroup) const { 00016 assert(wireGroup < 12); 00017 return ( (data_>>wireGroup) & 0x1 ); 00018 } 00019 00020 void addHit(unsigned wireGroup) 00021 { 00022 data_ |= (1 << wireGroup); 00023 } 00024 00025 unsigned short data() const {return data_;} 00026 00027 private: 00028 unsigned short data_ : 12; 00029 unsigned short reserved_ : 3; 00030 unsigned short flag_ : 1; 00031 }; 00032 00033 00034 class CSCAnodeData2007 : public CSCAnodeDataFormat { 00035 00036 public: 00038 explicit CSCAnodeData2007(const CSCALCTHeader &); 00040 CSCAnodeData2007(const CSCALCTHeader &, const unsigned short *buf); 00041 00042 virtual unsigned short * data() {return theDataFrames;} 00044 virtual unsigned short int sizeInWords() const {return sizeInWords2007_;} 00045 00047 virtual std::vector<CSCWireDigi> wireDigis(int layer) const; 00048 00049 virtual void add(const CSCWireDigi &, int layer); 00050 00051 static void selfTest(); 00052 00053 private: 00054 void init(const CSCALCTHeader &); 00055 int index(int tbin, int layer, int layerPart) const; 00056 CSCAnodeDataFrame2007 findFrame(int tbin, int layer, int layerPart) const; 00057 00059 enum {MAXFRAMES=2700}; 00060 unsigned short theDataFrames[MAXFRAMES]; 00061 unsigned short int sizeInWords2007_; 00062 unsigned short int nAFEBs_; 00063 unsigned short int nTimeBins_; 00064 00065 unsigned short int layerParts_; 00066 unsigned short int maxWireGroups_; 00067 unsigned int alctBX_; 00068 }; 00069 00070 #endif 00071 00072