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