CMS 3D CMS Logo

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 
24  // Applying sliding window on the strip output after the peak finder
26  even_output = input_even_ >> shift_;
27  } else {
28  if (inputEvenPeak_ == 1)
29  even_output = input_even_ >> shift_;
30  }
31 
33  if (inputOddPeak_ == 1)
34  odd_output = input_odd_ >> shift_;
35  } else {
36  odd_output = input_odd_ >> shift_;
37  }
38 
39  // Truncating the signals to 12 bit after peak finder sliding window
40  if (odd_output > 0XFFF)
41  odd_output = 0XFFF;
42  if (even_output > 0XFFF)
43  even_output = 0XFFF;
44 
45  // Prepare the amplitude output for the strip looking at the TPmode options
46  int output = 0;
47  bool is_odd_larger = false;
48  if (ecaltpgTPMode_->EnableEBOddFilter && odd_output > even_output)
49  is_odd_larger =
50  true; // If running with odd filter enabled, check if odd output is larger regardless of strip formatter output mode
52  case 0: // even filter out
53  output = even_output;
54  break;
55  case 1: // odd filter out
57  output = odd_output;
58  else
59  output = even_output;
60  break;
61  case 2: // larger between odd and even
62  if (ecaltpgTPMode_->EnableEBOddFilter && odd_output > even_output) {
63  output = odd_output;
64  } else
65  output = even_output;
66  break;
67  case 3: // even + odd
69  output = even_output + odd_output;
70  else
71  output = even_output;
72  break;
73  }
74 
75  if (output > 0XFFF)
76  output = 0XFFF; // ok: barrel saturates at 12 bits
77 
78  // Info bits
79  // bit12 is sFGVB, bit13 is for odd>even flagging
80  output |= ((inputsFGVB_ & 0x1) << 12);
81 
82  // if the flagging mode is OFF the bit stays 0, since it is not used for other things
84  output |= ((is_odd_larger & 0x1) << 13);
85  }
86 
87  return output;
88 }
89 
90 void EcalFenixStripFormatEB::process(std::vector<int> &sFGVBout,
91  std::vector<int> &peakout_even,
92  std::vector<int> &filtout_even,
93  std::vector<int> &peakout_odd,
94  std::vector<int> &filtout_odd,
95  std::vector<int> &output) {
96  if (peakout_even.size() != filtout_even.size() || sFGVBout.size() != filtout_even.size() ||
97  peakout_odd.size() != filtout_odd.size() || filtout_odd.size() != filtout_even.size()) {
98  edm::LogWarning("EcalTPG") << " problem in EcalFenixStripFormatEB: sfgvb_out, peak_out and "
99  "filt_out don't have the same size";
100  }
101  for (unsigned int i = 0; i < filtout_even.size(); i++) {
102  setInput(filtout_even[i], peakout_even[i], filtout_odd[i], peakout_odd[i], sFGVBout[i]);
103  output[i] = process();
104  }
105  return;
106 }
107 
109  const EcalTPGSlidingWindow *&slWin,
110  const EcalTPGTPMode *ecaltptTPMode) {
111  // TP mode contains options for the formatter (odd/even filters config)
112  ecaltpgTPMode_ = ecaltptTPMode;
113  const EcalTPGSlidingWindowMap &slwinmap = slWin->getMap();
114  EcalTPGSlidingWindowMapIterator it = slwinmap.find(id);
115  if (it != slwinmap.end())
116  shift_ = (*it).second;
117  else
118  edm::LogWarning("EcalTPG") << " could not find EcalTPGSlidingWindowMap entry for " << id;
119 }
const std::map< uint32_t, uint32_t > & getMap() const
uint16_t FenixEBStripOutput
Definition: EcalTPGTPMode.h:23
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_
Definition: output.py:1
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