File indexing completed on 2024-04-06 12:19:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0022
0023
0024
0025
0026
0027 #include <iostream>
0028 #include <fstream>
0029 #include <string>
0030
0031
0032
0033
0034
0035 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0036 #include "FWCore/Utilities/interface/InputTag.h"
0037 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTReg.h"
0038 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTEtaLUT.h"
0039 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFCOUDeltaEtaLUT.h"
0040 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFDeltaEtaLUT.h"
0041 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFDisableHotLUT.h"
0042 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFEtaConvLUT.h"
0043 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFMatchQualLUT.h"
0044 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFMergeRankCombineLUT.h"
0045 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFMergeRankEtaPhiLUT.h"
0046 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFMergeRankEtaQLUT.h"
0047 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFMergeRankPtQLUT.h"
0048 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFOvlEtaConvLUT.h"
0049 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFPhiProEtaConvLUT.h"
0050 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFPhiProLUT.h"
0051 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFPtMixLUT.h"
0052 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankCombineLUT.h"
0053 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankEtaPhiLUT.h"
0054 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankEtaQLUT.h"
0055 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankPtQLUT.h"
0056 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUEtaConvLUT.h"
0057 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUEtaProLUT.h"
0058 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUPhiPro1LUT.h"
0059 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUPhiPro2LUT.h"
0060 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTPhiLUT.h"
0061
0062 #include "CondFormats/L1TObjects/interface/L1MuGMTScales.h"
0063 #include "CondFormats/L1TObjects/interface/L1MuGMTParameters.h"
0064 #include "CondFormats/L1TObjects/interface/L1MuGMTChannelMask.h"
0065
0066 #include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
0067
0068 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0069
0070
0071
0072
0073 using namespace std;
0074
0075
0076
0077
0078
0079 L1MuGMTConfig::L1MuGMTConfig(const edm::ParameterSet& ps) {
0080 m_DTInputTag = ps.getParameter<edm::InputTag>("DTCandidates");
0081 m_CSCInputTag = ps.getParameter<edm::InputTag>("CSCCandidates");
0082 m_RPCbInputTag = ps.getParameter<edm::InputTag>("RPCbCandidates");
0083 m_RPCfInputTag = ps.getParameter<edm::InputTag>("RPCfCandidates");
0084 m_MipIsoInputTag = ps.getParameter<edm::InputTag>("MipIsoData");
0085
0086 m_debug = true;
0087 m_dbgLevel = ps.getUntrackedParameter<int>("Debug", 0);
0088
0089
0090 m_BxMin = ps.getParameter<int>("BX_min");
0091 m_BxMax = ps.getParameter<int>("BX_max");
0092
0093
0094 m_BxMinRo = ps.getParameter<int>("BX_min_readout");
0095 m_BxMaxRo = ps.getParameter<int>("BX_max_readout");
0096 }
0097
0098
0099
0100
0101 L1MuGMTConfig::~L1MuGMTConfig() {}
0102
0103
0104
0105
0106
0107 void L1MuGMTConfig::setDefaults() {
0108
0109 m_EtaWeight_barrel = m_GMTParams->getEtaWeight_barrel();
0110 m_PhiWeight_barrel = m_GMTParams->getPhiWeight_barrel();
0111 m_EtaPhiThreshold_barrel = m_GMTParams->getEtaPhiThreshold_barrel();
0112
0113 m_EtaWeight_endcap = m_GMTParams->getEtaWeight_endcap();
0114 m_PhiWeight_endcap = m_GMTParams->getPhiWeight_endcap();
0115 m_EtaPhiThreshold_endcap = m_GMTParams->getEtaPhiThreshold_endcap();
0116
0117 m_EtaWeight_COU = m_GMTParams->getEtaWeight_COU();
0118 m_PhiWeight_COU = m_GMTParams->getPhiWeight_COU();
0119 m_EtaPhiThreshold_COU = m_GMTParams->getEtaPhiThreshold_COU();
0120
0121 m_CaloTrigger = m_GMTParams->getCaloTrigger();
0122 m_IsolationCellSizeEta = m_GMTParams->getIsolationCellSizeEta();
0123 m_IsolationCellSizePhi = m_GMTParams->getIsolationCellSizePhi();
0124
0125 m_DoOvlRpcAnd = m_GMTParams->getDoOvlRpcAnd();
0126
0127 m_PropagatePhi = m_GMTParams->getPropagatePhi();
0128
0129 m_VersionSortRankEtaQLUT = m_GMTParams->getVersionSortRankEtaQLUT();
0130 m_VersionLUTs = m_GMTParams->getVersionLUTs();
0131
0132 if (Debug(1)) {
0133 stringstream stdss;
0134 stdss << endl
0135 << "*******************************************" << endl
0136 << "**** L1 Global Muon Trigger settings : ****" << endl
0137 << "*******************************************" << endl
0138 << endl
0139
0140 << "L1 Global Muon Trigger : DTCandidates : " << m_DTInputTag << endl
0141 << "L1 Global Muon Trigger : CSCCandidates : " << m_CSCInputTag << endl
0142 << "L1 Global Muon Trigger : RPCbCandidates : " << m_RPCbInputTag << endl
0143 << "L1 Global Muon Trigger : RPCfCandidates : " << m_RPCfInputTag << endl
0144 << "L1 Global Muon Trigger : debug level : " << m_dbgLevel << endl
0145 << "L1 Global Muon Trigger : minimal bunch-crossing : " << m_BxMin << endl
0146 << "L1 Global Muon Trigger : maximal bunch-crossing : " << m_BxMax << endl
0147 << "L1 Global Muon Trigger : barrel eta weight : " << m_EtaWeight_barrel << endl
0148 << "L1 Global Muon Trigger : barrel phi weight : " << m_PhiWeight_barrel << endl
0149 << "L1 Global Muon Trigger : barrel eta-phi threshold : " << m_EtaPhiThreshold_barrel << endl
0150 << "L1 Global Muon Trigger : endcap eta weight : " << m_EtaWeight_endcap << endl
0151 << "L1 Global Muon Trigger : endcap phi weight : " << m_PhiWeight_endcap << endl
0152 << "L1 Global Muon Trigger : endcap eta-phi threshold : " << m_EtaPhiThreshold_endcap << endl
0153 << "L1 Global Muon Trigger : cancel out unit eta weight : " << m_EtaWeight_COU << endl
0154 << "L1 Global Muon Trigger : cancel out unit phi weight : " << m_PhiWeight_COU << endl
0155 << "L1 Global Muon Trigger : cancel out unit eta-phi threshold : " << m_EtaPhiThreshold_COU << endl
0156 << "L1 Global Muon Trigger : calorimeter trigger : " << m_CaloTrigger << endl
0157 << "L1 Global Muon Trigger : muon isolation cell size (eta) : " << m_IsolationCellSizeEta << endl
0158 << "L1 Global Muon Trigger : muon isolation cell size (phi) : " << m_IsolationCellSizePhi << endl
0159 << "L1 Global Muon Trigger : require confirmation by RPC in overlap region : " << m_DoOvlRpcAnd << endl
0160 << "L1 Global Muon Trigger : propagate phi to vertex : " << m_PropagatePhi << endl
0161 << "L1 Global Muon Trigger : version of low quality assignment LUT : " << m_VersionSortRankEtaQLUT << endl
0162 << "L1 Global Muon Trigger : general LUTs version : " << m_VersionLUTs << endl;
0163 edm::LogVerbatim("GMT_Config_info") << stdss.str();
0164 }
0165 }
0166
0167 void L1MuGMTConfig::createLUTsRegs() {
0168
0169 m_RegCDLConfig = new L1MuGMTRegCDLConfig();
0170 m_RegMMConfigPhi = new L1MuGMTRegMMConfigPhi();
0171 m_RegMMConfigEta = new L1MuGMTRegMMConfigEta();
0172 m_RegMMConfigPt = new L1MuGMTRegMMConfigPt();
0173 m_RegMMConfigCharge = new L1MuGMTRegMMConfigCharge();
0174 m_RegMMConfigMIP = new L1MuGMTRegMMConfigMIP();
0175 m_RegMMConfigISO = new L1MuGMTRegMMConfigISO();
0176 m_RegMMConfigSRK = new L1MuGMTRegMMConfigSRK();
0177 m_RegSortRankOffset = new L1MuGMTRegSortRankOffset();
0178
0179
0180 m_EtaLUT = new L1MuGMTEtaLUT();
0181 m_LFCOUDeltaEtaLUT = new L1MuGMTLFCOUDeltaEtaLUT();
0182 m_LFDeltaEtaLUT = new L1MuGMTLFDeltaEtaLUT();
0183 m_LFDisableHotLUT = new L1MuGMTLFDisableHotLUT();
0184 m_LFEtaConvLUT = new L1MuGMTLFEtaConvLUT();
0185 m_LFMatchQualLUT = new L1MuGMTLFMatchQualLUT();
0186 m_LFMergeRankCombineLUT = new L1MuGMTLFMergeRankCombineLUT();
0187 m_LFMergeRankEtaPhiLUT = new L1MuGMTLFMergeRankEtaPhiLUT();
0188 m_LFMergeRankEtaQLUT = new L1MuGMTLFMergeRankEtaQLUT();
0189 m_LFMergeRankPtQLUT = new L1MuGMTLFMergeRankPtQLUT();
0190 m_LFOvlEtaConvLUT = new L1MuGMTLFOvlEtaConvLUT();
0191 m_LFPhiProEtaConvLUT = new L1MuGMTLFPhiProEtaConvLUT();
0192 m_LFPhiProLUT = new L1MuGMTLFPhiProLUT();
0193 m_LFPtMixLUT = new L1MuGMTLFPtMixLUT();
0194 m_LFSortRankCombineLUT = new L1MuGMTLFSortRankCombineLUT();
0195 m_LFSortRankEtaPhiLUT = new L1MuGMTLFSortRankEtaPhiLUT();
0196 m_LFSortRankEtaQLUT = new L1MuGMTLFSortRankEtaQLUT();
0197 m_LFSortRankPtQLUT = new L1MuGMTLFSortRankPtQLUT();
0198 m_MIAUEtaConvLUT = new L1MuGMTMIAUEtaConvLUT();
0199 m_MIAUEtaProLUT = new L1MuGMTMIAUEtaProLUT();
0200 m_MIAUPhiPro1LUT = new L1MuGMTMIAUPhiPro1LUT();
0201 m_MIAUPhiPro2LUT = new L1MuGMTMIAUPhiPro2LUT();
0202 m_PhiLUT = new L1MuGMTPhiLUT();
0203 }
0204
0205 void L1MuGMTConfig::clearLUTsRegs() {
0206
0207 delete m_RegCDLConfig;
0208 delete m_RegMMConfigPhi;
0209 delete m_RegMMConfigEta;
0210 delete m_RegMMConfigPt;
0211 delete m_RegMMConfigCharge;
0212 delete m_RegMMConfigMIP;
0213 delete m_RegMMConfigISO;
0214 delete m_RegMMConfigSRK;
0215 delete m_RegSortRankOffset;
0216
0217
0218 delete m_EtaLUT;
0219 delete m_LFCOUDeltaEtaLUT;
0220 delete m_LFDeltaEtaLUT;
0221 delete m_LFDisableHotLUT;
0222 delete m_LFEtaConvLUT;
0223 delete m_LFMatchQualLUT;
0224 delete m_LFMergeRankCombineLUT;
0225 delete m_LFMergeRankEtaPhiLUT;
0226 delete m_LFMergeRankEtaQLUT;
0227 delete m_LFMergeRankPtQLUT;
0228 delete m_LFOvlEtaConvLUT;
0229 delete m_LFPhiProEtaConvLUT;
0230 delete m_LFPhiProLUT;
0231 delete m_LFPtMixLUT;
0232 delete m_LFSortRankCombineLUT;
0233 delete m_LFSortRankEtaPhiLUT;
0234 delete m_LFSortRankEtaQLUT;
0235 delete m_LFSortRankPtQLUT;
0236 delete m_MIAUEtaConvLUT;
0237 delete m_MIAUEtaProLUT;
0238 delete m_MIAUPhiPro1LUT;
0239 delete m_MIAUPhiPro2LUT;
0240 delete m_PhiLUT;
0241 }
0242
0243 void L1MuGMTConfig::dumpLUTs(std::string dir) {
0244 std::vector<L1MuGMTLUT*> theLUTs;
0245
0246 theLUTs.push_back(m_LFSortRankEtaQLUT);
0247 theLUTs.push_back(m_LFSortRankPtQLUT);
0248 theLUTs.push_back(m_LFSortRankEtaPhiLUT);
0249 theLUTs.push_back(m_LFSortRankCombineLUT);
0250
0251 theLUTs.push_back(m_LFDisableHotLUT);
0252
0253 theLUTs.push_back(m_LFMergeRankEtaQLUT);
0254 theLUTs.push_back(m_LFMergeRankPtQLUT);
0255 theLUTs.push_back(m_LFMergeRankEtaPhiLUT);
0256 theLUTs.push_back(m_LFMergeRankCombineLUT);
0257
0258 theLUTs.push_back(m_LFDeltaEtaLUT);
0259 theLUTs.push_back(m_LFMatchQualLUT);
0260 theLUTs.push_back(m_LFOvlEtaConvLUT);
0261 theLUTs.push_back(m_LFCOUDeltaEtaLUT);
0262
0263 theLUTs.push_back(m_LFEtaConvLUT);
0264
0265 theLUTs.push_back(m_LFPtMixLUT);
0266 theLUTs.push_back(m_LFPhiProLUT);
0267 theLUTs.push_back(m_LFPhiProEtaConvLUT);
0268
0269 theLUTs.push_back(m_MIAUEtaConvLUT);
0270 theLUTs.push_back(m_MIAUPhiPro1LUT);
0271 theLUTs.push_back(m_MIAUPhiPro2LUT);
0272 theLUTs.push_back(m_MIAUEtaProLUT);
0273
0274 std::vector<L1MuGMTLUT*>::iterator it = theLUTs.begin();
0275 for (; it != theLUTs.end(); it++) {
0276 edm::LogVerbatim("GMT_LUTGen_info") << "**** Generating " << (*it)->Name() << " LUT ****" << endl
0277 << "saving" << endl;
0278 std::string fn = dir + "/" + (*it)->Name() + ".lut";
0279 (*it)->Save(fn.c_str());
0280 }
0281
0282 edm::LogVerbatim("GMT_LUTGen_info") << "Successfully created all GMT look-up tables in directory './" << dir << "'"
0283 << endl
0284 << endl;
0285 }
0286
0287 void L1MuGMTConfig::dumpRegs(std::string dir) {
0288 std::vector<L1MuGMTReg*> theRegs;
0289
0290 theRegs.push_back(m_RegCDLConfig);
0291 theRegs.push_back(m_RegMMConfigPhi);
0292 theRegs.push_back(m_RegMMConfigEta);
0293 theRegs.push_back(m_RegMMConfigPt);
0294 theRegs.push_back(m_RegMMConfigCharge);
0295 theRegs.push_back(m_RegMMConfigSRK);
0296 theRegs.push_back(m_RegMMConfigMIP);
0297 theRegs.push_back(m_RegMMConfigISO);
0298 theRegs.push_back(m_RegSortRankOffset);
0299
0300 ofstream of((dir + "/LogicFPGARegs.cfg").c_str());
0301
0302 std::vector<L1MuGMTReg*>::iterator it = theRegs.begin();
0303 for (; it != theRegs.end(); it++) {
0304 for (unsigned int i = 0; i < (*it)->getNumberOfInstances(); i++)
0305 of << (*it)->getName() << "[" << i << "] = " << (*it)->getValue(i) << endl;
0306 }
0307 }
0308
0309
0310
0311 edm::InputTag L1MuGMTConfig::m_DTInputTag = edm::InputTag();
0312 edm::InputTag L1MuGMTConfig::m_CSCInputTag = edm::InputTag();
0313 edm::InputTag L1MuGMTConfig::m_RPCbInputTag = edm::InputTag();
0314 edm::InputTag L1MuGMTConfig::m_RPCfInputTag = edm::InputTag();
0315 edm::InputTag L1MuGMTConfig::m_MipIsoInputTag = edm::InputTag();
0316 int L1MuGMTConfig::m_dbgLevel = 0;
0317 bool L1MuGMTConfig::m_debug = false;
0318 int L1MuGMTConfig::m_BxMin = -4;
0319 int L1MuGMTConfig::m_BxMax = 4;
0320 int L1MuGMTConfig::m_BxMinRo = -2;
0321 int L1MuGMTConfig::m_BxMaxRo = 2;
0322 float L1MuGMTConfig::m_EtaWeight_barrel = 0.028;
0323 float L1MuGMTConfig::m_PhiWeight_barrel = 1.0;
0324 float L1MuGMTConfig::m_EtaPhiThreshold_barrel = 0.062;
0325 float L1MuGMTConfig::m_EtaWeight_endcap = 0.13;
0326 float L1MuGMTConfig::m_PhiWeight_endcap = 1.0;
0327 float L1MuGMTConfig::m_EtaPhiThreshold_endcap = 0.062;
0328 float L1MuGMTConfig::m_EtaWeight_COU = 0.316;
0329 float L1MuGMTConfig::m_PhiWeight_COU = 1.0;
0330 float L1MuGMTConfig::m_EtaPhiThreshold_COU = 0.127;
0331 bool L1MuGMTConfig::m_CaloTrigger = true;
0332 int L1MuGMTConfig::m_IsolationCellSizeEta = 2;
0333 int L1MuGMTConfig::m_IsolationCellSizePhi = 2;
0334 bool L1MuGMTConfig::m_DoOvlRpcAnd = false;
0335
0336 bool L1MuGMTConfig::m_PropagatePhi = false;
0337 unsigned L1MuGMTConfig::m_VersionSortRankEtaQLUT = 2;
0338 unsigned L1MuGMTConfig::m_VersionLUTs = 0;
0339
0340 L1MuGMTRegCDLConfig* L1MuGMTConfig::m_RegCDLConfig = nullptr;
0341 L1MuGMTRegMMConfigPhi* L1MuGMTConfig::m_RegMMConfigPhi = nullptr;
0342 L1MuGMTRegMMConfigEta* L1MuGMTConfig::m_RegMMConfigEta = nullptr;
0343 L1MuGMTRegMMConfigPt* L1MuGMTConfig::m_RegMMConfigPt = nullptr;
0344 L1MuGMTRegMMConfigCharge* L1MuGMTConfig::m_RegMMConfigCharge = nullptr;
0345 L1MuGMTRegMMConfigMIP* L1MuGMTConfig::m_RegMMConfigMIP = nullptr;
0346 L1MuGMTRegMMConfigISO* L1MuGMTConfig::m_RegMMConfigISO = nullptr;
0347 L1MuGMTRegMMConfigSRK* L1MuGMTConfig::m_RegMMConfigSRK = nullptr;
0348 L1MuGMTRegSortRankOffset* L1MuGMTConfig::m_RegSortRankOffset = nullptr;
0349
0350 L1MuGMTEtaLUT* L1MuGMTConfig::m_EtaLUT = nullptr;
0351 L1MuGMTLFCOUDeltaEtaLUT* L1MuGMTConfig::m_LFCOUDeltaEtaLUT = nullptr;
0352 L1MuGMTLFDeltaEtaLUT* L1MuGMTConfig::m_LFDeltaEtaLUT = nullptr;
0353 L1MuGMTLFDisableHotLUT* L1MuGMTConfig::m_LFDisableHotLUT = nullptr;
0354 L1MuGMTLFEtaConvLUT* L1MuGMTConfig::m_LFEtaConvLUT = nullptr;
0355 L1MuGMTLFMatchQualLUT* L1MuGMTConfig::m_LFMatchQualLUT = nullptr;
0356 L1MuGMTLFMergeRankCombineLUT* L1MuGMTConfig::m_LFMergeRankCombineLUT = nullptr;
0357 L1MuGMTLFMergeRankEtaPhiLUT* L1MuGMTConfig::m_LFMergeRankEtaPhiLUT = nullptr;
0358 L1MuGMTLFMergeRankEtaQLUT* L1MuGMTConfig::m_LFMergeRankEtaQLUT = nullptr;
0359 L1MuGMTLFMergeRankPtQLUT* L1MuGMTConfig::m_LFMergeRankPtQLUT = nullptr;
0360 L1MuGMTLFOvlEtaConvLUT* L1MuGMTConfig::m_LFOvlEtaConvLUT = nullptr;
0361 L1MuGMTLFPhiProEtaConvLUT* L1MuGMTConfig::m_LFPhiProEtaConvLUT = nullptr;
0362 L1MuGMTLFPhiProLUT* L1MuGMTConfig::m_LFPhiProLUT = nullptr;
0363 L1MuGMTLFPtMixLUT* L1MuGMTConfig::m_LFPtMixLUT = nullptr;
0364 L1MuGMTLFSortRankCombineLUT* L1MuGMTConfig::m_LFSortRankCombineLUT = nullptr;
0365 L1MuGMTLFSortRankEtaPhiLUT* L1MuGMTConfig::m_LFSortRankEtaPhiLUT = nullptr;
0366 L1MuGMTLFSortRankEtaQLUT* L1MuGMTConfig::m_LFSortRankEtaQLUT = nullptr;
0367 L1MuGMTLFSortRankPtQLUT* L1MuGMTConfig::m_LFSortRankPtQLUT = nullptr;
0368 L1MuGMTMIAUEtaConvLUT* L1MuGMTConfig::m_MIAUEtaConvLUT = nullptr;
0369 L1MuGMTMIAUEtaProLUT* L1MuGMTConfig::m_MIAUEtaProLUT = nullptr;
0370 L1MuGMTMIAUPhiPro1LUT* L1MuGMTConfig::m_MIAUPhiPro1LUT = nullptr;
0371 L1MuGMTMIAUPhiPro2LUT* L1MuGMTConfig::m_MIAUPhiPro2LUT = nullptr;
0372 L1MuGMTPhiLUT* L1MuGMTConfig::m_PhiLUT = nullptr;
0373
0374 const L1MuGMTScales* L1MuGMTConfig::m_GMTScales = nullptr;
0375 const L1MuTriggerScales* L1MuGMTConfig::m_TriggerScales = nullptr;
0376 const L1MuTriggerPtScale* L1MuGMTConfig::m_TriggerPtScale = nullptr;
0377 const L1MuGMTParameters* L1MuGMTConfig::m_GMTParams = nullptr;
0378 const L1MuGMTChannelMask* L1MuGMTConfig::m_GMTChanMask = nullptr;
0379
0380 const L1CaloGeometry* L1MuGMTConfig::m_caloGeom = nullptr;