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 
23  // temporary to facilitate CCLUT-EMTF/OMTF integration studies
26  enum class Version { Legacy = 0, Run3 };
27  // for data vs emulator studies
28  enum CLCTBXMask { kBXDataMask = 0x3 };
29 
31  CSCCLCTDigi(const uint16_t valid,
32  const uint16_t quality,
33  const uint16_t pattern,
34  const uint16_t striptype,
35  const uint16_t bend,
36  const uint16_t strip,
37  const uint16_t cfeb,
38  const uint16_t bx,
39  const uint16_t trknmb = 0,
40  const uint16_t fullbx = 0,
41  const int16_t compCode = -1,
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;
63 
65  void setPattern(const uint16_t pattern);
66 
68  uint16_t getRun3Pattern() const;
69 
71  void setRun3Pattern(const uint16_t pattern);
72 
74  uint16_t getSlope() const;
75 
77  void setSlope(const uint16_t 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;
100 
102  void setStrip(const uint16_t strip) { strip_ = strip; }
103 
105  void setQuartStrip(const bool quartStrip);
106 
108  bool getQuartStrip() const;
109 
111  void setEighthStrip(const bool eighthStrip);
112 
114  bool getEighthStrip() const;
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  void setDataWord(const uint16_t newWord, uint16_t& word, const unsigned shift, const unsigned mask);
201  uint16_t getDataWord(const uint16_t word, const unsigned shift, const unsigned mask) const;
202 
203  uint16_t valid_;
204  uint16_t quality_;
205  // In Run-3, the 4-bit pattern number is reinterpreted as the
206  // 4-bit bending value. There will be 16 bending values * 2 (left/right)
207  uint16_t pattern_;
208  uint16_t striptype_; // not used since mid-2008
209  // Common definition for left/right bending in Run-1, Run-2 and Run-3.
210  // 0: right; 1: left
211  uint16_t bend_;
212  // In Run-3, the strip number receives two additional bits
213  // strip[4:0] -> 1/2 strip value
214  // strip[5] -> 1/4 strip bit
215  // strip[6] -> 1/8 strip bit
216  uint16_t strip_;
217  // There are up to 7 (D)CFEBs in a chamber
218  uint16_t cfeb_;
219  uint16_t bx_;
220  uint16_t trknmb_;
221  uint16_t fullbx_;
222 
223  // new in Run-3: 12-bit comparator code
224  // set by default to -1 for Run-1 and Run-2 CLCTs
225  int16_t compCode_;
226  // which hits are in this CLCT?
228 
230 };
231 
232 std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi);
233 
234 #endif
CSCCLCTDigi::striptype_
uint16_t striptype_
Definition: CSCCLCTDigi.h:208
CSCCLCTDigi::strip_
uint16_t strip_
Definition: CSCCLCTDigi.h:216
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:28
CSCCLCTDigi::operator!=
bool operator!=(const CSCCLCTDigi &) const
True if the preceding one is false.
Definition: CSCCLCTDigi.cc:239
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CSCCLCTDigi::kRun3PatternMask
Definition: CSCCLCTDigi.h:24
CSCCLCTDigi::getCompCode
int16_t getCompCode() const
Definition: CSCCLCTDigi.h:171
CSCCLCTDigi::kLegacyPatternShift
Definition: CSCCLCTDigi.h:25
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCCLCTDigi::kHalfStripShift
Definition: CSCCLCTDigi.h:22
CSCCLCTDigi::valid_
uint16_t valid_
Definition: CSCCLCTDigi.h:203
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.cc:90
CSCCLCTDigi::setStrip
void setStrip(const uint16_t strip)
set strip
Definition: CSCCLCTDigi.h:102
CSCCLCTDigi::getDataWord
uint16_t getDataWord(const uint16_t word, const unsigned shift, const unsigned mask) const
Definition: CSCCLCTDigi.cc:274
CSCCLCTDigi::setEighthStrip
void setEighthStrip(const bool eighthStrip)
set single eighth strip bit
Definition: CSCCLCTDigi.cc:177
CSCCLCTDigi::getKeyStrip
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:131
CSCCLCTDigi::setQuartStrip
void setQuartStrip(const bool quartStrip)
set single quart strip bit
Definition: CSCCLCTDigi.cc:171
CSCCLCTDigi::CLCTPatternShifts
CLCTPatternShifts
Definition: CSCCLCTDigi.h:25
CSCCLCTDigi::getEighthStrip
bool getEighthStrip() const
get single eighth strip bit
Definition: CSCCLCTDigi.cc:165
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
operator<<
std::ostream & operator<<(std::ostream &o, const CSCCLCTDigi &digi)
Definition: CSCCLCTDigi.cc:278
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
CSCCLCTDigi::CLCTKeyStripMasks
CLCTKeyStripMasks
Definition: CSCCLCTDigi.h:21
CSCCLCTDigi::pattern_
uint16_t pattern_
Definition: CSCCLCTDigi.h:207
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
CSCCLCTDigi::hits_
ComparatorContainer hits_
Definition: CSCCLCTDigi.h:227
CSCCLCTDigi::kLegacyPatternMask
Definition: CSCCLCTDigi.h:24
CSCCLCTDigi::getQuality
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
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:211
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:147
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:221
CSCCLCTDigi::setRun3
void setRun3(bool isRun3)
Definition: CSCCLCTDigi.cc:183
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:185
CSCCLCTDigi::bx_
uint16_t bx_
Definition: CSCCLCTDigi.h:219
CSCCLCTDigi::CSCCLCTDigi
CSCCLCTDigi()
default
Definition: CSCCLCTDigi.cc:48
CSCCLCTDigi::getStrip
uint16_t getStrip() const
return halfstrip that goes from 0 to 31 in a (D)CFEB
Definition: CSCCLCTDigi.cc:157
CSCCLCTDigi::kRun3SlopeShift
Definition: CSCCLCTDigi.h:25
CSCCLCTDigi::setRun3Pattern
void setRun3Pattern(const uint16_t pattern)
set pattern
Definition: CSCCLCTDigi.cc:100
CSCCLCTDigi::ComparatorContainer
std::vector< std::vector< uint16_t > > ComparatorContainer
Definition: CSCCLCTDigi.h:19
CSCCLCTDigi::kEighthStripMask
Definition: CSCCLCTDigi.h:21
CSCCLCTDigi::kRun3PatternShift
Definition: CSCCLCTDigi.h:25
CSCCLCTDigi::CLCTPatternMasks
CLCTPatternMasks
Definition: CSCCLCTDigi.h:24
CSCCLCTDigi::cfeb_
uint16_t cfeb_
Definition: CSCCLCTDigi.h:218
CSCCLCTDigi::Version::Run3
CSCCLCTDigi::getStripType
uint16_t getStripType() const
return striptype
Definition: CSCCLCTDigi.h:85
CSCCLCTDigi::getQuartStrip
bool getQuartStrip() const
get single quart strip bit
Definition: CSCCLCTDigi.cc:159
CSCCLCTDigi::setQuality
void setQuality(const uint16_t quality)
set quality
Definition: CSCCLCTDigi.h:59
CSCCLCTDigi::setDataWord
void setDataWord(const uint16_t newWord, uint16_t &word, const unsigned shift, const unsigned mask)
Definition: CSCCLCTDigi.cc:266
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.cc:112
CSCCLCTDigi::setHits
void setHits(const ComparatorContainer &hits)
Definition: CSCCLCTDigi.h:178
CSCCLCTDigi::getSlope
uint16_t getSlope() const
return the slope
Definition: CSCCLCTDigi.cc:106
CSCCLCTDigi::setFullBX
void setFullBX(const uint16_t fullbx)
Set 12-bit full BX.
Definition: CSCCLCTDigi.h:168
CSCCLCTDigi::kRun3SlopeMask
Definition: CSCCLCTDigi.h:24
CSCCLCTDigi::getBX
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:123
CSCCLCTDigi::compCode_
int16_t compCode_
Definition: CSCCLCTDigi.h:225
CSCCLCTDigi::CLCTBXMask
CLCTBXMask
Definition: CSCCLCTDigi.h:28
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
trklet::bend
double bend(double r, double rinv, double stripPitch)
Definition: Util.h:166
CSCCLCTDigi::clear
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:68
CSCCLCTDigi::kQuartStripShift
Definition: CSCCLCTDigi.h:22
CSCCLCTDigi::quality_
uint16_t quality_
Definition: CSCCLCTDigi.h:204
CSCCLCTDigi::CLCTKeyStripShifts
CLCTKeyStripShifts
Definition: CSCCLCTDigi.h:22
CSCCLCTDigi::getFractionalSlope
float getFractionalSlope() const
Definition: CSCCLCTDigi.cc:119
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::kQuartStripMask
Definition: CSCCLCTDigi.h:21
CSCCLCTDigi::trknmb_
uint16_t trknmb_
Definition: CSCCLCTDigi.h:220
CSCCLCTDigi::print
void print() const
Print content of digi.
Definition: CSCCLCTDigi.cc:248
CSCCLCTDigi::operator==
bool operator==(const CSCCLCTDigi &) const
True if the two LCTs have exactly the same members (except the number).
Definition: CSCCLCTDigi.cc:228
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
CSCCLCTDigi::getPattern
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.cc:88
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
CSCCLCTDigi::version_
Version version_
Definition: CSCCLCTDigi.h:229
CSCCLCTDigi::kHalfStripMask
Definition: CSCCLCTDigi.h:21
Version
Definition: InitMessage.h:39
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
CSCCLCTDigi::getHits
const ComparatorContainer & getHits() const
Definition: CSCCLCTDigi.h:176
CSCCLCTDigi::kEighthStripShift
Definition: CSCCLCTDigi.h:22
CSCCLCTDigi::getRun3Pattern
uint16_t getRun3Pattern() const
return pattern
Definition: CSCCLCTDigi.cc:94