Go to the documentation of this file.00001 #ifndef DATAFORMATS_SISTRIPCLUSTER_H
00002 #define DATAFORMATS_SISTRIPCLUSTER_H
00003
00004
00005 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00006 #include <vector>
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008
00009 class SiStripCluster {
00010 public:
00011
00012 typedef std::vector<SiStripDigi>::const_iterator SiStripDigiIter;
00013 typedef std::pair<SiStripDigiIter,SiStripDigiIter> SiStripDigiRange;
00014
00019 SiStripCluster() : detId_(0) {}
00020
00021 SiStripCluster( uint32_t detid, const SiStripDigiRange& range);
00022
00023 SiStripCluster(const uint32_t& detid,
00024 const uint16_t& firstStrip,
00025 std::vector<uint16_t>::const_iterator begin,
00026 std::vector<uint16_t>::const_iterator end );
00027
00030 uint16_t firstStrip() const {return firstStrip_;}
00031
00036 uint32_t geographicalId() const {
00037 if (detId_==0) edm::LogError("Deprecation")<<"this method will give zero offline";
00038 return detId_;
00039 }
00040 void setId(uint32_t id) { detId_=id; }
00041
00053 const std::vector<uint8_t>& amplitudes() const {return amplitudes_;}
00054
00058 float barycenter() const;
00059
00060 private:
00061
00062 uint32_t detId_;
00063 uint16_t firstStrip_;
00064 std::vector<uint8_t> amplitudes_;
00065 };
00066
00067
00068 inline bool operator<( const SiStripCluster& one, const SiStripCluster& other) {
00069 if(one.geographicalId() == other.geographicalId()) {
00070 return one.firstStrip() < other.firstStrip();
00071 }
00072 return one.geographicalId() < other.geographicalId();
00073 }
00074
00075 inline bool operator<(const SiStripCluster& cluster, const uint32_t& detid) {
00076 return cluster.geographicalId() < detid;
00077 }
00078
00079 inline bool operator<(const uint32_t& detid,const SiStripCluster& cluster) {
00080 return detid < cluster.geographicalId();
00081 }
00082
00083 inline bool operator<(const SiStripCluster& cluster, const uint16_t& firstStrip) {
00084 return cluster.firstStrip() < firstStrip;
00085 }
00086
00087 inline bool operator<(const uint16_t& firstStrip,const SiStripCluster& cluster) {
00088 return firstStrip < cluster.firstStrip();
00089 }
00090 #endif // DATAFORMATS_SISTRIPCLUSTER_H