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) : nbMaxStrips_(nbMaxStrips) {
6  std::vector<int> vec(maxNrSamples, 0);
7  for (int i2strip = 0; i2strip < nbMaxStrips_ - 1; ++i2strip)
8  sumby2_.push_back(vec);
9 }
10 
12 
14  std::vector<std::vector<int>> &bypasslinout, int nstrip, int bitMask, int bitOddEven, std::vector<int> &output) {
15  int mask = (1 << bitMask) - 1;
16  bool strip_oddmask[nstrip][output.size()];
17 
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  // Prepare also the mask of strips to be avoided because of the odd>even energy flag
25  for (int istrip = 0; istrip < nstrip; ++istrip) {
26  for (unsigned int i = 0; i < output.size(); i++) {
27  if ((bypasslinout[istrip][i] >> bitOddEven) & 1)
28  strip_oddmask[istrip][i] = false;
29  else
30  strip_oddmask[istrip][i] = true;
31  }
32  }
33 
34  for (unsigned int i = 0; i < output.size(); i++) {
35  if (nstrip - 1 == 0) {
36  output[i] = strip_oddmask[0][i] * ((bypasslinout[0][i]) & mask);
37  } else {
38  for (int i2strip = 0; i2strip < nstrip - 1; ++i2strip) {
39  sumby2_[i2strip][i] = strip_oddmask[i2strip][i] * ((bypasslinout[i2strip][i]) & mask) +
40  strip_oddmask[i2strip + 1][i] * ((bypasslinout[i2strip + 1][i]) & mask);
41  if (sumby2_[i2strip][i] > output[i]) {
42  output[i] = sumby2_[i2strip][i];
43  }
44  }
45  }
46  }
47  return;
48 }
std::vector< std::vector< int > > sumby2_
EcalFenixMaxof2(int maxNrSamples, int nbMaxStrips)
void process(std::vector< std::vector< int >> &, int nStr, int bitMask, int bitOddEven, std::vector< int > &out)
virtual ~EcalFenixMaxof2()
Definition: output.py:1