CMS 3D CMS Logo

EMTFHit2016Tools.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 EMTFHit2016::ImportCSCDetId( const CSCDetId& _detId) {
22 
23  EMTFHit2016::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  EMTFHit2016::set_endcap ( (_detId.endcap() == 2) ? -1 : _detId.endcap() ); // Convert from {+,-} = {1,2} to {1,-1}
29  EMTFHit2016::set_station ( _detId.station() );
31  EMTFHit2016::set_ring ( _detId.ring() );
32  EMTFHit2016::set_chamber ( _detId.chamber() );
33 
36 
37  } // End EMTFHit2016::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 EMTFHit2016::ImportRPCDetId( const RPCDetId& _detId) {
46 
47  EMTFHit2016::SetRPCDetId ( _detId );
48 
49  EMTFHit2016::set_endcap ( _detId.region() ); // 0 for barrel, +/-1 for +/- endcap
50  EMTFHit2016::set_station ( _detId.station() ); // Same as in CSCs (?)
51  EMTFHit2016::set_sector ( _detId.sector() ); // Same as in CSCs (?)
52  EMTFHit2016::set_subsector ( _detId.subsector() ); // Same as in CSCs (?)
53  EMTFHit2016::set_ring ( _detId.ring() ); // Ring number in endcap (from 1 to 3, but only 2 and 3 exist currently)
54  EMTFHit2016::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 EMTFHit2016::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 
74 
76  EMTFHit2016::set_valid ( _digi.isValid() );
78  EMTFHit2016::set_wire ( _digi.getKeyWG() );
79  EMTFHit2016::set_strip ( _digi.getStrip() );
81  EMTFHit2016::set_bend ( _digi.getBend() );
82  EMTFHit2016::set_bx ( _digi.getBX() - 6 ); // Standard for csctfDigis in data, simCscTriggerPrimitiveDigis in MC
86 
88 
89  } // End EMTFHit2016::ImportCSCCorrelatedLCTDigi
90 
92 
95 
96  } // End EMTFHit2016Extra::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 EMTFHit2016::ImportRPCDigi( const RPCDigi& _digi ) {
108 
109  EMTFHit2016::SetRPCDigi ( _digi );
110  EMTFHit2016::set_strip_hi ( _digi.strip() );
111  EMTFHit2016::set_strip_low ( _digi.strip() );
112  EMTFHit2016::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 EMTFHit2016::ImportME( const emtf::ME _ME) {
121 
122  EMTFHit2016::set_wire ( _ME.Wire() );
123  EMTFHit2016::set_strip ( _ME.Strip() );
126  EMTFHit2016::set_bend ( (_ME.LR() == 1) ? 1 : -1 );
127  EMTFHit2016::set_valid ( _ME.VP() );
128  EMTFHit2016::set_sync_err ( _ME.SE() );
129  EMTFHit2016::set_bx ( _ME.TBIN() - 3 );
130  EMTFHit2016::set_bc0 ( _ME.BC0() );
132  EMTFHit2016::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 EMTFHit2016::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 EMTFHit2016::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 EMTFHit2016::calc_chamber
175 
177 
178  EMTFHit2016 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 EMTFHit2016Extra::CreateEMTFHit2016
205 
206 
207 } // End namespace l1t
void set_valid(int bits)
Definition: EMTFHit2016.h:83
int chamber() const
Definition: CSCDetId.h:68
void set_quality(int bits)
Definition: EMTFHit2016.h:80
int getStrip() const
return the key halfstrip from 0,159
void set_ring(int bits)
Definition: EMTFHit2016.h:65
int TBIN() const
Definition: ME.h:67
void set_neighbor(int bits)
Definition: EMTFHit2016.h:73
uint16_t getSyncErr() const
int BX() const
Definition: EMTFHit2016.h:114
void set_pattern(int bits)
Definition: EMTFHit2016.h:81
void set_is_CSC_hit(int bits)
Definition: EMTFHit2016.h:88
int VP() const
Definition: ME.h:66
int Stub_num() const
Definition: EMTFHit2016.h:115
int Sync_err() const
Definition: EMTFHit2016.h:112
int Quality() const
Definition: ME.h:49
void set_bend(int bits)
Definition: EMTFHit2016.h:82
CSCDetId CreateCSCDetId()
int bx() const
Definition: RPCDigi.h:29
void set_strip_low(int bits)
Definition: EMTFHit2016.h:78
void set_strip(int bits)
Definition: EMTFHit2016.h:76
int BC0() const
Definition: ME.h:51
int calc_subsector(int _station, int _chamber)
int Track_num() const
Definition: EMTFHit2016.h:107
int getQuality() const
return the 4 bit Correlated LCT Quality
void SetCSCLCTDigi(CSCCorrelatedLCTDigi digi)
Definition: EMTFHit2016.h:51
void SetCSCDetId(CSCDetId id)
Definition: EMTFHit2016.h:49
int getBend() const
return bend
void set_strip_hi(int bits)
Definition: EMTFHit2016.h:77
int calc_chamber(int _station, int _sector, int _subsector, int _ring, int _csc_ID)
void ImportME(const emtf::ME _ME)
int Quality() const
Definition: EMTFHit2016.h:108
int Strip() const
Definition: EMTFHit2016.h:104
delete x;
Definition: CaloConfig.h:22
int Is_CSC_hit() const
Definition: EMTFHit2016.h:116
void set_roll(int bits)
Definition: EMTFHit2016.h:71
int Valid() const
Definition: EMTFHit2016.h:111
void set_chamber(int bits)
Definition: EMTFHit2016.h:69
void set_subsector(int bits)
Definition: EMTFHit2016.h:68
void ImportCSCCorrelatedLCTDigi(const CSCCorrelatedLCTDigi &_digi)
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi()
int Sector() const
Definition: EMTFHit2016.h:94
void set_csc_ID(int bits)
Definition: EMTFHit2016.h:70
int Station() const
Definition: EMTFHit2016.h:92
void set_wire(int bits)
Definition: EMTFHit2016.h:75
void SetRPCDigi(RPCDigi digi)
Definition: EMTFHit2016.h:52
void set_bc0(int bits)
Definition: EMTFHit2016.h:85
int endcap() const
Definition: CSCDetId.h:93
void set_endcap(int bits)
Definition: EMTFHit2016.h:63
int Endcap() const
Definition: EMTFHit2016.h:91
int Sector_index() const
Definition: EMTFHit2016.h:95
int Is_RPC_hit() const
Definition: EMTFHit2016.h:117
int strip() const
Definition: RPCDigi.h:28
RPCDetId CreateRPCDetId()
void set_is_RPC_hit(int bits)
Definition: EMTFHit2016.h:89
int roll() const
Definition: RPCDetId.h:120
int MPC_link() const
Definition: EMTFHit2016.h:102
int Subsector() const
Definition: EMTFHit2016.h:96
int ring() const
Definition: RPCDetId.h:72
void set_sector(int bits)
Definition: EMTFHit2016.h:66
int CLCT_pattern() const
Definition: ME.h:50
uint16_t getCSCID() const
void SetRPCDetId(RPCDetId id)
Definition: EMTFHit2016.h:50
void ImportCSCDetId(const CSCDetId &_detId)
int Neighbor() const
Definition: EMTFHit2016.h:101
int getTrknmb() const
return track number
int BC0() const
Definition: EMTFHit2016.h:113
int getBX() const
return BX
void set_sector_index(int bits)
Definition: EMTFHit2016.h:67
uint16_t getBX0() const
void ImportRPCDetId(const RPCDetId &_detId)
int SE() const
Definition: ME.h:61
void set_stub_num(int bits)
Definition: EMTFHit2016.h:87
int ring() const
Definition: CSCDetId.h:75
void set_station(int bits)
Definition: EMTFHit2016.h:64
void set_mpc_link(int bits)
Definition: EMTFHit2016.h:74
void ImportRPCDigi(const RPCDigi &_digi)
void set_track_num(int bits)
Definition: EMTFHit2016.h:79
int triggerSector() const
Definition: CSCDetId.cc:3
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 CSC_ID() const
Definition: EMTFHit2016.h:98
int Strip() const
Definition: ME.h:55
bool isValid() const
return valid pattern bit
int calc_ring(int _station, int _csc_ID, int _strip)
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 Ring() const
Definition: EMTFHit2016.h:93
int Pattern() const
Definition: EMTFHit2016.h:109
int station() const
Definition: CSCDetId.h:86
void set_bx0(int bits)
void ImportCSCCorrelatedLCTDigi(const CSCCorrelatedLCTDigi &_digi)
void set_bx(int bits)
Definition: EMTFHit2016.h:86
int Wire() const
Definition: EMTFHit2016.h:103
EMTFHit2016 CreateEMTFHit2016()
int Wire() const
Definition: ME.h:48
int LR() const
Definition: ME.h:53
void set_sync_err(int bits)
Definition: EMTFHit2016.h:84
int Chamber() const
Definition: EMTFHit2016.h:97
int getKeyWG() const
return the key wire group. counts from 0.
int Bend() const
Definition: EMTFHit2016.h:110
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96