CMS 3D CMS Logo

CSCCLCTDigi.h
Go to the documentation of this file.
1 #ifndef DataFormats_CSCDigi_CSCCLCTDigi_h
2 #define DataFormats_CSCDigi_CSCCLCTDigi_h
3 
12 #include <cstdint>
13 #include <iosfwd>
14 #include <vector>
15 #include <limits>
16 
17 class CSCCLCTDigi {
18 public:
19  typedef std::vector<std::vector<uint16_t>> ComparatorContainer;
20 
21  enum class Version { Legacy = 0, Run3 };
22  // for data vs emulator studies
23  enum CLCTBXMask { kBXDataMask = 0x3 };
24 
26  CSCCLCTDigi(const uint16_t valid,
27  const uint16_t quality,
28  const uint16_t pattern,
29  const uint16_t striptype,
30  const uint16_t bend,
31  const uint16_t strip,
32  const uint16_t cfeb,
33  const uint16_t bx,
34  const uint16_t trknmb = 0,
35  const uint16_t fullbx = 0,
36  const int16_t compCode = -1,
38  const bool run3_quart_strip_bit = false,
39  const bool run3_eighth_strip_bit = false,
40  const uint16_t run3_pattern = 0,
41  const uint16_t run3_slope = 0);
42 
44  CSCCLCTDigi();
45 
47  void clear();
48 
50  bool isValid() const { return valid_; }
51 
53  void setValid(const uint16_t valid) { valid_ = valid; }
54 
56  uint16_t getQuality() const { return quality_; }
57 
59  void setQuality(const uint16_t quality) { quality_ = quality; }
60 
62  uint16_t getPattern() const { return pattern_; }
63 
65  void setPattern(const uint16_t pattern) { pattern_ = pattern; }
66 
68  uint16_t getRun3Pattern() const { return run3_pattern_; }
69 
71  void setRun3Pattern(const uint16_t pattern) { run3_pattern_ = pattern; }
72 
74  uint16_t getSlope() const { return run3_slope_; }
75 
77  void setSlope(const uint16_t slope) { run3_slope_ = slope; }
78 
82  float getFractionalSlope() const;
83 
85  uint16_t getStripType() const { return striptype_; }
86 
88  void setStripType(const uint16_t stripType) { striptype_ = stripType; }
89 
93  uint16_t getBend() const { return bend_; }
94 
96  void setBend(const uint16_t bend) { bend_ = bend; }
97 
99  uint16_t getStrip() const { return strip_; }
100 
102  void setStrip(const uint16_t strip) { strip_ = strip; }
103 
105  void setQuartStripBit(const bool quartStripBit) { run3_quart_strip_bit_ = quartStripBit; }
106 
108  bool getQuartStripBit() const { return run3_quart_strip_bit_; }
109 
111  void setEighthStripBit(const bool eighthStripBit) { run3_eighth_strip_bit_ = eighthStripBit; }
112 
114  bool getEighthStripBit() const { return run3_eighth_strip_bit_; }
115 
117  uint16_t getCFEB() const { return cfeb_; }
118 
120  void setCFEB(const uint16_t cfeb) { cfeb_ = cfeb; }
121 
123  uint16_t getBX() const { return bx_; }
124 
126  uint16_t getBXData() const { return bx_ & kBXDataMask; }
127 
129  void setBX(const uint16_t bx) { bx_ = bx; }
130 
132  uint16_t getTrknmb() const { return trknmb_; }
133 
140  uint16_t getKeyStrip(const uint16_t n = 2) const;
141 
142  /*
143  Strips are numbered starting from 1 in CMSSW
144  Half-strips, quarter-strips and eighth-strips are numbered starting from 0
145  The table below shows the correct numbering
146  ---------------------------------------------------------------------------------
147  strip | 1 | 2 |
148  ---------------------------------------------------------------------------------
149  1/2-strip | 0 | 1 | 2 | 3 |
150  ---------------------------------------------------------------------------------
151  1/4-strip | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
152  ---------------------------------------------------------------------------------
153  1/8-strip | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
154  ---------------------------------------------------------------------------------
155 
156  Note: the CSC geometry also has a strip offset of +/- 0.25 strips. When comparing the
157  CLCT/LCT position with the true muon position, take the offset into account!
158  */
159  float getFractionalStrip(const uint16_t n = 2) const;
160 
162  void setTrknmb(const uint16_t number) { trknmb_ = number; }
163 
165  uint16_t getFullBX() const { return fullbx_; }
166 
168  void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; }
169 
170  // 12-bit comparator code
171  int16_t getCompCode() const { return (isRun3() ? compCode_ : -1); }
172 
173  void setCompCode(const int16_t code) { compCode_ = code; }
174 
175  // comparator hits in this CLCT
176  const ComparatorContainer& getHits() const { return hits_; }
177 
179 
183  bool operator>(const CSCCLCTDigi&) const;
184 
186  bool operator==(const CSCCLCTDigi&) const;
187 
189  bool operator!=(const CSCCLCTDigi&) const;
190 
192  void print() const;
193 
195  bool isRun3() const { return version_ == Version::Run3; }
196 
197  void setRun3(bool isRun3);
198 
199 private:
200  uint16_t valid_;
201  uint16_t quality_;
202  // Run-1/2 pattern number.
203  // For Run-3 CLCTs, please use run3_pattern_. For some backward
204  // compatibility the trigger emulator translates run3_pattern_
205  // approximately into pattern_ with a lookup table
206  uint16_t pattern_;
207  uint16_t striptype_; // not used since mid-2008
208  // Common definition for left/right bending in Run-1, Run-2 and Run-3.
209  // 0: right; 1: left
210  uint16_t bend_;
211  // actually the half-strip number
212  uint16_t strip_;
213  // There are up to 7 (D)CFEBs in a chamber
214  uint16_t cfeb_;
215  uint16_t bx_;
216  uint16_t trknmb_;
217  uint16_t fullbx_;
218 
219  // new members in Run-3:
220 
221  // 12-bit comparator code
222  // set by default to -1 for Run-1 and Run-2 CLCTs
223  int16_t compCode_;
224  // 1/4-strip bit set by CCLUT (see DN-19-059)
226  // 1/8-strip bit set by CCLUT
228  // In Run-3, the CLCT digi has 3-bit pattern ID, 0 through 4
229  uint16_t run3_pattern_;
230  // 4-bit bending value. There will be 16 bending values * 2 (left/right)
231  uint16_t run3_slope_;
232 
233  // which hits are in this CLCT?
235 
237 };
238 
239 std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi);
240 
241 #endif
CSCCLCTDigi::striptype_
uint16_t striptype_
Definition: CSCCLCTDigi.h:207
CSCCLCTDigi::strip_
uint16_t strip_
Definition: CSCCLCTDigi.h:212
CSCCLCTDigi::setTrknmb
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting CLCTs.
Definition: CSCCLCTDigi.h:162
CSCCLCTDigi::setStripType
void setStripType(const uint16_t stripType)
set stripType
Definition: CSCCLCTDigi.h:88
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
CSCCLCTDigi::getTrknmb
uint16_t getTrknmb() const
return track number (1,2)
Definition: CSCCLCTDigi.h:132
CSCCLCTDigi::kBXDataMask
Definition: CSCCLCTDigi.h:23
CSCCLCTDigi::operator!=
bool operator!=(const CSCCLCTDigi &) const
True if the preceding one is false.
Definition: CSCCLCTDigi.cc:181
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CSCCLCTDigi::getCompCode
int16_t getCompCode() const
Definition: CSCCLCTDigi.h:171
CSCCLCTDigi::run3_slope_
uint16_t run3_slope_
Definition: CSCCLCTDigi.h:231
CSCCLCTDigi::getEighthStripBit
bool getEighthStripBit() const
get single eighth strip bit
Definition: CSCCLCTDigi.h:114
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCCLCTDigi::valid_
uint16_t valid_
Definition: CSCCLCTDigi.h:200
CSCCLCTDigi::setBend
void setBend(const uint16_t bend)
set bend
Definition: CSCCLCTDigi.h:96
CSCCLCTDigi::setPattern
void setPattern(const uint16_t pattern)
set pattern
Definition: CSCCLCTDigi.h:65
CSCCLCTDigi::setStrip
void setStrip(const uint16_t strip)
set strip
Definition: CSCCLCTDigi.h:102
CSCCLCTDigi::getKeyStrip
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:99
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCCLCTDigi::run3_eighth_strip_bit_
bool run3_eighth_strip_bit_
Definition: CSCCLCTDigi.h:227
operator<<
std::ostream & operator<<(std::ostream &o, const CSCCLCTDigi &digi)
Definition: CSCCLCTDigi.cc:208
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
CSCCLCTDigi::pattern_
uint16_t pattern_
Definition: CSCCLCTDigi.h:206
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
CSCCLCTDigi::run3_pattern_
uint16_t run3_pattern_
Definition: CSCCLCTDigi.h:229
CSCCLCTDigi::hits_
ComparatorContainer hits_
Definition: CSCCLCTDigi.h:234
CSCCLCTDigi::getQuality
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
CSCCLCTDigi::getQuartStripBit
bool getQuartStripBit() const
get single quart strip bit
Definition: CSCCLCTDigi.h:108
CSCCLCTDigi::getBend
uint16_t getBend() const
Definition: CSCCLCTDigi.h:93
CSCCLCTDigi::setValid
void setValid(const uint16_t valid)
set valid
Definition: CSCCLCTDigi.h:53
CSCCLCTDigi::isRun3
bool isRun3() const
Distinguish Run-1/2 from Run-3.
Definition: CSCCLCTDigi.h:195
CSCCLCTDigi::bend_
uint16_t bend_
Definition: CSCCLCTDigi.h:210
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
CSCCLCTDigi::getFractionalStrip
float getFractionalStrip(const uint16_t n=2) const
return the fractional strip (middle of the strip)
Definition: CSCCLCTDigi.cc:115
CSCCLCTDigi::getBXData
uint16_t getBXData() const
return 2-bit BX as in data
Definition: CSCCLCTDigi.h:126
CSCCLCTDigi::fullbx_
uint16_t fullbx_
Definition: CSCCLCTDigi.h:217
CSCCLCTDigi::setRun3
void setRun3(bool isRun3)
Definition: CSCCLCTDigi.cc:125
CSCCLCTDigi::getFullBX
uint16_t getFullBX() const
return 12-bit full BX.
Definition: CSCCLCTDigi.h:165
CSCCLCTDigi::operator>
bool operator>(const CSCCLCTDigi &) const
Definition: CSCCLCTDigi.cc:127
CSCCLCTDigi::bx_
uint16_t bx_
Definition: CSCCLCTDigi.h:215
CSCCLCTDigi::CSCCLCTDigi
CSCCLCTDigi()
default (calls clear())
Definition: CSCCLCTDigi.cc:56
CSCCLCTDigi::getStrip
uint16_t getStrip() const
return halfstrip that goes from 0 to 31 in a (D)CFEB
Definition: CSCCLCTDigi.h:99
CSCCLCTDigi::setRun3Pattern
void setRun3Pattern(const uint16_t pattern)
set pattern
Definition: CSCCLCTDigi.h:71
CSCCLCTDigi::ComparatorContainer
std::vector< std::vector< uint16_t > > ComparatorContainer
Definition: CSCCLCTDigi.h:19
CSCCLCTDigi::run3_quart_strip_bit_
bool run3_quart_strip_bit_
Definition: CSCCLCTDigi.h:225
CSCCLCTDigi::cfeb_
uint16_t cfeb_
Definition: CSCCLCTDigi.h:214
CSCCLCTDigi::Version::Run3
CSCCLCTDigi::getStripType
uint16_t getStripType() const
return striptype
Definition: CSCCLCTDigi.h:85
CSCCLCTDigi::setQuality
void setQuality(const uint16_t quality)
set quality
Definition: CSCCLCTDigi.h:59
CSCCLCTDigi::isValid
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
CSCCLCTDigi::setCompCode
void setCompCode(const int16_t code)
Definition: CSCCLCTDigi.h:173
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
CSCCLCTDigi::setCFEB
void setCFEB(const uint16_t cfeb)
set Key CFEB ID
Definition: CSCCLCTDigi.h:120
CSCCLCTDigi::setSlope
void setSlope(const uint16_t slope)
set the slope
Definition: CSCCLCTDigi.h:77
CSCCLCTDigi::setHits
void setHits(const ComparatorContainer &hits)
Definition: CSCCLCTDigi.h:178
CSCCLCTDigi::getSlope
uint16_t getSlope() const
return the slope
Definition: CSCCLCTDigi.h:74
CSCCLCTDigi::setFullBX
void setFullBX(const uint16_t fullbx)
Set 12-bit full BX.
Definition: CSCCLCTDigi.h:168
CSCCLCTDigi::getBX
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:123
CSCCLCTDigi::compCode_
int16_t compCode_
Definition: CSCCLCTDigi.h:223
CSCCLCTDigi::CLCTBXMask
CLCTBXMask
Definition: CSCCLCTDigi.h:23
CSCCLCTDigi::clear
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:61
CSCCLCTDigi::quality_
uint16_t quality_
Definition: CSCCLCTDigi.h:201
CSCCLCTDigi::getFractionalSlope
float getFractionalSlope() const
Definition: CSCCLCTDigi.cc:87
CSCCLCTDigi::Version::Legacy
CSCCLCTDigi::getCFEB
uint16_t getCFEB() const
return Key CFEB ID
Definition: CSCCLCTDigi.h:117
CSCCLCTDigi::setBX
void setBX(const uint16_t bx)
set bx
Definition: CSCCLCTDigi.h:129
CSCCLCTDigi::trknmb_
uint16_t trknmb_
Definition: CSCCLCTDigi.h:216
CSCCLCTDigi::setEighthStripBit
void setEighthStripBit(const bool eighthStripBit)
set single eighth strip bit
Definition: CSCCLCTDigi.h:111
CSCCLCTDigi::print
void print() const
Print content of digi.
Definition: CSCCLCTDigi.cc:190
CSCCLCTDigi::operator==
bool operator==(const CSCCLCTDigi &) const
True if the two LCTs have exactly the same members (except the number).
Definition: CSCCLCTDigi.cc:170
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
CSCCLCTDigi::getPattern
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.h:62
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
CSCCLCTDigi::version_
Version version_
Definition: CSCCLCTDigi.h:236
Version
Definition: InitMessage.h:39
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
CSCCLCTDigi::setQuartStripBit
void setQuartStripBit(const bool quartStripBit)
set single quart strip bit
Definition: CSCCLCTDigi.h:105
CSCCLCTDigi::getHits
const ComparatorContainer & getHits() const
Definition: CSCCLCTDigi.h:176
CSCCLCTDigi::getRun3Pattern
uint16_t getRun3Pattern() const
return pattern
Definition: CSCCLCTDigi.h:68