CMS 3D CMS Logo

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