File indexing completed on 2024-04-06 12:04:34
0001 #include "DataFormats/L1TMuon/interface/EMTFHit.h"
0002 #include "DataFormats/CSCDigi/interface/CSCConstants.h"
0003
0004 namespace l1t {
0005
0006 CSCDetId EMTFHit::CreateCSCDetId() const {
0007 return CSCDetId((endcap == 1) ? 1 : 2, station, (ring == 4) ? 1 : ring, chamber, 0);
0008
0009
0010 }
0011
0012 RPCDetId EMTFHit::CreateRPCDetId() const {
0013 int roll_ = roll;
0014 int theta_ = theta_fp / 4;
0015 if (roll < 1 || roll > 3) {
0016 switch (station * 2 + ring) {
0017 case 4:
0018 roll_ = (theta_ < 17 ? 3 : (theta_ > 18 ? 1 : 2));
0019 break;
0020 case 6:
0021 roll_ = (theta_ < 16 ? 3 : (theta_ > 17 ? 1 : 2));
0022 break;
0023 case 8:
0024 roll_ = (theta_ < 12 ? 3 : (theta_ > 13 ? 1 : 2));
0025 break;
0026 case 9:
0027 roll_ = (theta_ < 20 ? 3 : (theta_ > 21 ? 1 : 2));
0028 break;
0029 case 10:
0030 roll_ = (theta_ < 11 ? 3 : (theta_ > 11 ? 1 : 2));
0031 break;
0032 case 11:
0033 roll_ = (theta_ < 18 ? 3 : (theta_ > 19 ? 1 : 2));
0034 break;
0035 default:
0036 roll_ = 2;
0037 }
0038 }
0039
0040 return RPCDetId(endcap, ring, station, sector_RPC, 1, subsector_RPC, roll_);
0041
0042 }
0043
0044 GEMDetId EMTFHit::CreateGEMDetId() const {
0045 return GEMDetId((endcap == 1) ? 1 : -1, ring, station, layer, chamber, roll);
0046 }
0047
0048 ME0DetId EMTFHit::CreateME0DetId() const { return ME0DetId((endcap == 1) ? 1 : -1, layer, chamber, roll); }
0049
0050 CPPFDigi EMTFHit::CreateCPPFDigi() const {
0051 if (!Is_RPC())
0052 return CPPFDigi();
0053
0054 int board_ = 1 + ((chamber % 36) / 9);
0055 int channel_ = (chamber % 9);
0056 int sector_ = (sector_idx + 1) - 6 * (endcap == -1);
0057 int link_ = (neighbor ? 0 : 1 + (((chamber + 33) % 36) % 6));
0058 int nStrips_ = (strip_low < 0 ? -99 : 1 + strip_hi - strip_low);
0059
0060 return CPPFDigi(RPC_DetId(),
0061 bx,
0062 phi_fp / 4,
0063 theta_fp / 4,
0064 valid,
0065 board_,
0066 channel_,
0067 sector_,
0068 link_,
0069 strip_low,
0070 nStrips_,
0071 phi_glob,
0072 theta);
0073 }
0074
0075 CSCCorrelatedLCTDigi EMTFHit::CreateCSCCorrelatedLCTDigi(const bool isRun3) const {
0076 CSCCorrelatedLCTDigi lct = CSCCorrelatedLCTDigi(1,
0077 valid,
0078 quality,
0079 wire,
0080 strip,
0081 pattern,
0082 (bend == 1) ? 1 : 0,
0083 bx + CSCConstants::LCT_CENTRAL_BX,
0084 0,
0085 0,
0086 sync_err,
0087 csc_ID);
0088 bool quart_bit = strip_quart_bit == 1;
0089 bool eighth_bit = strip_eighth_bit == 1;
0090
0091 lct.setQuartStripBit(quart_bit);
0092 lct.setEighthStripBit(eighth_bit);
0093 lct.setSlope(slope);
0094 lct.setRun3Pattern(pattern_run3);
0095 lct.setRun3(isRun3);
0096
0097 return lct;
0098
0099
0100
0101
0102 }
0103
0104 CSCShowerDigi EMTFHit::CreateCSCShowerDigi() const {
0105 CSCShowerDigi shower = CSCShowerDigi(muon_shower_inTime == -99 ? 0 : muon_shower_inTime,
0106 muon_shower_outOfTime == -99 ? 0 : muon_shower_outOfTime,
0107 csc_ID,
0108 bx + CSCConstants::LCT_CENTRAL_BX,
0109 CSCShowerDigi::ShowerType::kEMTFShower);
0110
0111 return shower;
0112 }
0113
0114
0115
0116
0117
0118
0119 GEMPadDigiCluster EMTFHit::CreateGEMPadDigiCluster() const {
0120 std::vector<uint16_t> pads;
0121 for (int i = Pad_low(); i < Pad_hi(); ++i)
0122 pads.emplace_back(static_cast<uint16_t>(i));
0123 return GEMPadDigiCluster(pads, bx);
0124 }
0125
0126 }