Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#include "DataFormats/GEMDigi/interface/GEMDigi.h"
#include <iostream>

GEMDigi::GEMDigi(uint16_t strip, int16_t bx) : strip_(strip), bx_(bx) {}

GEMDigi::GEMDigi() : strip_(65535), bx_(-99) {}

// Comparison
bool GEMDigi::operator==(const GEMDigi& digi) const { return strip_ == digi.strip() and bx_ == digi.bx(); }

// Comparison
bool GEMDigi::operator!=(const GEMDigi& digi) const { return strip_ != digi.strip() or bx_ != digi.bx(); }

///Precedence operator
bool GEMDigi::operator<(const GEMDigi& digi) const {
  if (digi.bx() == bx_)
    return digi.strip() < strip_;
  else
    return digi.bx() < bx_;
}

bool GEMDigi::isValid() const { return bx_ != -99 and strip_ != 65535; }

std::ostream& operator<<(std::ostream& o, const GEMDigi& digi) {
  return o << " GEMDigi strip = " << digi.strip() << " bx = " << digi.bx();
}

void GEMDigi::print() const { std::cout << "Strip " << strip() << " bx " << bx() << std::endl; }