File indexing completed on 2024-04-06 12:20:42
0001 #include "L1Trigger/L1THGCal/interface/veryfrontend/HGCalVFESummationImpl.h"
0002
0003 HGCalVFESummationImpl::HGCalVFESummationImpl(const edm::ParameterSet& conf)
0004 : lsb_silicon_fC_(conf.getParameter<double>("siliconCellLSB_fC")),
0005 lsb_scintillator_MIP_(conf.getParameter<double>("scintillatorCellLSB_MIP")) {
0006 constexpr unsigned nThickness = 3;
0007 thresholds_silicon_ =
0008 conf.getParameter<edm::ParameterSet>("noiseSilicon").getParameter<std::vector<double>>("values");
0009 if (thresholds_silicon_.size() != nThickness) {
0010 throw cms::Exception("Configuration") << thresholds_silicon_.size() << " silicon thresholds are given instead of "
0011 << nThickness << " (the number of sensor thicknesses)";
0012 }
0013 threshold_scintillator_ = conf.getParameter<edm::ParameterSet>("noiseScintillator").getParameter<double>("noise_MIP");
0014 const auto threshold = conf.getParameter<double>("noiseThreshold");
0015 std::transform(
0016 thresholds_silicon_.begin(), thresholds_silicon_.end(), thresholds_silicon_.begin(), [threshold](auto noise) {
0017 return noise * threshold;
0018 });
0019 threshold_scintillator_ *= threshold;
0020 }
0021
0022 void HGCalVFESummationImpl::triggerCellSums(const std::vector<std::pair<DetId, uint32_t>>& input_dataframes,
0023 std::unordered_map<uint32_t, uint32_t>& triggercells) {
0024 if (input_dataframes.empty())
0025 return;
0026
0027 for (const auto& [cellid, value] : input_dataframes) {
0028
0029 uint32_t value_zero_suppressed = value;
0030 if (triggerTools_.isSilicon(cellid)) {
0031 int thickness = triggerTools_.thicknessIndex(cellid);
0032 double threshold = thresholds_silicon_.at(thickness);
0033 value_zero_suppressed = (value * lsb_silicon_fC_ > threshold ? value : 0);
0034 } else if (triggerTools_.isScintillator(cellid)) {
0035 value_zero_suppressed = (value * lsb_scintillator_MIP_ > threshold_scintillator_ ? value : 0);
0036 }
0037 if (value_zero_suppressed == 0)
0038 continue;
0039
0040
0041 uint32_t tcid = triggerTools_.getTriggerGeometry()->getTriggerCellFromCell(cellid);
0042 triggercells.emplace(tcid, 0);
0043
0044
0045 triggercells[tcid] += value_zero_suppressed;
0046 }
0047 }