CMS 3D CMS Logo

SiStripCluster.cc
Go to the documentation of this file.
1 
3 
4 SiStripCluster::SiStripCluster(const SiStripDigiRange& range) : firstStrip_(range.first->strip()), error_x(-99999.9) {
5  std::vector<uint8_t> v;
6  v.reserve(range.second - range.first);
7 
8  uint16_t lastStrip = 0;
9  bool firstInloop = true;
10  for (SiStripDigiIter i = range.first; i != range.second; i++) {
12  if (!firstInloop && i->strip() != lastStrip + 1) {
13  for (int j = 0; j < i->strip() - (lastStrip + 1); j++) {
14  v.push_back(0);
15  }
16  }
17  lastStrip = i->strip();
18  firstInloop = false;
19 
20  v.push_back(i->adc());
21  }
22  amplitudes_ = v;
23 }
24 
26  int sumx = 0;
27  int suma = 0;
28  auto asize = size();
29  for (auto i = 0U; i < asize; ++i) {
30  sumx += i * amplitudes_[i];
31  suma += amplitudes_[i];
32  }
33 
34  // strip centers are offcet by half pitch w.r.t. strip numbers,
35  // so one has to add 0.5 to get the correct barycenter position.
36  // Need to mask off the high bit of firstStrip_, which contains the merged status.
37  return float((firstStrip_ & stripIndexMask)) + float(sumx) / float(suma) + 0.5f;
38 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
SiStripCluster::barycenter
float barycenter() const
Definition: SiStripCluster.cc:25
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
SiStripCluster::stripIndexMask
static const uint16_t stripIndexMask
Definition: SiStripCluster.h:13
findQualityFiles.v
v
Definition: findQualityFiles.py:179
SiStripCluster::amplitudes_
std::vector< uint8_t > amplitudes_
Definition: SiStripCluster.h:90
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
SiStripCluster::SiStripDigiIter
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
Definition: SiStripCluster.h:10
SiStripCluster.h
SiStripCluster::size
uint8_t size() const
Definition: SiStripCluster.h:63
SiStripCluster::SiStripCluster
SiStripCluster()
Definition: SiStripCluster.h:20
SiStripCluster::SiStripDigiRange
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
Definition: SiStripCluster.h:11
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SiStripCluster::firstStrip_
uint16_t firstStrip_
Definition: SiStripCluster.h:92