Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_CSCRawToDigi_CSCRawToDigi_CSCALCTHeader2006_h
0002 #define EventFilter_CSCRawToDigi_CSCRawToDigi_CSCALCTHeader2006_h
0003 
0004 #include <vector>
0005 #include <cstring>
0006 #include <strings.h>
0007 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
0008 class CSCDMBHeader;
0009 
0010 ///ALCT Header consists of several modular units that are defined as structs below
0011 struct CSCALCTHeader2006 {  ///this struct contains all 2006 ALCT Header words except ALCTs
0012   CSCALCTHeader2006() { init(); }
0013 
0014   explicit CSCALCTHeader2006(int chamberType);
0015 
0016   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0017 
0018   void init() {
0019     bzero(this, sizeInWords() * 2);  ///size of header w/o LCTs = 8 bytes
0020   }
0021 
0022   short unsigned int sizeInWords() const {  ///size of ALCT Header
0023     return 4;
0024   }
0025 
0026   unsigned short int BXNCount() const { return bxnCount; }
0027 
0028   unsigned short nLCTChipRead() const;
0029 
0030   void setEventInformation(const CSCDMBHeader&);  ///for packing
0031 
0032   void setDAV(int afebBoard) { activeFEBs |= 1 << afebBoard; }
0033 
0034   /// l1 accept counter
0035   unsigned l1Acc : 4;
0036   /// chamber ID number
0037   unsigned cscID : 4;
0038   /// ALCT2000 board ID
0039   unsigned boardID : 3;
0040   /// should be '01100', so it'll be a 6xxx in the ASCII dump
0041   unsigned flag_0 : 5;
0042 
0043   /// see the FIFO_MODE enum
0044   unsigned fifoMode : 2;
0045   /// # of 25 ns time bins in the raw dump
0046   unsigned nTBins : 5;
0047   /// exteran L1A arrived in L1A window
0048   unsigned l1aMatch : 1;
0049   /// trigger source was external
0050   unsigned extTrig : 1;
0051   /// promotion bit for 1st LCT pattern
0052   unsigned promote1 : 1;
0053   /// promotion bit for 2nd LCT pattern
0054   unsigned promote2 : 1;
0055   /// reserved, set to 0
0056   unsigned reserved_1 : 3;
0057   /// DDU+LCT special word flags
0058   unsigned flag_1 : 2;
0059 
0060   /// full bunch crossing number
0061   unsigned bxnCount : 12;
0062   /// reserved, set to 0
0063   unsigned reserved_2 : 2;
0064   ///  DDU+LCT special word flags
0065   unsigned flag_2 : 2;
0066 
0067   /// LCT chips read out in raw hit dump
0068   unsigned lctChipRead : 7;
0069   /// LCT chips with ADB hits
0070   unsigned activeFEBs : 7;
0071   ///  DDU+LCT special word flags
0072   unsigned flag_3 : 2;
0073 };
0074 
0075 struct CSCALCTs2006 {
0076   CSCALCTs2006() {
0077     bzero(this, 8);  ///size of ALCT = 2bytes
0078   }
0079 
0080   void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }
0081 
0082   short unsigned int sizeInWords() const {  ///size of ALCT
0083     return 4;
0084   }
0085 
0086   std::vector<CSCALCTDigi> ALCTDigis() const;
0087 
0088   /// should try to sort, but doesn't for now
0089   void add(const std::vector<CSCALCTDigi>& digis);
0090   void addALCT0(const CSCALCTDigi& digi);
0091   void addALCT1(const CSCALCTDigi& digi);
0092 
0093   /// 1st LCT lower 15 bits
0094   /// http://www.phys.ufl.edu/cms/emu/dqm/data_formats/ALCT_data_format_notes.pdf
0095   unsigned alct0_valid : 1;
0096   unsigned alct0_quality : 2;
0097   unsigned alct0_accel : 1;
0098   unsigned alct0_pattern : 1;
0099   unsigned alct0_key_wire : 7;
0100   unsigned alct0_bxn_low : 3;
0101   ///  DDU+LCT special word flags
0102   unsigned flag_4 : 1;
0103 
0104   unsigned alct0_bxn_high : 2;
0105   unsigned alct0_reserved : 13;
0106   ///  DDU+LCT special word flags
0107   unsigned flag_5 : 1;
0108 
0109   /// 2nd LCT lower 15 bits
0110   unsigned alct1_valid : 1;
0111   unsigned alct1_quality : 2;
0112   unsigned alct1_accel : 1;
0113   unsigned alct1_pattern : 1;
0114   unsigned alct1_key_wire : 7;
0115   unsigned alct1_bxn_low : 3;
0116   unsigned flag_6 : 1;
0117 
0118   unsigned alct1_bxn_high : 2;
0119   unsigned alct1_reserved : 13;
0120   unsigned flag_7 : 1;
0121 };
0122 
0123 #endif