CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DataFormats/CSCDigi/src/CSCALCTDigi.cc

Go to the documentation of this file.
00001 
00011 #include <DataFormats/CSCDigi/interface/CSCALCTDigi.h>
00012 
00013 #include <iomanip>
00014 #include <iostream>
00015 
00016 using namespace std;
00017 
00019 CSCALCTDigi::CSCALCTDigi(const int valid, const int quality, const int accel,
00020                          const int patternb, const int keywire, const int bx,
00021                          const int trknmb) {
00022   valid_    = valid;
00023   quality_  = quality;
00024   accel_    = accel;
00025   patternb_ = patternb;
00026   keywire_  = keywire;
00027   bx_       = bx;
00028   trknmb_   = trknmb;
00029 }
00030 
00032 CSCALCTDigi::CSCALCTDigi() {
00033   clear(); // set contents to zero
00034 }
00035 
00037 void CSCALCTDigi::clear() {
00038   valid_    = 0;
00039   quality_  = 0;
00040   accel_    = 0;
00041   patternb_ = 0;
00042   keywire_  = 0;
00043   bx_       = 0;
00044   trknmb_   = 0;
00045   fullbx_   = 0;
00046 }
00047 
00048 bool CSCALCTDigi::operator > (const CSCALCTDigi& rhs) const {
00049   bool returnValue = false;
00050 
00051   // Early ALCTs are always preferred to the ones found at later bx's.
00052   if (getBX()  < rhs.getBX()) {returnValue = true;}
00053   if (getBX() != rhs.getBX()) {return returnValue;}
00054 
00055   // The > operator then checks the quality of ALCTs.
00056   // If two qualities are equal, the ALCT furthest from the beam axis
00057   // (lowest eta, highest wire group number) is selected.
00058   int quality1 = getQuality();
00059   int quality2 = rhs.getQuality();
00060   if (quality1 > quality2) {returnValue = true;}
00061   else if (quality1 == quality2 && getKeyWG() > rhs.getKeyWG())
00062     {returnValue = true;}
00063   return returnValue;
00064 }
00065 
00066 bool CSCALCTDigi::operator == (const CSCALCTDigi& rhs) const {
00067   // Exact equality.
00068   bool returnValue = false;
00069   if (isValid()        == rhs.isValid() && getQuality() == rhs.getQuality() &&
00070       getAccelerator() == rhs.getAccelerator() &&
00071       getCollisionB()  == rhs.getCollisionB()  &&
00072       getKeyWG()       == rhs.getKeyWG()       && getBX() == rhs.getBX()) {
00073     returnValue = true;
00074   }
00075   return returnValue;
00076 }
00077 
00078 bool CSCALCTDigi::operator != (const CSCALCTDigi& rhs) const {
00079   // True if == is false.
00080   bool returnValue = true;
00081   if ((*this) == rhs) returnValue = false;
00082   return returnValue;
00083 }
00084 
00086 void CSCALCTDigi::print() const {
00087   if (isValid()) {
00088     std::cout << "CSC ALCT #"         << setw(1) << getTrknmb()
00089               << ": Valid = "         << setw(1) << isValid()
00090               << " Quality = "        << setw(2) << getQuality()
00091               << " Accel. = "         << setw(1) << getAccelerator()
00092               << " PatternB = "       << setw(1) << getCollisionB()
00093               << " Key wire group = " << setw(3) << getKeyWG()
00094               << " BX = "             << setw(2) << getBX()
00095               << " Full BX= "         << std::setw(1) << getFullBX() << std::endl;
00096   }
00097   else {
00098     std::cout << "Not a valid Anode LCT." << std::endl;
00099   }
00100 }
00101 
00102 std::ostream & operator<<(std::ostream & o, const CSCALCTDigi& digi) {
00103   return o << "CSC ALCT #"         << digi.getTrknmb()
00104            << ": Valid = "         << digi.isValid()
00105            << " Quality = "        << digi.getQuality()
00106            << " Accel. = "         << digi.getAccelerator()
00107            << " PatternB = "       << digi.getCollisionB()
00108            << " Key wire group = " << digi.getKeyWG()
00109            << " BX = "             << digi.getBX();
00110 }