Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:12

0001 #include "DataFormats/GEMDigi/interface/GEMCoPadDigi.h"
0002 #include <iostream>
0003 
0004 GEMCoPadDigi::GEMCoPadDigi(uint8_t roll, GEMPadDigi f, GEMPadDigi s) : roll_(roll), first_(f), second_(s) {}
0005 
0006 GEMCoPadDigi::GEMCoPadDigi() : roll_(0), first_(GEMPadDigi()), second_(GEMPadDigi()) {}
0007 
0008 // Comparison
0009 bool GEMCoPadDigi::operator==(const GEMCoPadDigi& digi) const {
0010   return digi.first() == first_ and digi.second() == second_ and digi.roll() == roll_;
0011 }
0012 
0013 // Comparison
0014 bool GEMCoPadDigi::operator!=(const GEMCoPadDigi& digi) const {
0015   return digi.first() != first_ or digi.second() != second_ or digi.roll() != roll_;
0016 }
0017 
0018 bool GEMCoPadDigi::isValid() const { return first_.isValid() and second_.isValid(); }
0019 
0020 int GEMCoPadDigi::pad(int l) const {
0021   if (l == 1)
0022     return first_.pad();
0023   else if (l == 2)
0024     return second_.pad();
0025   else
0026     return -99;  // invalid
0027 }
0028 
0029 int GEMCoPadDigi::bx(int l) const {
0030   if (l == 1)
0031     return first_.bx();
0032   else if (l == 2)
0033     return second_.bx();
0034   else
0035     return -99;  // invalid
0036 }
0037 
0038 void GEMCoPadDigi::print() const {
0039   std::cout << "Roll " << roll_ << ", pad1 " << first_.pad() << " bx1 " << first_.bx() << ", Pad2 " << second_.pad()
0040             << " bx2 " << second_.bx() << std::endl;
0041 }
0042 
0043 std::ostream& operator<<(std::ostream& o, const GEMCoPadDigi& digi) {
0044   return o << "Roll: " << digi.roll() << " layer1:" << digi.first() << ", layer2:" << digi.second();
0045 }