![]() |
![]() |
00001 #include "GEMCluster.h" 00002 #include <iostream> 00003 #include <fstream> 00004 00005 using namespace std; 00006 00007 GEMCluster::GEMCluster() : fstrip(0), lstrip(0), bunchx(0) 00008 { 00009 } 00010 00011 GEMCluster::GEMCluster(int fs, int ls, int bx) : 00012 fstrip(fs), lstrip(ls), bunchx(bx) 00013 { 00014 } 00015 00016 GEMCluster::~GEMCluster() 00017 { 00018 } 00019 00020 int 00021 GEMCluster::firstStrip() const 00022 { 00023 return fstrip; 00024 } 00025 00026 int 00027 GEMCluster::lastStrip() const 00028 { 00029 return lstrip; 00030 } 00031 00032 int 00033 GEMCluster::clusterSize() const 00034 { 00035 return -(fstrip-lstrip)+1; 00036 } 00037 00038 int 00039 GEMCluster::bx() const 00040 { 00041 return bunchx; 00042 } 00043 00044 bool GEMCluster::isAdjacent(const GEMCluster& cl) const{ 00045 00046 return ((cl.firstStrip() == this->firstStrip()-1) && 00047 (cl.bx() == this->bx())); 00048 } 00049 00050 void GEMCluster::merge(const GEMCluster& cl){ 00051 00052 if(this->isAdjacent(cl)) 00053 { 00054 fstrip = cl.firstStrip(); 00055 } 00056 } 00057 00058 bool GEMCluster::operator<(const GEMCluster& cl) const{ 00059 00060 if(cl.bx() == this->bx()) 00061 return cl.firstStrip()<this->firstStrip(); 00062 else 00063 return cl.bx()<this->bx(); 00064 } 00065 00066 bool 00067 GEMCluster::operator==(const GEMCluster& cl) const { 00068 return ( (this->clusterSize() == cl.clusterSize()) && 00069 (this->bx() == cl.bx()) && 00070 (this->firstStrip() == cl.firstStrip()) ); 00071 }