Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2006_h
0002 #define EventFilter_CSCRawToDigi_CSCTMBHeader2006_h
0003 #include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h"
0004 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0005 
0006 struct CSCTMBHeader2006 : public CSCVTMBHeaderFormat {
0007   enum { NWORDS = 27 };
0008   CSCTMBHeader2006();
0009   explicit CSCTMBHeader2006(const unsigned short* buf);
0010   void setEventInformation(const CSCDMBHeader& dmbHeader) override;
0011 
0012   uint16_t BXNCount() const override { return bits.bxnCount; }
0013   uint16_t ALCTMatchTime() const override { return bits.alctMatchTime; }
0014   void setALCTMatchTime(uint16_t alctmatchtime) override { bits.alctMatchTime = alctmatchtime & 0xF; }
0015   uint16_t CLCTOnly() const override { return bits.clctOnly; }
0016   uint16_t ALCTOnly() const override { return bits.alctOnly; }
0017   uint16_t TMBMatch() const override { return bits.tmbMatch; }
0018   uint16_t Bxn0Diff() const override { return bits.bxn0Diff; }
0019   uint16_t Bxn1Diff() const override { return bits.bxn1Diff; }
0020   uint16_t L1ANumber() const override { return bits.l1aNumber; }
0021   uint16_t NTBins() const override { return bits.nTBins; }
0022   uint16_t NCFEBs() const override { return bits.nCFEBs; }
0023   void setNCFEBs(uint16_t ncfebs) override { bits.nCFEBs = ncfebs & 0x1F; }
0024   uint16_t firmwareRevision() const override { return bits.firmRevCode; }
0025   uint16_t syncError() const override { return bits.syncError; }
0026   uint16_t syncErrorCLCT() const override { return (bits.clct0_sync_err | bits.clct1_sync_err); }
0027   uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; }
0028   uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; }
0029   uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; }
0030 
0031   /// == Run 3 CSC-GEM Trigger Format
0032   uint16_t clct0_ComparatorCode() const override { return 0; }
0033   uint16_t clct1_ComparatorCode() const override { return 0; }
0034   uint16_t clct0_xky() const override { return 0; }
0035   uint16_t clct1_xky() const override { return 0; }
0036   uint16_t hmt_nhits() const override { return 0; }
0037   uint16_t hmt_ALCTMatchTime() const override { return 0; }
0038   uint16_t alctHMT() const override { return 0; }
0039   uint16_t clctHMT() const override { return 0; }
0040   uint16_t gem_enabled_fibers() const override { return 0; }
0041   uint16_t gem_fifo_tbins() const override { return 0; }
0042   uint16_t gem_fifo_pretrig() const override { return 0; }
0043   uint16_t gem_zero_suppress() const override { return 0; }
0044   uint16_t gem_sync_dataword() const override { return 0; }
0045   uint16_t gem_timing_dataword() const override { return 0; }
0046   uint16_t run3_CLCT_patternID() const override { return 0; }
0047 
0048   ///returns CLCT digis
0049   std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) override;
0050   ///returns CorrelatedLCT digis
0051   std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const override;
0052   ///returns lct HMT Shower digi
0053   CSCShowerDigi showerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); }
0054   ///returns anode HMT Shower digi
0055   CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); }
0056   ///returns cathode HMT Shower digi
0057   CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const override { return CSCShowerDigi(); }
0058 
0059   /// in 16-bit words.  Add olne because we include beginning(b0c) and
0060   /// end (e0c) flags
0061   unsigned short int sizeInWords() const override { return NWORDS; }
0062 
0063   unsigned short int NHeaderFrames() const override { return bits.nHeaderFrames; }
0064   /// returns the first data word
0065   unsigned short* data() override { return (unsigned short*)(&bits); }
0066   bool check() const override { return bits.e0bline == 0x6e0b && NHeaderFrames() + 1 == NWORDS; }
0067 
0068   /// for data packing
0069   void addCLCT0(const CSCCLCTDigi& digi) override;
0070   void addCLCT1(const CSCCLCTDigi& digi) override;
0071   void addALCT0(const CSCALCTDigi& digi) override;
0072   void addALCT1(const CSCALCTDigi& digi) override;
0073   void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) override;
0074   void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) override;
0075   void addShower(const CSCShowerDigi& digi) override {}
0076   void addAnodeShower(const CSCShowerDigi& digi) override {}
0077   void addCathodeShower(const CSCShowerDigi& digi) override {}
0078 
0079   void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
0080 
0081   void print(std::ostream& os) const override;
0082   struct {
0083     unsigned b0cline : 16;
0084     unsigned nTBins : 5, dumpCFEBs : 7, fifoMode : 3, reserved_1 : 1;
0085     unsigned l1aNumber : 4, cscID : 4, boardID : 5, l1atype : 2, reserved_2 : 1;
0086     unsigned bxnCount : 12, r_type : 2, reserved_3 : 2;
0087     unsigned nHeaderFrames : 5, nCFEBs : 3, hasBuf : 1, preTrigTBins : 5, reserved_4 : 2;
0088     unsigned l1aTxCounter : 4, trigSourceVect : 8, hasPreTrig : 4;
0089     unsigned activeCFEBs : 5, CFEBsInstantiated : 5, runID : 4, reserved_6 : 2;
0090     unsigned bxnPreTrigger : 12, syncError : 1, reserved_7 : 3;
0091 
0092     unsigned clct0_valid : 1;
0093     unsigned clct0_quality : 3;
0094     unsigned clct0_shape : 3;
0095     unsigned clct0_strip_type : 1;
0096     unsigned clct0_bend : 1;
0097     unsigned clct0_key : 5;
0098     unsigned clct0_cfeb_low : 1;
0099     unsigned reserved_8 : 1;
0100 
0101     unsigned clct1_valid : 1;
0102     unsigned clct1_quality : 3;
0103     unsigned clct1_shape : 3;
0104     unsigned clct1_strip_type : 1;
0105     unsigned clct1_bend : 1;
0106     unsigned clct1_key : 5;
0107     unsigned clct1_cfeb_low : 1;
0108     unsigned reserved_9 : 1;
0109 
0110     unsigned clct0_cfeb_high : 2;
0111     unsigned clct0_bxn : 2;
0112     unsigned clct0_sync_err : 1;
0113     unsigned clct0_bx0_local : 1;
0114     unsigned clct1_cfeb_high : 2;
0115     unsigned clct1_bxn : 2;
0116     unsigned clct1_sync_err : 1;
0117     unsigned clct1_bx0_local : 1;
0118     unsigned invalidPattern : 1;
0119     unsigned reserved_10 : 3;
0120 
0121     unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, bxn0Diff : 2, bxn1Diff : 2, alctMatchTime : 4, reserved_11 : 5;
0122 
0123     unsigned MPC_Muon0_wire_ : 7;
0124     unsigned MPC_Muon0_clct_pattern_ : 4;
0125     unsigned MPC_Muon0_quality_ : 4;
0126     unsigned reserved_12 : 1;
0127 
0128     unsigned MPC_Muon0_halfstrip_clct_pattern : 8;
0129     unsigned MPC_Muon0_bend_ : 1;
0130     unsigned MPC_Muon0_SyncErr_ : 1;
0131     unsigned MPC_Muon0_bx_ : 1;
0132     unsigned MPC_Muon0_bc0_ : 1;
0133     unsigned MPC_Muon0_cscid_low : 3;
0134     unsigned reserved_13 : 1;
0135 
0136     unsigned MPC_Muon1_wire_ : 7;
0137     unsigned MPC_Muon1_clct_pattern_ : 4;
0138     unsigned MPC_Muon1_quality_ : 4;
0139     unsigned reserved_14 : 1;
0140 
0141     unsigned MPC_Muon1_halfstrip_clct_pattern : 8;
0142     unsigned MPC_Muon1_bend_ : 1;
0143     unsigned MPC_Muon1_SyncErr_ : 1;
0144     unsigned MPC_Muon1_bx_ : 1;
0145     unsigned MPC_Muon1_bc0_ : 1;
0146     unsigned MPC_Muon1_cscid_low : 3;
0147     unsigned reserved_15 : 1;
0148 
0149     unsigned MPC_Muon0_vpf_ : 1;
0150     unsigned MPC_Muon0_cscid_bit4 : 1;
0151     unsigned MPC_Muon1_vpf_ : 1;
0152     unsigned MPC_Muon1_cscid_bit4 : 1;
0153     unsigned mpcAcceptLCT0 : 1;
0154     unsigned mpcAcceptLCT1 : 1;
0155     unsigned reserved_16_1 : 2;
0156     unsigned hs_thresh : 3;
0157     unsigned ds_thresh : 3;
0158     unsigned reserved_16_2 : 2;
0159 
0160     unsigned buffer_info_0 : 16;
0161     unsigned r_buf_nbusy : 4;
0162     unsigned buffer_info_1 : 12;
0163     unsigned buffer_info_2 : 16;
0164     unsigned buffer_info_3 : 16;
0165     unsigned alct_delay : 4, clct_width : 4, mpc_tx_delay : 4, reserved_21 : 4;
0166 
0167     unsigned rpc_exists : 2;
0168     unsigned rd_rpc_list : 2;
0169     unsigned rd_nrpcs : 2;
0170     unsigned rpc_read_enable : 1;
0171     unsigned r_nlayers_hit_vec : 3;
0172     unsigned pop_l1a_match_win : 4;
0173     unsigned reserved_22 : 2;
0174 
0175     unsigned bd_status : 14;
0176     unsigned reserved_23 : 2;
0177     unsigned uptime : 14;
0178     unsigned reserved_24 : 2;
0179     unsigned firmRevCode : 14, reserved_25 : 2;
0180     unsigned e0bline : 16;
0181   } bits;
0182 };
0183 
0184 #endif