Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:21

0001 #ifndef EventFilter_CSCRawToDigi_CSCRawToDigi_CSCALCTHeader2007_h
0002 #define EventFilter_CSCRawToDigi_CSCRawToDigi_CSCALCTHeader2007_h
0003 
0004 /** documented in  flags
0005   http://www.phys.ufl.edu/~madorsky/alctv/alct2000_spec.PDF
0006 // see http://www.phys.ufl.edu/cms/emu/dqm/data_formats/ALCT_v2p9_2008.03.28.pdf
0007 
0008 */
0009 #include <bitset>
0010 #include <vector>
0011 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
0012 #include <boost/dynamic_bitset.hpp>
0013 #include <cstring>
0014 
0015 class CSCDMBHeader;
0016 
0017 struct CSCALCT {
0018   CSCALCT();
0019   CSCALCT(const CSCALCTDigi& alctDigi);
0020 
0021   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0022 
0023   static short unsigned int sizeInWords() { return 1; }
0024 
0025   unsigned valid : 1;
0026   unsigned quality : 2;
0027   unsigned accel : 1;
0028   unsigned pattern : 1;
0029   unsigned keyWire : 7;
0030   unsigned reserved : 4;
0031 };
0032 
0033 struct CSCALCTHeader2007 {
0034   CSCALCTHeader2007();
0035   explicit CSCALCTHeader2007(int chamberType);
0036 
0037   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0038 
0039   void setEventInformation(const CSCDMBHeader&);  ///for packing
0040 
0041   short unsigned int sizeInWords() const {  ///size of ALCT2007 Header
0042     return 8;
0043   }
0044 
0045   unsigned flag1 : 16;  ///=0xDB0A
0046 
0047   unsigned bxnL1A : 12;
0048   unsigned reserved1 : 4;
0049 
0050   unsigned l1aCounter : 12;
0051   unsigned reserved2 : 4;
0052 
0053   unsigned readoutCounter : 12;
0054   unsigned reserved3 : 4;
0055 
0056   unsigned bxnCount : 12;
0057   unsigned rawOverflow : 1;
0058   unsigned lctOverflow : 1;
0059   unsigned configPresent : 1;
0060   unsigned flag3 : 1;
0061 
0062   unsigned bxnBeforeReset : 12;
0063   unsigned flag2 : 4;
0064 
0065   unsigned boardType : 3;
0066   unsigned backwardForward : 1;
0067   unsigned negativePositive : 1;
0068   unsigned mirrored : 1;
0069   unsigned qualityCancell : 1;
0070   unsigned latencyClocks : 1;
0071   unsigned patternB : 1;
0072   unsigned widePattern : 1;
0073   unsigned reserved0 : 2;
0074   unsigned flag0 : 4;
0075 
0076   unsigned rawBins : 5;
0077   unsigned lctBins : 4;
0078   unsigned firmwareVersion : 6;
0079   unsigned flag4 : 1;
0080 };
0081 
0082 struct CSCVirtexID {
0083   CSCVirtexID() {
0084     bzero(this, sizeInWords() * 2);  ///size of virtex ID bits = 6 bytes
0085   }
0086 
0087   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0088 
0089   short unsigned int sizeInWords() const {  ///size of VirtexID
0090     return 3;
0091   }
0092 
0093   unsigned virtexIDLow : 15;
0094   unsigned flag0 : 1;  ///==0
0095 
0096   unsigned virtexIDMed : 15;
0097   unsigned flag1 : 1;  ///==0
0098 
0099   unsigned virtexIDHigh : 10;
0100   unsigned trReg : 3;
0101   unsigned reserved : 2;
0102   unsigned flag2 : 1;  ///==0
0103 };
0104 
0105 struct CSCConfigurationRegister {
0106   CSCConfigurationRegister() { bzero(this, sizeInWords() * 2); }
0107 
0108   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0109 
0110   short unsigned int sizeInWords() const {  ///size of ConfigReg
0111     return 5;
0112   }
0113 
0114   unsigned configRegister0 : 15;
0115   unsigned flag0 : 1;  ///==0
0116 
0117   unsigned configRegister1 : 15;
0118   unsigned flag1 : 1;  ///==0
0119 
0120   unsigned configRegister2 : 15;
0121   unsigned flag2 : 1;  ///==0
0122 
0123   unsigned configRegister3 : 15;
0124   unsigned flag3 : 1;  ///==0
0125 
0126   unsigned configRegister4 : 9;
0127   unsigned reserved : 6;
0128   unsigned flag4 : 1;  ///==0
0129 };
0130 
0131 struct CSCCollisionMask {
0132   CSCCollisionMask() { bzero(this, sizeInWords() * 2); }
0133 
0134   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0135 
0136   short unsigned int sizeInWords() const {  ///size of one CollMask word
0137     return 1;
0138   }
0139 
0140   unsigned collisionMaskRegister : 14;
0141   unsigned reserved : 1;
0142   unsigned flag : 1;  ///==0
0143 };
0144 
0145 struct CSCHotChannelMask {
0146   CSCHotChannelMask() { bzero(this, sizeInWords() * 2); }
0147 
0148   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0149 
0150   short unsigned int sizeInWords() const {  ///size of one HotChannMask word
0151     return 1;
0152   }
0153 
0154   unsigned hotChannelMask : 12;
0155   unsigned reserved : 3;
0156   unsigned flag : 1;  ///==0
0157 };
0158 
0159 #endif