CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SectorProcessorLUT Class Reference

#include <SectorProcessorLUT.h>

Public Member Functions

uint32_t get_cppf_lut_id (int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll) const
 
uint32_t get_cppf_ph_lut (int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll, int halfstrip, bool is_neighbor) const
 
uint32_t get_cppf_th_lut (int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll) const
 
uint32_t get_ph_disp (int fw_endcap, int fw_sector, int pc_lut_id) const
 
uint32_t get_ph_init (int fw_endcap, int fw_sector, int pc_lut_id) const
 
uint32_t get_ph_init_hard (int fw_station, int fw_cscid) const
 
uint32_t get_ph_patt_corr (int pattern) const
 
uint32_t get_ph_patt_corr_sign (int pattern) const
 
uint32_t get_ph_zone_offset (int pc_station, int pc_chamber) const
 
uint32_t get_th_corr_lut (int fw_endcap, int fw_sector, int pc_lut_id, int pc_wire_strip_id) const
 
uint32_t get_th_disp (int fw_endcap, int fw_sector, int pc_lut_id) const
 
uint32_t get_th_init (int fw_endcap, int fw_sector, int pc_lut_id) const
 
uint32_t get_th_lut (int fw_endcap, int fw_sector, int pc_lut_id, int pc_wire_id) const
 
void read (bool pc_lut_data, int pc_lut_version)
 
 SectorProcessorLUT ()
 
 ~SectorProcessorLUT ()
 

Private Member Functions

void read_cppf_file (const std::string &filename, std::vector< uint32_t > &vec1, std::vector< uint32_t > &vec2, bool local)
 
void read_file (const std::string &filename, std::vector< uint32_t > &vec)
 

Private Attributes

std::vector< uint32_t > cppf_ph_lut_
 
std::vector< uint32_t > cppf_th_lut_
 
std::vector< uint32_t > ph_disp_neighbor_
 
std::vector< uint32_t > ph_init_hard_
 
std::vector< uint32_t > ph_init_neighbor_
 
std::vector< uint32_t > ph_patt_corr_
 
std::vector< uint32_t > ph_patt_corr_sign_
 
std::vector< uint32_t > ph_zone_offset_
 
std::vector< uint32_t > th_corr_lut_neighbor_
 
std::vector< uint32_t > th_disp_neighbor_
 
std::vector< uint32_t > th_init_neighbor_
 
std::vector< uint32_t > th_lut_neighbor_
 
int version_
 

Detailed Description

Definition at line 8 of file SectorProcessorLUT.h.

Constructor & Destructor Documentation

◆ SectorProcessorLUT()

SectorProcessorLUT::SectorProcessorLUT ( )
explicit

Definition at line 10 of file SectorProcessorLUT.cc.

10 : version_(0xFFFFFFFF) {}

◆ ~SectorProcessorLUT()

SectorProcessorLUT::~SectorProcessorLUT ( )

Definition at line 12 of file SectorProcessorLUT.cc.

12 {}

Member Function Documentation

◆ get_cppf_lut_id()

uint32_t SectorProcessorLUT::get_cppf_lut_id ( int  rpc_region,
int  rpc_sector,
int  rpc_station,
int  rpc_ring,
int  rpc_subsector,
int  rpc_roll 
) const

Definition at line 302 of file SectorProcessorLUT.cc.

Referenced by get_cppf_ph_lut(), get_cppf_th_lut(), and read_cppf_file().

303  {
304  uint32_t iendcap = (rpc_region == -1) ? 1 : 0;
305  uint32_t isector = (rpc_sector - 1);
306  uint32_t istationring = (rpc_station >= 3) ? ((rpc_station - 3) * 2 + (rpc_ring - 2) + 2) : (rpc_station - 1);
307  uint32_t isubsector = (rpc_subsector - 1);
308  uint32_t iroll = (rpc_roll - 1);
309  return ((((iendcap * 6 + isector) * 6 + istationring) * 6 + isubsector) * 3 + iroll);
310 }

◆ get_cppf_ph_lut()

uint32_t SectorProcessorLUT::get_cppf_ph_lut ( int  rpc_region,
int  rpc_sector,
int  rpc_station,
int  rpc_ring,
int  rpc_subsector,
int  rpc_roll,
int  halfstrip,
bool  is_neighbor 
) const

Definition at line 312 of file SectorProcessorLUT.cc.

References cppf_ph_lut_, and get_cppf_lut_id().

Referenced by PrimitiveConversion::convert_rpc_details().

319  {
320  const uint32_t th_index = get_cppf_lut_id(rpc_region, rpc_sector, rpc_station, rpc_ring, rpc_subsector, rpc_roll);
321  const uint32_t ph_index = (th_index * 64) + (halfstrip - 1);
322  uint32_t ph = 0;
323 
324  if (ph_index < cppf_ph_lut_.size()) {
325  ph = cppf_ph_lut_.at(ph_index);
326  } else {
327  edm::LogError("L1T") << "Could not retrieve entry from LUT. rpc_region: " << rpc_region
328  << ", rpc_sector: " << rpc_sector << ", rpc_station: " << rpc_station
329  << ", rpc_ring: " << rpc_ring << ", rpc_subsector: " << rpc_subsector
330  << ", rpc_roll: " << rpc_roll << ", halfstrip: " << halfstrip
331  << ", is_neighbor: " << is_neighbor;
332  }
333 
334  if (!is_neighbor && rpc_subsector == 2)
335  ph += 900;
336  return ph;
337 }
std::vector< uint32_t > cppf_ph_lut_
Log< level::Error, false > LogError
uint32_t get_cppf_lut_id(int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll) const

◆ get_cppf_th_lut()

uint32_t SectorProcessorLUT::get_cppf_th_lut ( int  rpc_region,
int  rpc_sector,
int  rpc_station,
int  rpc_ring,
int  rpc_subsector,
int  rpc_roll 
) const

Definition at line 339 of file SectorProcessorLUT.cc.

References cppf_th_lut_, and get_cppf_lut_id().

Referenced by PrimitiveConversion::convert_rpc_details().

340  {
341  const uint32_t th_index = get_cppf_lut_id(rpc_region, rpc_sector, rpc_station, rpc_ring, rpc_subsector, rpc_roll);
342  uint32_t th = 0;
343 
344  if (th_index < cppf_th_lut_.size()) {
345  th = cppf_th_lut_.at(th_index);
346  } else {
347  edm::LogError("L1T") << "Could not retrieve entry from LUT. rpc_region: " << rpc_region
348  << ", rpc_sector: " << rpc_sector << ", rpc_station: " << rpc_station
349  << ", rpc_ring: " << rpc_ring << ", rpc_subsector: " << rpc_subsector
350  << ", rpc_roll: " << rpc_roll;
351  }
352  return th;
353 }
std::vector< uint32_t > cppf_th_lut_
Log< level::Error, false > LogError
uint32_t get_cppf_lut_id(int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll) const

◆ get_ph_disp()

uint32_t SectorProcessorLUT::get_ph_disp ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id 
) const

Definition at line 157 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_disp_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

157  {
158  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
159  uint32_t entry = 0;
160 
161  if (index < ph_disp_neighbor_.size()) {
163  } else {
164  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
165  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
166  }
167  return entry;
168 }
Log< level::Error, false > LogError
std::vector< uint32_t > ph_disp_neighbor_

◆ get_ph_init()

uint32_t SectorProcessorLUT::get_ph_init ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id 
) const

Definition at line 144 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_init_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

144  {
145  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
146  uint32_t entry = 0;
147 
148  if (index < ph_init_neighbor_.size()) {
150  } else {
151  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
152  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
153  }
154  return entry;
155 }
Log< level::Error, false > LogError
std::vector< uint32_t > ph_init_neighbor_

◆ get_ph_init_hard()

uint32_t SectorProcessorLUT::get_ph_init_hard ( int  fw_station,
int  fw_cscid 
) const

Definition at line 289 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_init_hard_.

Referenced by PrimitiveConversion::convert_csc_details().

289  {
290  const uint32_t index = fw_station * 16 + fw_cscid;
291  uint32_t entry = 0;
292 
293  if (index < ph_init_hard_.size()) {
294  entry = ph_init_hard_.at(index);
295  } else {
296  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_station: " << fw_station
297  << ", fw_cscid: " << fw_cscid;
298  }
299  return entry;
300 }
Log< level::Error, false > LogError
std::vector< uint32_t > ph_init_hard_

◆ get_ph_patt_corr()

uint32_t SectorProcessorLUT::get_ph_patt_corr ( int  pattern) const

Definition at line 252 of file SectorProcessorLUT.cc.

References mps_splice::entry, topSingleLeptonDQM_PU_cfi::pattern, and ph_patt_corr_.

Referenced by PrimitiveConversion::convert_csc_details().

252  {
253  const uint32_t index = pattern;
254  uint32_t entry = 0;
255 
256  if (index < ph_patt_corr_.size()) {
257  entry = ph_patt_corr_.at(index);
258  } else {
259  edm::LogError("L1T") << "Could not retrieve entry from LUT. pattern: " << pattern;
260  }
261  return entry;
262 }
Log< level::Error, false > LogError
std::vector< uint32_t > ph_patt_corr_

◆ get_ph_patt_corr_sign()

uint32_t SectorProcessorLUT::get_ph_patt_corr_sign ( int  pattern) const

Definition at line 264 of file SectorProcessorLUT.cc.

References mps_splice::entry, topSingleLeptonDQM_PU_cfi::pattern, and ph_patt_corr_sign_.

Referenced by PrimitiveConversion::convert_csc_details().

264  {
265  const uint32_t index = pattern;
266  uint32_t entry = 0;
267 
268  if (index < ph_patt_corr_sign_.size()) {
270  } else {
271  edm::LogError("L1T") << "Could not retrieve entry from LUT. pattern: " << pattern;
272  }
273  return entry;
274 }
Log< level::Error, false > LogError
std::vector< uint32_t > ph_patt_corr_sign_

◆ get_ph_zone_offset()

uint32_t SectorProcessorLUT::get_ph_zone_offset ( int  pc_station,
int  pc_chamber 
) const

Definition at line 276 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_zone_offset_.

Referenced by PrimitiveConversion::convert_csc_details().

276  {
277  const uint32_t index = pc_station * 9 + pc_chamber;
278  uint32_t entry = 0;
279 
280  if (index < ph_zone_offset_.size()) {
282  } else {
283  edm::LogError("L1T") << "Could not retrieve entry from LUT. pc_station: " << pc_station
284  << ", pc_chamber: " << pc_chamber;
285  }
286  return entry;
287 }
std::vector< uint32_t > ph_zone_offset_
Log< level::Error, false > LogError

◆ get_th_corr_lut()

uint32_t SectorProcessorLUT::get_th_corr_lut ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id,
int  pc_wire_strip_id 
) const

Definition at line 219 of file SectorProcessorLUT.cc.

References mps_splice::entry, and th_corr_lut_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

219  {
220  int pc_lut_id2 = pc_lut_id;
221 
222  // Make ME1/1a the same as ME1/1b
223  if ((9 <= pc_lut_id2 && pc_lut_id2 < 12) || (25 <= pc_lut_id2 && pc_lut_id2 < 28))
224  pc_lut_id2 -= 9;
225  // Make ME1/1a neighbor the same as ME1/1b
226  if (pc_lut_id2 == 15)
227  pc_lut_id2 -= 3;
228 
229  if (pc_lut_id2 <= 3) {
230  pc_lut_id2 -= 0;
231  } else if (pc_lut_id2 == 12) {
232  pc_lut_id2 -= 9;
233  } else if (16 <= pc_lut_id2 && pc_lut_id2 < 19) {
234  pc_lut_id2 -= 12;
235  } else {
236  edm::LogError("L1T") << "get_th_corr_lut(): out of range pc_lut_id: " << pc_lut_id;
237  }
238 
239  const uint32_t index = ((fw_endcap * 6 + fw_sector) * 7 + pc_lut_id2) * 128 + pc_wire_strip_id;
240  uint32_t entry = 0;
241 
242  if (index < th_corr_lut_neighbor_.size()) {
244  } else {
245  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
246  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id
247  << ", pc_wire_strip_id: " << pc_wire_strip_id;
248  }
249  return entry;
250 }
std::vector< uint32_t > th_corr_lut_neighbor_
Log< level::Error, false > LogError

◆ get_th_disp()

uint32_t SectorProcessorLUT::get_th_disp ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id 
) const

Definition at line 183 of file SectorProcessorLUT.cc.

References mps_splice::entry, and th_disp_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

183  {
184  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
185  uint32_t entry = 0;
186 
187  if (index < th_disp_neighbor_.size()) {
189  } else {
190  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
191  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
192  }
193  return entry;
194 }
Log< level::Error, false > LogError
std::vector< uint32_t > th_disp_neighbor_

◆ get_th_init()

uint32_t SectorProcessorLUT::get_th_init ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id 
) const

Definition at line 170 of file SectorProcessorLUT.cc.

References mps_splice::entry, and th_init_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

170  {
171  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
172  uint32_t entry = 0;
173 
174  if (index < th_init_neighbor_.size()) {
176  } else {
177  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
178  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
179  }
180  return entry;
181 }
Log< level::Error, false > LogError
std::vector< uint32_t > th_init_neighbor_

◆ get_th_lut()

uint32_t SectorProcessorLUT::get_th_lut ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id,
int  pc_wire_id 
) const

Definition at line 196 of file SectorProcessorLUT.cc.

References mps_splice::entry, and th_lut_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

196  {
197  int pc_lut_id2 = pc_lut_id;
198 
199  // Make ME1/1a the same as ME1/1b
200  if ((9 <= pc_lut_id2 && pc_lut_id2 < 12) || (25 <= pc_lut_id2 && pc_lut_id2 < 28))
201  pc_lut_id2 -= 9;
202  // Make ME1/1a neighbor the same as ME1/1b
203  if (pc_lut_id2 == 15)
204  pc_lut_id2 -= 3;
205 
206  const uint32_t index = ((fw_endcap * 6 + fw_sector) * 61 + pc_lut_id2) * 128 + pc_wire_id;
207  uint32_t entry = 0;
208 
209  if (index < th_lut_neighbor_.size()) {
211  } else {
212  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
213  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id
214  << ", pc_wire_id: " << pc_wire_id;
215  }
216  return entry;
217 }
Log< level::Error, false > LogError
std::vector< uint32_t > th_lut_neighbor_

◆ read()

void SectorProcessorLUT::read ( bool  pc_lut_data,
int  pc_lut_version 
)

Definition at line 14 of file SectorProcessorLUT.cc.

References cppf_ph_lut_, cppf_th_lut_, Exception, ph_disp_neighbor_, ph_init_hard_, ph_init_neighbor_, ph_patt_corr_, ph_patt_corr_sign_, ph_zone_offset_, read_cppf_file(), read_file(), AlCaHLTBitMon_QueryRunRegistry::string, th_corr_lut_neighbor_, th_disp_neighbor_, th_init_neighbor_, th_lut_neighbor_, and version_.

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), and EMTFSetup::reload().

14  {
15  if (version_ == pc_lut_version)
16  return;
17 
18  edm::LogInfo("L1T") << "EMTF using pc_lut_ver: " << pc_lut_version << ", configured for "
19  << (pc_lut_data ? "data" : "MC");
20 
21  std::string coord_lut_dir = "";
22  if (pc_lut_version == 0)
23  coord_lut_dir = "ph_lut_v1"; // All year 2016
24  else if (pc_lut_version == 1)
25  coord_lut_dir = "ph_lut_v2"; // Beginning of 2017, improved alignment from ideal CMS geometry (MC)
26  else if (pc_lut_version == 2 && pc_lut_data)
27  coord_lut_dir = "ph_lut_v3_data"; // Update in September 2017 from ReReco alignment, data only
28  else if (pc_lut_version == 3 && pc_lut_data)
29  coord_lut_dir = "ph_lut_Run3_2022_data"; // Update in October 2022 from Run 3 2022 alignment, data only
30  else if (pc_lut_version == 4 && pc_lut_data)
31  coord_lut_dir = "ph_lut_Run3_2023_data"; // Update in June 2023 from Run 3 2023 alignment, data only
32  else if (pc_lut_version >= 2)
33  coord_lut_dir = "ph_lut_v2"; // MC still uses ideal CMS aligment
34  else if (pc_lut_version == -1 && pc_lut_data)
35  coord_lut_dir = "ph_lut_v3_data"; // September 2017 data LCT alignment, but use local CPPF LUTs for RPC
36  else if (pc_lut_version == -1)
37  coord_lut_dir = "ph_lut_v2"; // MC using ideal CMS LCT alignment, but use local CPPF LUTs for RPC
38  else
39  throw cms::Exception("L1TMuonEndCap")
40  << "Trying to use EMTF pc_lut_version = " << pc_lut_version << ", does not exist!";
41  // Will catch user trying to run with Global Tag settings on 2016 data, rather than fakeEmtfParams. - AWB 08.06.17
42 
43  std::string coord_lut_path = "L1Trigger/L1TMuon/data/emtf_luts/" + coord_lut_dir + "/";
44 
45  read_file(coord_lut_path + "ph_init_neighbor.txt", ph_init_neighbor_);
46  read_file(coord_lut_path + "ph_disp_neighbor.txt", ph_disp_neighbor_);
47  read_file(coord_lut_path + "th_init_neighbor.txt", th_init_neighbor_);
48  read_file(coord_lut_path + "th_disp_neighbor.txt", th_disp_neighbor_);
49  read_file(coord_lut_path + "th_lut_neighbor.txt", th_lut_neighbor_);
50  read_file(coord_lut_path + "th_corr_lut_neighbor.txt", th_corr_lut_neighbor_);
51 
52  std::string cppf_coord_lut_path = "L1Trigger/L1TMuon/data/cppf/"; // Coordinate LUTs actually used by CPPF
53  bool use_local_cppf_files = (pc_lut_version == -1);
54  if (use_local_cppf_files) { // More accurate coordinate transformation LUTs from Jia Fu
55  cppf_coord_lut_path = "L1Trigger/L1TMuon/data/cppf_luts/angleScale_v1/";
56  }
57 
58  read_cppf_file(cppf_coord_lut_path,
61  use_local_cppf_files); // cppf filenames are hardcoded in the function
62 
63  if (ph_init_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
64  throw cms::Exception("L1TMuonEndCap") << "Expected ph_init_neighbor_ to get " << 2 * 6 * 61 << " values, "
65  << "got " << ph_init_neighbor_.size() << " values.";
66  }
67 
68  if (ph_disp_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
69  throw cms::Exception("L1TMuonEndCap") << "Expected ph_disp_neighbor_ to get " << 2 * 6 * 61 << " values, "
70  << "got " << ph_disp_neighbor_.size() << " values.";
71  }
72 
73  if (th_init_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
74  throw cms::Exception("L1TMuonEndCap") << "Expected th_init_neighbor_ to get " << 2 * 6 * 61 << " values, "
75  << "got " << th_init_neighbor_.size() << " values.";
76  }
77 
78  if (th_disp_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
79  throw cms::Exception("L1TMuonEndCap") << "Expected th_disp_neighbor_ to get " << 2 * 6 * 61 << " values, "
80  << "got " << th_disp_neighbor_.size() << " values.";
81  }
82 
83  if (th_lut_neighbor_.size() != 2 * 6 * 61 * 128) { // [endcap_2][sector_6][chamber_61][wire_128]
84  throw cms::Exception("L1TMuonEndCap") << "Expected th_lut_neighbor_ to get " << 2 * 6 * 61 * 128 << " values, "
85  << "got " << th_lut_neighbor_.size() << " values.";
86  }
87 
88  if (th_corr_lut_neighbor_.size() != 2 * 6 * 7 * 128) { // [endcap_2][sector_6][chamber_61][strip_wire_128]
89  throw cms::Exception("L1TMuonEndCap") << "Expected th_corr_lut_neighbor_ to get " << 2 * 6 * 7 * 128 << " values, "
90  << "got " << th_corr_lut_neighbor_.size() << " values.";
91  }
92 
93  if (cppf_ph_lut_.size() !=
94  2 * 6 * 6 * 6 * 3 *
95  64) { // [endcap_2][rpc_sector_6][rpc_station_ring_6][rpc_subsector_6][rpc_roll_3][rpc_halfstrip_64]
96  throw cms::Exception("L1TMuonEndCap") << "Expected cppf_ph_lut_ to get " << 2 * 6 * 6 * 6 * 3 * 64 << " values, "
97  << "got " << cppf_ph_lut_.size() << " values.";
98  }
99 
100  if (cppf_th_lut_.size() !=
101  2 * 6 * 6 * 6 * 3) { // [endcap_2][rpc_sector_6][rpc_station_ring_6][rpc_subsector_6][rpc_roll_3]
102  throw cms::Exception("L1TMuonEndCap") << "Expected cppf_th_lut_ to get " << 2 * 6 * 6 * 6 * 3 << " values, "
103  << "got " << cppf_th_lut_.size() << " values.";
104  }
105 
106  // clct pattern convertion array from CMSSW
107  //{0.0, 0.0, -0.60, 0.60, -0.64, 0.64, -0.23, 0.23, -0.21, 0.21, 0.0}
108  // 0 0 -5 +5 -5 +5 -2 +2 -2 +2 0
109  ph_patt_corr_ = {0, 0, 5, 5, 5, 5, 2, 2, 2, 2, 0};
110  if (ph_patt_corr_.size() != 11) {
111  throw cms::Exception("L1TMuonEndCap") << "Expected ph_patt_corr_ to get " << 11 << " values, "
112  << "got " << ph_patt_corr_.size() << " values.";
113  }
114 
115  ph_patt_corr_sign_ = {0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0};
116  if (ph_patt_corr_sign_.size() != 11) {
117  throw cms::Exception("L1TMuonEndCap") << "Expected ph_patt_corr_sign_ to get " << 11 << " values, "
118  << "got " << ph_patt_corr_sign_.size() << " values.";
119  }
120 
121  ph_zone_offset_ = {39, 57, 76, 39, 58, 76, 41, 60, 79, 95, 114, 132, 95, 114, 133, 98, 116, 135,
122  38, 76, 113, 39, 58, 76, 95, 114, 132, 38, 76, 113, 39, 58, 76, 95, 114, 132,
123  38, 76, 113, 38, 57, 76, 95, 113, 132, 21, 21, 23, 1, 21, 1, 21, 1, 20};
124  if (ph_zone_offset_.size() != 6 * 9) {
125  throw cms::Exception("L1TMuonEndCap") << "Expected ph_zone_offset_ to get " << 6 * 9 << " values, "
126  << "got " << ph_zone_offset_.size() << " values.";
127  }
128 
129  // start phi of each chamber in reduced precision, for zone hits,
130  // with negative offset to allow for possible chamber movement
131  ph_init_hard_ = {39, 57, 76, 39, 58, 76, 41, 60, 79, 39, 57, 76, 21, 21, 23, 21, 95, 114, 132, 95,
132  114, 133, 98, 116, 135, 95, 114, 132, 0, 0, 0, 0, 38, 76, 113, 39, 58, 76, 95, 114,
133  132, 1, 21, 0, 0, 0, 0, 0, 38, 76, 113, 39, 58, 76, 95, 114, 132, 1, 21, 0,
134  0, 0, 0, 0, 38, 76, 113, 38, 57, 76, 95, 113, 132, 1, 20, 0, 0, 0, 0, 0};
135  if (ph_init_hard_.size() != 5 * 16) {
136  throw cms::Exception("L1TMuonEndCap") << "Expected ph_init_hard_ to get " << 5 * 16 << " values, "
137  << "got " << ph_init_hard_.size() << " values.";
138  }
139 
140  version_ = pc_lut_version;
141  return;
142 }
std::vector< uint32_t > ph_zone_offset_
std::vector< uint32_t > cppf_ph_lut_
std::vector< uint32_t > th_corr_lut_neighbor_
std::vector< uint32_t > cppf_th_lut_
std::vector< uint32_t > th_disp_neighbor_
std::vector< uint32_t > ph_patt_corr_
std::vector< uint32_t > ph_init_hard_
std::vector< uint32_t > ph_patt_corr_sign_
Log< level::Info, false > LogInfo
void read_cppf_file(const std::string &filename, std::vector< uint32_t > &vec1, std::vector< uint32_t > &vec2, bool local)
std::vector< uint32_t > th_init_neighbor_
std::vector< uint32_t > ph_disp_neighbor_
std::vector< uint32_t > ph_init_neighbor_
void read_file(const std::string &filename, std::vector< uint32_t > &vec)
std::vector< uint32_t > th_lut_neighbor_

◆ read_cppf_file()

void SectorProcessorLUT::read_cppf_file ( const std::string &  filename,
std::vector< uint32_t > &  vec1,
std::vector< uint32_t > &  vec2,
bool  local 
)
private

Definition at line 369 of file SectorProcessorLUT.cc.

References Exception, corrVsCorr::filename, contentValuesFiles::fullPath, get_cppf_lut_id(), mps_fire::i, l1ctLayer2EG_cff::id, timingPdfMaker::infile, and DTRecHitClients_cfi::local.

Referenced by read().

372  {
373  auto get_rpc_region = [](uint32_t id) { return (static_cast<int>((id >> 0) & 0X3) + (-1)); };
374  auto get_rpc_sector = [](uint32_t id) { return (static_cast<int>((id >> 7) & 0XF) + (1)); };
375  auto get_rpc_ring = [](uint32_t id) { return (static_cast<int>((id >> 2) & 0X7) + (1)); };
376  auto get_rpc_station = [](uint32_t id) { return (static_cast<int>((id >> 5) & 0X3) + (1)); };
377  auto get_rpc_subsector = [](uint32_t id) { return (static_cast<int>((id >> 12) & 0X7) + (1)); };
378  auto get_rpc_roll = [](uint32_t id) { return (static_cast<int>((id >> 15) & 0X7) + (0)); };
379 
380  std::vector<std::string> cppf_filenames = {
381  "angleScale_RPC_CPPFp1.txt",
382  "angleScale_RPC_CPPFp2.txt",
383  "angleScale_RPC_CPPFp3.txt",
384  "angleScale_RPC_CPPFp4.txt",
385  "angleScale_RPC_CPPFn1.txt",
386  "angleScale_RPC_CPPFn2.txt",
387  "angleScale_RPC_CPPFn3.txt",
388  "angleScale_RPC_CPPFn4.txt",
389  };
390 
391  vec1.clear();
392  vec2.clear();
393  vec1.resize(2 * 6 * 6 * 6 * 3 * 64, 0);
394  vec2.resize(2 * 6 * 6 * 6 * 3, 0);
395 
396  for (size_t i = 0; i < cppf_filenames.size(); ++i) {
397  std::ifstream infile;
398  infile.open(edm::FileInPath(filename + cppf_filenames.at(i)).fullPath().c_str());
399 
400  // std::cout << "\n\nOpening CPPF LUT file " << cppf_filenames.at(i) << std::endl;
401 
402  int buf1, buf2, buf3, buf4, buf5, buf6;
403  // Special variables for transforming centrally-provided CPPF LUTs
404  int buf1_prev = 0, buf2_prev = 0, halfstrip_prev = 0; // Values from previous line in file
405  int line_num = 0; // Line number in file
406  int count_dir = -1; // Direction of half-strip counting: +1 is up, -1 is down
407  int dStrip = 0; // Offset for half-strip from full strip
408  while ((infile >> buf1) && (infile >> buf2) && (infile >> buf3) && (infile >> buf4) && (infile >> buf5) &&
409  (infile >> buf6)) {
410  if ((line_num % 192) == 191)
411  line_num += 1; // Gap in central files vs. Jia Fu's files
412  line_num += 1;
413  // On roughly every-other line, files in L1Trigger/L1TMuon/data/cppf have 0 in the first three columns
414  // Skips a "0 0 0" line once every 192 lines
415  if ((line_num % 2) == 1) {
416  buf1_prev = buf1;
417  buf2_prev = buf2;
418  }
419 
420  if (local && (buf1 == 0 || buf2 == 0)) {
421  throw cms::Exception("L1TMuonEndCap") << "Expected non-0 values, got buf1 = " << buf1 << ", buf2 = " << buf2;
422  }
423  if (!local && (buf1_prev == 0 || buf2_prev == 0)) {
424  throw cms::Exception("L1TMuonEndCap")
425  << "Expected non-0 values, got buf1_prev = " << buf1_prev << ", buf2_prev = " << buf2_prev;
426  }
427 
428  uint32_t id = (local ? buf1 : buf1_prev);
429  int32_t rpc_region = get_rpc_region(id);
430  int32_t rpc_sector = get_rpc_sector(id);
431  int32_t rpc_station = get_rpc_station(id);
432  int32_t rpc_ring = get_rpc_ring(id);
433  int32_t rpc_subsector = get_rpc_subsector(id);
434  int32_t rpc_roll = get_rpc_roll(id);
435 
436  // Offset into halfstrips from centrally-provided LUTs
437  if (buf2_prev * 2 > halfstrip_prev + 8 ||
438  buf2_prev * 2 < halfstrip_prev - 8) { // Starting a new series of strips
439  if (buf2_prev == 1)
440  count_dir = +1; // Starting from a low number, counting up
441  else
442  count_dir = -1; // Starting from a high number, counting down
443  }
444  if (count_dir == -1)
445  dStrip = (buf2_prev * 2 == halfstrip_prev ? 1 : 0);
446  if (count_dir == +1)
447  dStrip = (buf2_prev * 2 == halfstrip_prev + 2 ? 1 : 0);
448  if (buf2_prev * 2 < halfstrip_prev - 8 && buf2_prev == 1)
449  dStrip = 1;
450 
451  //uint32_t strip = buf2;
452  uint32_t halfstrip =
453  (local ? buf2
454  : buf2_prev * 2 -
455  dStrip); // I modified the local text files to use 'halfstrip' instead of 'strip' in column 2
456  halfstrip_prev = halfstrip;
457 
458  uint32_t ph = buf5;
459  uint32_t th = buf6;
460 
461  const uint32_t th_index = get_cppf_lut_id(rpc_region, rpc_sector, rpc_station, rpc_ring, rpc_subsector, rpc_roll);
462  const uint32_t ph_index = (th_index * 64) + (halfstrip - 1);
463 
464  // std::cout << id << " " << rpc_region << " " << rpc_sector << " " << rpc_station << " " << rpc_ring << " "
465  // << rpc_subsector << " " << rpc_roll << " " << halfstrip << " " << th_index << " " << ph_index << std::endl;
466 
467  vec1.at(ph_index) = ph;
468  if (halfstrip == 1)
469  vec2.at(th_index) = th;
470 
471  // Fill gap in centrally-provided LUTs once every 192 lines
472  if (!local && (line_num % 192) == 191)
473  vec1.at(ph_index + 1) = ph;
474 
475  } // End while ((infile >> buf1) && ... && (infile >> buf6))
476  infile.close();
477  } // End loop over CPPF LUT files
478 }
std::vector< double > vec1
Definition: HCALResponse.h:15
uint32_t get_cppf_lut_id(int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll) const
std::vector< vec1 > vec2
Definition: HCALResponse.h:16

◆ read_file()

void SectorProcessorLUT::read_file ( const std::string &  filename,
std::vector< uint32_t > &  vec 
)
private

Definition at line 355 of file SectorProcessorLUT.cc.

References visDQMUpload::buf, corrVsCorr::filename, contentValuesFiles::fullPath, and timingPdfMaker::infile.

Referenced by read().

355  {
356  vec.clear();
357 
358  std::ifstream infile;
359  infile.open(edm::FileInPath(filename).fullPath().c_str());
360 
361  int buf;
362  while (infile >> buf) {
363  buf = (buf == -999) ? 0 : buf;
364  vec.push_back(buf);
365  }
366  infile.close();
367 }

Member Data Documentation

◆ cppf_ph_lut_

std::vector<uint32_t> SectorProcessorLUT::cppf_ph_lut_
private

Definition at line 67 of file SectorProcessorLUT.h.

Referenced by get_cppf_ph_lut(), and read().

◆ cppf_th_lut_

std::vector<uint32_t> SectorProcessorLUT::cppf_th_lut_
private

Definition at line 68 of file SectorProcessorLUT.h.

Referenced by get_cppf_th_lut(), and read().

◆ ph_disp_neighbor_

std::vector<uint32_t> SectorProcessorLUT::ph_disp_neighbor_
private

Definition at line 56 of file SectorProcessorLUT.h.

Referenced by get_ph_disp(), and read().

◆ ph_init_hard_

std::vector<uint32_t> SectorProcessorLUT::ph_init_hard_
private

Definition at line 65 of file SectorProcessorLUT.h.

Referenced by get_ph_init_hard(), and read().

◆ ph_init_neighbor_

std::vector<uint32_t> SectorProcessorLUT::ph_init_neighbor_
private

Definition at line 55 of file SectorProcessorLUT.h.

Referenced by get_ph_init(), and read().

◆ ph_patt_corr_

std::vector<uint32_t> SectorProcessorLUT::ph_patt_corr_
private

Definition at line 62 of file SectorProcessorLUT.h.

Referenced by get_ph_patt_corr(), and read().

◆ ph_patt_corr_sign_

std::vector<uint32_t> SectorProcessorLUT::ph_patt_corr_sign_
private

Definition at line 63 of file SectorProcessorLUT.h.

Referenced by get_ph_patt_corr_sign(), and read().

◆ ph_zone_offset_

std::vector<uint32_t> SectorProcessorLUT::ph_zone_offset_
private

Definition at line 64 of file SectorProcessorLUT.h.

Referenced by get_ph_zone_offset(), and read().

◆ th_corr_lut_neighbor_

std::vector<uint32_t> SectorProcessorLUT::th_corr_lut_neighbor_
private

Definition at line 60 of file SectorProcessorLUT.h.

Referenced by get_th_corr_lut(), and read().

◆ th_disp_neighbor_

std::vector<uint32_t> SectorProcessorLUT::th_disp_neighbor_
private

Definition at line 58 of file SectorProcessorLUT.h.

Referenced by get_th_disp(), and read().

◆ th_init_neighbor_

std::vector<uint32_t> SectorProcessorLUT::th_init_neighbor_
private

Definition at line 57 of file SectorProcessorLUT.h.

Referenced by get_th_init(), and read().

◆ th_lut_neighbor_

std::vector<uint32_t> SectorProcessorLUT::th_lut_neighbor_
private

Definition at line 59 of file SectorProcessorLUT.h.

Referenced by get_th_lut(), and read().

◆ version_

int SectorProcessorLUT::version_
private

Definition at line 70 of file SectorProcessorLUT.h.

Referenced by read().