CMS 3D CMS Logo

SiStripCluster.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_SISTRIPCLUSTER_H
2 #define DATAFORMATS_SISTRIPCLUSTER_H
3 
5 #include <vector>
6 #include <numeric>
8 
10 public:
11  typedef std::vector<SiStripDigi>::const_iterator SiStripDigiIter;
12  typedef std::pair<SiStripDigiIter, SiStripDigiIter> SiStripDigiRange;
13 
14  static const uint16_t stripIndexMask = 0x7FFF; // The first strip index is in the low 15 bits of firstStrip_
15  static const uint16_t mergedValueMask = 0x8000; // The merged state is given by the high bit of firstStrip_
16 
22 
23  explicit SiStripCluster(const SiStripDigiRange& range);
24 
25  template <typename Iter>
27 
28  template <typename Iter>
29  SiStripCluster(const uint16_t& firstStrip, Iter begin, Iter end, bool merged)
31  if (merged)
32  firstStrip_ |= mergedValueMask; // if this is a candidate merged cluster
33  }
34 
38  uint16_t firstStrip() const { return firstStrip_ & stripIndexMask; }
39 
51  const std::vector<uint8_t>& amplitudes() const { return amplitudes_; }
52 
56  float barycenter() const;
57 
61  int charge() const { return std::accumulate(amplitudes().begin(), amplitudes().end(), int(0)); }
62 
66  bool isMerged() const { return (firstStrip_ & mergedValueMask) != 0; }
67  void setMerged(bool mergedState) { mergedState ? firstStrip_ |= mergedValueMask : firstStrip_ &= stripIndexMask; }
68 
69  float getSplitClusterError() const { return error_x; }
70  void setSplitClusterError(float errx) { error_x = errx; }
71 
72 private:
73  std::vector<uint8_t> amplitudes_;
74 
75  uint16_t firstStrip_ = 0;
76 
77  // ggiurgiu@fnal.gov, 01/05/12
78  // Add cluster errors to be used by rechits from split clusters.
79  // A rechit from a split cluster has larger errors than rechits from normal clusters.
80  // However, when presented with a cluster, the CPE does not know if the cluster comes
81  // from a splitting procedure or not. That's why we have to instruct the CPE to use
82  // appropriate errors for split clusters.
83  // To avoid increase of data size on disk,these new data members are set as transient in:
84  // DataFormats/SiStripCluster/src/classes_def.xml
85  float error_x = -99999.9;
86 
87  // ggiurgiu@fnal.gov, 01/05/12
88  // Initialize the split cluster errors to un-physical values.
89  // The CPE will check these errors and if they are not un-physical,
90  // it will recognize the clusters as split and assign these (increased)
91  // errors to the corresponding rechit.
92 };
93 
94 // Comparison operators
95 inline bool operator<(const SiStripCluster& one, const SiStripCluster& other) {
96  return one.firstStrip() < other.firstStrip();
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
SiStripCluster::setMerged
void setMerged(bool mergedState)
Definition: SiStripCluster.h:67
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripCluster::barycenter
float barycenter() const
Definition: SiStripCluster.cc:23
MessageLogger.h
SiStripCluster::error_x
float error_x
Definition: SiStripCluster.h:85
SiStripCluster::stripIndexMask
static const uint16_t stripIndexMask
Definition: SiStripCluster.h:14
SiStripCluster::SiStripCluster
SiStripCluster(const uint16_t &firstStrip, Iter begin, Iter end, bool merged)
Definition: SiStripCluster.h:29
end
#define end
Definition: vmac.h:39
SiStripCluster::firstStrip
uint16_t firstStrip() const
Definition: SiStripCluster.h:38
SiStripCluster::setSplitClusterError
void setSplitClusterError(float errx)
Definition: SiStripCluster.h:70
SiStripCluster::amplitudes_
std::vector< uint8_t > amplitudes_
Definition: SiStripCluster.h:73
SiStripCluster::getSplitClusterError
float getSplitClusterError() const
Definition: SiStripCluster.h:69
SiStripDigi.h
trackingPlots.other
other
Definition: trackingPlots.py:1465
SiStripCluster::SiStripDigiIter
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
Definition: SiStripCluster.h:11
SiStripCluster::isMerged
bool isMerged() const
Definition: SiStripCluster.h:66
SiStripCluster::amplitudes
const std::vector< uint8_t > & amplitudes() const
Definition: SiStripCluster.h:51
SiStripCluster::SiStripCluster
SiStripCluster()
Definition: SiStripCluster.h:21
operator<
bool operator<(const SiStripCluster &one, const SiStripCluster &other)
Definition: SiStripCluster.h:95
SiStripCluster::charge
int charge() const
Definition: SiStripCluster.h:61
SiStripCluster::SiStripDigiRange
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
Definition: SiStripCluster.h:12
SiStripCluster::SiStripCluster
SiStripCluster(const uint16_t &firstStrip, Iter begin, Iter end)
Definition: SiStripCluster.h:26
SiStripCluster::mergedValueMask
static const uint16_t mergedValueMask
Definition: SiStripCluster.h:15
SiStripCluster
Definition: SiStripCluster.h:9
begin
#define begin
Definition: vmac.h:32
SiStripCluster::firstStrip_
uint16_t firstStrip_
Definition: SiStripCluster.h:75