CMS 3D CMS Logo

EcalFenixMaxof2.cc
Go to the documentation of this file.
2 
3 // global type definitions for class implementation in source file defined by
4 // Tag entries in ArgoUML Result: typedef <typedef_global_source> <tag_value>;
5 EcalFenixMaxof2::EcalFenixMaxof2(int maxNrSamples, int nbMaxStrips)
6  : nbMaxStrips_(nbMaxStrips) {
7  std::vector<int> vec(maxNrSamples, 0);
8  for (int i2strip = 0; i2strip < nbMaxStrips_ - 1; ++i2strip)
9  sumby2_.push_back(vec);
10 }
11 
13 
14 void EcalFenixMaxof2::process(std::vector<std::vector<int>> &bypasslinout,
15  int nstrip, int bitMask,
16  std::vector<int> &output) {
17  int mask = (1 << bitMask) - 1;
18  for (int i2strip = 0; i2strip < nstrip - 1; ++i2strip)
19  for (unsigned int i = 0; i < output.size(); i++)
20  sumby2_[i2strip][i] = 0;
21  for (unsigned int i = 0; i < output.size(); i++)
22  output[i] = 0;
23 
24  for (unsigned int i = 0; i < output.size(); i++) {
25  if (nstrip - 1 == 0) {
26  output[i] = ((bypasslinout[0][i]) & mask);
27  } else {
28  for (int i2strip = 0; i2strip < nstrip - 1; ++i2strip) {
29  sumby2_[i2strip][i] = ((bypasslinout[i2strip][i]) & mask) +
30  ((bypasslinout[i2strip + 1][i]) & mask);
31  if (sumby2_[i2strip][i] > output[i]) {
32  output[i] = sumby2_[i2strip][i];
33  }
34  }
35  }
36  }
37  return;
38 }
void process(std::vector< std::vector< int >> &, int nStr, int bitMask, std::vector< int > &out)
std::vector< std::vector< int > > sumby2_
EcalFenixMaxof2(int maxNrSamples, int nbMaxStrips)
virtual ~EcalFenixMaxof2()