Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2013_h
0002 #define EventFilter_CSCRawToDigi_CSCTMBHeader2013_h
0003 #include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h"
0004 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0005 
0006 struct CSCTMBHeader2013 : public CSCVTMBHeaderFormat {
0007   enum { NWORDS = 43 };
0008   CSCTMBHeader2013();
0009   CSCTMBHeader2013(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.matchWin; }
0014   void setALCTMatchTime(uint16_t alctmatchtime) override { bits.matchWin = 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 0; }
0019   uint16_t Bxn1Diff() const override { return 0; }
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 & 0x7F; }
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.clct_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; }
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 
0083   struct {
0084     // 0
0085     unsigned b0cline : 16;
0086     unsigned bxnCount : 12, dduCode1 : 3, flag1 : 1;
0087     unsigned l1aNumber : 12, dduCode2 : 3, flag2 : 1;
0088     unsigned readoutCounter : 12, dduCode3 : 3, flag3 : 1;
0089     // 4
0090     unsigned boardID : 5, cscID : 4, runID : 4, stackOvf : 1, syncError : 1, flag4 : 1;
0091     unsigned nHeaderFrames : 6, fifoMode : 3, r_type : 2, l1atype : 2, hasBuf : 1, bufFull : 1, flag5 : 1;
0092     unsigned bd_status : 15, flag6 : 1;
0093     unsigned firmRevCode : 15, flag7 : 1;
0094     // 8
0095     unsigned bxnPreTrigger : 12, tmb_clct0_discard : 1, tmb_clct1_discard : 1, clock_lock_lost : 1, flag8 : 1;
0096     unsigned preTrigCounterLow : 15, flag9 : 1;
0097     unsigned preTrigCounterHigh : 15, flag10 : 1;
0098     unsigned clctCounterLow : 15, flag11 : 1;
0099     // 12
0100     unsigned clctCounterHigh : 15, flag12 : 1;
0101     unsigned trigCounterLow : 15, flag13 : 1;
0102     unsigned trigCounterHigh : 15, flag14 : 1;
0103     unsigned alctCounterLow : 15, flag15 : 1;
0104     // 16
0105     unsigned alctCounterHigh : 15, flag16 : 1;
0106     unsigned uptimeCounterLow : 15, flag17 : 1;
0107     unsigned uptimeCounterHigh : 15, flag18 : 1;
0108     unsigned nCFEBs : 3, nTBins : 5, fifoPretrig : 5, scopeExists : 1, vmeExists : 1, flag19 : 1;
0109     // 20
0110     unsigned hitThresh : 3, pidThresh : 4, nphThresh : 3, pid_thresh_postdrift : 4, staggerCSC : 1, flag20 : 1;
0111     unsigned triadPersist : 4, dmbThresh : 3, alct_delay : 4, clct_width : 4, flag21 : 1;
0112     unsigned trigSourceVect : 9, r_nlayers_hit_vec : 6, flag22 : 1;
0113     unsigned activeCFEBs : 5, readCFEBs : 5, pop_l1a_match_win : 4, aff_source : 1, flag23 : 1;
0114     // 24
0115     unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, matchWin : 4, noALCT : 1, oneALCT : 1, oneCLCT : 1, twoALCT : 1,
0116         twoCLCT : 1, dupeALCT : 1, dupeCLCT : 1, lctRankErr : 1, flag24 : 1;
0117     unsigned clct0_valid : 1, clct0_quality : 3, clct0_shape : 4, clct0_key_low : 7, flag25 : 1;
0118     unsigned clct1_valid : 1, clct1_quality : 3, clct1_shape : 4, clct1_key_low : 7, flag26 : 1;
0119     unsigned clct0_key_high : 1, clct1_key_high : 1, clct_bxn : 2, clct_sync_err : 1, clct0Invalid : 1,
0120         clct1Invalid : 1, clct1Busy : 1, parity_err_cfeb_ram : 5, parity_err_rpc : 1, parity_err_summary : 1,
0121         flag27 : 1;
0122     // 28
0123     unsigned alct0Valid : 1, alct0Quality : 2, alct0Amu : 1, alct0Key : 7, alct_pretrig_win : 4, flag28 : 1;
0124     unsigned alct1Valid : 1, alct1Quality : 2, alct1Amu : 1, alct1Key : 7, drift_delay : 2, bcb_read_enable : 1,
0125         hs_layer_trig : 1, flag29 : 1;
0126     unsigned alctBXN : 5, alct_ecc_err : 2, cfeb_badbits_found : 5, cfeb_badbits_blocked : 1, alctCfg : 1,
0127         bx0_match : 1, flag30 : 1;
0128     unsigned MPC_Muon0_wire_ : 7, MPC_Muon0_clct_pattern_ : 4, MPC_Muon0_quality_ : 4, flag31 : 1;
0129     // 32
0130     unsigned MPC_Muon0_halfstrip_clct_pattern : 8, MPC_Muon0_bend_ : 1, MPC_Muon0_SyncErr_ : 1, MPC_Muon0_bx_ : 1,
0131         MPC_Muon0_bc0_ : 1, MPC_Muon0_cscid_low : 3, flag32 : 1;
0132     unsigned MPC_Muon1_wire_ : 7, MPC_Muon1_clct_pattern_ : 4, MPC_Muon1_quality_ : 4, flag33 : 1;
0133     unsigned MPC_Muon1_halfstrip_clct_pattern : 8, MPC_Muon1_bend_ : 1, MPC_Muon1_SyncErr_ : 1, MPC_Muon1_bx_ : 1,
0134         MPC_Muon1_bc0_ : 1, MPC_Muon1_cscid_low : 3, flag34 : 1;
0135     unsigned MPC_Muon0_vpf_ : 1, MPC_Muon0_cscid_bit4 : 1, MPC_Muon1_vpf_ : 1, MPC_Muon1_cscid_bit4 : 1, MPCDelay : 4,
0136         MPCAccept : 2, CFEBsEnabled : 5, flag35 : 1;
0137     // 36
0138     unsigned RPCList : 2, NRPCs : 2, RPCEnable : 1, fifo_tbins_rpc : 5, fifo_pretrig_rpc : 5, flag36 : 1;
0139     unsigned r_wr_buf_adr : 11, r_wr_buf_ready : 1, wr_buf_ready : 1, buf_q_full : 1, buf_q_empty : 1, flag37 : 1;
0140     unsigned r_buf_fence_dist : 11, buf_q_ovf_err : 1, buf_q_udf_err : 1, buf_q_adr_err : 1, buf_stalled : 1,
0141         flag38 : 1;
0142     unsigned buf_fence_cnt : 12, reverse_hs_csc : 1, reverse_hs_me1a : 1, reverse_hs_me1b : 1, flag39 : 1;
0143     // 40
0144     unsigned activeCFEBs_2 : 2, readCFEBs_2 : 2, cfeb_badbits_found_2 : 2, parity_err_cfeb_ram_2 : 2,
0145         CFEBsEnabled_2 : 2, buf_fence_cnt_is_peak : 1, mxcfeb : 1, trig_source_vec : 2, tmb_trig_pulse : 1, flag40 : 1;
0146     unsigned tmb_allow_alct : 1, tmb_allow_clct : 1, tmb_allow_match : 1, tmb_allow_alct_ro : 1, tmb_allow_clct_ro : 1,
0147         tmb_allow_match_ro : 1, tmb_alct_only_ro : 1, tmb_clct_only_ro : 1, tmb_match_ro : 1, tmb_trig_keep : 1,
0148         tmb_non_trig_keep : 1, lyr_thresh_pretrig : 3, layer_trig_en : 1, flag41 : 1;
0149     unsigned e0bline : 16;
0150   } bits;
0151 };
0152 
0153 #endif