Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:39

0001 #include "L1Trigger/L1THGCal/interface/backend/HGCalBackendLayer1Processor.h"
0002 
0003 DEFINE_EDM_PLUGIN(HGCalBackendLayer1Factory, HGCalBackendLayer1Processor, "HGCalBackendLayer1Processor");
0004 
0005 HGCalBackendLayer1Processor::HGCalBackendLayer1Processor(const edm::ParameterSet& conf)
0006     : HGCalBackendLayer1ProcessorBase(conf) {
0007   clusteringDummy_ = std::make_unique<HGCalClusteringDummyImpl>(conf.getParameterSet("C2d_parameters"));
0008   truncation_ = std::make_unique<HGCalStage1TruncationImpl>(conf.getParameterSet("truncation_parameters"));
0009 }
0010 
0011 void HGCalBackendLayer1Processor::run(const edm::Handle<l1t::HGCalTriggerCellBxCollection>& collHandle,
0012                                       l1t::HGCalClusterBxCollection& collCluster2D) {
0013   if (clusteringDummy_)
0014     clusteringDummy_->setGeometry(geometry());
0015   if (truncation_)
0016     truncation_->setGeometry(geometry());
0017 
0018   std::unordered_map<uint32_t, std::vector<edm::Ptr<l1t::HGCalTriggerCell>>> tcs_per_fpga;
0019 
0020   for (unsigned i = 0; i < collHandle->size(); ++i) {
0021     edm::Ptr<l1t::HGCalTriggerCell> tc_ptr(collHandle, i);
0022     uint32_t module = geometry()->getModuleFromTriggerCell(tc_ptr->detId());
0023     uint32_t fpga = geometry()->getStage1FpgaFromModule(module);
0024     tcs_per_fpga[fpga].push_back(tc_ptr);
0025   }
0026 
0027   std::vector<edm::Ptr<l1t::HGCalTriggerCell>> truncated_tcs;
0028   for (auto& fpga_tcs : tcs_per_fpga) {
0029     truncation_->run(fpga_tcs.first, fpga_tcs.second, truncated_tcs);
0030   }
0031   clusteringDummy_->clusterizeDummy(truncated_tcs, collCluster2D);
0032 }