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 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFMatchQualLUT.h"
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0030 #include "CondFormats/L1TObjects/interface/L1MuGMTScales.h"
0031 #include "CondFormats/L1TObjects/interface/L1MuPacking.h"
0032
0033
0034
0035
0036
0037 void L1MuGMTLFMatchQualLUT::InitParameters() {
0038 m_EtaWeights[0] = L1MuGMTConfig::getEtaWeightBarrel();
0039 m_PhiWeights[0] = L1MuGMTConfig::getPhiWeightBarrel();
0040 m_EtaPhiThresholds[0] = L1MuGMTConfig::getEtaPhiThresholdBarrel();
0041
0042 m_EtaWeights[1] = L1MuGMTConfig::getEtaWeightEndcap();
0043 m_PhiWeights[1] = L1MuGMTConfig::getPhiWeightEndcap();
0044 m_EtaPhiThresholds[1] = L1MuGMTConfig::getEtaPhiThresholdEndcap();
0045
0046 for (int i = 2; i < 6; i++) {
0047 m_EtaWeights[i] = L1MuGMTConfig::getEtaWeightCOU();
0048 m_PhiWeights[i] = L1MuGMTConfig::getPhiWeightCOU();
0049 m_EtaPhiThresholds[i] = L1MuGMTConfig::getEtaPhiThresholdCOU();
0050 }
0051 }
0052
0053
0054
0055
0056
0057 unsigned L1MuGMTLFMatchQualLUT::TheLookupFunction(int idx, unsigned delta_eta, unsigned delta_phi) const {
0058
0059
0060
0061
0062 const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
0063
0064 float deta = theGMTScales->getDeltaEtaScale(idx)->getCenter(delta_eta);
0065 float dphi = theGMTScales->getDeltaPhiScale()->getCenter(delta_phi);
0066
0067
0068 L1MuSignedPacking<4> EtaPacking;
0069 int delta_eta_signed = EtaPacking.idxFromPacked(delta_eta);
0070 L1MuSignedPacking<3> PhiPacking;
0071 int delta_phi_signed = PhiPacking.idxFromPacked(delta_phi);
0072
0073 bool dphi_outofrange = (delta_phi_signed == -4);
0074
0075
0076 if (delta_phi_signed >= 3 || delta_phi_signed <= -3)
0077 dphi_outofrange = true;
0078
0079
0080 bool deta_outofrange = (delta_eta_signed == -8);
0081
0082
0083 if (delta_eta_signed >= 7 || delta_eta_signed <= -7)
0084 deta_outofrange = true;
0085
0086 double delta_etaphi = sqrt(m_EtaWeights[idx] * deta * deta + m_PhiWeights[idx] * dphi * dphi);
0087
0088
0089
0090
0091
0092
0093 int matchqual = 0;
0094 if (dphi_outofrange || deta_outofrange || delta_etaphi > m_EtaPhiThresholds[idx]) {
0095 matchqual = 0;
0096 } else {
0097 double mq = 64. * (m_EtaPhiThresholds[idx] - delta_etaphi) / m_EtaPhiThresholds[idx];
0098 matchqual = static_cast<int>(mq);
0099 }
0100
0101 if (matchqual > 63)
0102 matchqual = 63;
0103 return matchqual;
0104 }