CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/DataFormats/SiStripCluster/interface/SiStripCluster.h

Go to the documentation of this file.
00001 #ifndef DATAFORMATS_SISTRIPCLUSTER_H
00002 #define DATAFORMATS_SISTRIPCLUSTER_H
00003 
00004 //#include "DataFormats/Common/interface/traits.h"
00005 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00006 #include <vector>
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 
00009 class SiStripCluster  /*: public edm::DoNotSortUponInsertion*/ {
00010 public:
00011 
00012   typedef std::vector<SiStripDigi>::const_iterator   SiStripDigiIter;
00013   typedef std::pair<SiStripDigiIter,SiStripDigiIter>   SiStripDigiRange;
00014 
00019   SiStripCluster() : detId_(0), error_x( -99999.9 ) {}
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   float getSplitClusterError () const    {  return error_x;  }
00061   void  setSplitClusterError ( float errx ) { error_x = errx; }
00062 
00063 
00064 private:
00065 
00066   uint32_t                detId_;
00067   uint16_t                firstStrip_;
00068 
00069   std::vector<uint8_t>   amplitudes_;
00070 
00071   // ggiurgiu@fnal.gov, 01/05/12
00072   // Add cluster errors to be used by rechits from split clusters. 
00073   // A rechit from a split cluster has larger errors than rechits from normal clusters. 
00074   // However, when presented with a cluster, the CPE does not know if the cluster comes 
00075   // from a splitting procedure or not. That's why we have to instruct the CPE to use 
00076   // appropriate errors for split clusters.
00077   // To avoid increase of data size on disk,these new data members are set as transient in: 
00078   // DataFormats/SiStripCluster/src/classes_def.xml
00079   float error_x;
00080   
00081 };
00082 
00083 // Comparison operators
00084 inline bool operator<( const SiStripCluster& one, const SiStripCluster& other) {
00085   if(one.geographicalId() == other.geographicalId()) {
00086     return one.firstStrip() < other.firstStrip();
00087   }
00088   return one.geographicalId() < other.geographicalId();
00089 } 
00090 
00091 inline bool operator<(const SiStripCluster& cluster, const uint32_t& detid) {
00092   return cluster.geographicalId() < detid;
00093 } 
00094 
00095 inline bool operator<(const uint32_t& detid,const SiStripCluster& cluster) {
00096   return detid < cluster.geographicalId();
00097 } 
00098 
00099 inline bool operator<(const SiStripCluster& cluster, const uint16_t& firstStrip) {
00100   return cluster.firstStrip() < firstStrip;
00101 } 
00102 
00103 inline bool operator<(const uint16_t& firstStrip,const SiStripCluster& cluster) {
00104   return firstStrip < cluster.firstStrip();
00105 } 
00106 #endif // DATAFORMATS_SISTRIPCLUSTER_H