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  // Run 3 muon shower
33  _hit.set_muon_shower_valid(_ME.MUSV());
34 
35  _hit.set_ring(L1TMuonEndCap::calc_ring(_hit.Station(), _hit.CSC_ID(), _hit.Strip()));
36  _hit.set_chamber(
37  L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.CSC_ID()));
38 
39  _hit.SetCSCDetId(_hit.CreateCSCDetId());
40  //_hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() );
41 
42  // Station, CSC_ID, Sector, Subsector, and Neighbor filled in
43  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc
44  // "set_layer()" is not invoked, so Layer is not yet filled - AWB 21.04.16
45 
46  } // End ImportME
47 
48  void ImportRPC(EMTFHit& _hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector) {
49  _hit.set_endcap(_endcap == 1 ? 1 : -1);
50  _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
51 
52  _hit.set_phi_fp(_RPC.Phi() * 4); // 1/4th the precision of CSC LCTs
53  _hit.set_theta_fp(_RPC.Theta() * 4); // 1/4th the precision of CSC LCTs
54  _hit.set_bx(_RPC.TBIN() - 3);
55  _hit.set_valid(_RPC.VP());
56  _hit.set_bc0(_RPC.BC0());
58 
59  _hit.SetRPCDetId(_hit.CreateRPCDetId());
60  // // Not yet implemented - AWB 15.03.17
61  // _hit.SetRPCDigi ( _hit.CreateRPCDigi() );
62 
63  // Convert integer values to degrees
65  _hit.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_hit.Phi_loc(), _evt_sector));
68 
69  // Station, Ring, Sector, Subsector, Neighbor, and PC/FS/BT_segment filled in
70  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockRPC.cc - AWB 02.05.17
71 
72  } // End ImportRPC
73 
74  void ImportGEM(EMTFHit& _hit, const l1t::emtf::GEM& _GEM, const int _endcap, const int _evt_sector) {
75  constexpr uint8_t GEM_MAX_CLUSTERS_PER_LAYER = 8;
76  _hit.set_endcap(_endcap == 1 ? 1 : -1);
77  _hit.set_sector_idx(_endcap == 1 ? _evt_sector - 1 : _evt_sector + 5);
78 
79  _hit.set_pad(_GEM.Pad());
80  _hit.set_pad_hi(_GEM.Pad() + (_GEM.ClusterSize() - 1));
81  _hit.set_pad_low(_GEM.Pad());
82  _hit.set_partition(_GEM.Partition());
83  // TODO: verify layer naming is 0/1 and not 1/2
84  _hit.set_layer(_GEM.ClusterID() < GEM_MAX_CLUSTERS_PER_LAYER ? 0 : 1);
85  _hit.set_cluster_size(_GEM.ClusterSize());
86  _hit.set_cluster_id(_GEM.ClusterID());
87  // TODO: FIXME is this value known for GEM? - JS 13.07.20
88  _hit.set_bx(_GEM.TBIN() - 3);
89  _hit.set_valid(_GEM.VP());
90  _hit.set_bc0(_GEM.BC0());
92 
93  _hit.set_ring(1); // GEM only on ring 1
94  // 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
95  // _hit.set_chamber(L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.GEM_ID()));
96  _hit.SetGEMDetId(_hit.CreateGEMDetId());
97  // _hit.SetGEMDigi(_hit.CreateGEMPadDigi());
98 
99  // Station, Ring, Sector, Subsector, and Neighbor filled in
100  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockGEM.cc - JS 13.07.20
101 
102  } // End ImportGEM
103 
104  void ImportSP(EMTFTrack& _track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector) {
105  _track.set_endcap((_endcap == 1) ? 1 : -1);
106  _track.set_sector(_evt_sector);
107  _track.set_sector_idx((_endcap == 1) ? _evt_sector - 1 : _evt_sector + 5);
108  _track.set_mode(_SP.Mode());
109  _track.set_mode_inv((((_SP.Mode() >> 0) & 1) << 3) | (((_SP.Mode() >> 1) & 1) << 2) |
110  (((_SP.Mode() >> 2) & 1) << 1) | (((_SP.Mode() >> 3) & 1) << 0));
111  _track.set_charge((_SP.C() == 1) ? -1 : 1); // uGMT uses opposite of physical charge (to match pdgID)
112  _track.set_bx(_SP.TBIN() - 3);
113  _track.set_phi_fp(_SP.Phi_full());
115  _track.set_phi_glob(L1TMuonEndCap::calc_phi_glob_deg(_track.Phi_loc(), _track.Sector()));
116  _track.set_eta(L1TMuonEndCap::calc_eta(_SP.Eta_GMT()));
117  _track.set_pt((_SP.Pt_GMT() - 1) * 0.5);
118  _track.set_pt_dxy((_SP.Pt_dxy_GMT() - 1));
119 
120  _track.set_gmt_pt(_SP.Pt_GMT());
121  _track.set_gmt_pt_dxy(_SP.Pt_dxy_GMT());
122  _track.set_gmt_dxy(_SP.Dxy_GMT());
123  _track.set_gmt_phi(_SP.Phi_GMT());
124  _track.set_gmt_eta(_SP.Eta_GMT());
125  _track.set_gmt_quality(_SP.Quality_GMT());
126  _track.set_gmt_charge(_SP.C());
127  _track.set_gmt_charge_valid(_SP.VC());
128 
129  EMTFPtLUT _lut = {};
130  _lut.address = _SP.Pt_LUT_addr();
131  _track.set_PtLUT(_lut);
132 
133  // First_bx, Second_bx, Track_num, Has_neighbor, All_neighbor, and Hits should be filled in
134  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockSP.cc - AWB 07.03.17
135 
136  } // End ImportSP
137 
138  } // End namespace emtf
139  } // End namespace stage2
140 } // 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:199
void set_bx(int bits)
Definition: EMTFTrack.h:139
int Strip() const
Definition: ME.h:95
float Theta() const
Definition: EMTFHit.h:286
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_muon_shower_inTime(int bits)
Definition: EMTFHit.h:168
void set_theta(float val)
Definition: EMTFHit.h:200
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:146
void set_bc0(int bits)
Definition: EMTFHit.h:187
int Phi_fp() const
Definition: EMTFHit.h:276
int Pt_dxy_GMT() const
Definition: SP.h:101
Definition: Event.h:15
void set_cluster_size(int bits)
Definition: EMTFHit.h:184
delete x;
Definition: CaloConfig.h:22
void set_sync_err(int bits)
Definition: EMTFHit.h:177
int Theta() const
Definition: RPC.h:43
int MUS_outOfTime() const
Definition: ME.h:117
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:191
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:128
void set_endcap(int bits)
Definition: EMTFHit.h:141
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:143
int CSC_ID() const
Definition: EMTFHit.h:221
int TBIN() const
Definition: ME.h:107
int LR() const
Definition: ME.h:93
void set_pad_hi(int bits)
Definition: EMTFHit.h:180
int Phi_full() const
Definition: SP.h:90
int Pt_GMT() const
Definition: SP.h:100
void SetRPCDetId(const RPCDetId &id)
Definition: EMTFHit.h:122
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:165
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:218
void set_strip_eighth_bit(int bits)
Definition: EMTFHit.h:166
void set_gmt_pt_dxy(int bits)
Definition: EMTFTrack.h:156
void set_slope(int bits)
Definition: EMTFHit.h:175
int Eighth_strip() const
Definition: ME.h:111
void set_pattern(int bits)
Definition: EMTFHit.h:172
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:159
int ClusterID() const
Returns the the cluster ID within the link.
Definition: GEM.h:49
void set_pattern_run3(int bits)
Definition: EMTFHit.h:173
int CLCT_pattern() const
Definition: ME.h:90
int Theta_fp() const
Definition: EMTFHit.h:277
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:231
int Partition() const
Returns the eta partition (local eta) of the cluster.
Definition: GEM.h:45
int BC0() const
Definition: ME.h:91
void set_gmt_dxy(int bits)
Definition: EMTFTrack.h:157
int BC0() const
Returns whether the cluster has BC0.
Definition: GEM.h:55
void set_phi_loc(float val)
Definition: EMTFHit.h:198
int VP() const
Definition: ME.h:106
int MUS_inTime() const
Definition: ME.h:116
void SetCSCDetId(const CSCDetId &id)
Definition: EMTFHit.h:121
void set_eta(float val)
Definition: EMTFTrack.h:151
void set_layer(int bits)
Definition: EMTFHit.h:183
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:179
int Endcap() const
Definition: EMTFHit.h:212
int Station() const
Definition: EMTFHit.h:213
void set_valid(int bits)
Definition: EMTFHit.h:176
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:160
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:140
void set_cluster_id(int bits)
Definition: EMTFHit.h:185
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:181
void SetGEMDetId(const GEMDetId &id)
Definition: EMTFHit.h:123
void set_phi_loc(float val)
Definition: EMTFTrack.h:153
void set_bx(int bits)
Definition: EMTFHit.h:188
void set_gmt_charge_valid(int bits)
Definition: EMTFTrack.h:162
int Ring() const
Definition: EMTFHit.h:214
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:171
float Phi_loc() const
Definition: EMTFHit.h:284
int MUSV() const
Definition: ME.h:115
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:149
double calc_eta(int bits)
Definition: TrackTools.h:99
void set_bend(int bits)
Definition: EMTFHit.h:174
void set_phi_fp(int bits)
Definition: EMTFHit.h:190
void set_partition(int bits)
Definition: EMTFHit.h:182
void set_muon_shower_valid(int bits)
Definition: EMTFHit.h:167
int Dxy_GMT() const
Definition: SP.h:102
int Sector() const
Definition: EMTFHit.h:215
CSCDetId CreateCSCDetId() const
Definition: EMTFHit.cc:6
void set_muon_shower_outOfTime(int bits)
Definition: EMTFHit.h:169
void set_eta(float val)
Definition: EMTFHit.h:201
void set_pt_dxy(float val)
Definition: EMTFTrack.h:144