CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalFenixStripFormatEB.cc
Go to the documentation of this file.
5 
7 
9 
11  int input_even, int inputEvenPeak, int input_odd, int inputOddPeak, int inputsFGVB) {
12  inputsFGVB_ = inputsFGVB;
13  inputEvenPeak_ = inputEvenPeak;
14  input_even_ = input_even;
15  inputOddPeak_ = inputOddPeak;
16  input_odd_ = input_odd;
17  return 0;
18 }
19 
21  int even_output = 0;
22  int odd_output = 0;
23 
25  even_output = input_even_ >> shift_;
26  } else {
27  if (inputEvenPeak_ == 1)
28  even_output = input_even_ >> shift_;
29  }
30 
32  if (inputOddPeak_ == 1)
33  odd_output = input_odd_ >> shift_;
34  } else {
35  odd_output = input_odd_ >> shift_;
36  }
37 
38  // Prepare the amplitude output for the strip looking at the TPmode options
39  int output = 0;
40  bool is_odd_larger = false;
41  if (ecaltpgTPMode_->EnableEBOddFilter && odd_output > even_output)
42  is_odd_larger =
43  true; // If running with odd filter enabled, check if odd output is larger regardless of strip formatter output mode
45  case 0: // even filter out
46  output = even_output;
47  break;
48  case 1: // odd filter out
50  output = odd_output;
51  else
52  output = even_output;
53  break;
54  case 2: // larger between odd and even
55  if (ecaltpgTPMode_->EnableEBOddFilter && odd_output > even_output) {
56  output = odd_output;
57  } else
58  output = even_output;
59  break;
60  case 3: // even + odd
62  output = even_output + odd_output;
63  else
64  output = even_output;
65  break;
66  }
67 
68  if (output > 0XFFF)
69  output = 0XFFF; // ok: barrel saturates at 12 bits
70 
71  // Info bits
72  // bit12 is sFGVB, bit13 is for odd>even flagging
73  output |= ((inputsFGVB_ & 0x1) << 12);
74 
75  // if the flagging mode is OFF the bit stays 0, since it is not used for other things
77  output |= ((is_odd_larger & 0x1) << 13);
78  }
79 
80  return output;
81 }
82 
83 void EcalFenixStripFormatEB::process(std::vector<int> &sFGVBout,
84  std::vector<int> &peakout_even,
85  std::vector<int> &filtout_even,
86  std::vector<int> &peakout_odd,
87  std::vector<int> &filtout_odd,
88  std::vector<int> &output) {
89  if (peakout_even.size() != filtout_even.size() || sFGVBout.size() != filtout_even.size() ||
90  peakout_odd.size() != filtout_odd.size() || filtout_odd.size() != filtout_even.size()) {
91  edm::LogWarning("EcalTPG") << " problem in EcalFenixStripFormatEB: sfgvb_out, peak_out and "
92  "filt_out don't have the same size";
93  }
94  for (unsigned int i = 0; i < filtout_even.size(); i++) {
95  setInput(filtout_even[i], peakout_even[i], filtout_odd[i], peakout_odd[i], sFGVBout[i]);
96  output[i] = process();
97  }
98  return;
99 }
100 
102  const EcalTPGSlidingWindow *&slWin,
103  const EcalTPGTPMode *ecaltptTPMode) {
104  // TP mode contains options for the formatter (odd/even filters config)
105  ecaltpgTPMode_ = ecaltptTPMode;
106  const EcalTPGSlidingWindowMap &slwinmap = slWin->getMap();
107  EcalTPGSlidingWindowMapIterator it = slwinmap.find(id);
108  if (it != slwinmap.end())
109  shift_ = (*it).second;
110  else
111  edm::LogWarning("EcalTPG") << " could not find EcalTPGSlidingWindowMap entry for " << id;
112 }
const std::map< uint32_t, uint32_t > & getMap() const
uint16_t FenixEBStripOutput
Definition: EcalTPGTPMode.h:23
uint16_t *__restrict__ id
int setInput(int input_even, int inputEvenPeak, int input_odd, int inputOddPeak, int inputsFGVB)
uint16_t FenixEBStripInfobit2
Definition: EcalTPGTPMode.h:25
std::map< uint32_t, uint32_t > EcalTPGSlidingWindowMap
bool DisableEBEvenPeakFinder
Definition: EcalTPGTPMode.h:21
bool EnableEBOddPeakFinder
Definition: EcalTPGTPMode.h:19
const EcalTPGTPMode * ecaltpgTPMode_
Log< level::Warning, false > LogWarning
void setParameters(uint32_t &, const EcalTPGSlidingWindow *&, const EcalTPGTPMode *)
bool EnableEBOddFilter
Definition: EcalTPGTPMode.h:17
std::map< uint32_t, uint32_t >::const_iterator EcalTPGSlidingWindowMapIterator