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 }
EcalFenixMaxof2::sumby2_
std::vector< std::vector< int > > sumby2_
Definition: EcalFenixMaxof2.h:28
mps_fire.i
i
Definition: mps_fire.py:428
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
EcalFenixMaxof2::EcalFenixMaxof2
EcalFenixMaxof2(int maxNrSamples, int nbMaxStrips)
Definition: EcalFenixMaxof2.cc:5
EcalFenixMaxof2::process
void process(std::vector< std::vector< int >> &, int nStr, int bitMask, int bitOddEven, std::vector< int > &out)
Definition: EcalFenixMaxof2.cc:13
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
EcalFenixMaxof2::nbMaxStrips_
int nbMaxStrips_
Definition: EcalFenixMaxof2.h:27
EcalFenixMaxof2.h
EcalFenixMaxof2::~EcalFenixMaxof2
virtual ~EcalFenixMaxof2()
Definition: EcalFenixMaxof2.cc:11