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  template<typename Iter>
24  SiStripCluster(const uint32_t& detid,
25  const uint16_t& firstStrip,
26  Iter begin, Iter end ):
27  detId_(0), firstStrip_(firstStrip), amplitudes_(begin,end),
28  // ggiurgiu@fnal.gov, 01/05/12
29  // Initialize the split cluster errors to un-physical values.
30  // The CPE will check these errors and if they are not un-physical,
31  // it will recognize the clusters as split and assign these (increased)
32  // errors to the corresponding rechit.
33  error_x(-99999.9){}
34 
37  uint16_t firstStrip() const {return firstStrip_;}
38 
43  uint32_t geographicalId() const {
44  if (detId_==0) edm::LogError("Deprecation")<<"this method will give zero offline";
45  return detId_;
46  }
47  void setId(uint32_t id) { detId_=id; }
48 
60  const std::vector<uint8_t>& amplitudes() const {return amplitudes_;}
61 
65  float barycenter() const;
66 
67  float getSplitClusterError () const { return error_x; }
68  void setSplitClusterError ( float errx ) { error_x = errx; }
69 
70 
71 private:
72 
73  uint32_t detId_;
74  uint16_t firstStrip_;
75 
76  std::vector<uint8_t> amplitudes_;
77 
78  // ggiurgiu@fnal.gov, 01/05/12
79  // Add cluster errors to be used by rechits from split clusters.
80  // A rechit from a split cluster has larger errors than rechits from normal clusters.
81  // However, when presented with a cluster, the CPE does not know if the cluster comes
82  // from a splitting procedure or not. That's why we have to instruct the CPE to use
83  // appropriate errors for split clusters.
84  // To avoid increase of data size on disk,these new data members are set as transient in:
85  // DataFormats/SiStripCluster/src/classes_def.xml
86  float error_x;
87 
88 };
89 
90 // Comparison operators
91 inline bool operator<( const SiStripCluster& one, const SiStripCluster& other) {
92  if(one.geographicalId() == other.geographicalId()) {
93  return one.firstStrip() < other.firstStrip();
94  }
95  return one.geographicalId() < other.geographicalId();
96 }
97 
98 inline bool operator<(const SiStripCluster& cluster, const uint32_t& detid) {
99  return cluster.geographicalId() < detid;
100 }
101 
102 inline bool operator<(const uint32_t& detid,const SiStripCluster& cluster) {
103  return detid < cluster.geographicalId();
104 }
105 
106 inline bool operator<(const SiStripCluster& cluster, const uint16_t& firstStrip) {
107  return cluster.firstStrip() < firstStrip;
108 }
109 
110 inline bool operator<(const uint16_t& firstStrip,const SiStripCluster& cluster) {
111  return firstStrip < cluster.firstStrip();
112 }
113 #endif // DATAFORMATS_SISTRIPCLUSTER_H
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
SiStripCluster(const uint32_t &detid, const uint16_t &firstStrip, Iter begin, Iter end)
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:37
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
void setSplitClusterError(float errx)
void setId(uint32_t id)
#define begin
Definition: vmac.h:30
std::vector< uint8_t > amplitudes_
uint16_t firstStrip_
const std::vector< uint8_t > & amplitudes() const