CMS 3D CMS Logo

EMTFHitTools.cc
Go to the documentation of this file.
1 
3 
4 namespace l1t {
5 
7  std::cout << "Simulator hits: time_bin, endcap, sector, subsector, station, valid, "
8  << "quality, CLCT pattern, wiregroup, cscid, bend, halfstrip" << std::endl;
9  std::cout << "Expected values: 0 - 7, 1 or 0, 1 - 6, 0 / 1 - 2, 1 - 4, 0 - 1, "
10  << " 0 - 15, 0 - 15, 0 - ?, 1 - 18, 0 - 1, 0 - ?" << std::endl;
11  }
12 
14  std::cout << bx + 6 << ", " << ((endcap == 1) ? 1 : 0) << ", " << sector << ", " << std::max(subsector, 0) << ", "
15  << station << ", " << valid << ", " << quality << ", " << pattern << ", " << wire << ", "
16  << ((ring == 4) ? csc_ID + 9 : csc_ID) << ", " << std::max(bend, 0) << ", " << strip << std::endl;
17  }
18 
19  // Based on L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc
20  // TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, const CSCCorrelatedLCTDigi& digi)
21  void EMTFHit::ImportCSCDetId( const CSCDetId& _detId) {
22 
23  EMTFHit::SetCSCDetId ( _detId );
24  // It appears the following function *actually does literally nothing* - AWB 17.03.16
25  // calculateCSCGlobalSector(detid,_globalsector,_subsector);
26 
27  // Based on L1Trigger/L1TMuonEndCap/interface/PrimitiveConverter.h
28  EMTFHit::set_endcap ( (_detId.endcap() == 2) ? -1 : _detId.endcap() ); // Convert from {+,-} = {1,2} to {1,-1}
29  EMTFHit::set_station ( _detId.station() );
31  EMTFHit::set_ring ( _detId.ring() );
32  EMTFHit::set_chamber ( _detId.chamber() );
33 
36 
37  } // End EMTFHit::ImportCSCDetId
38 
40 
41  return CSCDetId( (endcap == 1) ? 1 : 2, station, // For now, leave "layer" unfilled, defaults to 0.
42  (ring == 4) ? 1 : ring, chamber ); // Not sure if this is correct, or what "layer" does. - AWB 27.04.16
43  }
44 
45  void EMTFHit::ImportRPCDetId( const RPCDetId& _detId) {
46 
47  EMTFHit::SetRPCDetId ( _detId );
48 
49  EMTFHit::set_endcap ( _detId.region() ); // 0 for barrel, +/-1 for +/- endcap
50  EMTFHit::set_station ( _detId.station() ); // Same as in CSCs (?)
51  EMTFHit::set_sector ( _detId.sector() ); // Same as in CSCs (?)
52  EMTFHit::set_subsector ( _detId.subsector() ); // Same as in CSCs (?)
53  EMTFHit::set_ring ( _detId.ring() ); // Ring number in endcap (from 1 to 3, but only 2 and 3 exist currently)
54  EMTFHit::set_roll ( _detId.roll() ); // AKA eta "partition" or "segment": subdivision of ring into 3 parts, noted "C-B-A" in-to-out
55 
58 
59  } // End EMTFHit::ImportCSCDetId
60 
62 
64 
65  }
66 
67  // Based on L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc
68  // TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, const CSCCorrelatedLCTDigi& digi)
69  // This is what gets filled when "getCSCData()" is called in
70  // L1Trigger/L1TMuonEndCap/interface/PrimitiveConverter.h
72 
73  EMTFHit::SetCSCLCTDigi ( _digi );
74 
76  EMTFHit::set_valid ( _digi.isValid() );
77  EMTFHit::set_quality ( _digi.getQuality() );
78  EMTFHit::set_wire ( _digi.getKeyWG() );
79  EMTFHit::set_strip ( _digi.getStrip() );
80  EMTFHit::set_pattern ( _digi.getPattern() );
81  EMTFHit::set_bend ( _digi.getBend() );
82  EMTFHit::set_bx ( _digi.getBX() - 6 ); // Standard for csctfDigis in data, simCscTriggerPrimitiveDigis in MC
85  EMTFHit::set_csc_ID ( _digi.getCSCID() );
86 
88 
89  } // End EMTFHit::ImportCSCCorrelatedLCTDigi
90 
92 
94  EMTFHitExtra::set_bx0 ( _digi.getBX0() );
95 
96  } // End EMTFHitExtra::ImportCSCCorrelatedLCTDigi
97 
99 
101  pattern, (bend == 1) ? 1 : 0,
102  bx + 6, 0, 0, sync_err, csc_ID );
103  // Unsure of how to fill "trknmb" or "bx0" - for now filling with 1 and 0. - AWB 27.04.16
104  // Appear to be unused in the emulator code. mpclink = 0 (after bx) indicates unsorted.
105  }
106 
107  void EMTFHit::ImportRPCDigi( const RPCDigi& _digi ) {
108 
109  EMTFHit::SetRPCDigi ( _digi );
110  EMTFHit::set_strip_hi ( _digi.strip() );
111  EMTFHit::set_strip_low ( _digi.strip() );
112  EMTFHit::set_bx ( _digi.bx() - 6 ); // Started looking at RPCs, not used yet
113 
114  }
115 
117  return RPCDigi( strip, bx + 6 );
118  }
119 
120  void EMTFHit::ImportME( const emtf::ME _ME) {
121 
122  EMTFHit::set_wire ( _ME.Wire() );
123  EMTFHit::set_strip ( _ME.Strip() );
124  EMTFHit::set_quality ( _ME.Quality() );
126  EMTFHit::set_bend ( (_ME.LR() == 1) ? 1 : -1 );
127  EMTFHit::set_valid ( _ME.VP() );
128  EMTFHit::set_sync_err ( _ME.SE() );
129  EMTFHit::set_bx ( _ME.TBIN() - 3 );
130  EMTFHit::set_bc0 ( _ME.BC0() );
131  EMTFHit::set_is_CSC_hit ( true );
132  EMTFHit::set_is_RPC_hit ( false );
133 
134  // Station, CSC_ID, Sector, Subsector, Neighbor, Sector_index, Ring, and Chamber filled in
135  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc
136  // "set_layer()" is not invoked, so Layer is not yet filled - AWB 21.04.16
137 
138  } // End EMTFHit::ImportME
139 
140  int calc_ring (int _station, int _csc_ID, int _strip) {
141  if (_station > 1) {
142  if (_csc_ID < 4) return 1;
143  else if (_csc_ID < 10) return 2;
144  else return -999;
145  }
146  else if (_station == 1) {
147  if (_csc_ID < 4 && _strip > 127) return 4;
148  else if (_csc_ID < 4 && _strip >= 0) return 1;
149  else if (_csc_ID > 3 && _csc_ID < 7) return 2;
150  else if (_csc_ID > 6 && _csc_ID < 10) return 3;
151  else return -999;
152  }
153  else return -999;
154  } // End EMTFHit::calc_ring
155 
156  int calc_chamber (int _station, int _sector, int _subsector, int _ring, int _csc_ID) {
157  int tmp_chamber = -999;
158  if (_station == 1) {
159  tmp_chamber = ((_sector-1) * 6) + _csc_ID + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
160  if (_ring == 2) tmp_chamber -= 3;
161  if (_ring == 3) tmp_chamber -= 6;
162  if (_subsector == 2) tmp_chamber += 3;
163  if (tmp_chamber > 36) tmp_chamber -= 36;
164  }
165  else if (_ring == 1) {
166  tmp_chamber = ((_sector-1) * 3) + _csc_ID + 1; // Chamber offset of 1: First chamber in sector 1 is chamber 2
167  if (tmp_chamber > 18) tmp_chamber -= 18;
168  }
169  else if (_ring == 2) {
170  tmp_chamber = ((_sector-1) * 6) + _csc_ID - 3 + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
171  if (tmp_chamber > 36) tmp_chamber -= 36;
172  }
173  return tmp_chamber;
174  } // End EMTFHit::calc_chamber
175 
177 
178  EMTFHit thisHit;
179  thisHit.set_endcap ( Endcap() );
180  thisHit.set_station ( Station() );
181  thisHit.set_ring ( Ring() );
182  thisHit.set_sector ( Sector() );
183  thisHit.set_sector_index ( Sector_index() );
184  thisHit.set_subsector ( Subsector() );
185  thisHit.set_chamber ( Chamber() );
186  thisHit.set_csc_ID ( CSC_ID() );
187  thisHit.set_neighbor ( Neighbor() );
188  thisHit.set_mpc_link ( MPC_link() );
189  thisHit.set_wire ( Wire() );
190  thisHit.set_strip ( Strip() );
191  thisHit.set_track_num ( Track_num() );
192  thisHit.set_quality ( Quality() );
193  thisHit.set_pattern ( Pattern() );
194  thisHit.set_bend ( Bend() );
195  thisHit.set_valid ( Valid() );
196  thisHit.set_sync_err ( Sync_err() );
197  thisHit.set_bc0 ( BC0() );
198  thisHit.set_bx ( BX() );
199  thisHit.set_stub_num ( Stub_num() );
200  thisHit.set_is_CSC_hit ( Is_CSC_hit() );
201  thisHit.set_is_RPC_hit ( Is_RPC_hit() );
202 
203  return thisHit;
204  } // End EMTFHitExtra::CreateEMTFHit
205 
206 
207 } // End namespace l1t
int chamber() const
Definition: CSCDetId.h:68
int getStrip() const
return the key halfstrip from 0,159
int Quality() const
Definition: EMTFHit.h:108
void set_neighbor(int bits)
Definition: EMTFHit.h:73
int Sector_index() const
Definition: EMTFHit.h:95
int Bend() const
Definition: EMTFHit.h:110
void SetCSCLCTDigi(CSCCorrelatedLCTDigi digi)
Definition: EMTFHit.h:51
int station
Definition: EMTFHit.h:128
int TBIN() const
Definition: ME.h:67
uint16_t getSyncErr() const
int Strip() const
Definition: EMTFHit.h:104
void set_sector_index(int bits)
Definition: EMTFHit.h:67
void SetRPCDetId(RPCDetId id)
Definition: EMTFHit.h:50
int VP() const
Definition: ME.h:66
int Quality() const
Definition: ME.h:49
RPCDetId CreateRPCDetId()
Definition: EMTFHitTools.cc:61
int bx() const
Definition: RPCDigi.h:29
void set_stub_num(int bits)
Definition: EMTFHit.h:87
int BC0() const
Definition: ME.h:51
int calc_subsector(int _station, int _chamber)
Definition: EMTFHitTools.h:12
void set_station(int bits)
Definition: EMTFHit.h:64
int getQuality() const
return the 4 bit Correlated LCT Quality
RPCDigi CreateRPCDigi()
void ImportME(const emtf::ME _ME)
int getBend() const
return bend
void PrintForSimulator()
Definition: EMTFHitTools.cc:13
int MPC_link() const
Definition: EMTFHit.h:102
void set_bc0(int bits)
Definition: EMTFHit.h:85
int calc_chamber(int _station, int _sector, int _subsector, int _ring, int _csc_ID)
delete x;
Definition: CaloConfig.h:22
void set_sync_err(int bits)
Definition: EMTFHit.h:84
int sync_err
Definition: EMTFHit.h:148
void PrintSimulatorHeader()
Definition: EMTFHitTools.cc:6
void set_bx0(int bits)
Definition: EMTFHitExtra.h:53
void set_endcap(int bits)
Definition: EMTFHit.h:63
void set_ring(int bits)
Definition: EMTFHit.h:65
int Chamber() const
Definition: EMTFHit.h:97
void ImportRPCDigi(const RPCDigi &_digi)
int Wire() const
Definition: EMTFHit.h:103
int endcap() const
Definition: CSCDetId.h:93
int Subsector() const
Definition: EMTFHit.h:96
int Is_RPC_hit() const
Definition: EMTFHit.h:117
int Sector() const
Definition: EMTFHit.h:94
void set_strip_low(int bits)
Definition: EMTFHit.h:78
int strip() const
Definition: RPCDigi.h:28
int Valid() const
Definition: EMTFHit.h:111
int roll() const
Definition: RPCDetId.h:120
int subsector
Definition: EMTFHit.h:132
int Sync_err() const
Definition: EMTFHit.h:112
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi()
Definition: EMTFHitTools.cc:98
int Track_num() const
Definition: EMTFHit.h:107
EMTFHit CreateEMTFHit()
int BX() const
Definition: EMTFHit.h:114
int ring() const
Definition: RPCDetId.h:72
void set_pattern(int bits)
Definition: EMTFHit.h:81
void set_csc_ID(int bits)
Definition: EMTFHit.h:70
void set_strip_hi(int bits)
Definition: EMTFHit.h:77
void set_wire(int bits)
Definition: EMTFHit.h:75
int CLCT_pattern() const
Definition: ME.h:50
uint16_t getCSCID() const
void ImportRPCDetId(const RPCDetId &_detId)
Definition: EMTFHitTools.cc:45
int Ring() const
Definition: EMTFHit.h:93
int getTrknmb() const
return track number
int getBX() const
return BX
int pattern
Definition: EMTFHit.h:145
uint16_t getBX0() const
void ImportCSCDetId(const CSCDetId &_detId)
Definition: EMTFHitTools.cc:21
int SE() const
Definition: ME.h:61
int endcap
Definition: EMTFHit.h:127
int ring() const
Definition: CSCDetId.h:75
void set_sector(int bits)
Definition: EMTFHit.h:66
void set_is_CSC_hit(int bits)
Definition: EMTFHit.h:88
int Station() const
Definition: EMTFHit.h:92
int rpc_layer
Definition: EMTFHit.h:136
void set_valid(int bits)
Definition: EMTFHit.h:83
void SetCSCDetId(CSCDetId id)
Definition: EMTFHit.h:49
void SetRPCDigi(RPCDigi digi)
Definition: EMTFHit.h:52
void set_strip(int bits)
Definition: EMTFHit.h:76
int triggerSector() const
Definition: CSCDetId.cc:3
int quality
Definition: EMTFHit.h:144
void ImportCSCCorrelatedLCTDigi(const CSCCorrelatedLCTDigi &_digi)
Definition: EMTFHitTools.cc:71
int getMPCLink() const
return MPC link number, 0 means not sorted, 1-3 give MPC sorting rank
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
int Strip() const
Definition: ME.h:55
bool isValid() const
return valid pattern bit
CSCDetId CreateCSCDetId()
Definition: EMTFHitTools.cc:39
void set_track_num(int bits)
Definition: EMTFHit.h:79
int calc_ring(int _station, int _csc_ID, int _strip)
void set_is_RPC_hit(int bits)
Definition: EMTFHit.h:89
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Definition: RPCDetId.h:114
int getPattern() const
return pattern
int Is_CSC_hit() const
Definition: EMTFHit.h:116
int Pattern() const
Definition: EMTFHit.h:109
int sector
Definition: EMTFHit.h:130
void set_bx(int bits)
Definition: EMTFHit.h:86
int chamber
Definition: EMTFHit.h:133
int Endcap() const
Definition: EMTFHit.h:91
int station() const
Definition: CSCDetId.h:86
void ImportCSCCorrelatedLCTDigi(const CSCCorrelatedLCTDigi &_digi)
Definition: EMTFHitTools.cc:91
int Stub_num() const
Definition: EMTFHit.h:115
int Wire() const
Definition: ME.h:48
int LR() const
Definition: ME.h:53
int BC0() const
Definition: EMTFHit.h:113
void set_quality(int bits)
Definition: EMTFHit.h:80
void set_mpc_link(int bits)
Definition: EMTFHit.h:74
void set_chamber(int bits)
Definition: EMTFHit.h:69
int Neighbor() const
Definition: EMTFHit.h:101
void set_subsector(int bits)
Definition: EMTFHit.h:68
void set_bend(int bits)
Definition: EMTFHit.h:82
int CSC_ID() const
Definition: EMTFHit.h:98
int getKeyWG() const
return the key wire group. counts from 0.
void set_roll(int bits)
Definition: EMTFHit.h:71
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
int csc_ID
Definition: EMTFHit.h:134