Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-21 02:52:56

0001 /** \file
0002  *
0003  *
0004  * \author M.Schmitt, Northwestern
0005  */
0006 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
0007 #include "DataFormats/CSCDigi/interface/CSCConstants.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include <iostream>
0010 #include <cstdint>
0011 
0012 // Comparison
0013 bool CSCStripDigi::operator==(const CSCStripDigi& digi) const {
0014   if (getStrip() != digi.getStrip())
0015     return false;
0016   if (getADCCounts().size() != digi.getADCCounts().size())
0017     return false;
0018   if (getADCCounts() != digi.getADCCounts())
0019     return false;
0020   return true;
0021 }
0022 
0023 /// Get the CFEB number. Counts from 0.
0024 // originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc
0025 int CSCStripDigi::getCFEB() const { return (strip - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; }
0026 
0027 void CSCStripDigi::setADCCounts(const std::vector<int>& vADCCounts) {
0028   bool badVal = false;
0029   for (int i = 0; i < (int)vADCCounts.size(); i++) {
0030     if (vADCCounts[i] < 1)
0031       badVal = true;
0032   }
0033   if (!badVal) {
0034     ADCCounts = vADCCounts;
0035   } else {
0036     std::vector<int> ZeroCounts(8, 0);
0037     ADCCounts = ZeroCounts;
0038   }
0039 }
0040 
0041 // Debug
0042 void CSCStripDigi::print() const {
0043   std::ostringstream ost;
0044   ost << "CSCStripDigi | strip " << getStrip() << " | ADCCounts ";
0045   for (int i = 0; i < (int)getADCCounts().size(); i++) {
0046     ost << getADCCounts()[i] << " ";
0047   }
0048   ost << " | Overflow ";
0049   for (int i = 0; i < (int)getADCOverflow().size(); i++) {
0050     ost << getADCOverflow()[i] << " ";
0051   }
0052   ost << " | Overlapped ";
0053   for (int i = 0; i < (int)getOverlappedSample().size(); i++) {
0054     ost << getOverlappedSample()[i] << " ";
0055   }
0056   ost << " | L1APhase ";
0057   for (int i = 0; i < (int)getL1APhase().size(); i++) {
0058     ost << getL1APhase()[i] << " ";
0059   }
0060   edm::LogVerbatim("CSCDigi") << ost.str();
0061 }
0062 
0063 std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi) {
0064   o << " " << digi.getStrip();
0065   for (size_t i = 0; i < digi.getADCCounts().size(); ++i) {
0066     o << " " << (digi.getADCCounts())[i];
0067   }
0068   return o;
0069 }