CMS 3D CMS Logo

CSCTMBHeader2020_GEM.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCTMBHeader2020_GEM_h
2 #define EventFilter_CSCRawToDigi_CSCTMBHeader2020_GEM_h
5 
7  enum { NWORDS = 43 };
9  CSCTMBHeader2020_GEM(const unsigned short* buf);
10  void setEventInformation(const CSCDMBHeader& dmbHeader) override;
11 
12  uint16_t BXNCount() const override { return bits.bxnCount; }
13  uint16_t ALCTMatchTime() const override { return bits.matchWin; }
14  void setALCTMatchTime(uint16_t alctmatchtime) override { bits.matchWin = alctmatchtime & 0xF; }
15  uint16_t CLCTOnly() const override { return bits.clctOnly; }
16  uint16_t ALCTOnly() const override { return bits.alctOnly; }
17  uint16_t TMBMatch() const override { return bits.tmbMatch; }
18  uint16_t Bxn0Diff() const override { return 0; }
19  uint16_t Bxn1Diff() const override { return 0; }
20  uint16_t L1ANumber() const override { return bits.l1aNumber; }
21  uint16_t NTBins() const override { return bits.nTBins; }
22  uint16_t NCFEBs() const override { return bits.nCFEBs; }
23  void setNCFEBs(uint16_t ncfebs) override { bits.nCFEBs = ncfebs & 0x7F; }
24  uint16_t firmwareRevision() const override { return bits.firmRevCode; }
25  uint16_t syncError() const override { return bits.syncError; }
26  uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; }
27  uint16_t syncErrorMPC0() const override { return 0; }
28  uint16_t syncErrorMPC1() const override { return 0; }
29 
30  // == Run 3 CSC-GEM Trigger Format
31  uint16_t clct0_ComparatorCode() const override { return bits.clct0_comparator_code; }
32  uint16_t clct1_ComparatorCode() const override { return bits.clct1_comparator_code; }
33  uint16_t clct0_xky() const override { return bits.clct0_xky; }
34  uint16_t clct1_xky() const override { return bits.clct1_xky; }
35  uint16_t hmt_nhits() const override {
36  return ((bits.hmt_nhits_bit0 & 0x1) + ((bits.hmt_nhits_bit1 & 0x1) << 1) +
37  ((bits.hmt_nhits_bits_high & 0x1F) << 2));
38  }
39  uint16_t hmt_ALCTMatchTime() const override { return bits.hmt_match_win; }
40  uint16_t alctHMT() const override { return bits.anode_hmt; }
41  uint16_t clctHMT() const override { return bits.cathode_hmt; }
42  uint16_t gem_enabled_fibers() const override { return (bits.gem_enabled_fibers_ & 0xF); }
43  uint16_t gem_fifo_tbins() const override { return bits.fifo_tbins_gem_; }
44  uint16_t gem_fifo_pretrig() const override { return bits.fifo_pretrig_gem_; }
45  uint16_t gem_zero_suppress() const override { return bits.gem_zero_suppression_; }
46  uint16_t gem_sync_dataword() const override {
47  return ((bits.lct0_nogem) + (bits.lct0_with_gemA << 1) + (bits.lct0_with_gemB << 2) + (bits.lct0_with_copad << 3) +
48  (bits.lct1_nogem << 4) + (bits.lct1_with_gemA << 5) + (bits.lct1_with_gemB << 6) +
49  (bits.lct1_with_copad << 7) + (bits.gemA_vpf << 8) + (bits.gemB_vpf << 9) + (bits.gemA_over_flow << 10) +
50  (bits.gemB_over_flow << 11) + (bits.gemA_sync << 12) + (bits.gemB_sync << 13) + (bits.gems_sync << 14));
51  }
52  uint16_t gem_timing_dataword() const override {
53  return ((bits.num_copad & 0xF) + ((bits.gem_delay & 0xF) << 4) + ((bits.gem_clct_win & 0xF) << 8) +
54  ((bits.alct_gem_win & 0x7) << 12));
55  }
56  uint16_t run3_CLCT_patternID() const override {
57  return (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4));
58  }
59  // ==
60 
62  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) override;
64  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const override;
66  CSCShowerDigi showerDigi(uint32_t idlayer) const override;
68  CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const override;
70  CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const override;
71 
74  unsigned short int sizeInWords() const override { return NWORDS; }
75 
76  unsigned short int NHeaderFrames() const override { return bits.nHeaderFrames; }
78  unsigned short* data() override { return (unsigned short*)(&bits); }
79  bool check() const override { return bits.e0bline == 0x6e0b; }
80 
82  void addCLCT0(const CSCCLCTDigi& digi) override;
83  void addCLCT1(const CSCCLCTDigi& digi) override;
84  void addALCT0(const CSCALCTDigi& digi) override;
85  void addALCT1(const CSCALCTDigi& digi) override;
86  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) override;
87  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) override;
88  void addShower(const CSCShowerDigi& digi) override;
89  void addAnodeShower(const CSCShowerDigi& digi) override;
90  void addCathodeShower(const CSCShowerDigi& digi) override;
91 
92  void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
93 
94  void print(std::ostream& os) const override;
95 
96  struct {
97  // 0
98  unsigned b0cline : 16;
99  unsigned bxnCount : 12, dduCode1 : 3, flag1 : 1;
100  unsigned l1aNumber : 12, dduCode2 : 3, flag2 : 1;
101  unsigned readoutCounter : 12, dduCode3 : 3, flag3 : 1;
102  // 4
103  unsigned boardID : 5, cscID : 4, runID : 4, stackOvf : 1, syncError : 1, flag4 : 1;
104  unsigned nHeaderFrames : 6, fifoMode : 3, r_type : 2, l1atype : 2, hasBuf : 1, bufFull : 1, flag5 : 1;
105  unsigned bd_status : 15, flag6 : 1;
106  unsigned firmRevCode : 15, flag7 : 1;
107  // 8
109  unsigned preTrigCounter : 15, flag9 : 1;
110  unsigned clct0_comparator_code : 12, clct0_xky : 2, hmt_nhits_bit0 : 1, flag10 : 1; // 12-bits comp code fw version
111  unsigned clctCounterLow : 15, flag11 : 1;
112  // 12
115  gemB_over_flow : 1, gemA_sync : 1, gemB_sync : 1, gems_sync : 1, flag12 : 1;
116  unsigned trigCounter : 15, flag13 : 1;
117  unsigned clct1_comparator_code : 12, clct1_xky : 2, hmt_nhits_bit1 : 1, flag14 : 1; // 12-bits comp code fw version
118  unsigned alctCounterLow : 15, flag15 : 1;
119  // 16
120  unsigned num_copad : 4, gem_delay : 4, gem_clct_win : 4, alct_gem_win : 3, flag16 : 1;
121  unsigned uptimeCounterLow : 15, flag17 : 1;
122  unsigned uptimeCounterHigh : 15, flag18 : 1;
123  unsigned nCFEBs : 3, nTBins : 5, fifoPretrig : 5, scopeExists : 1, vmeExists : 1, flag19 : 1;
124  // 20
125  unsigned hitThresh : 3, pidThresh : 4, nphThresh : 3, pid_thresh_postdrift : 4, staggerCSC : 1, flag20 : 1;
126  unsigned triadPersist : 4, dmbThresh : 3, alct_delay : 4, clct_width : 4, flag21 : 1;
127  unsigned trigSourceVect : 9, clct0_slope : 4, clct0_LR_bend : 1, clct1_LR_bend : 1, flag22 : 1;
128  unsigned activeCFEBs : 5, readCFEBs : 5, pop_l1a_match_win : 4, aff_source : 1, flag23 : 1;
129  // 24
130  unsigned tmbMatch : 1, alctOnly : 1, clctOnly : 1, matchWin : 4, noALCT : 1, oneALCT : 1, oneCLCT : 1, twoALCT : 1,
131  twoCLCT : 1, dupeALCT : 1, dupeCLCT : 1, lctRankErr : 1, flag24 : 1;
132  unsigned clct0_valid : 1, clct0_quality : 3, clct0_shape : 4, clct0_key_low : 7, flag25 : 1;
133  unsigned clct1_valid : 1, clct1_quality : 3, clct1_shape : 4, clct1_key_low : 7, flag26 : 1;
136  flag27 : 1;
137  // 28
138  unsigned alct0Valid : 1, alct0Quality : 2, alct0Amu : 1, alct0Key : 7, clct1_slope : 4, flag28 : 1;
139  unsigned alct1Valid : 1, alct1Quality : 2, alct1Amu : 1, alct1Key : 7, drift_delay : 2, bcb_read_enable : 1,
140  hs_layer_trig : 1, flag29 : 1;
142  bx0_match : 1, flag30 : 1;
145  // 32
153  MPCDelay : 4, MPCAccept : 2, CFEBsEnabled : 5, flag35 : 1;
154  // 36
156  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;
158  flag38 : 1;
160  // 40
163  flag40 : 1;
166  unsigned e0bline : 16;
167  } bits;
168 };
169 
170 #endif
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const override
returns CorrelatedLCT digis
uint16_t gem_enabled_fibers() const override
uint16_t Bxn1Diff() const override
unsigned short int sizeInWords() const override
CSCShowerDigi cathodeShowerDigi(uint32_t idlayer) const override
returns cathode HMT Shower digi
uint16_t gem_sync_dataword() const override
uint16_t syncErrorCLCT() const override
void addALCT1(const CSCALCTDigi &digi) override
uint16_t run3_CLCT_patternID() const override
CSCShowerDigi showerDigi(uint32_t idlayer) const override
returns lct HMT Shower digi
uint16_t CLCTOnly() const override
uint16_t alctHMT() const override
uint16_t NTBins() const override
uint16_t clct1_xky() const override
uint16_t ALCTOnly() const override
void addALCT0(const CSCALCTDigi &digi) override
uint16_t Bxn0Diff() const override
uint16_t NCFEBs() const override
bool check() const override
uint16_t hmt_ALCTMatchTime() const override
void setEventInformation(const CSCDMBHeader &dmbHeader) override
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi) override
void addCLCT0(const CSCCLCTDigi &digi) override
for data packing
uint16_t firmwareRevision() const override
uint16_t syncError() const override
void setALCTMatchTime(uint16_t alctmatchtime) override
void addCLCT1(const CSCCLCTDigi &digi) override
uint16_t gem_zero_suppress() const override
uint16_t clct0_xky() const override
struct CSCTMBHeader2020_GEM::@498 bits
uint16_t clct1_ComparatorCode() const override
uint16_t syncErrorMPC0() const override
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi) override
void swapCLCTs(CSCCLCTDigi &digi1, CSCCLCTDigi &digi2)
uint16_t syncErrorMPC1() const override
void print(std::ostream &os) const override
uint16_t ALCTMatchTime() const override
uint16_t hmt_nhits() const override
void setNCFEBs(uint16_t ncfebs) override
uint16_t L1ANumber() const override
uint16_t clct0_ComparatorCode() const override
== Run 3 CSC-GEM Trigger Format
uint16_t gem_fifo_tbins() const override
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer) override
returns CLCT digis
uint16_t gem_fifo_pretrig() const override
void addCathodeShower(const CSCShowerDigi &digi) override
uint16_t gem_timing_dataword() const override
unsigned short * data() override
returns the first data word
CSCShowerDigi anodeShowerDigi(uint32_t idlayer) const override
returns anode HMT Shower digi
void addAnodeShower(const CSCShowerDigi &digi) override
unsigned short int NHeaderFrames() const override
uint16_t TMBMatch() const override
void addShower(const CSCShowerDigi &digi) override
uint16_t clctHMT() const override
uint16_t BXNCount() const override