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 300 of file SectorProcessorLUT.cc.

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

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

◆ 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 310 of file SectorProcessorLUT.cc.

References cppf_ph_lut_, and get_cppf_lut_id().

Referenced by PrimitiveConversion::convert_rpc_details().

317  {
318  const uint32_t th_index = get_cppf_lut_id(rpc_region, rpc_sector, rpc_station, rpc_ring, rpc_subsector, rpc_roll);
319  const uint32_t ph_index = (th_index * 64) + (halfstrip - 1);
320  uint32_t ph = 0;
321 
322  if (ph_index < cppf_ph_lut_.size()) {
323  ph = cppf_ph_lut_.at(ph_index);
324  } else {
325  edm::LogError("L1T") << "Could not retrieve entry from LUT. rpc_region: " << rpc_region
326  << ", rpc_sector: " << rpc_sector << ", rpc_station: " << rpc_station
327  << ", rpc_ring: " << rpc_ring << ", rpc_subsector: " << rpc_subsector
328  << ", rpc_roll: " << rpc_roll << ", halfstrip: " << halfstrip
329  << ", is_neighbor: " << is_neighbor;
330  }
331 
332  if (!is_neighbor && rpc_subsector == 2)
333  ph += 900;
334  return ph;
335 }
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 337 of file SectorProcessorLUT.cc.

References cppf_th_lut_, and get_cppf_lut_id().

Referenced by PrimitiveConversion::convert_rpc_details().

338  {
339  const uint32_t th_index = get_cppf_lut_id(rpc_region, rpc_sector, rpc_station, rpc_ring, rpc_subsector, rpc_roll);
340  uint32_t th = 0;
341 
342  if (th_index < cppf_th_lut_.size()) {
343  th = cppf_th_lut_.at(th_index);
344  } else {
345  edm::LogError("L1T") << "Could not retrieve entry from LUT. rpc_region: " << rpc_region
346  << ", rpc_sector: " << rpc_sector << ", rpc_station: " << rpc_station
347  << ", rpc_ring: " << rpc_ring << ", rpc_subsector: " << rpc_subsector
348  << ", rpc_roll: " << rpc_roll;
349  }
350  return th;
351 }
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 155 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_disp_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

155  {
156  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
157  uint32_t entry = 0;
158 
159  if (index < ph_disp_neighbor_.size()) {
161  } else {
162  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
163  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
164  }
165  return entry;
166 }
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 142 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_init_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

142  {
143  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
144  uint32_t entry = 0;
145 
146  if (index < ph_init_neighbor_.size()) {
148  } else {
149  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
150  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
151  }
152  return entry;
153 }
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 287 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_init_hard_.

Referenced by PrimitiveConversion::convert_csc_details().

287  {
288  const uint32_t index = fw_station * 16 + fw_cscid;
289  uint32_t entry = 0;
290 
291  if (index < ph_init_hard_.size()) {
292  entry = ph_init_hard_.at(index);
293  } else {
294  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_station: " << fw_station
295  << ", fw_cscid: " << fw_cscid;
296  }
297  return entry;
298 }
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 250 of file SectorProcessorLUT.cc.

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

Referenced by PrimitiveConversion::convert_csc_details().

250  {
251  const uint32_t index = pattern;
252  uint32_t entry = 0;
253 
254  if (index < ph_patt_corr_.size()) {
255  entry = ph_patt_corr_.at(index);
256  } else {
257  edm::LogError("L1T") << "Could not retrieve entry from LUT. pattern: " << pattern;
258  }
259  return entry;
260 }
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 262 of file SectorProcessorLUT.cc.

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

Referenced by PrimitiveConversion::convert_csc_details().

262  {
263  const uint32_t index = pattern;
264  uint32_t entry = 0;
265 
266  if (index < ph_patt_corr_sign_.size()) {
268  } else {
269  edm::LogError("L1T") << "Could not retrieve entry from LUT. pattern: " << pattern;
270  }
271  return entry;
272 }
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 274 of file SectorProcessorLUT.cc.

References mps_splice::entry, and ph_zone_offset_.

Referenced by PrimitiveConversion::convert_csc_details().

274  {
275  const uint32_t index = pc_station * 9 + pc_chamber;
276  uint32_t entry = 0;
277 
278  if (index < ph_zone_offset_.size()) {
280  } else {
281  edm::LogError("L1T") << "Could not retrieve entry from LUT. pc_station: " << pc_station
282  << ", pc_chamber: " << pc_chamber;
283  }
284  return entry;
285 }
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 217 of file SectorProcessorLUT.cc.

References mps_splice::entry, and th_corr_lut_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

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

References mps_splice::entry, and th_disp_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

181  {
182  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
183  uint32_t entry = 0;
184 
185  if (index < th_disp_neighbor_.size()) {
187  } else {
188  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
189  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
190  }
191  return entry;
192 }
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 168 of file SectorProcessorLUT.cc.

References mps_splice::entry, and th_init_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

168  {
169  const uint32_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
170  uint32_t entry = 0;
171 
172  if (index < th_init_neighbor_.size()) {
174  } else {
175  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
176  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id;
177  }
178  return entry;
179 }
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 194 of file SectorProcessorLUT.cc.

References mps_splice::entry, and th_lut_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

194  {
195  int pc_lut_id2 = pc_lut_id;
196 
197  // Make ME1/1a the same as ME1/1b
198  if ((9 <= pc_lut_id2 && pc_lut_id2 < 12) || (25 <= pc_lut_id2 && pc_lut_id2 < 28))
199  pc_lut_id2 -= 9;
200  // Make ME1/1a neighbor the same as ME1/1b
201  if (pc_lut_id2 == 15)
202  pc_lut_id2 -= 3;
203 
204  const uint32_t index = ((fw_endcap * 6 + fw_sector) * 61 + pc_lut_id2) * 128 + pc_wire_id;
205  uint32_t entry = 0;
206 
207  if (index < th_lut_neighbor_.size()) {
209  } else {
210  edm::LogError("L1T") << "Could not retrieve entry from LUT. fw_endcap: " << fw_endcap
211  << ", fw_sector: " << fw_sector << ", pc_lut_id: " << pc_lut_id
212  << ", pc_wire_id: " << pc_wire_id;
213  }
214  return entry;
215 }
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 >= 2)
31  coord_lut_dir = "ph_lut_v2"; // MC still uses ideal CMS aligment
32  else if (pc_lut_version == -1 && pc_lut_data)
33  coord_lut_dir = "ph_lut_v3_data"; // September 2017 data LCT alignment, but use local CPPF LUTs for RPC
34  else if (pc_lut_version == -1)
35  coord_lut_dir = "ph_lut_v2"; // MC using ideal CMS LCT alignment, but use local CPPF LUTs for RPC
36  else
37  throw cms::Exception("L1TMuonEndCap")
38  << "Trying to use EMTF pc_lut_version = " << pc_lut_version << ", does not exist!";
39  // Will catch user trying to run with Global Tag settings on 2016 data, rather than fakeEmtfParams. - AWB 08.06.17
40 
41  std::string coord_lut_path = "L1Trigger/L1TMuon/data/emtf_luts/" + coord_lut_dir + "/";
42 
43  read_file(coord_lut_path + "ph_init_neighbor.txt", ph_init_neighbor_);
44  read_file(coord_lut_path + "ph_disp_neighbor.txt", ph_disp_neighbor_);
45  read_file(coord_lut_path + "th_init_neighbor.txt", th_init_neighbor_);
46  read_file(coord_lut_path + "th_disp_neighbor.txt", th_disp_neighbor_);
47  read_file(coord_lut_path + "th_lut_neighbor.txt", th_lut_neighbor_);
48  read_file(coord_lut_path + "th_corr_lut_neighbor.txt", th_corr_lut_neighbor_);
49 
50  std::string cppf_coord_lut_path = "L1Trigger/L1TMuon/data/cppf/"; // Coordinate LUTs actually used by CPPF
51  bool use_local_cppf_files = (pc_lut_version == -1);
52  if (use_local_cppf_files) { // More accurate coordinate transformation LUTs from Jia Fu
53  cppf_coord_lut_path = "L1Trigger/L1TMuon/data/cppf_luts/angleScale_v1/";
54  }
55 
56  read_cppf_file(cppf_coord_lut_path,
59  use_local_cppf_files); // cppf filenames are hardcoded in the function
60 
61  if (ph_init_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
62  throw cms::Exception("L1TMuonEndCap") << "Expected ph_init_neighbor_ to get " << 2 * 6 * 61 << " values, "
63  << "got " << ph_init_neighbor_.size() << " values.";
64  }
65 
66  if (ph_disp_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
67  throw cms::Exception("L1TMuonEndCap") << "Expected ph_disp_neighbor_ to get " << 2 * 6 * 61 << " values, "
68  << "got " << ph_disp_neighbor_.size() << " values.";
69  }
70 
71  if (th_init_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
72  throw cms::Exception("L1TMuonEndCap") << "Expected th_init_neighbor_ to get " << 2 * 6 * 61 << " values, "
73  << "got " << th_init_neighbor_.size() << " values.";
74  }
75 
76  if (th_disp_neighbor_.size() != 2 * 6 * 61) { // [endcap_2][sector_6][chamber_61]
77  throw cms::Exception("L1TMuonEndCap") << "Expected th_disp_neighbor_ to get " << 2 * 6 * 61 << " values, "
78  << "got " << th_disp_neighbor_.size() << " values.";
79  }
80 
81  if (th_lut_neighbor_.size() != 2 * 6 * 61 * 128) { // [endcap_2][sector_6][chamber_61][wire_128]
82  throw cms::Exception("L1TMuonEndCap") << "Expected th_lut_neighbor_ to get " << 2 * 6 * 61 * 128 << " values, "
83  << "got " << th_lut_neighbor_.size() << " values.";
84  }
85 
86  if (th_corr_lut_neighbor_.size() != 2 * 6 * 7 * 128) { // [endcap_2][sector_6][chamber_61][strip_wire_128]
87  throw cms::Exception("L1TMuonEndCap") << "Expected th_corr_lut_neighbor_ to get " << 2 * 6 * 7 * 128 << " values, "
88  << "got " << th_corr_lut_neighbor_.size() << " values.";
89  }
90 
91  if (cppf_ph_lut_.size() !=
92  2 * 6 * 6 * 6 * 3 *
93  64) { // [endcap_2][rpc_sector_6][rpc_station_ring_6][rpc_subsector_6][rpc_roll_3][rpc_halfstrip_64]
94  throw cms::Exception("L1TMuonEndCap") << "Expected cppf_ph_lut_ to get " << 2 * 6 * 6 * 6 * 3 * 64 << " values, "
95  << "got " << cppf_ph_lut_.size() << " values.";
96  }
97 
98  if (cppf_th_lut_.size() !=
99  2 * 6 * 6 * 6 * 3) { // [endcap_2][rpc_sector_6][rpc_station_ring_6][rpc_subsector_6][rpc_roll_3]
100  throw cms::Exception("L1TMuonEndCap") << "Expected cppf_th_lut_ to get " << 2 * 6 * 6 * 6 * 3 << " values, "
101  << "got " << cppf_th_lut_.size() << " values.";
102  }
103 
104  // clct pattern convertion array from CMSSW
105  //{0.0, 0.0, -0.60, 0.60, -0.64, 0.64, -0.23, 0.23, -0.21, 0.21, 0.0}
106  // 0 0 -5 +5 -5 +5 -2 +2 -2 +2 0
107  ph_patt_corr_ = {0, 0, 5, 5, 5, 5, 2, 2, 2, 2, 0};
108  if (ph_patt_corr_.size() != 11) {
109  throw cms::Exception("L1TMuonEndCap") << "Expected ph_patt_corr_ to get " << 11 << " values, "
110  << "got " << ph_patt_corr_.size() << " values.";
111  }
112 
113  ph_patt_corr_sign_ = {0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0};
114  if (ph_patt_corr_sign_.size() != 11) {
115  throw cms::Exception("L1TMuonEndCap") << "Expected ph_patt_corr_sign_ to get " << 11 << " values, "
116  << "got " << ph_patt_corr_sign_.size() << " values.";
117  }
118 
119  ph_zone_offset_ = {39, 57, 76, 39, 58, 76, 41, 60, 79, 95, 114, 132, 95, 114, 133, 98, 116, 135,
120  38, 76, 113, 39, 58, 76, 95, 114, 132, 38, 76, 113, 39, 58, 76, 95, 114, 132,
121  38, 76, 113, 38, 57, 76, 95, 113, 132, 21, 21, 23, 1, 21, 1, 21, 1, 20};
122  if (ph_zone_offset_.size() != 6 * 9) {
123  throw cms::Exception("L1TMuonEndCap") << "Expected ph_zone_offset_ to get " << 6 * 9 << " values, "
124  << "got " << ph_zone_offset_.size() << " values.";
125  }
126 
127  // start phi of each chamber in reduced precision, for zone hits,
128  // with negative offset to allow for possible chamber movement
129  ph_init_hard_ = {39, 57, 76, 39, 58, 76, 41, 60, 79, 39, 57, 76, 21, 21, 23, 21, 95, 114, 132, 95,
130  114, 133, 98, 116, 135, 95, 114, 132, 0, 0, 0, 0, 38, 76, 113, 39, 58, 76, 95, 114,
131  132, 1, 21, 0, 0, 0, 0, 0, 38, 76, 113, 39, 58, 76, 95, 114, 132, 1, 21, 0,
132  0, 0, 0, 0, 38, 76, 113, 38, 57, 76, 95, 113, 132, 1, 20, 0, 0, 0, 0, 0};
133  if (ph_init_hard_.size() != 5 * 16) {
134  throw cms::Exception("L1TMuonEndCap") << "Expected ph_init_hard_ to get " << 5 * 16 << " values, "
135  << "got " << ph_init_hard_.size() << " values.";
136  }
137 
138  version_ = pc_lut_version;
139  return;
140 }
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 367 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().

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

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

Referenced by read().

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

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().