test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripCluster.cc
Go to the documentation of this file.
1 
3 
5  firstStrip_(range.first->strip()),
6  error_x(-99999.9)
7 {
8 
9  amplitudes_.reserve( range.second - range.first);
10 
11  uint16_t lastStrip=0;
12  bool firstInloop = true;
13  for (SiStripDigiIter i=range.first; i!=range.second; i++) {
14 
16  if (!firstInloop && i->strip() != lastStrip + 1) {
17  for (int j=0; j < i->strip()-(lastStrip+1); j++) {
18  amplitudes_.push_back( 0);
19  }
20  }
21  lastStrip = i->strip();
22  firstInloop = false;
23 
24  amplitudes_.push_back(i->adc());
25  }
26 }
27 
28 
30  int sumx = 0;
31  int suma = 0;
32  auto asize = amplitudes_.size();
33  for (auto i=0U;i<asize;++i) {
34  sumx += i*amplitudes_[i];
35  suma += amplitudes_[i];
36  }
37 
38  // strip centers are offcet by half pitch w.r.t. strip numbers,
39  // so one has to add 0.5 to get the correct barycenter position.
40  // Need to mask off the high bit of firstStrip_, which contains the merged status.
41  return float((firstStrip_ & stripIndexMask)) + float(sumx) / float(suma) + 0.5f;
42 }
int i
Definition: DBlmapReader.cc:9
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
int j
Definition: DBlmapReader.cc:9
float barycenter() const
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
std::vector< uint8_t > amplitudes_
uint16_t firstStrip_
static const uint16_t stripIndexMask