00001 #ifndef CSCTMBHeader2007_h
00002 #define CSCTMBHeader2007_h
00003 #include "EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h"
00004 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00005
00006
00007 struct CSCTMBHeader2007 : public CSCVTMBHeaderFormat {
00008 enum {NWORDS = 43};
00009 CSCTMBHeader2007();
00010 CSCTMBHeader2007(const unsigned short * buf);
00011 virtual void setEventInformation(const CSCDMBHeader & dmbHeader);
00012
00013 virtual uint16_t BXNCount() const {return bits.bxnCount;}
00014 virtual uint16_t ALCTMatchTime() const {return bits.matchWin;}
00015 virtual uint16_t CLCTOnly() const {return bits.clctOnly;}
00016 virtual uint16_t ALCTOnly() const {return bits.alctOnly;}
00017 virtual uint16_t TMBMatch() const {return bits.tmbMatch;}
00018 virtual uint16_t Bxn0Diff() const {return 0;}
00019 virtual uint16_t Bxn1Diff() const {return 0;}
00020 virtual uint16_t L1ANumber() const {return bits.l1aNumber;}
00021 virtual uint16_t NTBins() const {return bits.nTBins;}
00022 virtual uint16_t NCFEBs() const {return bits.nCFEBs;}
00023 virtual uint16_t firmwareRevision() const {return bits.firmRevCode;}
00024
00026 virtual std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer);
00028 virtual std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const;
00029
00030
00033 unsigned short int sizeInWords() const {return NWORDS;}
00034
00035 virtual unsigned short int NHeaderFrames() const {return bits.nHeaderFrames;}
00037 virtual unsigned short * data() {return (unsigned short *)(&bits);}
00038 virtual bool check() const {return bits.e0bline==0x6e0b;}
00039
00041
00042
00044 virtual void addCLCT0(const CSCCLCTDigi & digi);
00045 virtual void addCLCT1(const CSCCLCTDigi & digi);
00046 virtual void addALCT0(const CSCALCTDigi & digi);
00047 virtual void addALCT1(const CSCALCTDigi & digi);
00048 virtual void addCorrelatedLCT0(const CSCCorrelatedLCTDigi & digi);
00049 virtual void addCorrelatedLCT1(const CSCCorrelatedLCTDigi & digi);
00050
00051 void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
00052
00053 virtual void print(std::ostream & os) const;
00054
00055 struct {
00056 unsigned b0cline:16;
00057 unsigned bxnCount:12, dduCode1:3, flag1:1;
00058 unsigned l1aNumber:12, dduCode2:3, flag2:1;
00059 unsigned readoutCounter:12, dduCode3:3, flag3:1;
00060 unsigned boardID:5, cscID:4, runID:4, stackOvf:1, syncError:1, flag4:1;
00061 unsigned nHeaderFrames:6, fifoMode:3, r_type:2, l1atype:2, hasBuf:1, bufFull:1, flag5:1;
00062 unsigned bd_status:15, flag6:1;
00063 unsigned firmRevCode:15, flag7:1;
00064 unsigned bxnPreTrigger:12, reserved:3, flag8:1;
00065 unsigned preTrigCounterLow:15, flag9:1;
00066 unsigned preTrigCounterHigh:15, flag10:1;
00067 unsigned clctCounterLow:15, flag11:1;
00068 unsigned clctCounterHigh:15, flag12:1;
00069 unsigned trigCounterLow:15, flag13:1;
00070 unsigned trigCounterHigh:15, flag14:1;
00071 unsigned alctCounterLow:15, flag15:1;
00072 unsigned alctCounterHigh:15, flag16:1;
00073 unsigned uptimeCounterLow:15, flag17:1;
00074 unsigned uptimeCounterHigh:15, flag18:1;
00075 unsigned nCFEBs:3, nTBins:5, fifoPretrig:5, scopeExists:1, vmeExists:1, flag19:1;
00076 unsigned hitThresh:3, pidThresh:4, nphThresh:3, lyrThresh:3, layerTrigEnabled:1, staggerCSC:1, flag20:1;
00077 unsigned triadPersist:4, dmbThresh:3, alct_delay:4, clct_width:4, flag21:1;
00078 unsigned trigSourceVect:9, r_nlayers_hit_vec:6, flag22:1;
00079 unsigned activeCFEBs:5, readCFEBs:5, pop_l1a_match_win:4, layerTriggered:1, flag23:1;
00080 unsigned tmbMatch:1, alctOnly:1, clctOnly:1, matchWin:4, noTMBTrig:1, noMPCFrame:1, noMPCResponse:1, reserved1:5, flag24:1;
00081 unsigned clct0_valid:1, clct0_quality:3, clct0_shape:4, clct0_bend:1, clct0_key:5, clct0_cfeb_low:1, flag25:1;
00082 unsigned clct1_valid:1, clct1_quality:3, clct1_shape:4, clct1_bend:1, clct1_key:5, clct1_cfeb_low:1, flag26:1;
00083 unsigned clct0_cfeb_high:2, clct0_bxn:2, clct0_sync_err:1, clct0_bx0_local:1, clct1_cfeb_high:2, clct1_bxn:2, clct1_sync_err:1, clct1_bx0_local:1, clct0Invalid:1, clct1Invalid:1, clct1Busy:1, flag27:1;
00084 unsigned alct0Valid:1, alct0Quality:2, alct0Amu:1, alct0Key:7, reserved2:4, flag28:1;
00085 unsigned alct1Valid:1, alct1Quality:2, alct1Amu:1, alct1Key:7, reserved3:4, flag29:1;
00086 unsigned alctBXN:5, alctSeqStatus:2, alctSEUStatus:2, alctReserved:4, alctCfg:1, reserved4:1, flag30:1;
00087 unsigned MPC_Muon0_wire_:7, MPC_Muon0_clct_pattern_:4, MPC_Muon0_quality_:4, flag31:1;
00088 unsigned MPC_Muon0_halfstrip_clct_pattern:8, MPC_Muon0_bend_:1, MPC_Muon0_SyncErr_:1, MPC_Muon0_bx_:1, MPC_Muon0_bc0_:1, MPC_Muon0_cscid_low:3, flag32:1;
00089 unsigned MPC_Muon1_wire_: 7, MPC_Muon1_clct_pattern_:4, MPC_Muon1_quality_:4, flag33:1;
00090 unsigned MPC_Muon1_halfstrip_clct_pattern:8, MPC_Muon1_bend_:1, MPC_Muon1_SyncErr_:1, MPC_Muon1_bx_:1, MPC_Muon1_bc0_:1, MPC_Muon1_cscid_low:3, flag34:1;
00091 unsigned MPC_Muon0_vpf_:1, MPC_Muon0_cscid_bit4:1, MPC_Muon1_vpf_:1, MPC_Muon1_cscid_bit4:1, MPCDelay:4, MPCAccept:2, CFEBsEnabled:5, flag35:1;
00092 unsigned RPCExists:2, RPCList:2, NRPCs:2, RPCEnable:1, RPCMatch:8, flag36:1;
00093 unsigned addrPretrig:12, bufReady:1, reserved5:2, flag37:1;
00094 unsigned addrL1a:12, reserved6:3, flag38:1;
00095 unsigned reserved7:15, flag39:1;
00096 unsigned reserved8:15, flag40:1;
00097 unsigned reserved9:15, flag41:1;
00098 unsigned e0bline:16;
00099 } bits;
00100
00101
00102 };
00103
00104 #endif
00105