test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  // Based on L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc
46  // TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, const CSCCorrelatedLCTDigi& digi)
47  // This is what gets filled when "getCSCData()" is called in
48  // L1Trigger/L1TMuonEndCap/interface/PrimitiveConverter.h
50 
51  EMTFHit::SetCSCLCTDigi ( _digi );
52 
54  EMTFHit::set_valid ( _digi.isValid() );
55  EMTFHit::set_quality ( _digi.getQuality() );
56  EMTFHit::set_wire ( _digi.getKeyWG() );
57  EMTFHit::set_strip ( _digi.getStrip() );
58  EMTFHit::set_pattern ( _digi.getPattern() );
59  EMTFHit::set_bend ( _digi.getBend() );
60  EMTFHit::set_bx ( _digi.getBX() - 6 ); // Standard for csctfDigis in data, simCscTriggerPrimitiveDigis in MC
63  EMTFHit::set_csc_ID ( _digi.getCSCID() );
64 
66 
67  } // End EMTFHit::ImportCSCCorrelatedLCTDigi
68 
70 
72  EMTFHitExtra::set_bx0 ( _digi.getBX0() );
73 
74  } // End EMTFHitExtra::ImportCSCCorrelatedLCTDigi
75 
77 
79  pattern, (bend == 1) ? 1 : 0,
80  bx + 6, 0, 0, sync_err, csc_ID );
81  // Unsure of how to fill "trknmb" or "bx0" - for now filling with 1 and 0. - AWB 27.04.16
82  // Appear to be unused in the emulator code. mpclink = 0 (after bx) indicates unsorted.
83  }
84 
85  void EMTFHit::ImportME( const emtf::ME _ME) {
86 
87  EMTFHit::set_wire ( _ME.Wire() );
88  EMTFHit::set_strip ( _ME.Strip() );
89  EMTFHit::set_quality ( _ME.Quality() );
91  EMTFHit::set_bend ( (_ME.LR() == 1) ? 1 : -1 );
92  EMTFHit::set_valid ( _ME.VP() );
93  EMTFHit::set_sync_err ( _ME.SE() );
94  EMTFHit::set_bx ( _ME.TBIN() - 3 );
95  EMTFHit::set_bc0 ( _ME.BC0() );
96  EMTFHit::set_is_CSC_hit ( true );
97  EMTFHit::set_is_RPC_hit ( false );
98 
99  // Station, CSC_ID, Sector, Subsector, Neighbor, Sector_index, Ring, and Chamber filled in
100  // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc
101  // "set_layer()" is not invoked, so Layer is not yet filled - AWB 21.04.16
102 
103  } // End EMTFHit::ImportME
104 
105  int calc_ring (int _station, int _csc_ID, int _strip) {
106  if (_station > 1) {
107  if (_csc_ID < 4) return 1;
108  else if (_csc_ID < 10) return 2;
109  else return -999;
110  }
111  else if (_station == 1) {
112  if (_csc_ID < 4 && _strip > 127) return 4;
113  else if (_csc_ID < 4 && _strip >= 0) return 1;
114  else if (_csc_ID > 3 && _csc_ID < 7) return 2;
115  else if (_csc_ID > 6 && _csc_ID < 10) return 3;
116  else return -999;
117  }
118  else return -999;
119  } // End EMTFHit::calc_ring
120 
121  int calc_chamber (int _station, int _sector, int _subsector, int _ring, int _csc_ID) {
122  int tmp_chamber = -999;
123  if (_station == 1) {
124  tmp_chamber = ((_sector-1) * 6) + _csc_ID + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
125  if (_ring == 2) tmp_chamber -= 3;
126  if (_ring == 3) tmp_chamber -= 6;
127  if (_subsector == 2) tmp_chamber += 3;
128  if (tmp_chamber > 36) tmp_chamber -= 36;
129  }
130  else if (_ring == 1) {
131  tmp_chamber = ((_sector-1) * 3) + _csc_ID + 1; // Chamber offset of 1: First chamber in sector 1 is chamber 2
132  if (tmp_chamber > 18) tmp_chamber -= 18;
133  }
134  else if (_ring == 2) {
135  tmp_chamber = ((_sector-1) * 6) + _csc_ID - 3 + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
136  if (tmp_chamber > 36) tmp_chamber -= 36;
137  }
138  return tmp_chamber;
139  } // End EMTFHit::calc_chamber
140 
142 
143  EMTFHit thisHit;
144  thisHit.set_endcap ( Endcap() );
145  thisHit.set_station ( Station() );
146  thisHit.set_ring ( Ring() );
147  thisHit.set_sector ( Sector() );
148  thisHit.set_sector_index ( Sector_index() );
149  thisHit.set_subsector ( Subsector() );
150  thisHit.set_chamber ( Chamber() );
151  thisHit.set_csc_ID ( CSC_ID() );
152  thisHit.set_neighbor ( Neighbor() );
153  thisHit.set_mpc_link ( MPC_link() );
154  thisHit.set_wire ( Wire() );
155  thisHit.set_strip ( Strip() );
156  thisHit.set_track_num ( Track_num() );
157  thisHit.set_quality ( Quality() );
158  thisHit.set_pattern ( Pattern() );
159  thisHit.set_bend ( Bend() );
160  thisHit.set_valid ( Valid() );
161  thisHit.set_sync_err ( Sync_err() );
162  thisHit.set_bc0 ( BC0() );
163  thisHit.set_bx ( BX() );
164  thisHit.set_stub_num ( Stub_num() );
165  thisHit.set_is_CSC_hit ( Is_CSC_hit() );
166  thisHit.set_is_RPC_hit ( Is_RPC_hit() );
167 
168  return thisHit;
169  } // End EMTFHitExtra::CreateEMTFHit
170 
171 
172 } // 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:86
void set_neighbor(int bits)
Definition: EMTFHit.h:57
int Sector_index() const
Definition: EMTFHit.h:77
int Bend() const
Definition: EMTFHit.h:88
void SetCSCLCTDigi(CSCCorrelatedLCTDigi digi)
Definition: EMTFHit.h:42
int station
Definition: EMTFHit.h:104
int TBIN() const
Definition: ME.h:67
uint16_t getSyncErr() const
int Strip() const
Definition: EMTFHit.h:84
void set_sector_index(int bits)
Definition: EMTFHit.h:53
int VP() const
Definition: ME.h:66
int Quality() const
Definition: ME.h:49
void set_stub_num(int bits)
Definition: EMTFHit.h:69
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:50
int getQuality() const
return the 4 bit Correlated LCT Quality
void ImportME(const emtf::ME _ME)
Definition: EMTFHitTools.cc:85
int getBend() const
return bend
void PrintForSimulator()
Definition: EMTFHitTools.cc:13
int MPC_link() const
Definition: EMTFHit.h:82
void set_bc0(int bits)
Definition: EMTFHit.h:67
int calc_chamber(int _station, int _sector, int _subsector, int _ring, int _csc_ID)
void set_sync_err(int bits)
Definition: EMTFHit.h:66
int sync_err
Definition: EMTFHit.h:120
void PrintSimulatorHeader()
Definition: EMTFHitTools.cc:6
void set_bx0(int bits)
Definition: EMTFHitExtra.h:35
void set_endcap(int bits)
Definition: EMTFHit.h:49
void set_ring(int bits)
Definition: EMTFHit.h:51
int Chamber() const
Definition: EMTFHit.h:79
int Wire() const
Definition: EMTFHit.h:83
int endcap() const
Definition: CSCDetId.h:93
int Subsector() const
Definition: EMTFHit.h:78
int Is_RPC_hit() const
Definition: EMTFHit.h:95
int Sector() const
Definition: EMTFHit.h:76
int Valid() const
Definition: EMTFHit.h:89
int subsector
Definition: EMTFHit.h:108
int Sync_err() const
Definition: EMTFHit.h:90
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi()
Definition: EMTFHitTools.cc:76
int Track_num() const
Definition: EMTFHit.h:85
EMTFHit CreateEMTFHit()
int BX() const
Definition: EMTFHit.h:92
void set_pattern(int bits)
Definition: EMTFHit.h:63
void set_csc_ID(int bits)
Definition: EMTFHit.h:56
void set_wire(int bits)
Definition: EMTFHit.h:59
int CLCT_pattern() const
Definition: ME.h:50
uint16_t getCSCID() const
int Ring() const
Definition: EMTFHit.h:75
int getTrknmb() const
return track number
int getBX() const
return BX
int pattern
Definition: EMTFHit.h:117
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:103
int ring() const
Definition: CSCDetId.h:75
void set_sector(int bits)
Definition: EMTFHit.h:52
void set_is_CSC_hit(int bits)
Definition: EMTFHit.h:70
int Station() const
Definition: EMTFHit.h:74
void set_valid(int bits)
Definition: EMTFHit.h:65
void SetCSCDetId(CSCDetId id)
Definition: EMTFHit.h:41
void set_strip(int bits)
Definition: EMTFHit.h:60
int triggerSector() const
Definition: CSCDetId.cc:3
int quality
Definition: EMTFHit.h:116
void ImportCSCCorrelatedLCTDigi(const CSCCorrelatedLCTDigi &_digi)
Definition: EMTFHitTools.cc:49
int getMPCLink() const
return MPC link number, 0 means not sorted, 1-3 give MPC sorting rank
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:61
int calc_ring(int _station, int _csc_ID, int _strip)
void set_is_RPC_hit(int bits)
Definition: EMTFHit.h:71
int getPattern() const
return pattern
int Is_CSC_hit() const
Definition: EMTFHit.h:94
int Pattern() const
Definition: EMTFHit.h:87
int sector
Definition: EMTFHit.h:106
void set_bx(int bits)
Definition: EMTFHit.h:68
int chamber
Definition: EMTFHit.h:109
int Endcap() const
Definition: EMTFHit.h:73
int station() const
Definition: CSCDetId.h:86
tuple cout
Definition: gather_cfg.py:145
void ImportCSCCorrelatedLCTDigi(const CSCCorrelatedLCTDigi &_digi)
Definition: EMTFHitTools.cc:69
int Stub_num() const
Definition: EMTFHit.h:93
int Wire() const
Definition: ME.h:48
int LR() const
Definition: ME.h:53
int BC0() const
Definition: EMTFHit.h:91
void set_quality(int bits)
Definition: EMTFHit.h:62
void set_mpc_link(int bits)
Definition: EMTFHit.h:58
void set_chamber(int bits)
Definition: EMTFHit.h:55
int Neighbor() const
Definition: EMTFHit.h:81
void set_subsector(int bits)
Definition: EMTFHit.h:54
void set_bend(int bits)
Definition: EMTFHit.h:64
int CSC_ID() const
Definition: EMTFHit.h:80
int getKeyWG() const
return the key wire group
int csc_ID
Definition: EMTFHit.h:110