Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-03 04:17:48

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         // Run 3 muon shower
0031         _hit.set_muon_shower_inTime(_ME.MUS_inTime());
0032         _hit.set_muon_shower_outOfTime(_ME.MUS_outOfTime());
0033         _hit.set_muon_shower_valid(_ME.MUSV());
0034 
0035         _hit.set_ring(L1TMuonEndCap::calc_ring(_hit.Station(), _hit.CSC_ID(), _hit.Strip()));
0036         _hit.set_chamber(
0037             L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.CSC_ID()));
0038 
0039         _hit.SetCSCDetId(_hit.CreateCSCDetId());
0040         //_hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() );
0041 
0042         // Station, CSC_ID, Sector, Subsector, and Neighbor filled in
0043         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc
0044         // "set_layer()" is not invoked, so Layer is not yet filled - AWB 21.04.16
0045 
0046       }  // End ImportME
0047 
0048       void ImportRPC(EMTFHit& _hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector) {
0049         _hit.set_endcap(_endcap == 1 ? 1 : -1);
0050         _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
0051 
0052         _hit.set_phi_fp(_RPC.Phi() * 4);      // 1/4th the precision of CSC LCTs
0053         _hit.set_theta_fp(_RPC.Theta() * 4);  // 1/4th the precision of CSC LCTs
0054         _hit.set_bx(_RPC.TBIN() - 3);
0055         _hit.set_valid(_RPC.VP());
0056         _hit.set_bc0(_RPC.BC0());
0057         _hit.set_subsystem(l1tmu::kRPC);
0058 
0059         _hit.SetRPCDetId(_hit.CreateRPCDetId());
0060         // // Not yet implemented - AWB 15.03.17
0061         // _hit.SetRPCDigi  ( _hit.CreateRPCDigi() );
0062 
0063         // Convert integer values to degrees
0064         _hit.set_phi_loc(L1TMuonEndCap::calc_phi_loc_deg(_hit.Phi_fp()));
0065         _hit.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_hit.Phi_loc(), _evt_sector));
0066         _hit.set_theta(L1TMuonEndCap::calc_theta_deg_from_int(_hit.Theta_fp()));
0067         _hit.set_eta(L1TMuonEndCap::calc_eta_from_theta_deg(_hit.Theta(), _hit.Endcap()));
0068 
0069         // Station, Ring, Sector, Subsector, Neighbor, and PC/FS/BT_segment filled in
0070         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockRPC.cc - AWB 02.05.17
0071 
0072       }  // End ImportRPC
0073 
0074       void ImportGEM(EMTFHit& _hit, const l1t::emtf::GEM& _GEM, const int _endcap, const int _evt_sector) {
0075         constexpr uint8_t GEM_MAX_NROLL = 8;  //unpacked roll number 0-7, GE1/1 case only
0076         _hit.set_endcap(_endcap == 1 ? 1 : -1);
0077         _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
0078 
0079         _hit.set_pad(_GEM.Pad());
0080         _hit.set_pad_hi(_GEM.Pad() + (_GEM.ClusterSize() - 1));
0081         _hit.set_pad_low(_GEM.Pad());
0082         //_GEM.Partition() is roll number, 0-7, ieta is for GEMDetID, 8-1
0083         _hit.set_partition(GEM_MAX_NROLL - _GEM.Partition());
0084         _hit.set_cluster_size(_GEM.ClusterSize());
0085         _hit.set_cluster_id(_GEM.ClusterID());
0086         // TODO: FIXME is this value known for GEM? - JS 13.07.20
0087         _hit.set_bx(_GEM.TBIN() - 3);
0088         _hit.set_valid(_GEM.VP());
0089         _hit.set_bc0(_GEM.BC0());
0090         _hit.set_subsystem(l1tmu::kGEM);
0091 
0092         _hit.set_ring(1);  // GEM only on ring 1
0093         _hit.SetGEMDetId(_hit.CreateGEMDetId());
0094         // _hit.SetGEMDigi(_hit.CreateGEMPadDigi());
0095 
0096         // Station, Ring, Sector, Subsector, and Neighbor filled in
0097         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockGEM.cc - JS 13.07.20
0098 
0099       }  // End ImportGEM
0100 
0101       void ImportSP(EMTFTrack& _track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector) {
0102         _track.set_endcap((_endcap == 1) ? 1 : -1);
0103         _track.set_sector(_evt_sector);
0104         _track.set_sector_idx((_endcap == 1) ? _evt_sector - 1 : _evt_sector + 5);
0105         _track.set_mode(_SP.Mode());
0106         _track.set_mode_inv((((_SP.Mode() >> 0) & 1) << 3) | (((_SP.Mode() >> 1) & 1) << 2) |
0107                             (((_SP.Mode() >> 2) & 1) << 1) | (((_SP.Mode() >> 3) & 1) << 0));
0108         _track.set_charge((_SP.C() == 1) ? -1 : 1);  // uGMT uses opposite of physical charge (to match pdgID)
0109         _track.set_bx(_SP.TBIN() - 3);
0110         _track.set_phi_fp(_SP.Phi_full());
0111         _track.set_phi_loc(L1TMuonEndCap::calc_phi_loc_deg(_SP.Phi_full()));
0112         _track.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_track.Phi_loc(), _track.Sector()));
0113         _track.set_eta(L1TMuonEndCap::calc_eta(_SP.Eta_GMT()));
0114         _track.set_pt((_SP.Pt_GMT() - 1) * 0.5);
0115         _track.set_pt_dxy((_SP.Pt_dxy_GMT() - 1));
0116 
0117         _track.set_gmt_pt(_SP.Pt_GMT());
0118         _track.set_gmt_pt_dxy(_SP.Pt_dxy_GMT());
0119         _track.set_gmt_dxy(_SP.Dxy_GMT());
0120         _track.set_gmt_phi(_SP.Phi_GMT());
0121         _track.set_gmt_eta(_SP.Eta_GMT());
0122         _track.set_gmt_quality(_SP.Quality_GMT());
0123         _track.set_gmt_charge(_SP.C());
0124         _track.set_gmt_charge_valid(_SP.VC());
0125 
0126         EMTFPtLUT _lut = {};
0127         _lut.address = _SP.Pt_LUT_addr();
0128         _track.set_PtLUT(_lut);
0129 
0130         // First_bx, Second_bx, Track_num, Has_neighbor, All_neighbor, and Hits should be filled in
0131         // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockSP.cc - AWB 07.03.17
0132 
0133       }  // End ImportSP
0134 
0135     }  // End namespace emtf
0136   }    // End namespace stage2
0137 }  // End namespace l1t