CMS 3D CMS Logo

HGCalVFEProcessorSums.cc
Go to the documentation of this file.
2 #include <limits>
3 
6 
8 
10  vfeLinearizationImpl_ = std::make_unique<HGCalVFELinearizationImpl>(conf);
11  vfeSummationImpl_ = std::make_unique<HGCalVFESummationImpl>(conf);
12  vfeCompressionImpl_ = std::make_unique<HGCalVFECompressionImpl>(conf);
13  calibration_ = std::make_unique<HGCalTriggerCellCalibration>(conf);
14 }
15 
17  l1t::HGCalTriggerCellBxCollection& triggerCellColl,
18  const edm::EventSetup& es) {
19  vfeSummationImpl_->eventSetup(es);
20  calibration_->eventSetup(es);
21 
22  std::vector<HGCalDataFrame> dataframes;
23  std::vector<std::pair<DetId, uint32_t>> linearized_dataframes;
24  std::unordered_map<uint32_t, uint32_t> payload;
25  std::unordered_map<uint32_t, std::array<uint32_t, 2>> compressed_payload;
26 
27  // convert ee and fh hit collections into the same object
28  for (const auto& digiData : digiColl) {
29  if (DetId(digiData.id()).det() == DetId::Hcal && HcalDetId(digiData.id()).subdetId() != HcalEndcap)
30  continue;
31  uint32_t module = geometry_->getModuleFromCell(digiData.id());
32  if (geometry_->disconnectedModule(module))
33  continue;
34  dataframes.emplace_back(digiData.id());
35  for (int i = 0; i < digiData.size(); i++) {
36  dataframes.back().setSample(i, digiData.sample(i));
37  }
38  }
39 
40  vfeLinearizationImpl_->linearize(dataframes, linearized_dataframes);
41  vfeSummationImpl_->triggerCellSums(*geometry_, linearized_dataframes, payload);
42  vfeCompressionImpl_->compress(payload, compressed_payload);
43 
44  // Transform map to trigger cell vector vector<HGCalTriggerCell>
45  for (const auto& id_value : payload) {
46  if (id_value.second > 0) {
47  l1t::HGCalTriggerCell triggerCell(
48  reco::LeafCandidate::LorentzVector(), compressed_payload[id_value.first][1], 0, 0, 0, id_value.first);
49  triggerCell.setCompressedCharge(compressed_payload[id_value.first][0]);
50  triggerCell.setUncompressedCharge(id_value.second);
52 
53  // 'value' is hardware, so p4 is meaningless, except for eta and phi
54  math::PtEtaPhiMLorentzVector p4((double)id_value.second / cosh(point.eta()), point.eta(), point.phi(), 0.);
55  triggerCell.setP4(p4);
56  triggerCell.setPosition(point);
57 
58  // calibration part ---------------------------
59  if (triggerCell.hwPt() > 0) {
60  l1t::HGCalTriggerCell calibratedtriggercell(triggerCell);
61  calibration_->calibrateInGeV(calibratedtriggercell);
62  triggerCellColl.push_back(0, calibratedtriggercell);
63  }
64  }
65  }
66 }
void run(const HGCalDigiCollection &digiColl, l1t::HGCalTriggerCellBxCollection &triggerCellColl, const edm::EventSetup &es) override
const HGCalTriggerGeometryBase * geometry_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
HGCalVFEProcessorSums(const edm::ParameterSet &conf)
std::unique_ptr< HGCalVFECompressionImpl > vfeCompressionImpl_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
double p4[4]
Definition: TauolaWrapper.h:92
void setCompressedCharge(uint32_t value)
std::unique_ptr< HGCalVFELinearizationImpl > vfeLinearizationImpl_
virtual bool disconnectedModule(const unsigned module_id) const =0
virtual unsigned getModuleFromCell(const unsigned cell_det_id) const =0
Definition: DetId.h:18
int hwPt() const
Definition: L1Candidate.h:48
std::unique_ptr< HGCalVFESummationImpl > vfeSummationImpl_
void setUncompressedCharge(uint32_t value)
T eta() const
Definition: PV3DBase.h:76
std::unique_ptr< HGCalTriggerCellCalibration > calibration_
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: vlib.h:208
void setPosition(const GlobalPoint &position)
void setP4(const LorentzVector &p4) final
set 4-momentum
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23
*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
virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const =0
void push_back(int bx, T object)