File indexing completed on 2024-04-25 02:14:00
0001 #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuon.h"
0002 #include <cmath>
0003 L1Analysis::L1AnalysisL1UpgradeTfMuon::L1AnalysisL1UpgradeTfMuon() {}
0004
0005 L1Analysis::L1AnalysisL1UpgradeTfMuon::~L1AnalysisL1UpgradeTfMuon() {}
0006
0007 void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCandBxCollection& muon,
0008 unsigned maxL1UpgradeTfMuon) {
0009 for (int ibx = muon.getFirstBX(); ibx <= muon.getLastBX(); ++ibx) {
0010 for (l1t::RegionalMuonCandBxCollection::const_iterator it = muon.begin(ibx);
0011 it != muon.end(ibx) && l1upgradetfmuon_.nTfMuons < maxL1UpgradeTfMuon;
0012 ++it) {
0013 if (it->hwPt() > 0) {
0014 l1upgradetfmuon_.tfMuonHwPt.push_back(it->hwPt());
0015 if (isRun3_) {
0016 l1upgradetfmuon_.tfMuonHwPtUnconstrained.push_back(it->hwPtUnconstrained());
0017 l1upgradetfmuon_.tfMuonHwDxy.push_back(it->hwDXY());
0018 }
0019 l1upgradetfmuon_.tfMuonHwEta.push_back(it->hwEta());
0020 l1upgradetfmuon_.tfMuonHwPhi.push_back(it->hwPhi());
0021 l1upgradetfmuon_.tfMuonGlobalPhi.push_back(
0022 l1t::MicroGMTConfiguration::calcGlobalPhi(it->hwPhi(), it->trackFinderType(), it->processor()));
0023 l1upgradetfmuon_.tfMuonHwSign.push_back(it->hwSign());
0024 l1upgradetfmuon_.tfMuonHwSignValid.push_back(it->hwSignValid());
0025 l1upgradetfmuon_.tfMuonHwQual.push_back(it->hwQual());
0026 l1upgradetfmuon_.tfMuonLink.push_back(it->link());
0027 l1upgradetfmuon_.tfMuonProcessor.push_back(it->processor());
0028 l1upgradetfmuon_.tfMuonTrackFinderType.push_back(it->trackFinderType());
0029 l1upgradetfmuon_.tfMuonHwHF.push_back(it->hwHF());
0030 l1upgradetfmuon_.tfMuonBx.push_back(ibx);
0031 std::map<std::string, int> decoded_track_address;
0032 if (it->trackFinderType() == l1t::tftype::bmtf) {
0033 int detSide = it->trackSubAddress(l1t::RegionalMuonCand::kWheelSide);
0034 int wheelNum = it->trackSubAddress(l1t::RegionalMuonCand::kWheelNum);
0035 int stat1 = it->trackSubAddress(l1t::RegionalMuonCand::kStat1);
0036 int stat2 = it->trackSubAddress(l1t::RegionalMuonCand::kStat2);
0037 int stat3 = it->trackSubAddress(l1t::RegionalMuonCand::kStat3);
0038 int stat4 = it->trackSubAddress(l1t::RegionalMuonCand::kStat4);
0039
0040 int wheel = pow(-1, detSide) * wheelNum;
0041 l1upgradetfmuon_.tfMuonWh.push_back(wheel);
0042 l1upgradetfmuon_.tfMuonTrAdd.push_back(stat1);
0043 l1upgradetfmuon_.tfMuonTrAdd.push_back(stat2);
0044 l1upgradetfmuon_.tfMuonTrAdd.push_back(stat3);
0045 l1upgradetfmuon_.tfMuonTrAdd.push_back(stat4);
0046 decoded_track_address["wheel"] = wheel;
0047 decoded_track_address["station1"] = stat1;
0048 decoded_track_address["station2"] = stat2;
0049 decoded_track_address["station3"] = stat3;
0050 decoded_track_address["station4"] = stat4;
0051 } else if (it->trackFinderType() == l1t::omtf_neg || it->trackFinderType() == l1t::omtf_pos) {
0052 decoded_track_address["kLayers"] = it->trackSubAddress(l1t::RegionalMuonCand::kLayers);
0053 decoded_track_address["kWeight"] = it->trackSubAddress(l1t::RegionalMuonCand::kWeight);
0054 } else if (it->trackFinderType() == l1t::emtf_neg || it->trackFinderType() == l1t::emtf_pos) {
0055 decoded_track_address["kME1Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Seg);
0056 decoded_track_address["kME1Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Ch);
0057 decoded_track_address["kME2Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Seg);
0058 decoded_track_address["kME2Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Ch);
0059 decoded_track_address["kME3Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Seg);
0060 decoded_track_address["kME3Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Ch);
0061 decoded_track_address["kME4Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Seg);
0062 decoded_track_address["kME4Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Ch);
0063 decoded_track_address["kTrkNum"] = it->trackSubAddress(l1t::RegionalMuonCand::kTrkNum);
0064 decoded_track_address["kBX"] = it->trackSubAddress(l1t::RegionalMuonCand::kBX);
0065 }
0066 l1upgradetfmuon_.tfMuonDecodedTrAdd.push_back(decoded_track_address);
0067 l1upgradetfmuon_.tfMuonHwTrAdd.push_back(
0068 l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it, isRun3_));
0069 l1upgradetfmuon_.nTfMuons++;
0070 }
0071 }
0072 }
0073 }