File indexing completed on 2023-03-17 11:12:41
0001 #include "L1Trigger/L1TMuonEndCap/interface/DebugTools.h"
0002 #include "DataFormats/L1TMuon/interface/L1TMuonSubsystems.h"
0003
0004 namespace emtf {
0005
0006 void dump_fw_raw_input(const l1t::EMTFHitCollection& out_hits, const l1t::EMTFTrackCollection& out_tracks) {
0007
0008 constexpr int MIN_ENDCAP = 1;
0009 constexpr int MAX_ENDCAP = 2;
0010 constexpr int MIN_TRIGSECTOR = 1;
0011 constexpr int MAX_TRIGSECTOR = 6;
0012
0013 for (int endcap = MIN_ENDCAP; endcap <= MAX_ENDCAP; ++endcap) {
0014 for (int sector = MIN_TRIGSECTOR; sector <= MAX_TRIGSECTOR; ++sector) {
0015 const int es = (endcap - MIN_ENDCAP) * (MAX_TRIGSECTOR - MIN_TRIGSECTOR + 1) + (sector - MIN_TRIGSECTOR);
0016
0017
0018
0019
0020
0021 std::cout << "==== Endcap " << endcap << " Sector " << sector << " Hits ====" << std::endl;
0022 std::cout << "bx e s ss st vf ql cp wg id bd hs" << std::endl;
0023
0024 bool empty_sector = true;
0025 for (const auto& h : out_hits) {
0026 if (h.Sector_idx() != es)
0027 continue;
0028 empty_sector = false;
0029 }
0030
0031 for (int ibx = -3 - 5; (ibx < +3 + 5 + 5) && !empty_sector; ++ibx) {
0032 for (const auto& h : out_hits) {
0033 if (h.Subsystem() == L1TMuon::kCSC) {
0034 if (h.Sector_idx() != es)
0035 continue;
0036 if (h.BX() != ibx)
0037 continue;
0038
0039 int bx = 1;
0040 int endcap = (h.Endcap() == 1) ? 1 : 2;
0041 int sector = h.PC_sector();
0042 int station = (h.PC_station() == 0 && h.Subsector() == 1) ? 1 : h.PC_station();
0043 int chamber = h.PC_chamber() + 1;
0044 int strip = (h.Station() == 1 && h.Ring() == 4) ? h.Strip() + 128 : h.Strip();
0045 int wire = h.Wire();
0046 int valid = 1;
0047 std::cout << bx << " " << endcap << " " << sector << " " << h.Subsector() << " " << station << " "
0048 << valid << " " << h.Quality() << " " << h.Pattern() << " " << wire << " " << chamber << " "
0049 << h.Bend() << " " << strip << std::endl;
0050
0051 } else if (h.Subsystem() == L1TMuon::kRPC) {
0052 if (h.Sector_idx() != es)
0053 continue;
0054 if (h.BX() + 6 != ibx)
0055 continue;
0056
0057
0058 int rpc_sub = -1;
0059 int rpc_chm = -1;
0060 if (!h.Neighbor()) {
0061 rpc_sub = ((h.Subsector_RPC() + 3) % 6);
0062 } else {
0063 rpc_sub = 6;
0064 }
0065 if (h.Station() <= 2) {
0066 rpc_chm = (h.Station() - 1);
0067 } else {
0068 rpc_chm = 2 + (h.Station() - 3) * 2 + (h.Ring() - 2);
0069 }
0070
0071 int bx = 1;
0072 int endcap = (h.Endcap() == 1) ? 1 : 2;
0073 int sector = h.PC_sector();
0074 int station = rpc_sub;
0075 int chamber = rpc_chm + 1;
0076 int strip = (h.Phi_fp() >> 2);
0077 int wire = (h.Theta_fp() >> 2);
0078 int valid = 2;
0079 std::cout << bx << " " << endcap << " " << sector << " " << 0 << " " << station << " " << valid << " "
0080 << 0 << " " << 0 << " " << wire << " " << chamber << " " << 0 << " " << strip << std::endl;
0081 }
0082 }
0083
0084 std::cout << "12345" << std::endl;
0085 }
0086
0087
0088
0089
0090 std::cout << "==== Endcap " << endcap << " Sector " << sector << " Tracks ====" << std::endl;
0091 std::cout << "bx e s a mo et ph cr q pt" << std::endl;
0092
0093 for (const auto& t : out_tracks) {
0094 if (t.Sector_idx() != es)
0095 continue;
0096
0097 std::cout << t.BX() << " " << (t.Endcap() == 1 ? 1 : 2) << " " << t.Sector() << " " << t.PtLUT().address
0098 << " " << t.Mode() << " " << (t.GMT_eta() >= 0 ? t.GMT_eta() : t.GMT_eta() + 512) << " "
0099 << t.GMT_phi() << " " << t.GMT_charge() << " " << t.GMT_quality() << " " << t.Pt() << std::endl;
0100 }
0101
0102 }
0103 }
0104 }
0105
0106 }