Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-02 08:36:05

0001 #ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2007_h
0002 #define EventFilter_CSCRawToDigi_CSCTMBHeader2007_h
0003 #include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h"
0004 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0005 
0006 struct CSCTMBHeader2007 : public CSCVTMBHeaderFormat {
0007   enum { NWORDS = 43 };
0008   CSCTMBHeader2007();
0009   CSCTMBHeader2007(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 & 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; }
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     unsigned b0cline : 16;
0085     unsigned bxnCount : 12, dduCode1 : 3, flag1 : 1;
0086     unsigned l1aNumber : 12, dduCode2 : 3, flag2 : 1;
0087     unsigned readoutCounter : 12, dduCode3 : 3, flag3 : 1;
0088     unsigned boardID : 5, cscID : 4, runID : 4, stackOvf : 1, syncError : 1, flag4 : 1;
0089     unsigned nHeaderFrames : 6, fifoMode : 3, r_type : 2, l1atype : 2, hasBuf : 1, bufFull : 1, flag5 : 1;
0090     unsigned bd_status : 15, flag6 : 1;
0091     unsigned firmRevCode : 15, flag7 : 1;
0092     unsigned bxnPreTrigger : 12, reserved : 3, flag8 : 1;
0093     unsigned preTrigCounterLow : 15, flag9 : 1;
0094     unsigned preTrigCounterHigh : 15, flag10 : 1;
0095     unsigned clctCounterLow : 15, flag11 : 1;
0096     unsigned clctCounterHigh : 15, flag12 : 1;
0097     unsigned trigCounterLow : 15, flag13 : 1;
0098     unsigned trigCounterHigh : 15, flag14 : 1;
0099     unsigned alctCounterLow : 15, flag15 : 1;
0100     unsigned alctCounterHigh : 15, flag16 : 1;
0101     unsigned uptimeCounterLow : 15, flag17 : 1;
0102     unsigned uptimeCounterHigh : 15, flag18 : 1;
0103     unsigned nCFEBs : 3, nTBins : 5, fifoPretrig : 5, scopeExists : 1, vmeExists : 1, flag19 : 1;
0104     unsigned hitThresh : 3, pidThresh : 4, nphThresh : 3, lyrThresh : 3, layerTrigEnabled : 1, staggerCSC : 1,
0105         flag20 : 1;
0106     unsigned triadPersist : 4, dmbThresh : 3, alct_delay : 4, clct_width : 4, flag21 : 1;
0107     unsigned trigSourceVect : 9, r_nlayers_hit_vec : 6, flag22 : 1;
0108     unsigned activeCFEBs : 5, readCFEBs : 5, pop_l1a_match_win : 4, layerTriggered : 1, flag23 : 1;
0109     unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, matchWin : 4, noTMBTrig : 1, noMPCFrame : 1, noMPCResponse : 1,
0110         reserved1 : 5, flag24 : 1;
0111     unsigned clct0_valid : 1, clct0_quality : 3, clct0_shape : 4, clct0_bend : 1, clct0_key : 5, clct0_cfeb_low : 1,
0112         flag25 : 1;
0113     unsigned clct1_valid : 1, clct1_quality : 3, clct1_shape : 4, clct1_bend : 1, clct1_key : 5, clct1_cfeb_low : 1,
0114         flag26 : 1;
0115     unsigned clct0_cfeb_high : 2, clct0_bxn : 2, clct0_sync_err : 1, clct0_bx0_local : 1, clct1_cfeb_high : 2,
0116         clct1_bxn : 2, clct1_sync_err : 1, clct1_bx0_local : 1, clct0Invalid : 1, clct1Invalid : 1, clct1Busy : 1,
0117         flag27 : 1;
0118     unsigned alct0Valid : 1, alct0Quality : 2, alct0Amu : 1, alct0Key : 7, reserved2 : 4, flag28 : 1;
0119     unsigned alct1Valid : 1, alct1Quality : 2, alct1Amu : 1, alct1Key : 7, reserved3 : 4, flag29 : 1;
0120     unsigned alctBXN : 5, alctSeqStatus : 2, alctSEUStatus : 2, alctReserved : 4, alctCfg : 1, reserved4 : 1,
0121         flag30 : 1;
0122     unsigned MPC_Muon0_wire_ : 7, MPC_Muon0_clct_pattern_ : 4, MPC_Muon0_quality_ : 4, flag31 : 1;
0123     unsigned MPC_Muon0_halfstrip_clct_pattern : 8, MPC_Muon0_bend_ : 1, MPC_Muon0_SyncErr_ : 1, MPC_Muon0_bx_ : 1,
0124         MPC_Muon0_bc0_ : 1, MPC_Muon0_cscid_low : 3, flag32 : 1;
0125     unsigned MPC_Muon1_wire_ : 7, MPC_Muon1_clct_pattern_ : 4, MPC_Muon1_quality_ : 4, flag33 : 1;
0126     unsigned MPC_Muon1_halfstrip_clct_pattern : 8, MPC_Muon1_bend_ : 1, MPC_Muon1_SyncErr_ : 1, MPC_Muon1_bx_ : 1,
0127         MPC_Muon1_bc0_ : 1, MPC_Muon1_cscid_low : 3, flag34 : 1;
0128     unsigned MPC_Muon0_vpf_ : 1, MPC_Muon0_cscid_bit4 : 1, MPC_Muon1_vpf_ : 1, MPC_Muon1_cscid_bit4 : 1, MPCDelay : 4,
0129         MPCAccept : 2, CFEBsEnabled : 5, flag35 : 1;
0130     unsigned RPCExists : 2, RPCList : 2, NRPCs : 2, RPCEnable : 1, RPCMatch : 8, flag36 : 1;
0131     unsigned addrPretrig : 12, bufReady : 1, reserved5 : 2, flag37 : 1;
0132     unsigned addrL1a : 12, reserved6 : 3, flag38 : 1;
0133     unsigned reserved7 : 15, flag39 : 1;
0134     unsigned reserved8 : 15, flag40 : 1;
0135     unsigned reserved9 : 15, flag41 : 1;
0136     unsigned e0bline : 16;
0137   } bits;
0138 };
0139 
0140 #endif