00001 #ifndef DATAFORMATS_SISTRIPCLUSTER_H
00002 #define DATAFORMATS_SISTRIPCLUSTER_H
00003
00004
00005 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00006 #include <vector>
00007
00008 class SiStripCluster {
00009 public:
00010
00011 typedef std::vector<SiStripDigi>::const_iterator SiStripDigiIter;
00012 typedef std::pair<SiStripDigiIter,SiStripDigiIter> SiStripDigiRange;
00013
00018 SiStripCluster() : detId_(0) {}
00019
00020 SiStripCluster( uint32_t detid, const SiStripDigiRange& range);
00021
00022 SiStripCluster(const uint32_t& detid,
00023 const uint16_t& firstStrip,
00024 std::vector<uint16_t>::const_iterator begin,
00025 std::vector<uint16_t>::const_iterator end );
00026
00029 uint16_t firstStrip() const {return firstStrip_;}
00030
00035 uint32_t geographicalId() const {return detId_;}
00036
00045 const std::vector<uint8_t>& amplitudes() const {return amplitudes_;}
00046
00050 float barycenter() const;
00051
00052 private:
00053
00054 uint32_t detId_;
00055 uint16_t firstStrip_;
00056 std::vector<uint8_t> amplitudes_;
00057 };
00058
00059
00060 inline bool operator<( const SiStripCluster& one, const SiStripCluster& other) {
00061 if(one.geographicalId() == other.geographicalId()) {
00062 return one.firstStrip() < other.firstStrip();
00063 }
00064 return one.geographicalId() < other.geographicalId();
00065 }
00066
00067 inline bool operator<(const SiStripCluster& cluster, const uint32_t& detid) {
00068 return cluster.geographicalId() < detid;
00069 }
00070
00071 inline bool operator<(const uint32_t& detid,const SiStripCluster& cluster) {
00072 return detid < cluster.geographicalId();
00073 }
00074
00075 inline bool operator<(const SiStripCluster& cluster, const uint16_t& firstStrip) {
00076 return cluster.firstStrip() < firstStrip;
00077 }
00078
00079 inline bool operator<(const uint16_t& firstStrip,const SiStripCluster& cluster) {
00080 return firstStrip < cluster.firstStrip();
00081 }
00082 #endif // DATAFORMATS_SISTRIPCLUSTER_H