Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:10

0001 #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include <iomanip>
0004 #include <iostream>
0005 
0006 using namespace std;
0007 
0008 /// Constructors
0009 CSCALCTPreTriggerDigi::CSCALCTPreTriggerDigi(const int valid,
0010                                              const int quality,
0011                                              const int accel,
0012                                              const int patternb,
0013                                              const int keywire,
0014                                              const int bx,
0015                                              const int trknmb) {
0016   valid_ = valid;
0017   quality_ = quality;
0018   accel_ = accel;
0019   patternb_ = patternb;
0020   keywire_ = keywire;
0021   bx_ = bx;
0022   trknmb_ = trknmb;
0023 }
0024 
0025 /// Default
0026 CSCALCTPreTriggerDigi::CSCALCTPreTriggerDigi() {
0027   clear();  // set contents to zero
0028 }
0029 
0030 /// Clears this ALCT.
0031 void CSCALCTPreTriggerDigi::clear() {
0032   valid_ = 0;
0033   quality_ = 0;
0034   accel_ = 0;
0035   patternb_ = 0;
0036   keywire_ = 0;
0037   bx_ = 0;
0038   trknmb_ = 0;
0039   fullbx_ = 0;
0040 }
0041 
0042 bool CSCALCTPreTriggerDigi::operator>(const CSCALCTPreTriggerDigi& rhs) const {
0043   bool returnValue = false;
0044 
0045   // Early ALCTs are always preferred to the ones found at later bx's.
0046   if (getBX() < rhs.getBX()) {
0047     returnValue = true;
0048   }
0049   if (getBX() != rhs.getBX()) {
0050     return returnValue;
0051   }
0052 
0053   // The > operator then checks the quality of ALCTs.
0054   // If two qualities are equal, the ALCT furthest from the beam axis
0055   // (lowest eta, highest wire group number) is selected.
0056   int quality1 = getQuality();
0057   int quality2 = rhs.getQuality();
0058   if (quality1 > quality2) {
0059     returnValue = true;
0060   } else if (quality1 == quality2 && getKeyWG() > rhs.getKeyWG()) {
0061     returnValue = true;
0062   }
0063   return returnValue;
0064 }
0065 
0066 bool CSCALCTPreTriggerDigi::operator==(const CSCALCTPreTriggerDigi& rhs) const {
0067   // Exact equality.
0068   bool returnValue = false;
0069   if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getAccelerator() == rhs.getAccelerator() &&
0070       getCollisionB() == rhs.getCollisionB() && getKeyWG() == rhs.getKeyWG() && getBX() == rhs.getBX()) {
0071     returnValue = true;
0072   }
0073   return returnValue;
0074 }
0075 
0076 bool CSCALCTPreTriggerDigi::operator!=(const CSCALCTPreTriggerDigi& rhs) const {
0077   // True if == is false.
0078   bool returnValue = true;
0079   if ((*this) == rhs)
0080     returnValue = false;
0081   return returnValue;
0082 }
0083 
0084 /// Debug
0085 void CSCALCTPreTriggerDigi::print() const {
0086   if (isValid()) {
0087     edm::LogVerbatim("CSCDigi") << "CSC ALCT #" << setw(1) << getTrknmb() << ": Valid = " << setw(1) << isValid()
0088                                 << " Quality = " << setw(2) << getQuality() << " Accel. = " << setw(1)
0089                                 << getAccelerator() << " PatternB = " << setw(1) << getCollisionB()
0090                                 << " Key wire group = " << setw(3) << getKeyWG() << " BX = " << setw(2) << getBX()
0091                                 << " Full BX= " << std::setw(1) << getFullBX();
0092   } else {
0093     edm::LogVerbatim("CSCDigi") << "Not a valid Anode LCT.";
0094   }
0095 }
0096 
0097 std::ostream& operator<<(std::ostream& o, const CSCALCTPreTriggerDigi& digi) {
0098   return o << "CSC ALCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality()
0099            << " Accel. = " << digi.getAccelerator() << " PatternB = " << digi.getCollisionB()
0100            << " Key wire group = " << digi.getKeyWG() << " BX = " << digi.getBX();
0101 }