CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DataFormats/CSCDigi/src/CSCCLCTDigi.cc

Go to the documentation of this file.
00001 
00011 #include <DataFormats/CSCDigi/interface/CSCCLCTDigi.h>
00012 
00013 #include <iomanip>
00014 #include <iostream>
00015 
00017 CSCCLCTDigi::CSCCLCTDigi(const int valid, const int quality, const int pattern,
00018                          const int striptype, const int bend, const int strip,
00019                          const int cfeb, const int bx, const int trknmb, const int fullbx):
00020   valid_(valid),
00021   quality_(quality),
00022   pattern_(pattern),
00023   striptype_(striptype),
00024   bend_(bend),
00025   strip_(strip),
00026   cfeb_(cfeb),
00027   bx_(bx),
00028   trknmb_(trknmb),
00029   //fullbx_(0)
00030   fullbx_(fullbx)
00031  {
00032   //valid_     = valid;
00033   //quality_   = quality;
00034   //pattern_   = pattern;
00035   //striptype_ = striptype;
00036   //bend_      = bend;
00037   //strip_     = strip;
00038   //cfeb_      = cfeb;
00039   //bx_        = bx;
00040   //trknmb_    = trknmb;
00041 }
00042 
00044 CSCCLCTDigi::CSCCLCTDigi () :
00045   valid_(0),
00046   quality_(0),
00047   pattern_(0),
00048   striptype_(0),
00049   bend_(0),
00050   strip_(0),
00051   cfeb_(0),
00052   bx_(0),
00053   trknmb_(0),
00054   fullbx_(0)
00055 {
00056 //  clear(); // set contents to zero
00057 }
00058 
00060 void CSCCLCTDigi::clear() {
00061   valid_     = 0;
00062   quality_   = 0;
00063   pattern_   = 0;
00064   striptype_ = 0;
00065   bend_      = 0;
00066   strip_     = 0;
00067   cfeb_      = 0;
00068   bx_        = 0;
00069   trknmb_    = 0;
00070   fullbx_    = 0;
00071 }
00072 
00073 bool CSCCLCTDigi::operator > (const CSCCLCTDigi& rhs) const {
00074   // Several versions of CLCT sorting criteria were used before 2008.
00075   // They are available in CMSSW versions prior to 3_1_0; here we only keep
00076   // the latest one, used in TMB-07 firmware (w/o distrips).
00077   bool returnValue = false;
00078 
00079   int quality1 = getQuality();
00080   int quality2 = rhs.getQuality();
00081   // The bend-direction bit pid[0] is ignored (left and right bends have
00082   // equal quality).
00083   int pattern1 = getPattern()     & 14;
00084   int pattern2 = rhs.getPattern() & 14;
00085 
00086   // Better-quality CLCTs are preferred.
00087   // If two qualities are equal, larger pattern id (i.e., straighter pattern)
00088   // is preferred; left- and right-bend patterns are considered to be of
00089   // the same quality.
00090   // If both qualities and pattern id's are the same, lower keystrip
00091   // is preferred.
00092   if ((quality1  > quality2) ||
00093       (quality1 == quality2 && pattern1 > pattern2) ||
00094       (quality1 == quality2 && pattern1 == pattern2 &&
00095        getKeyStrip() < rhs.getKeyStrip())) {returnValue = true;}
00096 
00097   return returnValue;
00098 }
00099 
00100 bool CSCCLCTDigi::operator == (const CSCCLCTDigi& rhs) const {
00101   // Exact equality.
00102   bool returnValue = false;
00103   if (isValid()      == rhs.isValid()    && getQuality() == rhs.getQuality() &&
00104       getPattern()   == rhs.getPattern() && getKeyStrip()== rhs.getKeyStrip()&&
00105       getStripType() == rhs.getStripType() && getBend()  == getBend()        &&
00106       getBX()        == rhs.getBX()) {
00107     returnValue = true;
00108   }
00109   return returnValue;
00110 }
00111 
00112 bool CSCCLCTDigi::operator != (const CSCCLCTDigi& rhs) const {
00113   // True if == is false.
00114   bool returnValue = true;
00115   if ((*this) == rhs) returnValue = false;
00116   return returnValue;
00117 }
00118 
00120 void CSCCLCTDigi::print() const {
00121   if (isValid()) {
00122     char stripType = (getStripType() == 0) ? 'D' : 'H';
00123     char bend      = (getBend()      == 0) ? 'L' : 'R';
00124 
00125     std::cout << " CSC CLCT #"    << std::setw(1) << getTrknmb()
00126               << ": Valid = "     << std::setw(1) << isValid()
00127               << " Key Strip = "  << std::setw(3) << getKeyStrip()
00128               << " Strip = "      << std::setw(2) << getStrip()
00129               << " Quality = "    << std::setw(1) << getQuality()
00130               << " Pattern = "    << std::setw(1) << getPattern()
00131               << " Bend = "       << std::setw(1) << bend
00132               << " Strip type = " << std::setw(1) << stripType
00133               << " CFEB ID = "    << std::setw(1) << getCFEB()
00134               << " BX = "         << std::setw(1) << getBX() 
00135               << " Full BX= "     << std::setw(1) << getFullBX() << std::endl;
00136   }
00137   else {
00138     std::cout << "Not a valid Cathode LCT." << std::endl;
00139   }
00140 }
00141 
00142 std::ostream & operator<<(std::ostream & o, const CSCCLCTDigi& digi) {
00143   return o << "CSC CLCT #"    << digi.getTrknmb()
00144            << ": Valid = "    << digi.isValid()
00145            << " Quality = "   << digi.getQuality()
00146            << " Pattern = "   << digi.getPattern()
00147            << " StripType = " << digi.getStripType()
00148            << " Bend = "      << digi.getBend()
00149            << " Strip = "     << digi.getStrip()
00150            << " KeyStrip = "  << digi.getKeyStrip()
00151            << " CFEB = "      << digi.getCFEB()
00152            << " BX = "        << digi.getBX();
00153 }