CMS 3D CMS Logo

HGCalVFEProcessorSums.cc
Go to the documentation of this file.
2 
4 
7  std::make_unique<HGCalVFELinearizationImpl>(conf.getParameter<edm::ParameterSet>("linearizationCfg_si"));
9  std::make_unique<HGCalVFELinearizationImpl>(conf.getParameter<edm::ParameterSet>("linearizationCfg_sc"));
10 
11  vfeSummationImpl_ = std::make_unique<HGCalVFESummationImpl>(conf.getParameter<edm::ParameterSet>("summationCfg"));
12 
14  std::make_unique<HGCalVFECompressionImpl>(conf.getParameter<edm::ParameterSet>("compressionCfg_ldm"));
16  std::make_unique<HGCalVFECompressionImpl>(conf.getParameter<edm::ParameterSet>("compressionCfg_hdm"));
17 
19  std::make_unique<HGCalTriggerCellCalibration>(conf.getParameter<edm::ParameterSet>("calibrationCfg_ee"));
21  std::make_unique<HGCalTriggerCellCalibration>(conf.getParameter<edm::ParameterSet>("calibrationCfg_hesi"));
23  std::make_unique<HGCalTriggerCellCalibration>(conf.getParameter<edm::ParameterSet>("calibrationCfg_hesc"));
25  std::make_unique<HGCalTriggerCellCalibration>(conf.getParameter<edm::ParameterSet>("calibrationCfg_nose"));
26 }
27 
29  l1t::HGCalTriggerCellBxCollection& triggerCellColl,
30  const edm::EventSetup& es) {
31  vfeSummationImpl_->eventSetup(es);
32  calibrationEE_->eventSetup(es);
33  calibrationHEsi_->eventSetup(es);
34  calibrationHEsc_->eventSetup(es);
35  calibrationNose_->eventSetup(es);
37 
38  std::vector<HGCalDataFrame> dataframes;
39  std::vector<std::pair<DetId, uint32_t>> linearized_dataframes;
40  std::unordered_map<uint32_t, uint32_t> tc_payload;
41  std::unordered_map<uint32_t, std::array<uint32_t, 2>> tc_compressed_payload;
42 
43  // Remove disconnected modules and invalid cells
44  for (const auto& digiData : digiColl) {
45  if (DetId(digiData.id()).det() == DetId::Hcal && HcalDetId(digiData.id()).subdetId() != HcalEndcap)
46  continue;
47  if (!geometry_->validCell(digiData.id()))
48  continue;
49  uint32_t module = geometry_->getModuleFromCell(digiData.id());
50 
51  // no disconnected layer for HFNose
52  if (DetId(digiData.id()).subdetId() != ForwardSubdetector::HFNose) {
53  if (geometry_->disconnectedModule(module))
54  continue;
55  }
56 
57  dataframes.emplace_back(digiData.id());
58  for (int i = 0; i < digiData.size(); i++) {
59  dataframes.back().setSample(i, digiData.sample(i));
60  }
61  }
62  if (dataframes.empty())
63  return;
64 
65  constexpr int kHighDensityThickness = 0;
66  bool isSilicon = triggerTools_.isSilicon(dataframes[0].id());
67  bool isEM = triggerTools_.isEm(dataframes[0].id());
68  bool isNose = triggerTools_.isNose(dataframes[0].id());
69  int thickness = triggerTools_.thicknessIndex(dataframes[0].id(), true);
70  // Linearization of ADC and TOT values to the same LSB
71  if (isSilicon) {
72  vfeLinearizationSiImpl_->linearize(dataframes, linearized_dataframes);
73  } else {
74  vfeLinearizationScImpl_->linearize(dataframes, linearized_dataframes);
75  }
76  // Sum of sensor cells into trigger cells
77  vfeSummationImpl_->triggerCellSums(linearized_dataframes, tc_payload);
78  // Compression of trigger cell charges to a floating point format
79  if (thickness == kHighDensityThickness) {
80  vfeCompressionHDMImpl_->compress(tc_payload, tc_compressed_payload);
81  } else {
82  vfeCompressionLDMImpl_->compress(tc_payload, tc_compressed_payload);
83  }
84 
85  // Transform map to trigger cell vector
86  for (const auto& [tc_id, tc_value] : tc_payload) {
87  if (tc_value > 0) {
88  const auto& [tc_compressed_code, tc_compressed_value] = tc_compressed_payload[tc_id];
89  l1t::HGCalTriggerCell triggerCell(reco::LeafCandidate::LorentzVector(), tc_compressed_value, 0, 0, 0, tc_id);
90  triggerCell.setCompressedCharge(tc_compressed_code);
91  triggerCell.setUncompressedCharge(tc_value);
93 
94  // 'value' is hardware, so p4 is meaningless, except for eta and phi
95  math::PtEtaPhiMLorentzVector p4((double)tc_compressed_value / cosh(point.eta()), point.eta(), point.phi(), 0.);
96  triggerCell.setP4(p4);
97  triggerCell.setPosition(point);
98 
99  // calibration
100  if (triggerCell.hwPt() > 0) {
101  l1t::HGCalTriggerCell calibratedtriggercell(triggerCell);
102  if (isNose) {
103  calibrationNose_->calibrateInGeV(calibratedtriggercell);
104  } else if (isSilicon) {
105  if (isEM) {
106  calibrationEE_->calibrateInGeV(calibratedtriggercell);
107  } else {
108  calibrationHEsi_->calibrateInGeV(calibratedtriggercell);
109  }
110  } else {
111  calibrationHEsc_->calibrateInGeV(calibratedtriggercell);
112  }
113  triggerCellColl.push_back(0, calibratedtriggercell);
114  }
115  }
116  }
117 }
HGCalVFEProcessorSums::vfeLinearizationSiImpl_
std::unique_ptr< HGCalVFELinearizationImpl > vfeLinearizationSiImpl_
Definition: HGCalVFEProcessorSums.h:21
HGCalVFEProcessorSums::calibrationNose_
std::unique_ptr< HGCalTriggerCellCalibration > calibrationNose_
Definition: HGCalVFEProcessorSums.h:29
DigiToRawDM_cff.digiColl
digiColl
Definition: DigiToRawDM_cff.py:32
HGCalVFEProcessorSums::calibrationEE_
std::unique_ptr< HGCalTriggerCellCalibration > calibrationEE_
Definition: HGCalVFEProcessorSums.h:26
HGCalVFEProcessorSums::vfeSummationImpl_
std::unique_ptr< HGCalVFESummationImpl > vfeSummationImpl_
Definition: HGCalVFEProcessorSums.h:23
HGCalTriggerTools::eventSetup
void eventSetup(const edm::EventSetup &)
Definition: HGCalTriggerTools.cc:35
mps_fire.i
i
Definition: mps_fire.py:428
HGCalTriggerGeometryBase::disconnectedModule
virtual bool disconnectedModule(const unsigned module_id) const =0
HGCalTriggerGeometryBase::validCell
virtual bool validCell(const unsigned cell_id) const =0
DetId::Hcal
Definition: DetId.h:28
HGCalVFEProcessorSums
Definition: HGCalVFEProcessorSums.h:12
HGCalTriggerTools::thicknessIndex
int thicknessIndex(const DetId &, bool tc=false) const
Definition: HGCalTriggerTools.cc:233
edm::SortedCollection
Definition: SortedCollection.h:49
HGCalTriggerGeometryBase::getModuleFromCell
virtual unsigned getModuleFromCell(const unsigned cell_det_id) const =0
HGCalVFEProcessorSums::HGCalVFEProcessorSums
HGCalVFEProcessorSums(const edm::ParameterSet &conf)
Definition: HGCalVFEProcessorSums.cc:5
HGCalTriggerTools::isSilicon
bool isSilicon(const DetId &) const
Definition: HGCalTriggerTools.cc:181
HGCalVFEProcessorSums::calibrationHEsc_
std::unique_ptr< HGCalTriggerCellCalibration > calibrationHEsc_
Definition: HGCalVFEProcessorSums.h:28
BXVector
Definition: BXVector.h:15
HGCalVFEProcessorSums::vfeCompressionHDMImpl_
std::unique_ptr< HGCalVFECompressionImpl > vfeCompressionHDMImpl_
Definition: HGCalVFEProcessorSums.h:25
DetId
Definition: DetId.h:17
l1t::HGCalTriggerCell::setCompressedCharge
void setCompressedCharge(uint32_t value)
Definition: HGCalTriggerCell.h:36
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:114
HFNose
Definition: ForwardSubdetector.h:11
l1t::HGCalTriggerCell
Definition: HGCalTriggerCell.h:14
Point3DBase< float, GlobalTag >
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
HGCalVFEProcessorSums::run
void run(const HGCalDigiCollection &digiColl, l1t::HGCalTriggerCellBxCollection &triggerCellColl, const edm::EventSetup &es) override
Definition: HGCalVFEProcessorSums.cc:28
HGCalTriggerTools::isNose
bool isNose(const DetId &) const
Definition: HGCalTriggerTools.cc:170
HGCalTriggerTools::isEm
bool isEm(const DetId &) const
Definition: HGCalTriggerTools.cc:151
HGCalVFEProcessorSums::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalVFEProcessorSums.h:31
edm::ParameterSet
Definition: ParameterSet.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
HGCalProcessorBaseT::geometry_
const HGCalTriggerGeometryBase * geometry_
Definition: HGCalProcessorBaseT.h:26
HcalDetId
Definition: HcalDetId.h:12
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::EventSetup
Definition: EventSetup.h:57
HGCalVFEProcessorSums::vfeCompressionLDMImpl_
std::unique_ptr< HGCalVFECompressionImpl > vfeCompressionLDMImpl_
Definition: HGCalVFEProcessorSums.h:24
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
HGCalVFEProcessorSums.h
HcalEndcap
Definition: HcalAssistant.h:34
l1t::HGCalTriggerCell::setPosition
void setPosition(const GlobalPoint &position)
Definition: HGCalTriggerCell.h:23
HGCalTriggerGeometryBase::getTriggerCellPosition
virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const =0
l1t::L1Candidate::hwPt
int hwPt() const
Definition: L1Candidate.h:35
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
l1t::HGCalTriggerCell::setUncompressedCharge
void setUncompressedCharge(uint32_t value)
Definition: HGCalTriggerCell.h:33
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
BXVector::push_back
void push_back(int bx, T object)
HGCalVFEProcessorSums::calibrationHEsi_
std::unique_ptr< HGCalTriggerCellCalibration > calibrationHEsi_
Definition: HGCalVFEProcessorSums.h:27
HGCalProcessorBaseT
Definition: HGCalProcessorBaseT.h:10
HGCalVFEProcessorSums::vfeLinearizationScImpl_
std::unique_ptr< HGCalVFELinearizationImpl > vfeLinearizationScImpl_
Definition: HGCalVFEProcessorSums.h:22
reco::LeafCandidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23