CMS 3D CMS Logo

HGCalVFESummationImpl.cc
Go to the documentation of this file.
2 
4  : thickness_corrections_(conf.getParameter<std::vector<double>>("ThicknessCorrections")),
5  lsb_silicon_fC_(conf.getParameter<double>("siliconCellLSB_fC")),
6  lsb_scintillator_MIP_(conf.getParameter<double>("scintillatorCellLSB_MIP")),
7  thresholds_silicon_(conf.getParameter<std::vector<double>>("thresholdsSilicon")),
8  threshold_scintillator_(conf.getParameter<double>("thresholdScintillator")) {
9  const unsigned nThickness = 3;
10  if (thickness_corrections_.size() != nThickness) {
11  throw cms::Exception("Configuration")
12  << thickness_corrections_.size() << " thickness corrections are given instead of " << nThickness
13  << " (the number of sensor thicknesses)";
14  }
15  if (thresholds_silicon_.size() != nThickness) {
16  throw cms::Exception("Configuration") << thresholds_silicon_.size() << " silicon thresholds are given instead of "
17  << nThickness << " (the number of sensor thicknesses)";
18  }
19 }
20 
22  const std::vector<std::pair<DetId, uint32_t>>& linearized_dataframes,
23  std::unordered_map<uint32_t, uint32_t>& payload) {
24  if (linearized_dataframes.empty())
25  return;
26  // sum energies in trigger cells
27  for (const auto& frame : linearized_dataframes) {
28  DetId cellid(frame.first);
29  uint32_t value = frame.second;
30 
31  // Apply noise threshold before summing into trigger cells
32  if (triggerTools_.isSilicon(cellid)) {
33  int thickness = triggerTools_.thicknessIndex(cellid);
34  double threshold = thresholds_silicon_.at(thickness);
35  value = (value * lsb_silicon_fC_ > threshold ? value : 0);
36  } else if (triggerTools_.isScintillator(cellid)) {
37  value = (value * lsb_scintillator_MIP_ > threshold_scintillator_ ? value : 0);
38  }
39  if (value == 0)
40  continue;
41 
42  // find trigger cell associated to cell
43  uint32_t tcid = geometry.getTriggerCellFromCell(cellid);
44  payload.emplace(tcid, 0); // do nothing if key exists already
45 
46  // equalize value among cell thicknesses for Silicon parts
47  if (triggerTools_.isSilicon(cellid)) {
48  int thickness = triggerTools_.thicknessIndex(cellid);
49  double thickness_correction = thickness_corrections_.at(thickness);
50  value = (double)value * thickness_correction;
51  }
52 
53  // sums energy for the same trigger cell id
54  payload[tcid] += value; // 32 bits integer should be largely enough
55  }
56 }
bool isScintillator(const DetId &id) const
HGCalVFESummationImpl(const edm::ParameterSet &conf)
HGCalTriggerTools triggerTools_
std::vector< double > thresholds_silicon_
std::vector< double > thickness_corrections_
Definition: value.py:1
Definition: DetId.h:18
int thicknessIndex(const DetId &, bool tc=false) const
bool isSilicon(const DetId &) const
void triggerCellSums(const HGCalTriggerGeometryBase &, const std::vector< std::pair< DetId, uint32_t > > &, std::unordered_map< uint32_t, uint32_t > &payload)
virtual unsigned getTriggerCellFromCell(const unsigned cell_det_id) const =0