Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-12 02:58:15

0001 #include "EMTFUnpackerTools.h"
0002 #include "DataFormats/L1TMuon/interface/L1TMuonSubsystems.h"
0003 
0004 namespace l1t {
0005   namespace stage2 {
0006     namespace emtf {
0007 
0008       void ImportME(EMTFHit& _hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector) {
0009         _hit.set_endcap(_endcap == 1 ? 1 : -1);
0010         _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
0011 
0012         _hit.set_wire(_ME.Wire());
0013         _hit.set_strip(_ME.Strip());
0014         _hit.set_quality(_ME.Quality());
0015         _hit.set_pattern(_ME.CLCT_pattern());
0016         _hit.set_bend((_ME.LR() == 1) ? 1 : -1);
0017         _hit.set_valid(_ME.VP());
0018         _hit.set_sync_err(_ME.SE());
0019         _hit.set_bx(_ME.TBIN() - 3);
0020         _hit.set_bc0(_ME.BC0());
0021         _hit.set_subsystem(l1tmu::kCSC);
0022         // _hit.set_layer();
0023 
0024         // Run 3 OTMB
0025         _hit.set_strip_quart_bit(_ME.Quarter_strip());
0026         _hit.set_strip_eighth_bit(_ME.Eighth_strip());
0027         _hit.set_slope(_ME.Slope());
0028         _hit.set_pattern_run3(_ME.Run3_pattern());
0029 
0030         _hit.set_ring(L1TMuonEndCap::calc_ring(_hit.Station(), _hit.CSC_ID(), _hit.Strip()));
0031         _hit.set_chamber(
0032             L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.CSC_ID()));
0033 
0034         _hit.SetCSCDetId(_hit.CreateCSCDetId());
0035         //_hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() );
0036 
0037         // Station, CSC_ID, Sector, Subsector, and Neighbor filled in
0038         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc
0039         // "set_layer()" is not invoked, so Layer is not yet filled - AWB 21.04.16
0040 
0041       }  // End ImportME
0042 
0043       void ImportRPC(EMTFHit& _hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector) {
0044         _hit.set_endcap(_endcap == 1 ? 1 : -1);
0045         _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
0046 
0047         _hit.set_phi_fp(_RPC.Phi() * 4);      // 1/4th the precision of CSC LCTs
0048         _hit.set_theta_fp(_RPC.Theta() * 4);  // 1/4th the precision of CSC LCTs
0049         _hit.set_bx(_RPC.TBIN() - 3);
0050         _hit.set_valid(_RPC.VP());
0051         _hit.set_bc0(_RPC.BC0());
0052         _hit.set_subsystem(l1tmu::kRPC);
0053 
0054         _hit.SetRPCDetId(_hit.CreateRPCDetId());
0055         // // Not yet implemented - AWB 15.03.17
0056         // _hit.SetRPCDigi  ( _hit.CreateRPCDigi() );
0057 
0058         // Convert integer values to degrees
0059         _hit.set_phi_loc(L1TMuonEndCap::calc_phi_loc_deg(_hit.Phi_fp()));
0060         _hit.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_hit.Phi_loc(), _evt_sector));
0061         _hit.set_theta(L1TMuonEndCap::calc_theta_deg_from_int(_hit.Theta_fp()));
0062         _hit.set_eta(L1TMuonEndCap::calc_eta_from_theta_deg(_hit.Theta(), _hit.Endcap()));
0063 
0064         // Station, Ring, Sector, Subsector, Neighbor, and PC/FS/BT_segment filled in
0065         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockRPC.cc - AWB 02.05.17
0066 
0067       }  // End ImportRPC
0068 
0069       void ImportGEM(EMTFHit& _hit, const l1t::emtf::GEM& _GEM, const int _endcap, const int _evt_sector) {
0070         constexpr uint8_t GEM_MAX_CLUSTERS_PER_LAYER = 8;
0071         _hit.set_endcap(_endcap == 1 ? 1 : -1);
0072         _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
0073 
0074         _hit.set_pad(_GEM.Pad());
0075         _hit.set_pad_hi(_GEM.Pad() + (_GEM.ClusterSize() - 1));
0076         _hit.set_pad_low(_GEM.Pad());
0077         _hit.set_partition(_GEM.Partition());
0078         // TODO: verify layer naming is 0/1 and not 1/2
0079         _hit.set_layer(_GEM.ClusterID() < GEM_MAX_CLUSTERS_PER_LAYER ? 0 : 1);
0080         _hit.set_cluster_size(_GEM.ClusterSize());
0081         _hit.set_cluster_id(_GEM.ClusterID());
0082         // TODO: FIXME is this value known for GEM? - JS 13.07.20
0083         _hit.set_bx(_GEM.TBIN() - 3);
0084         _hit.set_valid(_GEM.VP());
0085         _hit.set_bc0(_GEM.BC0());
0086         _hit.set_subsystem(l1tmu::kGEM);
0087 
0088         _hit.set_ring(1);  // GEM only on ring 1
0089         // TODO: FIXME correct for GEM, should match CSC chamber, but GEM have 2 chambers (layers in a superchamber) per CSC chamber - JS 13.07.20
0090         // _hit.set_chamber(L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.GEM_ID()));
0091         _hit.SetGEMDetId(_hit.CreateGEMDetId());
0092         // _hit.SetGEMDigi(_hit.CreateGEMPadDigi());
0093 
0094         // Station, Ring, Sector, Subsector, and Neighbor filled in
0095         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockGEM.cc - JS 13.07.20
0096 
0097       }  // End ImportGEM
0098 
0099       void ImportSP(EMTFTrack& _track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector) {
0100         _track.set_endcap((_endcap == 1) ? 1 : -1);
0101         _track.set_sector(_evt_sector);
0102         _track.set_sector_idx((_endcap == 1) ? _evt_sector - 1 : _evt_sector + 5);
0103         _track.set_mode(_SP.Mode());
0104         _track.set_mode_inv((((_SP.Mode() >> 0) & 1) << 3) | (((_SP.Mode() >> 1) & 1) << 2) |
0105                             (((_SP.Mode() >> 2) & 1) << 1) | (((_SP.Mode() >> 3) & 1) << 0));
0106         _track.set_charge((_SP.C() == 1) ? -1 : 1);  // uGMT uses opposite of physical charge (to match pdgID)
0107         _track.set_bx(_SP.TBIN() - 3);
0108         _track.set_phi_fp(_SP.Phi_full());
0109         _track.set_phi_loc(L1TMuonEndCap::calc_phi_loc_deg(_SP.Phi_full()));
0110         _track.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_track.Phi_loc(), _track.Sector()));
0111         _track.set_eta(L1TMuonEndCap::calc_eta(_SP.Eta_GMT()));
0112         _track.set_pt((_SP.Pt_GMT() - 1) * 0.5);
0113 
0114         _track.set_gmt_pt(_SP.Pt_GMT());
0115         _track.set_gmt_phi(_SP.Phi_GMT());
0116         _track.set_gmt_eta(_SP.Eta_GMT());
0117         _track.set_gmt_quality(_SP.Quality_GMT());
0118         _track.set_gmt_charge(_SP.C());
0119         _track.set_gmt_charge_valid(_SP.VC());
0120 
0121         EMTFPtLUT _lut = {};
0122         _lut.address = _SP.Pt_LUT_addr();
0123         _track.set_PtLUT(_lut);
0124 
0125         // First_bx, Second_bx, Track_num, Has_neighbor, All_neighbor, and Hits should be filled in
0126         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockSP.cc - AWB 07.03.17
0127 
0128       }  // End ImportSP
0129 
0130     }  // End namespace emtf
0131   }    // End namespace stage2
0132 }  // End namespace l1t