Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:55:29

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") {
0025     pt_assign_engine_ = std::make_unique<PtAssignmentEngine2017>();
0026   } else if (era() == "Run3_2021") {
0027     pt_assign_engine_ = std::make_unique<PtAssignmentEngine2017>();  //TODO - implement ver 2021
0028   } else {
0029     throw cms::Exception("L1TMuonEndCap") << "Cannot recognize the era option: " << era();
0030   }
0031 
0032   // No era setup for displaced pT assignment engine
0033   pt_assign_engine_dxy_ = std::make_unique<PtAssignmentEngineDxy>();
0034 
0035   emtf_assert(pt_assign_engine_ != nullptr);
0036   emtf_assert(pt_assign_engine_dxy_ != nullptr);
0037 }
0038 
0039 EMTFSetup::~EMTFSetup() {}
0040 
0041 void EMTFSetup::reload(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0042   // Get the geometry for TP conversions
0043   geometry_translator_.checkAndUpdateGeometry(iSetup);
0044 
0045   // Get the conditions, primarily the firmware version and the BDT forests
0046   condition_helper_.checkAndUpdateConditions(iSetup);
0047 
0048   // Set version numbers
0049   fw_ver_ = condition_helper_.get_fw_version();
0050   pt_lut_ver_ = condition_helper_.get_pt_lut_version();
0051   pc_lut_ver_ = condition_helper_.get_pc_lut_version();
0052 
0053   if (!useO2O()) {
0054     // Currently, do not modify fw_ver_ and pt_lut_ver_
0055     pc_lut_ver_ = condition_helper_.get_pc_lut_version_unchecked();
0056   }
0057 
0058   // Do run-dependent configuration. This may overwrite the configurables passed by the python config file
0059   version_control_.configure_by_fw_version(get_fw_version());
0060 
0061   // Reload primitive conversion LUTs if necessary
0062   sector_processor_lut_.read(iEvent.isRealData(), get_pc_lut_version());
0063 
0064   // Reload pT LUT if necessary
0065   pt_assign_engine_->load(get_pt_lut_version(), condition_helper_.getForest());
0066 
0067   return;
0068 }