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  _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
l1t::EMTFHit::set_pad
void set_pad(int bits)
Definition: EMTFHit.h:158
l1t::emtf::ME::Strip
int Strip() const
Definition: ME.h:73
l1t::EMTFHit::set_subsystem
void set_subsystem(int bits)
Definition: EMTFHit.h:128
l1t::EMTFHit::set_eta
void set_eta(float val)
Definition: EMTFHit.h:180
l1t::EMTFHit::set_pad_hi
void set_pad_hi(int bits)
Definition: EMTFHit.h:159
l1t::emtf::SP::Pt_LUT_addr
unsigned long Pt_LUT_addr() const
Definition: SP.h:107
l1t::emtf::SP::Quality_GMT
int Quality_GMT() const
Definition: SP.h:87
l1t::stage2::emtf::ImportRPC
void ImportRPC(EMTFHit &_hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector)
Definition: EMTFUnpackerTools.cc:37
l1t::emtf::RPC::BC0
int BC0() const
Definition: RPC.h:48
l1t::EMTFTrack::set_gmt_phi
void set_gmt_phi(int bits)
Definition: EMTFTrack.h:156
l1t::EMTFHit::CSC_ID
int CSC_ID() const
Definition: EMTFHit.h:200
l1t::EMTFPtLUT
Definition: EMTFTrack.h:24
l1t::EMTFTrack::set_phi_fp
void set_phi_fp(int bits)
Definition: EMTFTrack.h:150
l1t::emtf::RPC
Definition: RPC.h:11
emtf::calc_eta
double calc_eta(int bits)
Definition: TrackTools.h:95
l1t::EMTFTrack::set_sector
void set_sector(int bits)
Definition: EMTFTrack.h:130
l1t::emtf::ME
Definition: ME.h:11
l1t::EMTFHit::SetGEMDetId
void SetGEMDetId(const GEMDetId &id)
Definition: EMTFHit.h:111
l1t::EMTFTrack::set_mode
void set_mode(int bits)
Definition: EMTFTrack.h:132
l1t::emtf::ME::TBIN
int TBIN() const
Definition: ME.h:85
l1t::emtf::SP::Pt_GMT
int Pt_GMT() const
Definition: SP.h:92
l1t::EMTFHit::Sector
int Sector() const
Definition: EMTFHit.h:194
l1t::stage2::emtf::ImportGEM
void ImportGEM(EMTFHit &_hit, const l1t::emtf::GEM &_GEM, const int _endcap, const int _evt_sector)
Definition: EMTFUnpackerTools.cc:63
l1t::EMTFHit::Endcap
int Endcap() const
Definition: EMTFHit.h:191
l1t::EMTFHit::set_phi_loc
void set_phi_loc(float val)
Definition: EMTFHit.h:177
l1t::EMTFHit::Theta
float Theta() const
Definition: EMTFHit.h:256
l1t::emtf::ME::SE
int SE() const
Definition: ME.h:79
l1t::EMTFTrack::Sector
int Sector() const
Definition: EMTFTrack.h:164
l1t::EMTFHit::CreateRPCDetId
RPCDetId CreateRPCDetId() const
Definition: EMTFHit.cc:12
emtf::calc_ring
int calc_ring(int station, int csc_ID, int strip)
Definition: TrackTools.cc:5
l1t::EMTFHit::set_cluster_id
void set_cluster_id(int bits)
Definition: EMTFHit.h:164
emtf::calc_eta_from_theta_deg
double calc_eta_from_theta_deg(double theta_deg, int endcap)
Definition: TrackTools.h:113
l1t::EMTFHit::set_cluster_size
void set_cluster_size(int bits)
Definition: EMTFHit.h:163
l1t::EMTFTrack::set_phi_loc
void set_phi_loc(float val)
Definition: EMTFTrack.h:151
emtf::calc_chamber
int calc_chamber(int station, int sector, int subsector, int ring, int csc_ID)
Definition: TrackTools.cc:28
l1t::emtf::SP::Phi_full
int Phi_full() const
Definition: SP.h:82
l1t::emtf::GEM::ClusterID
int ClusterID() const
Returns the the cluster ID within the link.
Definition: GEM.h:49
l1t::EMTFHit::set_theta
void set_theta(float val)
Definition: EMTFHit.h:179
l1t::EMTFHit::set_chamber
void set_chamber(int bits)
Definition: EMTFHit.h:137
emtf::calc_theta_deg_from_int
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:128
L1TMuon::kRPC
Definition: L1TMuonSubsystems.h:5
l1t::emtf::ME::CLCT_pattern
int CLCT_pattern() const
Definition: ME.h:68
l1t::emtf::SP
Definition: SP.h:11
l1t::EMTFHit::CreateCSCDetId
CSCDetId CreateCSCDetId() const
Definition: EMTFHit.cc:6
l1t::emtf::RPC::Theta
int Theta() const
Definition: RPC.h:43
l1t::EMTFHit::set_pad_low
void set_pad_low(int bits)
Definition: EMTFHit.h:160
l1t::emtf::ME::LR
int LR() const
Definition: ME.h:71
l1t::EMTFHit::Subsector
int Subsector() const
Definition: EMTFHit.h:197
emtf
Definition: Event.h:15
l1t::emtf::RPC::Phi
int Phi() const
Definition: RPC.h:42
emtf::calc_phi_loc_deg
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:176
l1t::emtf::SP::Phi_GMT
int Phi_GMT() const
Definition: SP.h:88
l1t::EMTFHit::Theta_fp
int Theta_fp() const
Definition: EMTFHit.h:247
l1t::EMTFHit::set_valid
void set_valid(int bits)
Definition: EMTFHit.h:155
l1t::EMTFTrack::set_charge
void set_charge(int bits)
Definition: EMTFTrack.h:136
l1t::EMTFTrack::set_pt
void set_pt(float val)
Definition: EMTFTrack.h:140
l1t::emtf::GEM::ClusterSize
int ClusterSize() const
Returns the size (in pads) of the cluster.
Definition: GEM.h:47
l1t::EMTFHit::set_strip
void set_strip(int bits)
Definition: EMTFHit.h:148
l1t::emtf::GEM::Pad
int Pad() const
Returns the lowest pad (strip pair, i.e., local phi) of the cluster.
Definition: GEM.h:43
l1t::emtf::ME::VP
int VP() const
Definition: ME.h:84
l1t::EMTFHit::set_sync_err
void set_sync_err(int bits)
Definition: EMTFHit.h:156
emtf::calc_phi_glob_deg
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:166
l1t::EMTFTrack
Definition: EMTFTrack.h:42
l1t::EMTFTrack::set_gmt_charge_valid
void set_gmt_charge_valid(int bits)
Definition: EMTFTrack.h:160
l1t::emtf::SP::C
int C() const
Definition: SP.h:81
l1t::emtf::GEM
Definition: GEM.h:11
L1TMuon::kCSC
Definition: L1TMuonSubsystems.h:5
l1t::emtf::SP::Eta_GMT
int Eta_GMT() const
Definition: SP.h:91
l1t::emtf::SP::VC
int VC() const
Definition: SP.h:83
l1t::EMTFTrack::set_sector_idx
void set_sector_idx(int bits)
Definition: EMTFTrack.h:131
l1t::EMTFHit
Definition: EMTFHit.h:25
l1t
delete x;
Definition: CaloConfig.h:22
l1t::EMTFHit::CreateGEMDetId
GEMDetId CreateGEMDetId() const
Definition: EMTFHit.cc:44
l1t::EMTFHit::SetCSCDetId
void SetCSCDetId(const CSCDetId &id)
Definition: EMTFHit.h:109
l1t::EMTFHit::set_quality
void set_quality(int bits)
Definition: EMTFHit.h:152
l1t::EMTFHit::set_phi_glob
void set_phi_glob(float val)
Definition: EMTFHit.h:178
l1t::emtf::SP::Mode
int Mode() const
Definition: SP.h:90
l1t::EMTFHit::set_sector_idx
void set_sector_idx(int bits)
Definition: EMTFHit.h:134
l1t::EMTFPtLUT::address
uint64_t address
Definition: EMTFTrack.h:25
L1TMuon::kGEM
Definition: L1TMuonSubsystems.h:5
l1t::EMTFHit::set_theta_fp
void set_theta_fp(int bits)
Definition: EMTFHit.h:170
l1t::EMTFHit::set_partition
void set_partition(int bits)
Definition: EMTFHit.h:161
l1t::emtf::GEM::VP
int VP() const
Returns the valid flag? of the cluster.
Definition: GEM.h:59
l1t::EMTFHit::set_wire
void set_wire(int bits)
Definition: EMTFHit.h:147
L1TMuonSubsystems.h
l1t::emtf::RPC::TBIN
int TBIN() const
Definition: RPC.h:49
l1t::emtf::RPC::VP
int VP() const
Definition: RPC.h:50
l1t::EMTFHit::set_pattern
void set_pattern(int bits)
Definition: EMTFHit.h:153
l1t::EMTFHit::Phi_loc
float Phi_loc() const
Definition: EMTFHit.h:254
l1t::EMTFTrack::set_bx
void set_bx(int bits)
Definition: EMTFTrack.h:137
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
l1t::EMTFTrack::set_gmt_charge
void set_gmt_charge(int bits)
Definition: EMTFTrack.h:159
l1t::EMTFHit::set_endcap
void set_endcap(int bits)
Definition: EMTFHit.h:129
l1t::EMTFTrack::set_gmt_quality
void set_gmt_quality(int bits)
Definition: EMTFTrack.h:158
l1t::emtf::ME::Quality
int Quality() const
Definition: ME.h:67
l1t::stage2::emtf::ImportSP
void ImportSP(EMTFTrack &_track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector)
Definition: EMTFUnpackerTools.cc:93
l1t::EMTFHit::set_bx
void set_bx(int bits)
Definition: EMTFHit.h:167
l1t::emtf::ME::BC0
int BC0() const
Definition: ME.h:69
l1t::EMTFTrack::set_PtLUT
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:126
l1t::EMTFHit::Ring
int Ring() const
Definition: EMTFHit.h:193
l1t::emtf::GEM::Partition
int Partition() const
Returns the eta partition (local eta) of the cluster.
Definition: GEM.h:45
EMTFUnpackerTools.h
l1t::emtf::ME::Wire
int Wire() const
Definition: ME.h:66
l1t::emtf::GEM::BC0
int BC0() const
Returns whether the cluster has BC0.
Definition: GEM.h:55
l1t::EMTFTrack::set_gmt_pt
void set_gmt_pt(int bits)
Definition: EMTFTrack.h:153
l1t::EMTFHit::set_phi_fp
void set_phi_fp(int bits)
Definition: EMTFHit.h:169
l1t::EMTFHit::Station
int Station() const
Definition: EMTFHit.h:192
l1t::stage2::emtf::ImportME
void ImportME(EMTFHit &_hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector)
Definition: EMTFUnpackerTools.cc:8
l1t::emtf::GEM::TBIN
int TBIN() const
Returns the time bin of the cluster.
Definition: GEM.h:57
l1t::EMTFTrack::set_mode_inv
void set_mode_inv(int bits)
Definition: EMTFTrack.h:133
l1t::EMTFTrack::set_phi_glob
void set_phi_glob(float val)
Definition: EMTFTrack.h:152
l1t::emtf::SP::TBIN
int TBIN() const
Definition: SP.h:102
l1t::EMTFTrack::set_endcap
void set_endcap(int bits)
Definition: EMTFTrack.h:129
l1t::EMTFHit::SetRPCDetId
void SetRPCDetId(const RPCDetId &id)
Definition: EMTFHit.h:110
l1t::EMTFHit::set_bend
void set_bend(int bits)
Definition: EMTFHit.h:154
l1t::EMTFTrack::Phi_loc
float Phi_loc() const
Definition: EMTFTrack.h:189
l1t::EMTFTrack::set_gmt_eta
void set_gmt_eta(int bits)
Definition: EMTFTrack.h:157
l1t::EMTFHit::set_bc0
void set_bc0(int bits)
Definition: EMTFHit.h:166
l1t::EMTFHit::Phi_fp
int Phi_fp() const
Definition: EMTFHit.h:246
l1t::EMTFHit::set_ring
void set_ring(int bits)
Definition: EMTFHit.h:131
l1t::EMTFHit::set_layer
void set_layer(int bits)
Definition: EMTFHit.h:162
l1t::EMTFTrack::set_eta
void set_eta(float val)
Definition: EMTFTrack.h:149
l1t::EMTFHit::Strip
int Strip() const
Definition: EMTFHit.h:210