CMS 3D CMS Logo

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