CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripCluster.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_SISTRIPCLUSTER_H
2 #define DATAFORMATS_SISTRIPCLUSTER_H
3 
4 //#include "DataFormats/Common/interface/traits.h"
6 #include <vector>
8 
9 class SiStripCluster /*: public edm::DoNotSortUponInsertion*/ {
10 public:
11 
12  typedef std::vector<SiStripDigi>::const_iterator SiStripDigiIter;
13  typedef std::pair<SiStripDigiIter,SiStripDigiIter> SiStripDigiRange;
14 
19  SiStripCluster() : detId_(0), error_x( -99999.9 ) {}
20 
21  SiStripCluster( uint32_t detid, const SiStripDigiRange& range);
22 
23  SiStripCluster(const uint32_t& detid,
24  const uint16_t& firstStrip,
25  std::vector<uint16_t>::const_iterator begin,
26  std::vector<uint16_t>::const_iterator end );
27 
30  uint16_t firstStrip() const {return firstStrip_;}
31 
36  uint32_t geographicalId() const {
37  if (detId_==0) edm::LogError("Deprecation")<<"this method will give zero offline";
38  return detId_;
39  }
40  void setId(uint32_t id) { detId_=id; }
41 
53  const std::vector<uint8_t>& amplitudes() const {return amplitudes_;}
54 
58  float barycenter() const;
59 
60  float getSplitClusterError () const { return error_x; }
61  void setSplitClusterError ( float errx ) { error_x = errx; }
62 
63 
64 private:
65 
66  uint32_t detId_;
67  uint16_t firstStrip_;
68 
69  std::vector<uint8_t> amplitudes_;
70 
71  // ggiurgiu@fnal.gov, 01/05/12
72  // Add cluster errors to be used by rechits from split clusters.
73  // A rechit from a split cluster has larger errors than rechits from normal clusters.
74  // However, when presented with a cluster, the CPE does not know if the cluster comes
75  // from a splitting procedure or not. That's why we have to instruct the CPE to use
76  // appropriate errors for split clusters.
77  // To avoid increase of data size on disk,these new data members are set as transient in:
78  // DataFormats/SiStripCluster/src/classes_def.xml
79  float error_x;
80 
81 };
82 
83 // Comparison operators
84 inline bool operator<( const SiStripCluster& one, const SiStripCluster& other) {
85  if(one.geographicalId() == other.geographicalId()) {
86  return one.firstStrip() < other.firstStrip();
87  }
88  return one.geographicalId() < other.geographicalId();
89 }
90 
91 inline bool operator<(const SiStripCluster& cluster, const uint32_t& detid) {
92  return cluster.geographicalId() < detid;
93 }
94 
95 inline bool operator<(const uint32_t& detid,const SiStripCluster& cluster) {
96  return detid < cluster.geographicalId();
97 }
98 
99 inline bool operator<(const SiStripCluster& cluster, const uint16_t& firstStrip) {
100  return cluster.firstStrip() < firstStrip;
101 }
102 
103 inline bool operator<(const uint16_t& firstStrip,const SiStripCluster& cluster) {
104  return firstStrip < cluster.firstStrip();
105 }
106 #endif // DATAFORMATS_SISTRIPCLUSTER_H
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
uint16_t firstStrip() const
float getSplitClusterError() const
uint32_t geographicalId() const
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
float barycenter() const
#define end
Definition: vmac.h:38
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
void setSplitClusterError(float errx)
void setId(uint32_t id)
#define begin
Definition: vmac.h:31
std::vector< uint8_t > amplitudes_
uint16_t firstStrip_
const std::vector< uint8_t > & amplitudes() const