CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EMTFUnpackerTools.cc
Go to the documentation of this file.
1 #include "EMTFUnpackerTools.h"
3 
4 namespace l1t {
5  namespace stage2 {
6  namespace emtf {
7 
8  void ImportME(EMTFHit& _hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector) {
9  _hit.set_endcap(_endcap == 1 ? 1 : -1);
10  _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
11 
12  _hit.set_wire(_ME.Wire());
13  _hit.set_strip(_ME.Strip());
14  _hit.set_quality(_ME.Quality());
15  _hit.set_pattern(_ME.CLCT_pattern());
16  _hit.set_bend((_ME.LR() == 1) ? 1 : -1);
17  _hit.set_valid(_ME.VP());
18  _hit.set_sync_err(_ME.SE());
19  _hit.set_bx(_ME.TBIN() - 3);
20  _hit.set_bc0(_ME.BC0());
22  // _hit.set_layer();
23 
24  _hit.set_ring(L1TMuonEndCap::calc_ring(_hit.Station(), _hit.CSC_ID(), _hit.Strip()));
25  _hit.set_chamber(
26  L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.CSC_ID()));
27 
28  _hit.SetCSCDetId(_hit.CreateCSCDetId());
29  //_hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() );
30 
31  // Station, CSC_ID, Sector, Subsector, and Neighbor filled in
32  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc
33  // "set_layer()" is not invoked, so Layer is not yet filled - AWB 21.04.16
34 
35  } // End ImportME
36 
37  void ImportRPC(EMTFHit& _hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector) {
38  _hit.set_endcap(_endcap == 1 ? 1 : -1);
39  _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
40 
41  _hit.set_phi_fp(_RPC.Phi() * 4); // 1/4th the precision of CSC LCTs
42  _hit.set_theta_fp(_RPC.Theta() * 4); // 1/4th the precision of CSC LCTs
43  _hit.set_bx(_RPC.TBIN() - 3);
44  _hit.set_valid(_RPC.VP());
45  _hit.set_bc0(_RPC.BC0());
47 
48  _hit.SetRPCDetId(_hit.CreateRPCDetId());
49  // // Not yet implemented - AWB 15.03.17
50  // _hit.SetRPCDigi ( _hit.CreateRPCDigi() );
51 
52  // Convert integer values to degrees
54  _hit.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_hit.Phi_loc(), _evt_sector));
57 
58  // Station, Ring, Sector, Subsector, Neighbor, and PC/FS/BT_segment filled in
59  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockRPC.cc - AWB 02.05.17
60 
61  } // End ImportRPC
62 
63  void ImportGEM(EMTFHit& _hit, const l1t::emtf::GEM& _GEM, const int _endcap, const int _evt_sector) {
64  constexpr uint8_t GEM_MAX_CLUSTERS_PER_LAYER = 8;
65  _hit.set_endcap(_endcap == 1 ? 1 : -1);
66  _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
67 
68  _hit.set_pad(_GEM.Pad());
69  _hit.set_pad_hi(_GEM.Pad() + (_GEM.ClusterSize() - 1));
70  _hit.set_pad_low(_GEM.Pad());
71  _hit.set_partition(_GEM.Partition());
72  // TODO: verify layer naming is 0/1 and not 1/2
73  _hit.set_layer(_GEM.ClusterID() < GEM_MAX_CLUSTERS_PER_LAYER ? 0 : 1);
74  _hit.set_cluster_size(_GEM.ClusterSize());
75  _hit.set_cluster_id(_GEM.ClusterID());
76  // TODO: FIXME is this value known for GEM? - JS 13.07.20
77  _hit.set_bx(_GEM.TBIN() - 3);
78  _hit.set_valid(_GEM.VP());
79  _hit.set_bc0(_GEM.BC0());
81 
82  _hit.set_ring(1); // GEM only on ring 1
83  // 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
84  // _hit.set_chamber(L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.GEM_ID()));
85  _hit.SetGEMDetId(_hit.CreateGEMDetId());
86  // _hit.SetGEMDigi(_hit.CreateGEMPadDigi());
87 
88  // Station, Ring, Sector, Subsector, and Neighbor filled in
89  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockGEM.cc - JS 13.07.20
90 
91  } // End ImportGEM
92 
93  void ImportSP(EMTFTrack& _track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector) {
94  _track.set_endcap((_endcap == 1) ? 1 : -1);
95  _track.set_sector(_evt_sector);
96  _track.set_sector_idx((_endcap == 1) ? _evt_sector - 1 : _evt_sector + 5);
97  _track.set_mode(_SP.Mode());
98  _track.set_mode_inv((((_SP.Mode() >> 0) & 1) << 3) | (((_SP.Mode() >> 1) & 1) << 2) |
99  (((_SP.Mode() >> 2) & 1) << 1) | (((_SP.Mode() >> 3) & 1) << 0));
100  _track.set_charge((_SP.C() == 1) ? -1 : 1); // uGMT uses opposite of physical charge (to match pdgID)
101  _track.set_bx(_SP.TBIN() - 3);
102  _track.set_phi_fp(_SP.Phi_full());
104  _track.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_track.Phi_loc(), _track.Sector()));
105  _track.set_eta(L1TMuonEndCap::calc_eta(_SP.Eta_GMT()));
106  _track.set_pt((_SP.Pt_GMT() - 1) * 0.5);
107 
108  _track.set_gmt_pt(_SP.Pt_GMT());
109  _track.set_gmt_phi(_SP.Phi_GMT());
110  _track.set_gmt_eta(_SP.Eta_GMT());
111  _track.set_gmt_quality(_SP.Quality_GMT());
112  _track.set_gmt_charge(_SP.C());
113  _track.set_gmt_charge_valid(_SP.VC());
114 
115  EMTFPtLUT _lut = {};
116  _lut.address = _SP.Pt_LUT_addr();
117  _track.set_PtLUT(_lut);
118 
119  // First_bx, Second_bx, Track_num, Has_neighbor, All_neighbor, and Hits should be filled in
120  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockSP.cc - AWB 07.03.17
121 
122  } // End ImportSP
123 
124  } // End namespace emtf
125  } // End namespace stage2
126 } // End namespace l1t
void set_mode(int bits)
Definition: EMTFTrack.h:134
void set_phi_glob(float val)
Definition: EMTFHit.h:190
void set_bx(int bits)
Definition: EMTFTrack.h:139
int ClusterSize() const
Returns the size (in pads) of the cluster.
Definition: GEM.h:47
int BC0() const
Returns whether the cluster has BC0.
Definition: GEM.h:55
int TBIN() const
Definition: ME.h:85
int Phi_full() const
Definition: SP.h:82
float Phi_loc() const
Definition: EMTFHit.h:272
int Strip() const
Definition: EMTFHit.h:222
void set_gmt_eta(int bits)
Definition: EMTFTrack.h:159
void set_sector(int bits)
Definition: EMTFTrack.h:132
GEMDetId CreateGEMDetId() const
Definition: EMTFHit.cc:44
int VP() const
Definition: ME.h:84
int calc_chamber(int station, int sector, int subsector, int ring, int csc_ID)
Definition: TrackTools.cc:28
int Quality() const
Definition: ME.h:67
void set_phi_fp(int bits)
Definition: EMTFTrack.h:152
void ImportME(EMTFHit &_hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector)
int BC0() const
Definition: ME.h:69
int Phi_fp() const
Definition: EMTFHit.h:264
void set_theta(float val)
Definition: EMTFHit.h:191
void set_charge(int bits)
Definition: EMTFTrack.h:138
int Sector() const
Definition: EMTFTrack.h:166
float Theta() const
Definition: EMTFHit.h:274
int Mode() const
Definition: SP.h:90
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:176
void set_sector_idx(int bits)
Definition: EMTFHit.h:140
void set_bc0(int bits)
Definition: EMTFHit.h:178
int TBIN() const
Returns the time bin of the cluster.
Definition: GEM.h:57
int TBIN() const
Definition: SP.h:102
void set_cluster_size(int bits)
Definition: EMTFHit.h:175
int Partition() const
Returns the eta partition (local eta) of the cluster.
Definition: GEM.h:45
void set_sync_err(int bits)
Definition: EMTFHit.h:168
int BC0() const
Definition: RPC.h:48
void ImportGEM(EMTFHit &_hit, const l1t::emtf::GEM &_GEM, const int _endcap, const int _evt_sector)
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:128
void set_endcap(int bits)
Definition: EMTFHit.h:135
void set_sector_idx(int bits)
Definition: EMTFTrack.h:133
void set_ring(int bits)
Definition: EMTFHit.h:137
void set_pad_hi(int bits)
Definition: EMTFHit.h:171
void SetRPCDetId(const RPCDetId &id)
Definition: EMTFHit.h:116
RPCDetId CreateRPCDetId() const
Definition: EMTFHit.cc:12
int TBIN() const
Definition: RPC.h:49
int Theta() const
Definition: RPC.h:43
int Subsector() const
Definition: EMTFHit.h:209
void ImportRPC(EMTFHit &_hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector)
void set_gmt_phi(int bits)
Definition: EMTFTrack.h:158
void set_pt(float val)
Definition: EMTFTrack.h:142
int Sector() const
Definition: EMTFHit.h:206
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:128
int Phi_GMT() const
Definition: SP.h:88
int VC() const
Definition: SP.h:83
int Phi() const
Definition: RPC.h:42
void set_pattern(int bits)
Definition: EMTFHit.h:163
void set_gmt_quality(int bits)
Definition: EMTFTrack.h:160
int ClusterID() const
Returns the the cluster ID within the link.
Definition: GEM.h:49
void set_wire(int bits)
Definition: EMTFHit.h:153
int CLCT_pattern() const
Definition: ME.h:68
int VP() const
Returns the valid flag? of the cluster.
Definition: GEM.h:59
int Pad() const
Returns the lowest pad (strip pair, i.e., local phi) of the cluster.
Definition: GEM.h:43
CSCDetId CreateCSCDetId() const
Definition: EMTFHit.cc:6
int Ring() const
Definition: EMTFHit.h:205
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:166
int VP() const
Definition: RPC.h:50
void set_phi_loc(float val)
Definition: EMTFHit.h:189
void SetCSCDetId(const CSCDetId &id)
Definition: EMTFHit.h:115
int SE() const
Definition: ME.h:79
void set_eta(float val)
Definition: EMTFTrack.h:151
void set_layer(int bits)
Definition: EMTFHit.h:174
void set_gmt_charge(int bits)
Definition: EMTFTrack.h:161
float Phi_loc() const
Definition: EMTFTrack.h:191
void set_pad(int bits)
Definition: EMTFHit.h:170
int Station() const
Definition: EMTFHit.h:204
int Pt_GMT() const
Definition: SP.h:92
void set_valid(int bits)
Definition: EMTFHit.h:167
int calc_ring(int station, int csc_ID, int strip)
Definition: TrackTools.cc:5
void set_strip(int bits)
Definition: EMTFHit.h:154
double calc_eta_from_theta_deg(double theta_deg, int endcap)
Definition: TrackTools.h:113
uint64_t address
Definition: EMTFTrack.h:25
void set_endcap(int bits)
Definition: EMTFTrack.h:131
void set_subsystem(int bits)
Definition: EMTFHit.h:134
int Strip() const
Definition: ME.h:73
int Eta_GMT() const
Definition: SP.h:91
void set_cluster_id(int bits)
Definition: EMTFHit.h:176
void ImportSP(EMTFTrack &_track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector)
void set_pad_low(int bits)
Definition: EMTFHit.h:172
void SetGEMDetId(const GEMDetId &id)
Definition: EMTFHit.h:117
int C() const
Definition: SP.h:81
void set_phi_loc(float val)
Definition: EMTFTrack.h:153
void set_bx(int bits)
Definition: EMTFHit.h:179
void set_gmt_charge_valid(int bits)
Definition: EMTFTrack.h:162
int Endcap() const
Definition: EMTFHit.h:203
void set_phi_glob(float val)
Definition: EMTFTrack.h:154
int Theta_fp() const
Definition: EMTFHit.h:265
unsigned long Pt_LUT_addr() const
Definition: SP.h:107
int Wire() const
Definition: ME.h:66
void set_mode_inv(int bits)
Definition: EMTFTrack.h:135
int LR() const
Definition: ME.h:71
void set_quality(int bits)
Definition: EMTFHit.h:162
void set_gmt_pt(int bits)
Definition: EMTFTrack.h:155
void set_chamber(int bits)
Definition: EMTFHit.h:143
double calc_eta(int bits)
Definition: TrackTools.h:95
int Quality_GMT() const
Definition: SP.h:87
void set_bend(int bits)
Definition: EMTFHit.h:165
int CSC_ID() const
Definition: EMTFHit.h:212
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_partition(int bits)
Definition: EMTFHit.h:173
void set_eta(float val)
Definition: EMTFHit.h:192