Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/L1THGCal/interface/HGCalProcessorBase.h"
0002 
0003 #include "DataFormats/L1THGCal/interface/HGCalTowerMap.h"
0004 #include "DataFormats/L1THGCal/interface/HGCalTower.h"
0005 
0006 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0007 #include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"
0008 #include "L1Trigger/L1THGCal/interface/backend/HGCalTowerMap2DImpl.h"
0009 #include "L1Trigger/L1THGCal/interface/backend/HGCalTowerMap3DImpl.h"
0010 
0011 #include "L1Trigger/L1THGCal/interface/HGCalAlgoWrapperBase.h"
0012 
0013 class HGCalTowerProcessorSA : public HGCalTowerProcessorBase {
0014 public:
0015   HGCalTowerProcessorSA(const edm::ParameterSet& conf) : HGCalTowerProcessorBase(conf), conf_(conf) {
0016     const std::string towerMapsAlgoName(
0017         conf.getParameterSet("towermap_parameters").getParameter<std::string>("AlgoName"));
0018     towerMapWrapper_ = std::unique_ptr<HGCalTowerMapsWrapperBase>{HGCalTowerMapsWrapperBaseFactory::get()->create(
0019         towerMapsAlgoName, conf.getParameterSet("towermap_parameters"))};
0020   }
0021 
0022   void run(const std::pair<edm::Handle<l1t::HGCalTowerMapBxCollection>, edm::Handle<l1t::HGCalClusterBxCollection>>&
0023                collHandle,
0024            l1t::HGCalTowerBxCollection& collTowers) override {
0025     auto& towerMapCollHandle = collHandle.first;
0026 
0027     /* create a persistent vector of pointers to the towerMaps */
0028     std::vector<edm::Ptr<l1t::HGCalTowerMap>> towerMapsPtrs;
0029     for (unsigned i = 0; i < towerMapCollHandle->size(); ++i) {
0030       towerMapsPtrs.emplace_back(towerMapCollHandle, i);
0031     }
0032 
0033     // Configuration
0034     const std::pair<const HGCalTriggerGeometryBase* const, const edm::ParameterSet&> configuration{geometry(), conf_};
0035     towerMapWrapper_->configure(configuration);
0036     towerMapWrapper_->process(towerMapsPtrs, collTowers);
0037   }
0038 
0039 private:
0040   edm::ESHandle<HGCalTriggerGeometryBase> triggerGeometry_;
0041 
0042   /* Standalone algorithm instance */
0043   std::unique_ptr<HGCalTowerMapsWrapperBase> towerMapWrapper_;
0044 
0045   const edm::ParameterSet conf_;
0046 };
0047 
0048 DEFINE_EDM_PLUGIN(HGCalTowerFactory, HGCalTowerProcessorSA, "HGCalTowerProcessorSA");