CMS 3D CMS Logo

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