CMS 3D CMS Logo

SiStripApproximateCluster.cc
Go to the documentation of this file.
3 #include <algorithm>
4 #include <cmath>
5 
7  unsigned int maxNSat,
8  float hitPredPos,
9  bool peakFilter) {
10  barycenter_ = std::round(cluster.barycenter() * 10);
11  width_ = cluster.size();
12  avgCharge_ = cluster.charge() / cluster.size();
13  filter_ = false;
14  isSaturated_ = false;
16 
17  //mimicing the algorithm used in StripSubClusterShapeTrajectoryFilter...
18  //Looks for 3 adjacent saturated strips (ADC>=254)
19  const auto& ampls = cluster.amplitudes();
20  unsigned int thisSat = (ampls[0] >= 254), maxSat = thisSat;
21  for (unsigned int i = 1, n = ampls.size(); i < n; ++i) {
22  if (ampls[i] >= 254) {
23  thisSat++;
24  } else if (thisSat > 0) {
25  maxSat = std::max<int>(maxSat, thisSat);
26  thisSat = 0;
27  }
28  }
29  if (thisSat > 0) {
30  maxSat = std::max<int>(maxSat, thisSat);
31  }
32  if (maxSat >= maxNSat) {
33  filter_ = true;
34  isSaturated_ = true;
35  }
36 
37  unsigned int hitStripsTrim = ampls.size();
38  int sum = std::accumulate(ampls.begin(), ampls.end(), 0);
39  uint8_t trimCut = std::min<uint8_t>(trimMaxADC_, std::floor(trimMaxFracTotal_ * sum));
40  auto begin = ampls.begin();
41  auto last = ampls.end() - 1;
42  while (hitStripsTrim > 1 && (*begin < std::max<uint8_t>(trimCut, trimMaxFracNeigh_ * (*(begin + 1))))) {
43  hitStripsTrim--;
44  ++begin;
45  }
46  while (hitStripsTrim > 1 && (*last < std::max<uint8_t>(trimCut, trimMaxFracNeigh_ * (*(last - 1))))) {
47  hitStripsTrim--;
48  --last;
49  }
50  if (hitStripsTrim < std::floor(std::abs(hitPredPos) - maxTrimmedSizeDiffNeg_)) {
51  filter_ = false;
52  } else if (hitStripsTrim <= std::ceil(std::abs(hitPredPos) + maxTrimmedSizeDiffPos_)) {
53  filter_ = true;
54  } else {
56  }
57 }
constexpr int32_t ceil(float num)
int charge() const
static constexpr double maxTrimmedSizeDiffNeg_
static constexpr double trimMaxFracTotal_
SiStripCluster const & amplitudes() const
auto size() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr double maxTrimmedSizeDiffPos_
float barycenter() const
static constexpr double trimMaxFracNeigh_
static constexpr double trimMaxADC_