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 
31  const uint16_t& firstStrip,
32  std::vector<uint16_t>::const_iterator begin,
33  std::vector<uint16_t>::const_iterator end) :
34 
35  // detId_(detid),
36  detId_(0),
37  firstStrip_(firstStrip),
38  amplitudes_(begin,end),
39 
40  // ggiurgiu@fnal.gov, 01/05/12
41  // Initialize the split cluster errors to un-physical values.
42  // The CPE will check these errors and if they are not un-physical,
43  // it will recognize the clusters as split and assign these (increased)
44  // errors to the corresponding rechit.
45  error_x(-99999.9)
46 {}
47 
49  int sumx = 0;
50  int suma = 0;
51  size_t asize = amplitudes_.size();
52  for (size_t i=0;i<asize;++i) {
53  sumx += (firstStrip_+i)*(amplitudes_[i]);
54  suma += amplitudes_[i];
55  }
56 
57  // strip centers are offcet by half pitch w.r.t. strip numbers,
58  // so one has to add 0.5 to get the correct barycenter position
59  return sumx / static_cast<float>(suma) + 0.5;
60 }
int i
Definition: DBlmapReader.cc:9
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::pair< SiStripDigiIter, SiStripDigiIter > SiStripDigiRange
uint16_t firstStrip() const
int j
Definition: DBlmapReader.cc:9
float barycenter() const
#define end
Definition: vmac.h:38
bool first
Definition: L1TdeRCT.cc:94
std::vector< SiStripDigi >::const_iterator SiStripDigiIter
#define begin
Definition: vmac.h:31
std::vector< uint8_t > amplitudes_
uint16_t firstStrip_