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  //detId_(detid),
6  detId_(0),
7  firstStrip_(range.first->strip()),
8  error_x(-99999.9)
9 {
10 
11  amplitudes_.reserve( range.second - range.first);
12 
13  uint16_t lastStrip=0;
14  bool firstInloop = true;
15  for (SiStripDigiIter i=range.first; i!=range.second; i++) {
16 
18  if (!firstInloop && i->strip() != lastStrip + 1) {
19  for (int j=0; j < i->strip()-(lastStrip+1); j++) {
20  amplitudes_.push_back( 0);
21  }
22  }
23  lastStrip = i->strip();
24  firstInloop = false;
25 
26  amplitudes_.push_back(i->adc());
27  }
28 }
29 
30 
32  int sumx = 0;
33  int suma = 0;
34  size_t asize = amplitudes_.size();
35  for (size_t i=0;i<asize;++i) {
36  sumx += (firstStrip_+i)*(amplitudes_[i]);
37  suma += amplitudes_[i];
38  }
39 
40  // strip centers are offcet by half pitch w.r.t. strip numbers,
41  // so one has to add 0.5 to get the correct barycenter position
42  return sumx / static_cast<float>(suma) + 0.5f;
43 }
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:79
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
std::vector< uint8_t > amplitudes_
uint16_t firstStrip_