CMS 3D CMS Logo

CSCAnodeData2006.h

Go to the documentation of this file.
00001 #ifndef CSCAnodeData2006_h
00002 #define CSCAnodeData2006_h
00003 #include "EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h"
00004 #include <cassert>
00005 class CSCALCTHeader;
00006 
00007 class CSCAnodeDataFrame2006 {
00008 public:
00009   CSCAnodeDataFrame2006() {}
00010   CSCAnodeDataFrame2006(unsigned chip, unsigned tbin, unsigned data) 
00011   :  data_(data&0x3), tbin_(tbin),
00012   // do we have 2 bits for this, or 3? 
00013   // chip_( chip&1 + 2*(chip&2 | chip&4) ) 
00014   chip_(chip) {}
00015 
00017   bool isHit(unsigned wireGroup) const {
00018     assert(wireGroup < 8);
00019     return ( (data_>>wireGroup) & 0x1 );
00020   }
00021 
00023   void addHit(unsigned wireGroup) {
00024     data_ |= (1 << wireGroup);
00025   }
00026 
00028   unsigned tbin() const {return tbin_;}
00031   unsigned chip() const {return chip_;}
00032   unsigned short data() const {return data_;}
00033 
00034 private:
00035   unsigned short data_ : 8;
00036   unsigned short tbin_ : 5;
00037   unsigned short chip_ : 2;
00038   unsigned short ddu_code_ : 1;
00039 };
00040 
00041 
00042 class CSCAnodeData2006 : public CSCAnodeDataFormat 
00043 {
00044 public:
00046   CSCAnodeData2006(const CSCALCTHeader &);
00048   CSCAnodeData2006(const CSCALCTHeader &, const unsigned short *buf);
00049 
00050   virtual unsigned short * data() {return theDataFrames;}
00052   virtual unsigned short int sizeInWords() const {return nAFEBs_ * nTimeBins_ * 6 * 2;}
00053 
00055   virtual std::vector<CSCWireDigi> wireDigis(int layer) const;
00056 
00057   virtual void add(const CSCWireDigi &, int layer);
00058 
00059 private:
00060   void init();
00061 
00062   const CSCAnodeDataFrame2006 & rawHit(int afeb, int tbin, int layer, int halfLayer) const {
00063     return (const CSCAnodeDataFrame2006 &)(theDataFrames[index(afeb, tbin, layer)+halfLayer]);
00064   }
00065 
00067   CSCAnodeDataFrame2006 & rawHit(int afeb, int tbin, int layer, int halfLayer) {
00068     return (CSCAnodeDataFrame2006 &)(theDataFrames[index(afeb, tbin, layer)+halfLayer]);
00069   }
00070 
00072   int index(int afeb, int tbin, int layer) const {
00073     int result = (layer-1)*2 + 12*tbin + afeb*12*nTimeBins_;
00074     assert(result < sizeInWords());
00075     return result;
00076   }
00077 
00079   unsigned short theDataFrames[2700];
00081   int nAFEBs_;
00082   int nTimeBins_;
00083 };
00084 
00085 #endif
00086 
00087 

Generated on Tue Jun 9 17:34:21 2009 for CMSSW by  doxygen 1.5.4