Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-26 23:26:57

0001 #include <memory>
0002 
0003 #include "L1Trigger/L1TMuonEndCap/interface/EMTFSetup.h"
0004 
0005 #include "FWCore/Utilities/interface/Exception.h"
0006 #include "FWCore/Framework/interface/ConsumesCollector.h"
0007 
0008 #include "L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngine2016.h"
0009 #include "L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngine2017.h"
0010 
0011 EMTFSetup::EMTFSetup(const edm::ParameterSet& iConfig, edm::ConsumesCollector iCollector)
0012     : geometry_translator_(iCollector),
0013       condition_helper_(iCollector),
0014       version_control_(iConfig),
0015       sector_processor_lut_(),
0016       pt_assign_engine_(nullptr),
0017       pt_assign_engine_dxy_(nullptr),
0018       fw_ver_(0),
0019       pt_lut_ver_(0),
0020       pc_lut_ver_(0) {
0021   // Set pt assignment engine according to Era
0022   if (era() == "Run2_2016") {
0023     pt_assign_engine_ = std::make_unique<PtAssignmentEngine2016>();
0024   } else if (era() == "Run2_2017" || era() == "Run2_2018" || era() == "Run3_2021" || era() == "Run3_2023" ||
0025              era() == "Run3_2024" || era() == "Run3_2025") {
0026     pt_assign_engine_ = std::make_unique<PtAssignmentEngine2017>();
0027   } else {
0028     throw cms::Exception("L1TMuonEndCap") << "Cannot recognize the era option: " << era();
0029   }
0030 
0031   // No era setup for displaced pT assignment engine
0032   pt_assign_engine_dxy_ = std::make_unique<PtAssignmentEngineDxy>();
0033 
0034   emtf_assert(pt_assign_engine_ != nullptr);
0035   emtf_assert(pt_assign_engine_dxy_ != nullptr);
0036 }
0037 
0038 EMTFSetup::~EMTFSetup() {}
0039 
0040 void EMTFSetup::reload(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0041   // Get the geometry for TP conversions
0042   geometry_translator_.checkAndUpdateGeometry(iSetup);
0043 
0044   // Get the conditions, primarily the firmware version and the BDT forests
0045   condition_helper_.checkAndUpdateConditions(iSetup);
0046 
0047   // Set version numbers
0048   fw_ver_ = condition_helper_.get_fw_version();
0049   pt_lut_ver_ = condition_helper_.get_pt_lut_version();
0050   pc_lut_ver_ = condition_helper_.get_pc_lut_version();
0051 
0052   if (!useO2O()) {
0053     // Currently, do not modify fw_ver_ and pt_lut_ver_
0054     pc_lut_ver_ = condition_helper_.get_pc_lut_version_unchecked();
0055   }
0056 
0057   // Do run-dependent configuration. This may overwrite the configurables passed by the python config file
0058   version_control_.configure_by_fw_version(get_fw_version());
0059 
0060   // Reload primitive conversion LUTs if necessary
0061   sector_processor_lut_.read(iEvent.isRealData(), get_pc_lut_version());
0062 
0063   // Reload pT LUT if necessary
0064   pt_assign_engine_->load(get_pt_lut_version(), condition_helper_.getForest());
0065 
0066   return;
0067 }