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 
80  float getFractionalSlope(const uint16_t slope = 4) const;
81 
83  uint16_t getStripType() const { return striptype_; }
84 
86  void setStripType(const uint16_t stripType) { striptype_ = stripType; }
87 
91  uint16_t getBend() const { return bend_; }
92 
94  void setBend(const uint16_t bend) { bend_ = bend; }
95 
97  uint16_t getStrip() const;
98 
100  void setStrip(const uint16_t strip) { strip_ = strip; }
101 
103  void setQuartStrip(const bool quartStrip);
104 
106  bool getQuartStrip() const;
107 
109  void setEightStrip(const bool eightStrip);
110 
112  bool getEightStrip() const;
113 
115  uint16_t getCFEB() const { return cfeb_; }
116 
118  void setCFEB(const uint16_t cfeb) { cfeb_ = cfeb; }
119 
121  uint16_t getBX() const { return bx_; }
122 
124  uint16_t getBXData() const { return bx_ & kBXDataMask; }
125 
127  void setBX(const uint16_t bx) { bx_ = bx; }
128 
130  uint16_t getTrknmb() const { return trknmb_; }
131 
138  uint16_t getKeyStrip(const uint16_t n = 2) const;
139 
140  /*
141  Strips are numbered starting from 1 in CMSSW
142  Half-strips, quarter-strips and eighth-strips are numbered starting from 0
143  The table below shows the correct numbering
144  ---------------------------------------------------------------------------------
145  strip | 1 | 2 |
146  ---------------------------------------------------------------------------------
147  1/2-strip | 0 | 1 | 2 | 3 |
148  ---------------------------------------------------------------------------------
149  1/4-strip | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
150  ---------------------------------------------------------------------------------
151  1/8-strip | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
152  ---------------------------------------------------------------------------------
153 
154  Note: the CSC geometry also has a strip offset of +/- 0.25 strips. When comparing the
155  CLCT/LCT position with the true muon position, take the offset into account!
156  */
157  float getFractionalStrip(const uint16_t n = 2) const;
158 
160  void setTrknmb(const uint16_t number) { trknmb_ = number; }
161 
163  uint16_t getFullBX() const { return fullbx_; }
164 
166  void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; }
167 
168  // 12-bit comparator code
169  int16_t getCompCode() const { return (isRun3() ? compCode_ : -1); }
170 
171  void setCompCode(const int16_t code) { compCode_ = code; }
172 
173  // comparator hits in this CLCT
174  const ComparatorContainer& getHits() const { return hits_; }
175 
177 
181  bool operator>(const CSCCLCTDigi&) const;
182 
184  bool operator==(const CSCCLCTDigi&) const;
185 
187  bool operator!=(const CSCCLCTDigi&) const;
188 
190  void print() const;
191 
193  bool isRun3() const { return version_ == Version::Run3; }
194 
195  void setRun3(bool isRun3);
196 
197 private:
198  void setDataWord(const uint16_t newWord, uint16_t& word, const unsigned shift, const unsigned mask);
199  uint16_t getDataWord(const uint16_t word, const unsigned shift, const unsigned mask) const;
200 
201  uint16_t valid_;
202  uint16_t quality_;
203  // In Run-3, the 4-bit pattern number is reinterpreted as the
204  // 4-bit bending value. There will be 16 bending values * 2 (left/right)
205  uint16_t pattern_;
206  uint16_t striptype_; // not used since mid-2008
207  // Common definition for left/right bending in Run-1, Run-2 and Run-3.
208  // 0: right; 1: left
209  uint16_t bend_;
210  // In Run-3, the strip number receives two additional bits
211  // strip[4:0] -> 1/2 strip value
212  // strip[5] -> 1/4 strip bit
213  // strip[6] -> 1/8 strip bit
214  uint16_t strip_;
215  // There are up to 7 (D)CFEBs in a chamber
216  uint16_t cfeb_;
217  uint16_t bx_;
218  uint16_t trknmb_;
219  uint16_t fullbx_;
220 
221  // new in Run-3: 12-bit comparator code
222  // set by default to -1 for Run-1 and Run-2 CLCTs
223  int16_t compCode_;
224  // which hits are in this CLCT?
226 
228 };
229 
230 std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi);
231 
232 #endif
CSCCLCTDigi::striptype_
uint16_t striptype_
Definition: CSCCLCTDigi.h:206
CSCCLCTDigi::strip_
uint16_t strip_
Definition: CSCCLCTDigi.h:214
CSCCLCTDigi::setTrknmb
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting CLCTs.
Definition: CSCCLCTDigi.h:160
CSCCLCTDigi::setStripType
void setStripType(const uint16_t stripType)
set stripType
Definition: CSCCLCTDigi.h:86
CSCCLCTDigi::getFractionalSlope
float getFractionalSlope(const uint16_t slope=4) const
slope in number of half-strips/layer
Definition: CSCCLCTDigi.cc:119
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:130
CSCCLCTDigi::kBXDataMask
Definition: CSCCLCTDigi.h:28
CSCCLCTDigi::operator!=
bool operator!=(const CSCCLCTDigi &) const
True if the preceding one is false.
Definition: CSCCLCTDigi.cc:241
CSCCLCTDigi::kEightStripMask
Definition: CSCCLCTDigi.h:21
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CSCCLCTDigi::kRun3PatternMask
Definition: CSCCLCTDigi.h:24
CSCCLCTDigi::getCompCode
int16_t getCompCode() const
Definition: CSCCLCTDigi.h:169
CSCCLCTDigi::kLegacyPatternShift
Definition: CSCCLCTDigi.h:25
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCCLCTDigi::kHalfStripShift
Definition: CSCCLCTDigi.h:22
CSCCLCTDigi::setEightStrip
void setEightStrip(const bool eightStrip)
set single eight strip bit
Definition: CSCCLCTDigi.cc:179
CSCCLCTDigi::valid_
uint16_t valid_
Definition: CSCCLCTDigi.h:201
CSCCLCTDigi::setBend
void setBend(const uint16_t bend)
set bend
Definition: CSCCLCTDigi.h:94
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:100
CSCCLCTDigi::getDataWord
uint16_t getDataWord(const uint16_t word, const unsigned shift, const unsigned mask) const
Definition: CSCCLCTDigi.cc:276
CSCCLCTDigi::getKeyStrip
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:133
CSCCLCTDigi::setQuartStrip
void setQuartStrip(const bool quartStrip)
set single quart strip bit
Definition: CSCCLCTDigi.cc:173
CSCCLCTDigi::CLCTPatternShifts
CLCTPatternShifts
Definition: CSCCLCTDigi.h:25
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
operator<<
std::ostream & operator<<(std::ostream &o, const CSCCLCTDigi &digi)
Definition: CSCCLCTDigi.cc:280
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
CSCCLCTDigi::CLCTKeyStripMasks
CLCTKeyStripMasks
Definition: CSCCLCTDigi.h:21
CSCCLCTDigi::pattern_
uint16_t pattern_
Definition: CSCCLCTDigi.h:205
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
CSCCLCTDigi::hits_
ComparatorContainer hits_
Definition: CSCCLCTDigi.h:225
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:91
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:193
CSCCLCTDigi::bend_
uint16_t bend_
Definition: CSCCLCTDigi.h:209
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:149
CSCCLCTDigi::getBXData
uint16_t getBXData() const
return 2-bit BX as in data
Definition: CSCCLCTDigi.h:124
CSCCLCTDigi::fullbx_
uint16_t fullbx_
Definition: CSCCLCTDigi.h:219
CSCCLCTDigi::setRun3
void setRun3(bool isRun3)
Definition: CSCCLCTDigi.cc:185
CSCCLCTDigi::getFullBX
uint16_t getFullBX() const
return 12-bit full BX.
Definition: CSCCLCTDigi.h:163
CSCCLCTDigi::operator>
bool operator>(const CSCCLCTDigi &) const
Definition: CSCCLCTDigi.cc:187
CSCCLCTDigi::bx_
uint16_t bx_
Definition: CSCCLCTDigi.h:217
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:159
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::kRun3PatternShift
Definition: CSCCLCTDigi.h:25
CSCCLCTDigi::CLCTPatternMasks
CLCTPatternMasks
Definition: CSCCLCTDigi.h:24
CSCCLCTDigi::cfeb_
uint16_t cfeb_
Definition: CSCCLCTDigi.h:216
CSCCLCTDigi::Version::Run3
CSCCLCTDigi::getEightStrip
bool getEightStrip() const
get single eight strip bit
Definition: CSCCLCTDigi.cc:167
CSCCLCTDigi::getStripType
uint16_t getStripType() const
return striptype
Definition: CSCCLCTDigi.h:83
CSCCLCTDigi::getQuartStrip
bool getQuartStrip() const
get single quart strip bit
Definition: CSCCLCTDigi.cc:161
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:268
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:171
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:118
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:176
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:166
CSCCLCTDigi::kRun3SlopeMask
Definition: CSCCLCTDigi.h:24
CSCCLCTDigi::getBX
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:121
CSCCLCTDigi::kEightStripShift
Definition: CSCCLCTDigi.h:22
CSCCLCTDigi::compCode_
int16_t compCode_
Definition: CSCCLCTDigi.h:223
CSCCLCTDigi::CLCTBXMask
CLCTBXMask
Definition: CSCCLCTDigi.h:28
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
trklet::bend
double bend(double r, double rinv, double stripPitch)
Definition: Util.h:160
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:202
CSCCLCTDigi::CLCTKeyStripShifts
CLCTKeyStripShifts
Definition: CSCCLCTDigi.h:22
CSCCLCTDigi::Version::Legacy
CSCCLCTDigi::getCFEB
uint16_t getCFEB() const
return Key CFEB ID
Definition: CSCCLCTDigi.h:115
CSCCLCTDigi::setBX
void setBX(const uint16_t bx)
set bx
Definition: CSCCLCTDigi.h:127
CSCCLCTDigi::kQuartStripMask
Definition: CSCCLCTDigi.h:21
CSCCLCTDigi::trknmb_
uint16_t trknmb_
Definition: CSCCLCTDigi.h:218
CSCCLCTDigi::print
void print() const
Print content of digi.
Definition: CSCCLCTDigi.cc:250
CSCCLCTDigi::operator==
bool operator==(const CSCCLCTDigi &) const
True if the two LCTs have exactly the same members (except the number).
Definition: CSCCLCTDigi.cc:230
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:227
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:174
CSCCLCTDigi::getRun3Pattern
uint16_t getRun3Pattern() const
return pattern
Definition: CSCCLCTDigi.cc:94