CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HGCalVFESummationImpl.cc
Go to the documentation of this file.
2 
4  : lsb_silicon_fC_(conf.getParameter<double>("siliconCellLSB_fC")),
5  lsb_scintillator_MIP_(conf.getParameter<double>("scintillatorCellLSB_MIP")) {
6  constexpr unsigned nThickness = 3;
8  conf.getParameter<edm::ParameterSet>("noiseSilicon").getParameter<std::vector<double>>("values");
9  if (thresholds_silicon_.size() != nThickness) {
10  throw cms::Exception("Configuration") << thresholds_silicon_.size() << " silicon thresholds are given instead of "
11  << nThickness << " (the number of sensor thicknesses)";
12  }
13  threshold_scintillator_ = conf.getParameter<edm::ParameterSet>("noiseScintillator").getParameter<double>("noise_MIP");
14  const auto threshold = conf.getParameter<double>("noiseThreshold");
17  return noise * threshold;
18  });
20 }
21 
22 void HGCalVFESummationImpl::triggerCellSums(const std::vector<std::pair<DetId, uint32_t>>& input_dataframes,
23  std::unordered_map<uint32_t, uint32_t>& triggercells) {
24  if (input_dataframes.empty())
25  return;
26  // sum energies in trigger cells
27  for (const auto& [cellid, value] : input_dataframes) {
28  // Apply noise threshold before summing into trigger cells
29  uint32_t value_zero_suppressed = value;
30  if (triggerTools_.isSilicon(cellid)) {
32  double threshold = thresholds_silicon_.at(thickness);
33  value_zero_suppressed = (value * lsb_silicon_fC_ > threshold ? value : 0);
34  } else if (triggerTools_.isScintillator(cellid)) {
35  value_zero_suppressed = (value * lsb_scintillator_MIP_ > threshold_scintillator_ ? value : 0);
36  }
37  if (value_zero_suppressed == 0)
38  continue;
39 
40  // find trigger cell associated to cell
41  uint32_t tcid = triggerTools_.getTriggerGeometry()->getTriggerCellFromCell(cellid);
42  triggercells.emplace(tcid, 0); // do nothing if key exists already
43 
44  // sums energy for the same trigger cell id
45  triggercells[tcid] += value_zero_suppressed; // 32 bits integer should be largely enough
46  }
47 }
bool isScintillator(const DetId &id) const
int thicknessIndex(const DetId &) const
HGCalVFESummationImpl(const edm::ParameterSet &conf)
HGCalTriggerTools triggerTools_
void triggerCellSums(const std::vector< std::pair< DetId, uint32_t > > &, std::unordered_map< uint32_t, uint32_t > &)
const HGCalTriggerGeometryBase * getTriggerGeometry() const
virtual unsigned getTriggerCellFromCell(const unsigned cell_det_id) const =0
std::vector< double > thresholds_silicon_
__shared__ int noise
bool isSilicon(const DetId &) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned transform(const HcalDetId &id, unsigned transformCode)