File indexing completed on 2024-04-06 12:26:12
0001 #include "RecoLocalMuon/GEMRecHit/interface/GEMCluster.h"
0002 #include <iostream>
0003 #include <fstream>
0004
0005 using namespace std;
0006
0007 GEMCluster::GEMCluster() : fstrip(0), lstrip(0), bunchx(0) {}
0008
0009 GEMCluster::GEMCluster(int fs, int ls, int bx) : fstrip(fs), lstrip(ls), bunchx(bx) {}
0010
0011 GEMCluster::~GEMCluster() {}
0012
0013 int GEMCluster::firstStrip() const { return fstrip; }
0014
0015 int GEMCluster::lastStrip() const { return lstrip; }
0016
0017 int GEMCluster::clusterSize() const { return -(fstrip - lstrip) + 1; }
0018
0019 int GEMCluster::bx() const { return bunchx; }
0020
0021 bool GEMCluster::isAdjacent(const GEMCluster& cl) const {
0022 return ((cl.firstStrip() == this->firstStrip() - 1) && (cl.bx() == this->bx()));
0023 }
0024
0025 void GEMCluster::merge(const GEMCluster& cl) {
0026 if (this->isAdjacent(cl)) {
0027 fstrip = cl.firstStrip();
0028 }
0029 }
0030
0031 bool GEMCluster::operator<(const GEMCluster& cl) const {
0032 if (cl.bx() == this->bx())
0033 return cl.firstStrip() < this->firstStrip();
0034 else
0035 return cl.bx() < this->bx();
0036 }
0037
0038 bool GEMCluster::operator==(const GEMCluster& cl) const {
0039 return ((this->clusterSize() == cl.clusterSize()) && (this->bx() == cl.bx()) &&
0040 (this->firstStrip() == cl.firstStrip()));
0041 }