Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/GEMDigi/interface/GEMPadDigiCluster.h"
0002 #include <iostream>
0003 
0004 GEMPadDigiCluster::GEMPadDigiCluster(std::vector<uint16_t> pads,
0005                                      int16_t bx,
0006                                      enum GEMSubDetId::Station station,
0007                                      unsigned nPart)
0008     : v_(pads), bx_(bx), station_(station), part_(nPart) {}
0009 
0010 GEMPadDigiCluster::GEMPadDigiCluster()
0011     : v_(std::vector<uint16_t>()), bx_(-99), station_(GEMSubDetId::Station::GE11), part_(NumberPartitions::GE11) {}
0012 
0013 // Comparison
0014 bool GEMPadDigiCluster::operator==(const GEMPadDigiCluster& digi) const {
0015   return v_ == digi.pads() and bx_ == digi.bx() and station_ == digi.station();
0016 }
0017 
0018 // Comparison
0019 bool GEMPadDigiCluster::operator!=(const GEMPadDigiCluster& digi) const {
0020   return v_ != digi.pads() or bx_ != digi.bx();
0021 }
0022 
0023 ///Precedence operator
0024 bool GEMPadDigiCluster::operator<(const GEMPadDigiCluster& digi) const {
0025   if (digi.bx() == bx_)
0026     return digi.pads().front() < v_.front();
0027   else
0028     return digi.bx() < bx_;
0029 }
0030 
0031 bool GEMPadDigiCluster::isValid() const {
0032   // empty clusters are always invalid
0033   if (v_.empty())
0034     return false;
0035 
0036   uint16_t invalid = GE11InValid;
0037   if (station_ == GEMSubDetId::Station::GE21) {
0038     invalid = GE21InValid;
0039   }
0040   return v_[0] != invalid;
0041 }
0042 
0043 std::ostream& operator<<(std::ostream& o, const GEMPadDigiCluster& digi) {
0044   o << " bx: " << digi.bx() << " pads: [";
0045   for (auto p : digi.pads())
0046     o << " " << p;
0047   o << "]";
0048   return o;
0049 }
0050 
0051 void GEMPadDigiCluster::print() const {
0052   std::cout << " bx: " << bx() << " pads: ";
0053   for (auto p : pads())
0054     std::cout << " " << p;
0055   std::cout << std::endl;
0056 }