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  size_t asize = amplitudes_.size();
33  for (size_t i=0;i<asize;++i) {
34  sumx += (firstStrip_+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  return sumx / static_cast<float>(suma) + 0.5f;
41 }
int i
Definition: DBlmapReader.cc:9
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
int j
Definition: DBlmapReader.cc:9
double f[11][100]
float barycenter() const
bool first
Definition: L1TdeRCT.cc:75
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
std::vector< uint8_t > amplitudes_
uint16_t firstStrip_