File indexing completed on 2024-11-15 23:40:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "L1MuBMSectorProcessor.h"
0020
0021
0022
0023
0024
0025 #include <iostream>
0026 #include <cmath>
0027
0028
0029
0030
0031
0032 #include <FWCore/Framework/interface/Event.h>
0033 #include "L1Trigger/L1TMuonBarrel/interface/L1MuBMTFConfig.h"
0034 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMSectorReceiver.h"
0035 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMDataBuffer.h"
0036 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h"
0037 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMTrackAssembler.h"
0038 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMAssignmentUnit.h"
0039 #include "L1Trigger/L1TMuonBarrel/interface/L1MuBMTrackFinder.h"
0040
0041 #include "DataFormats/L1TMuon/interface/BMTF/L1MuBMSecProcId.h"
0042 #include "DataFormats/L1TMuon/interface/L1MuBMTrack.h"
0043
0044 using namespace std;
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 L1MuBMSectorProcessor::L1MuBMSectorProcessor(const L1MuBMTrackFinder& tf,
0055 const L1MuBMSecProcId& id,
0056 edm::ConsumesCollector&& iC)
0057 :
0058
0059 m_tf(tf),
0060 m_spid(id),
0061 m_SectorReceiver(*this, std::move(iC)),
0062 m_DataBuffer(*this),
0063 m_EU(*this, iC),
0064 m_TA(*this),
0065 m_bmtfParamsToken(iC.esConsumes()),
0066 m_AUs(),
0067 m_TrackCands(),
0068 m_TracKCands() {
0069
0070 m_AUs.reserve(2);
0071 m_AUs.emplace_back(*this, 0);
0072 m_AUs.emplace_back(*this, 1);
0073
0074
0075 m_TrackCands.reserve(2);
0076 m_TrackCands.emplace_back(m_spid);
0077 m_TrackCands.push_back(m_spid);
0078
0079 m_TracKCands.reserve(2);
0080 m_TracKCands.push_back(m_spid);
0081 m_TracKCands.push_back(m_spid);
0082 }
0083
0084
0085
0086
0087
0088
0089
0090
0091 void L1MuBMSectorProcessor::run(int bx, const edm::Event& e, const edm::EventSetup& c) {
0092
0093 m_SectorReceiver.run(bx, e, c);
0094
0095
0096 if (config().Debug(4) && m_DataBuffer.numberTSphi() > 0) {
0097 cout << "Phi track segments received by " << m_spid << " : " << endl;
0098 m_DataBuffer.printTSphi();
0099 }
0100
0101
0102 int n_ext = 0;
0103 if (m_DataBuffer.numberTSphi() > 1) {
0104 m_EU.run(c);
0105 n_ext = m_EU.numberOfExt();
0106 if (config().Debug(3) && n_ext > 0) {
0107
0108 cout << "Number of successful extrapolations : " << n_ext << endl;
0109 m_EU.print();
0110 }
0111 }
0112
0113
0114
0115
0116
0117 if (n_ext > 0) {
0118 m_TA.run();
0119 if (config().Debug(3))
0120 m_TA.print();
0121 }
0122
0123 L1TMuonBarrelParams const& bmtfParams = c.getData(m_bmtfParamsToken);
0124
0125
0126 if (!m_TA.isEmpty(0))
0127 m_AUs[0].run(bmtfParams);
0128 if (!m_TA.isEmpty(1))
0129 m_AUs[1].run(bmtfParams);
0130
0131 if (m_spid.wheel() == -1) {
0132 if (!m_TrackCands[0].empty() && m_TrackCands[0].address(2) > 3 && m_TrackCands[0].address(2) < 6)
0133 m_TrackCands[0].reset();
0134 if (!m_TrackCands[0].empty() && m_TrackCands[0].address(3) > 3 && m_TrackCands[0].address(3) < 6)
0135 m_TrackCands[0].reset();
0136 if (!m_TrackCands[0].empty() && m_TrackCands[0].address(4) > 3 && m_TrackCands[0].address(4) < 6)
0137 m_TrackCands[0].reset();
0138
0139 if (!m_TracKCands[0].empty() && m_TracKCands[0].address(2) > 3 && m_TracKCands[0].address(2) < 6)
0140 m_TracKCands[0].reset();
0141 if (!m_TracKCands[0].empty() && m_TracKCands[0].address(3) > 3 && m_TracKCands[0].address(3) < 6)
0142 m_TracKCands[0].reset();
0143 if (!m_TracKCands[0].empty() && m_TracKCands[0].address(4) > 3 && m_TracKCands[0].address(4) < 6)
0144 m_TracKCands[0].reset();
0145
0146 if (!m_TrackCands[1].empty() && m_TrackCands[1].address(2) > 3 && m_TrackCands[1].address(2) < 6)
0147 m_TrackCands[1].reset();
0148 if (!m_TrackCands[1].empty() && m_TrackCands[1].address(3) > 3 && m_TrackCands[1].address(3) < 6)
0149 m_TrackCands[1].reset();
0150 if (!m_TrackCands[1].empty() && m_TrackCands[1].address(4) > 3 && m_TrackCands[1].address(4) < 6)
0151 m_TrackCands[1].reset();
0152
0153 if (!m_TracKCands[1].empty() && m_TracKCands[1].address(2) > 3 && m_TracKCands[1].address(2) < 6)
0154 m_TracKCands[1].reset();
0155 if (!m_TracKCands[1].empty() && m_TracKCands[1].address(3) > 3 && m_TracKCands[1].address(3) < 6)
0156 m_TracKCands[1].reset();
0157 if (!m_TracKCands[1].empty() && m_TracKCands[1].address(4) > 3 && m_TracKCands[1].address(4) < 6)
0158 m_TracKCands[1].reset();
0159
0160 if (!m_TrackCands[0].empty() && m_TrackCands[0].address(2) > 7 && m_TrackCands[0].address(2) < 10)
0161 m_TrackCands[0].reset();
0162 if (!m_TrackCands[0].empty() && m_TrackCands[0].address(3) > 7 && m_TrackCands[0].address(3) < 10)
0163 m_TrackCands[0].reset();
0164 if (!m_TrackCands[0].empty() && m_TrackCands[0].address(4) > 7 && m_TrackCands[0].address(4) < 10)
0165 m_TrackCands[0].reset();
0166
0167 if (!m_TracKCands[0].empty() && m_TracKCands[0].address(2) > 7 && m_TracKCands[0].address(2) < 10)
0168 m_TracKCands[0].reset();
0169 if (!m_TracKCands[0].empty() && m_TracKCands[0].address(3) > 7 && m_TracKCands[0].address(3) < 10)
0170 m_TracKCands[0].reset();
0171 if (!m_TracKCands[0].empty() && m_TracKCands[0].address(4) > 7 && m_TracKCands[0].address(4) < 10)
0172 m_TracKCands[0].reset();
0173
0174 if (!m_TrackCands[1].empty() && m_TrackCands[1].address(2) > 7 && m_TrackCands[1].address(2) < 10)
0175 m_TrackCands[1].reset();
0176 if (!m_TrackCands[1].empty() && m_TrackCands[1].address(3) > 7 && m_TrackCands[1].address(3) < 10)
0177 m_TrackCands[1].reset();
0178 if (!m_TrackCands[1].empty() && m_TrackCands[1].address(4) > 7 && m_TrackCands[1].address(4) < 10)
0179 m_TrackCands[1].reset();
0180
0181 if (!m_TracKCands[1].empty() && m_TracKCands[1].address(2) > 7 && m_TracKCands[1].address(2) < 10)
0182 m_TracKCands[1].reset();
0183 if (!m_TracKCands[1].empty() && m_TracKCands[1].address(3) > 7 && m_TracKCands[1].address(3) < 10)
0184 m_TracKCands[1].reset();
0185 if (!m_TracKCands[1].empty() && m_TracKCands[1].address(4) > 7 && m_TracKCands[1].address(4) < 10)
0186 m_TracKCands[1].reset();
0187 }
0188 }
0189
0190
0191
0192
0193 void L1MuBMSectorProcessor::reset() {
0194 m_SectorReceiver.reset();
0195 m_DataBuffer.reset();
0196 m_EU.reset();
0197 m_TA.reset();
0198 m_AUs[0].reset();
0199 m_AUs[1].reset();
0200 m_TrackCands[0].reset();
0201 m_TrackCands[1].reset();
0202 m_TracKCands[0].reset();
0203 m_TracKCands[1].reset();
0204 }
0205
0206
0207
0208
0209 void L1MuBMSectorProcessor::print() const {
0210 if (anyTrack()) {
0211 cout << "Muon candidates found in " << m_spid << " : " << endl;
0212 for (auto const& t : m_TrackCands) {
0213 t.print();
0214 }
0215 }
0216 }
0217
0218
0219
0220
0221 const L1MuBMSectorProcessor* L1MuBMSectorProcessor::neighbour() const {
0222 int sector = m_spid.sector();
0223 int wheel = m_spid.wheel();
0224
0225
0226
0227
0228
0229 if (wheel == 1)
0230 return nullptr;
0231 wheel = (wheel == -1) ? 1 : (wheel / abs(wheel)) * (abs(wheel) - 1);
0232
0233 const L1MuBMSecProcId id(wheel, sector);
0234
0235 return m_tf.sp(id);
0236 }
0237
0238
0239
0240
0241 bool L1MuBMSectorProcessor::anyTrack() const {
0242 if (!m_TrackCands[0].empty())
0243 return true;
0244 if (!m_TrackCands[1].empty())
0245 return true;
0246
0247 return false;
0248 }
0249
0250 const L1MuBMTFConfig& L1MuBMSectorProcessor::config() const { return m_tf.config(); }