CMS 3D CMS Logo

EMTFUnpackerTools.cc
Go to the documentation of this file.
1 
2 #include "EMTFUnpackerTools.h"
3 
4 namespace l1t {
5  namespace stage2 {
6  namespace emtf {
7 
8 
9  void ImportME( EMTFHit& _hit, const l1t::emtf::ME _ME,
10  const int _endcap, const int _evt_sector ) {
11 
12  _hit.set_endcap ( _endcap == 1 ? 1 : -1 );
13  _hit.set_sector_idx ( _endcap == 1 ? _evt_sector - 1 : _evt_sector + 5 );
14 
15  _hit.set_wire ( _ME.Wire() );
16  _hit.set_strip ( _ME.Strip() );
17  _hit.set_quality ( _ME.Quality() );
18  _hit.set_pattern ( _ME.CLCT_pattern() );
19  _hit.set_bend ( (_ME.LR() == 1) ? 1 : -1 );
20  _hit.set_valid ( _ME.VP() );
21  _hit.set_sync_err ( _ME.SE() );
22  _hit.set_bx ( _ME.TBIN() - 3 );
23  _hit.set_bc0 ( _ME.BC0() );
24  _hit.set_is_CSC ( true );
25  _hit.set_is_RPC ( false );
26  _hit.set_subsystem ( 1 );
27  // _hit.set_layer();
28 
29  _hit.set_ring ( L1TMuonEndCap::calc_ring( _hit.Station(), _hit.CSC_ID(), _hit.Strip() ) );
31  _hit.Subsector(), _hit.Ring(), _hit.CSC_ID() ) );
32 
33  _hit.SetCSCDetId ( _hit.CreateCSCDetId() );
35 
36  // Station, CSC_ID, Sector, Subsector, and Neighbor filled in
37  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc
38  // "set_layer()" is not invoked, so Layer is not yet filled - AWB 21.04.16
39 
40  } // End ImportME
41 
42 
43  void ImportRPC( EMTFHit& _hit, const l1t::emtf::RPC _RPC,
44  const int _endcap, const int _evt_sector ) {
45 
46  _hit.set_endcap ( _endcap == 1 ? 1 : -1 );
47  _hit.set_sector_idx ( _endcap == 1 ? _evt_sector - 1 : _evt_sector + 5 );
48 
49  _hit.set_phi_fp ( _RPC.Phi()*4 ); // 1/4th the precision of CSC LCTs
50  _hit.set_theta_fp ( _RPC.Theta()*4 ); // 1/4th the precision of CSC LCTs
51  _hit.set_bx ( _RPC.TBIN() - 3 );
52  _hit.set_valid ( _RPC.VP() );
53  _hit.set_bc0 ( _RPC.BC0() );
54  _hit.set_is_CSC ( false );
55  _hit.set_is_RPC ( true );
56  _hit.set_subsystem ( 2 );
57 
58  // // Not yet implemented - AWB 15.03.17
59  // _hit.SetRPCDetId ( _hit.CreateRPCDetId() );
60  // _hit.SetRPCDigi ( _hit.CreateRPCDigi() );
61 
62  // Convert integer values to degrees
64  _hit.set_phi_glob ( L1TMuonEndCap::calc_phi_glob_deg ( _hit.Phi_loc(), _hit.Sector() ) );
66  _hit.set_eta ( L1TMuonEndCap::calc_eta_from_theta_deg ( _hit.Theta(), _hit.Endcap() ) );
67 
68  // Station, Ring, Sector, Subsector, Neighbor, and PC/FS/BT_segment filled in
69  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockRPC.cc - AWB 02.05.17
70 
71  } // End ImportRPC
72 
73 
74  void ImportSP( EMTFTrack& _track, const l1t::emtf::SP _SP,
75  const int _endcap, const int _evt_sector ) {
76 
77  _track.set_endcap ( (_endcap == 1) ? 1 : -1 );
78  _track.set_sector ( _evt_sector );
79  _track.set_sector_idx ( (_endcap == 1) ? _evt_sector - 1 : _evt_sector + 5 );
80  _track.set_mode ( _SP.Mode() );
81  _track.set_mode_inv ( (((_SP.Mode() >> 0) & 1) << 3) |
82  (((_SP.Mode() >> 1) & 1) << 2) |
83  (((_SP.Mode() >> 2) & 1) << 1) |
84  (((_SP.Mode() >> 3) & 1) << 0) );
85  _track.set_charge ( (_SP.C() == 1) ? -1 : 1 ); // uGMT uses opposite of physical charge (to match pdgID)
86  _track.set_bx ( _SP.TBIN() - 3 );
87  _track.set_phi_fp ( _SP.Phi_full() );
89  _track.set_phi_glob ( L1TMuonEndCap::calc_phi_glob_deg( _track.Phi_loc(), _track.Sector() ) );
90  _track.set_eta ( L1TMuonEndCap::calc_eta( _SP.Eta_GMT() ) );
91  _track.set_pt ( (_SP.Pt_GMT() - 1) * 0.5 );
92 
93  _track.set_gmt_pt ( _SP.Pt_GMT() );
94  _track.set_gmt_phi ( _SP.Phi_GMT() );
95  _track.set_gmt_eta ( _SP.Eta_GMT() );
96  _track.set_gmt_quality( _SP.Quality_GMT() );
97  _track.set_gmt_charge ( _SP.C() );
98  _track.set_gmt_charge_valid( _SP.VC() );
99 
100  EMTFPtLUT _lut = {};
101  _lut.address = _SP.Pt_LUT_addr();
102  _track.set_PtLUT( _lut );
103 
104  // First_bx, Second_bx, Track_num, Has_neighbor, All_neighbor, and Hits should be filled in
105  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockSP.cc - AWB 07.03.17
106 
107  } // End ImportSP
108 
109 
110  } // End namespace emtf
111  } // End namespace stage2
112 } // End namespace l1t
void set_mode(int bits)
Definition: EMTFTrack.h:91
void set_phi_glob(float val)
Definition: EMTFHit.h:111
void set_bx(int bits)
Definition: EMTFTrack.h:96
int TBIN() const
Definition: ME.h:69
int Phi_full() const
Definition: SP.h:61
float Phi_loc() const
Definition: EMTFHit.h:163
int Strip() const
Definition: EMTFHit.h:141
void set_gmt_eta(int bits)
Definition: EMTFTrack.h:112
void set_sector(int bits)
Definition: EMTFTrack.h:89
void SetCSCLCTDigi(const CSCCorrelatedLCTDigi &digi)
Definition: EMTFHit.h:58
int VP() const
Definition: ME.h:68
int calc_chamber(int station, int sector, int subsector, int ring, int csc_ID)
Definition: TrackTools.cc:21
int Quality() const
Definition: ME.h:51
void set_phi_fp(int bits)
Definition: EMTFTrack.h:107
void ImportME(EMTFHit &_hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector)
int BC0() const
Definition: ME.h:53
int Phi_fp() const
Definition: EMTFHit.h:153
void set_theta(float val)
Definition: EMTFHit.h:112
void set_charge(int bits)
Definition: EMTFTrack.h:95
int Sector() const
Definition: EMTFTrack.h:120
float Theta() const
Definition: EMTFHit.h:165
int Mode() const
Definition: SP.h:69
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:149
void set_sector_idx(int bits)
Definition: EMTFHit.h:74
void set_bc0(int bits)
Definition: EMTFHit.h:97
Definition: Event.h:15
int TBIN() const
Definition: SP.h:81
delete x;
Definition: CaloConfig.h:22
void set_sync_err(int bits)
Definition: EMTFHit.h:96
int BC0() const
Definition: RPC.h:42
void set_theta_fp(int bits)
Definition: EMTFHit.h:101
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:85
void set_endcap(int bits)
Definition: EMTFHit.h:69
void set_sector_idx(int bits)
Definition: EMTFTrack.h:90
void set_ring(int bits)
Definition: EMTFHit.h:71
int TBIN() const
Definition: RPC.h:43
int Theta() const
Definition: RPC.h:37
int Subsector() const
Definition: EMTFHit.h:128
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:111
void set_pt(float val)
Definition: EMTFTrack.h:99
int Sector() const
Definition: EMTFHit.h:125
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:110
int Phi_GMT() const
Definition: SP.h:67
int VC() const
Definition: SP.h:62
int Phi() const
Definition: RPC.h:36
void set_is_CSC(int bits)
Definition: EMTFHit.h:117
void set_pattern(int bits)
Definition: EMTFHit.h:93
void set_gmt_quality(int bits)
Definition: EMTFTrack.h:113
void set_wire(int bits)
Definition: EMTFHit.h:87
int CLCT_pattern() const
Definition: ME.h:52
CSCDetId CreateCSCDetId() const
Definition: EMTFHit.cc:6
int Ring() const
Definition: EMTFHit.h:124
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:139
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi() const
Definition: EMTFHit.cc:18
int VP() const
Definition: RPC.h:44
void set_phi_loc(float val)
Definition: EMTFHit.h:110
void set_is_RPC(int bits)
Definition: EMTFHit.h:118
void SetCSCDetId(const CSCDetId &id)
Definition: EMTFHit.h:55
int SE() const
Definition: ME.h:63
void set_eta(float val)
Definition: EMTFTrack.h:106
void set_gmt_charge(int bits)
Definition: EMTFTrack.h:114
float Phi_loc() const
Definition: EMTFTrack.h:142
int Station() const
Definition: EMTFHit.h:123
int Pt_GMT() const
Definition: SP.h:71
void set_valid(int bits)
Definition: EMTFHit.h:95
int calc_ring(int station, int csc_ID, int strip)
Definition: TrackTools.cc:5
void set_strip(int bits)
Definition: EMTFHit.h:88
double calc_eta_from_theta_deg(double theta_deg, int endcap)
Definition: TrackTools.h:95
uint64_t address
Definition: EMTFTrack.h:18
void set_endcap(int bits)
Definition: EMTFTrack.h:88
void set_subsystem(int bits)
Definition: EMTFHit.h:120
int Strip() const
Definition: ME.h:57
int Eta_GMT() const
Definition: SP.h:70
void ImportSP(EMTFTrack &_track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector)
int C() const
Definition: SP.h:60
void set_phi_loc(float val)
Definition: EMTFTrack.h:108
void set_bx(int bits)
Definition: EMTFHit.h:98
void set_gmt_charge_valid(int bits)
Definition: EMTFTrack.h:115
int Endcap() const
Definition: EMTFHit.h:122
void set_phi_glob(float val)
Definition: EMTFTrack.h:109
int Theta_fp() const
Definition: EMTFHit.h:154
unsigned long Pt_LUT_addr() const
Definition: SP.h:86
int Wire() const
Definition: ME.h:50
void set_mode_inv(int bits)
Definition: EMTFTrack.h:92
int LR() const
Definition: ME.h:55
void set_quality(int bits)
Definition: EMTFHit.h:92
void set_gmt_pt(int bits)
Definition: EMTFTrack.h:110
void set_chamber(int bits)
Definition: EMTFHit.h:77
double calc_eta(int bits)
Definition: TrackTools.h:77
int Quality_GMT() const
Definition: SP.h:66
void set_bend(int bits)
Definition: EMTFHit.h:94
int CSC_ID() const
Definition: EMTFHit.h:131
void set_phi_fp(int bits)
Definition: EMTFHit.h:100
void set_eta(float val)
Definition: EMTFHit.h:113