CMS 3D CMS Logo

CSCCLCTDigi.cc
Go to the documentation of this file.
1 
11 #include <iomanip>
12 #include <iostream>
13 
15 CSCCLCTDigi::CSCCLCTDigi(const int valid,
16  const int quality,
17  const int pattern,
18  const int striptype,
19  const int bend,
20  const int strip,
21  const int cfeb,
22  const int bx,
23  const int trknmb,
24  const int fullbx)
25  : valid_(valid),
26  quality_(quality),
27  pattern_(pattern),
28  striptype_(striptype),
29  bend_(bend),
30  strip_(strip),
31  cfeb_(cfeb),
32  bx_(bx),
33  trknmb_(trknmb),
34  //fullbx_(0)
35  fullbx_(fullbx) {
36  //valid_ = valid;
37  //quality_ = quality;
38  //pattern_ = pattern;
39  //striptype_ = striptype;
40  //bend_ = bend;
41  //strip_ = strip;
42  //cfeb_ = cfeb;
43  //bx_ = bx;
44  //trknmb_ = trknmb;
45 }
46 
49  : valid_(0), quality_(0), pattern_(0), striptype_(0), bend_(0), strip_(0), cfeb_(0), bx_(0), trknmb_(0), fullbx_(0) {
50  // clear(); // set contents to zero
51 }
52 
55  valid_ = 0;
56  quality_ = 0;
57  pattern_ = 0;
58  striptype_ = 0;
59  bend_ = 0;
60  strip_ = 0;
61  cfeb_ = 0;
62  bx_ = 0;
63  trknmb_ = 0;
64  fullbx_ = 0;
65 }
66 
67 bool CSCCLCTDigi::operator>(const CSCCLCTDigi& rhs) const {
68  // Several versions of CLCT sorting criteria were used before 2008.
69  // They are available in CMSSW versions prior to 3_1_0; here we only keep
70  // the latest one, used in TMB-07 firmware (w/o distrips).
71  bool returnValue = false;
72 
73  int quality1 = getQuality();
74  int quality2 = rhs.getQuality();
75  // The bend-direction bit pid[0] is ignored (left and right bends have
76  // equal quality).
77  int pattern1 = getPattern() & 14;
78  int pattern2 = rhs.getPattern() & 14;
79 
80  // Better-quality CLCTs are preferred.
81  // If two qualities are equal, larger pattern id (i.e., straighter pattern)
82  // is preferred; left- and right-bend patterns are considered to be of
83  // the same quality.
84  // If both qualities and pattern id's are the same, lower keystrip
85  // is preferred.
86  if ((quality1 > quality2) || (quality1 == quality2 && pattern1 > pattern2) ||
87  (quality1 == quality2 && pattern1 == pattern2 && getKeyStrip() < rhs.getKeyStrip())) {
88  returnValue = true;
89  }
90 
91  return returnValue;
92 }
93 
94 bool CSCCLCTDigi::operator==(const CSCCLCTDigi& rhs) const {
95  // Exact equality.
96  bool returnValue = false;
97  if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getPattern() == rhs.getPattern() &&
98  getKeyStrip() == rhs.getKeyStrip() && getStripType() == rhs.getStripType() && getBend() == getBend() &&
99  getBX() == rhs.getBX()) {
100  returnValue = true;
101  }
102  return returnValue;
103 }
104 
105 bool CSCCLCTDigi::operator!=(const CSCCLCTDigi& rhs) const {
106  // True if == is false.
107  bool returnValue = true;
108  if ((*this) == rhs)
109  returnValue = false;
110  return returnValue;
111 }
112 
114 void CSCCLCTDigi::print() const {
115  if (isValid()) {
116  char stripType = (getStripType() == 0) ? 'D' : 'H';
117  char bend = (getBend() == 0) ? 'L' : 'R';
118 
119  edm::LogVerbatim("CSCDigi") << " CSC CLCT #" << std::setw(1) << getTrknmb() << ": Valid = " << std::setw(1)
120  << isValid() << " Key Strip = " << std::setw(3) << getKeyStrip()
121  << " Strip = " << std::setw(2) << getStrip() << " Quality = " << std::setw(1)
122  << getQuality() << " Pattern = " << std::setw(1) << getPattern()
123  << " Bend = " << std::setw(1) << bend << " Strip type = " << std::setw(1) << stripType
124  << " CFEB ID = " << std::setw(1) << getCFEB() << " BX = " << std::setw(1) << getBX()
125  << " Full BX= " << std::setw(1) << getFullBX();
126  } else {
127  edm::LogVerbatim("CSCDigi") << "Not a valid Cathode LCT.";
128  }
129 }
130 
131 std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi) {
132  return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality()
133  << " Pattern = " << digi.getPattern() << " StripType = " << digi.getStripType()
134  << " Bend = " << digi.getBend() << " Strip = " << digi.getStrip() << " KeyStrip = " << digi.getKeyStrip()
135  << " CFEB = " << digi.getCFEB() << " BX = " << digi.getBX();
136 }
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:41
uint16_t trknmb_
Definition: CSCCLCTDigi.h:131
uint16_t strip_
Definition: CSCCLCTDigi.h:128
void print() const
Print content of digi.
Definition: CSCCLCTDigi.cc:114
uint16_t pattern_
Definition: CSCCLCTDigi.h:125
uint16_t valid_
Definition: CSCCLCTDigi.h:123
int getStrip() const
return halfstrip that goes from 0 to 31
Definition: CSCCLCTDigi.h:65
static const uint16_t valid_
Definition: Constants.h:17
int getStripType() const
return striptype
Definition: CSCCLCTDigi.h:53
int getBend() const
return bend
Definition: CSCCLCTDigi.h:59
uint16_t bx_
Definition: CSCCLCTDigi.h:130
CSCCLCTDigi()
default
Definition: CSCCLCTDigi.cc:48
uint16_t bend_
Definition: CSCCLCTDigi.h:127
bool operator>(const CSCCLCTDigi &) const
Definition: CSCCLCTDigi.cc:67
int getCFEB() const
return Key CFEB ID
Definition: CSCCLCTDigi.h:71
uint16_t fullbx_
Definition: CSCCLCTDigi.h:132
int getBX() const
return BX
Definition: CSCCLCTDigi.h:77
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:35
bool operator!=(const CSCCLCTDigi &) const
True if the preceding one is false.
Definition: CSCCLCTDigi.cc:105
int getTrknmb() const
return track number (1,2)
Definition: CSCCLCTDigi.h:83
std::ostream & operator<<(std::ostream &o, const CSCCLCTDigi &digi)
Definition: CSCCLCTDigi.cc:131
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:47
uint16_t cfeb_
Definition: CSCCLCTDigi.h:129
bool operator==(const CSCCLCTDigi &) const
True if the two LCTs have exactly the same members (except the number).
Definition: CSCCLCTDigi.cc:94
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:54
uint16_t striptype_
Definition: CSCCLCTDigi.h:126
uint16_t quality_
Definition: CSCCLCTDigi.h:124
int getKeyStrip() const
Definition: CSCCLCTDigi.h:94
int getFullBX() const
return 12-bit full BX.
Definition: CSCCLCTDigi.h:103