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_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 (unsigned pc_lut_version)
 
 SectorProcessorLUT ()
 
 ~SectorProcessorLUT ()
 

Private Member Functions

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

Private Attributes

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_
 
unsigned version_
 

Detailed Description

Definition at line 9 of file SectorProcessorLUT.h.

Constructor & Destructor Documentation

SectorProcessorLUT::SectorProcessorLUT ( )
explicit

Definition at line 11 of file SectorProcessorLUT.cc.

11  :
12  version_(0xFFFFFFFF)
13 {
14 
15 }
SectorProcessorLUT::~SectorProcessorLUT ( )

Definition at line 17 of file SectorProcessorLUT.cc.

17  {
18 
19 }

Member Function Documentation

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

Definition at line 140 of file SectorProcessorLUT.cc.

References diffTreeTool::index, and ph_disp_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

140  {
141  size_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
142  return ph_disp_neighbor_.at(index);
143 }
std::vector< uint32_t > ph_disp_neighbor_
uint32_t SectorProcessorLUT::get_ph_init ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id 
) const

Definition at line 135 of file SectorProcessorLUT.cc.

References diffTreeTool::index, and ph_init_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

135  {
136  size_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
137  return ph_init_neighbor_.at(index);
138 }
std::vector< uint32_t > ph_init_neighbor_
uint32_t SectorProcessorLUT::get_ph_init_hard ( int  fw_station,
int  fw_cscid 
) const

Definition at line 207 of file SectorProcessorLUT.cc.

References diffTreeTool::index, and ph_init_hard_.

Referenced by PrimitiveConversion::convert_csc_details().

207  {
208  size_t index = fw_station * 16 + fw_cscid;
209  return ph_init_hard_.at(index);
210 }
std::vector< uint32_t > ph_init_hard_
uint32_t SectorProcessorLUT::get_ph_patt_corr ( int  pattern) const

Definition at line 194 of file SectorProcessorLUT.cc.

References ph_patt_corr_.

Referenced by PrimitiveConversion::convert_csc_details().

194  {
195  return ph_patt_corr_.at(pattern);
196 }
std::vector< uint32_t > ph_patt_corr_
uint32_t SectorProcessorLUT::get_ph_patt_corr_sign ( int  pattern) const

Definition at line 198 of file SectorProcessorLUT.cc.

References ph_patt_corr_sign_.

Referenced by PrimitiveConversion::convert_csc_details().

198  {
199  return ph_patt_corr_sign_.at(pattern);
200 }
std::vector< uint32_t > ph_patt_corr_sign_
uint32_t SectorProcessorLUT::get_ph_zone_offset ( int  pc_station,
int  pc_chamber 
) const

Definition at line 202 of file SectorProcessorLUT.cc.

References diffTreeTool::index, and ph_zone_offset_.

Referenced by PrimitiveConversion::convert_csc_details().

202  {
203  size_t index = pc_station * 9 + pc_chamber;
204  return ph_zone_offset_.at(index);
205 }
std::vector< uint32_t > ph_zone_offset_
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 169 of file SectorProcessorLUT.cc.

References Exception, diffTreeTool::index, and th_corr_lut_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

169  {
170  int pc_lut_id2 = pc_lut_id;
171 
172  // Make ME1/1a the same as ME1/1b
173  if ((9 <= pc_lut_id2 && pc_lut_id2 < 12) || (25 <= pc_lut_id2 && pc_lut_id2 < 28))
174  pc_lut_id2 -= 9;
175  // Make ME1/1a neighbor the same as ME1/1b
176  if (pc_lut_id2 == 15)
177  pc_lut_id2 -= 3;
178 
179  if (pc_lut_id2 <= 3) {
180  pc_lut_id2 -= 0;
181  } else if (pc_lut_id2 == 12) {
182  pc_lut_id2 -= 9;
183  } else if (16 <= pc_lut_id2 && pc_lut_id2 < 19) {
184  pc_lut_id2 -= 12;
185  } else {
186  throw cms::Exception("SectorProcessorLUT")
187  << "get_th_corr_lut(): out of range pc_lut_id: " << pc_lut_id;
188  }
189 
190  size_t index = ((fw_endcap * 6 + fw_sector) * 7 + pc_lut_id2) * 128 + pc_wire_strip_id;
191  return th_corr_lut_neighbor_.at(index);
192 }
std::vector< uint32_t > th_corr_lut_neighbor_
uint32_t SectorProcessorLUT::get_th_disp ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id 
) const

Definition at line 150 of file SectorProcessorLUT.cc.

References diffTreeTool::index, and th_disp_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

150  {
151  size_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
152  return th_disp_neighbor_.at(index);
153 }
std::vector< uint32_t > th_disp_neighbor_
uint32_t SectorProcessorLUT::get_th_init ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id 
) const

Definition at line 145 of file SectorProcessorLUT.cc.

References diffTreeTool::index, and th_init_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

145  {
146  size_t index = (fw_endcap * 6 + fw_sector) * 61 + pc_lut_id;
147  return th_init_neighbor_.at(index);
148 }
std::vector< uint32_t > th_init_neighbor_
uint32_t SectorProcessorLUT::get_th_lut ( int  fw_endcap,
int  fw_sector,
int  pc_lut_id,
int  pc_wire_id 
) const

Definition at line 155 of file SectorProcessorLUT.cc.

References diffTreeTool::index, and th_lut_neighbor_.

Referenced by PrimitiveConversion::convert_csc_details().

155  {
156  int pc_lut_id2 = pc_lut_id;
157 
158  // Make ME1/1a the same as ME1/1b
159  if ((9 <= pc_lut_id2 && pc_lut_id2 < 12) || (25 <= pc_lut_id2 && pc_lut_id2 < 28))
160  pc_lut_id2 -= 9;
161  // Make ME1/1a neighbor the same as ME1/1b
162  if (pc_lut_id2 == 15)
163  pc_lut_id2 -= 3;
164 
165  size_t index = ((fw_endcap * 6 + fw_sector) * 61 + pc_lut_id2) * 128 + pc_wire_id;
166  return th_lut_neighbor_.at(index);
167 }
std::vector< uint32_t > th_lut_neighbor_
void SectorProcessorLUT::read ( unsigned  pc_lut_version)

Definition at line 21 of file SectorProcessorLUT.cc.

References Exception, ph_disp_neighbor_, ph_init_hard_, ph_init_neighbor_, ph_patt_corr_, ph_patt_corr_sign_, ph_zone_offset_, 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 TrackFinder::process().

21  {
22  if (version_ == pc_lut_version) return;
23 
24  std::string coord_lut_dir = "";
25  if (pc_lut_version == 0)
26  coord_lut_dir = "ph_lut_v1"; // All year 2016
27  else if (pc_lut_version == 1)
28  coord_lut_dir = "ph_lut_v2"; // Beginning of 2017
29  else
30  throw cms::Exception("SectorProcessorLUT")
31  << "Trying to use EMTF pc_lut_version = " << pc_lut_version << ", does not exist!";
32  // Will catch user trying to run with Global Tag settings on 2016 data, rather than fakeEmtfParams. - AWB 08.06.17
33 
34  std::string coord_lut_path = "L1Trigger/L1TMuon/data/emtf_luts/" + coord_lut_dir + "/";
35 
36  // std::cout << "coord_lut_path = " << coord_lut_path << std::endl;
37 
38  read_file(coord_lut_path+"ph_init_neighbor.txt", ph_init_neighbor_);
39  read_file(coord_lut_path+"ph_disp_neighbor.txt", ph_disp_neighbor_);
40  read_file(coord_lut_path+"th_init_neighbor.txt", th_init_neighbor_);
41  read_file(coord_lut_path+"th_disp_neighbor.txt", th_disp_neighbor_);
42  read_file(coord_lut_path+"th_lut_neighbor.txt", th_lut_neighbor_);
43  read_file(coord_lut_path+"th_corr_lut_neighbor.txt", th_corr_lut_neighbor_);
44 
45  if (ph_init_neighbor_.size() != 2*6*61) { // [endcap_2][sector_6][chamber_61]
46  throw cms::Exception("SectorProcessorLUT")
47  << "Expected ph_init_neighbor_ to get " << 2*6*61 << " values, "
48  << "got " << ph_init_neighbor_.size() << " values.";
49  }
50 
51  if (ph_disp_neighbor_.size() != 2*6*61) { // [endcap_2][sector_6][chamber_61]
52  throw cms::Exception("SectorProcessorLUT")
53  << "Expected ph_disp_neighbor_ to get " << 2*6*61 << " values, "
54  << "got " << ph_disp_neighbor_.size() << " values.";
55  }
56 
57  if (th_init_neighbor_.size() != 2*6*61) { // [endcap_2][sector_6][chamber_61]
58  throw cms::Exception("SectorProcessorLUT")
59  << "Expected th_init_neighbor_ to get " << 2*6*61 << " values, "
60  << "got " << th_init_neighbor_.size() << " values.";
61  }
62 
63  if (th_disp_neighbor_.size() != 2*6*61) { // [endcap_2][sector_6][chamber_61]
64  throw cms::Exception("SectorProcessorLUT")
65  << "Expected th_disp_neighbor_ to get " << 2*6*61 << " values, "
66  << "got " << th_disp_neighbor_.size() << " values.";
67  }
68 
69  if (th_lut_neighbor_.size() != 2*6*61*128) { // [endcap_2][sector_6][chamber_61][wire_128]
70  throw cms::Exception("SectorProcessorLUT")
71  << "Expected th_lut_neighbor_ to get " << 2*6*61*128 << " values, "
72  << "got " << th_lut_neighbor_.size() << " values.";
73  }
74 
75  if (th_corr_lut_neighbor_.size() != 2*6*7*128) { // [endcap_2][sector_6][chamber_61][strip_wire_128]
76  throw cms::Exception("SectorProcessorLUT")
77  << "Expected th_corr_lut_neighbor_ to get " << 2*6*7*128 << " values, "
78  << "got " << th_corr_lut_neighbor_.size() << " values.";
79  }
80 
81  // clct pattern convertion array from CMSSW
82  //{0.0, 0.0, -0.60, 0.60, -0.64, 0.64, -0.23, 0.23, -0.21, 0.21, 0.0}
83  // 0 0 -5 +5 -5 +5 -2 +2 -2 +2 0
84  ph_patt_corr_ = {
85  0, 0, 5, 5, 5, 5, 2, 2, 2, 2, 0
86  };
87  if (ph_patt_corr_.size() != 11) {
88  throw cms::Exception("SectorProcessorLUT")
89  << "Expected ph_patt_corr_ to get " << 11 << " values, "
90  << "got " << ph_patt_corr_.size() << " values.";
91  }
92 
94  0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0
95  };
96  if (ph_patt_corr_sign_.size() != 11) {
97  throw cms::Exception("SectorProcessorLUT")
98  << "Expected ph_patt_corr_sign_ to get " << 11 << " values, "
99  << "got " << ph_patt_corr_sign_.size() << " values.";
100  }
101 
102  ph_zone_offset_ = {
103  39,57,76,39,58,76,41,60,79,
104  95,114,132,95,114,133,98,116,135,
105  38,76,113,39,58,76,95,114,132,
106  38,76,113,39,58,76,95,114,132,
107  38,76,113,38,57,76,95,113,132,
108  21,21,23,1,21,1,21,1,20
109  };
110  if (ph_zone_offset_.size() != 6*9) {
111  throw cms::Exception("SectorProcessorLUT")
112  << "Expected ph_zone_offset_ to get " << 6*9 << " values, "
113  << "got " << ph_zone_offset_.size() << " values.";
114  }
115 
116  // start phi of each chamber in reduced precision, for zone hits,
117  // with negative offset to allow for possible chamber movement
118  ph_init_hard_ = {
119  39, 57, 76, 39, 58, 76, 41, 60, 79, 39, 57, 76, 21, 21, 23, 21,
120  95, 114, 132, 95, 114, 133, 98, 116, 135, 95, 114, 132, 0, 0, 0, 0,
121  38, 76, 113, 39, 58, 76, 95, 114, 132, 1, 21, 0, 0, 0, 0, 0,
122  38, 76, 113, 39, 58, 76, 95, 114, 132, 1, 21, 0, 0, 0, 0, 0,
123  38, 76, 113, 38, 57, 76, 95, 113, 132, 1, 20, 0, 0, 0, 0, 0
124  };
125  if (ph_init_hard_.size() != 5*16) {
126  throw cms::Exception("SectorProcessorLUT")
127  << "Expected ph_init_hard_ to get " << 5*16 << " values, "
128  << "got " << ph_init_hard_.size() << " values.";
129  }
130 
131  version_ = pc_lut_version;
132  return;
133 }
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 > ph_patt_corr_
std::vector< uint32_t > ph_init_hard_
std::vector< uint32_t > ph_patt_corr_sign_
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_
void SectorProcessorLUT::read_file ( const std::string &  filename,
std::vector< uint32_t > &  vec 
)
private

Definition at line 212 of file SectorProcessorLUT.cc.

Referenced by read().

212  {
213  vec.clear();
214 
215  std::ifstream infile;
216  infile.open(edm::FileInPath(filename).fullPath().c_str());
217 
218  int buf;
219  while (infile >> buf) {
220  buf = (buf == -999) ? 0 : buf;
221  vec.push_back(buf);
222  }
223  infile.close();
224 }

Member Data Documentation

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

Definition at line 40 of file SectorProcessorLUT.h.

Referenced by get_ph_disp(), and read().

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

Definition at line 49 of file SectorProcessorLUT.h.

Referenced by get_ph_init_hard(), and read().

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

Definition at line 39 of file SectorProcessorLUT.h.

Referenced by get_ph_init(), and read().

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

Definition at line 46 of file SectorProcessorLUT.h.

Referenced by get_ph_patt_corr(), and read().

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

Definition at line 47 of file SectorProcessorLUT.h.

Referenced by get_ph_patt_corr_sign(), and read().

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

Definition at line 48 of file SectorProcessorLUT.h.

Referenced by get_ph_zone_offset(), and read().

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

Definition at line 44 of file SectorProcessorLUT.h.

Referenced by get_th_corr_lut(), and read().

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

Definition at line 42 of file SectorProcessorLUT.h.

Referenced by get_th_disp(), and read().

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

Definition at line 41 of file SectorProcessorLUT.h.

Referenced by get_th_init(), and read().

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

Definition at line 43 of file SectorProcessorLUT.h.

Referenced by get_th_lut(), and read().

unsigned SectorProcessorLUT::version_
private

Definition at line 51 of file SectorProcessorLUT.h.

Referenced by read().