CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
MuonPathAnalyticAnalyzer Class Reference

#include <MuonPathAnalyticAnalyzer.h>

Inheritance diagram for MuonPathAnalyticAnalyzer:
MuonPathAnalyzer

Public Member Functions

void finish () override
 
bool hasPosRF (int wh, int sec)
 
void initialise (const edm::EventSetup &iEventSetup) override
 
 MuonPathAnalyticAnalyzer (const edm::ParameterSet &pset, edm::ConsumesCollector &iC, std::shared_ptr< GlobalCoordsObtainer > &globalcoordsobtainer)
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, MuonPathPtrs &inMpath, std::vector< cmsdt::metaPrimitive > &metaPrimitives) override
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, MuonPathPtrs &inMpath, MuonPathPtrs &outMPath) override
 
 ~MuonPathAnalyticAnalyzer () override
 
- Public Member Functions inherited from MuonPathAnalyzer
 MuonPathAnalyzer (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
virtual ~MuonPathAnalyzer ()
 

Public Attributes

int chosen_sl_
 
DTGeometry const * dtGeo_
 
edm::ESGetToken< DTGeometry,
MuonGeometryRecord
dtGeomH
 
edm::FileInPath shift_filename_
 
edm::FileInPath shift_theta_filename_
 
std::map< int, float > shiftinfo_
 
std::map< int, float > shiftthetainfo_
 

Private Member Functions

void analyze (MuonPathPtr &inMPath, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
 
int compute_parameter (MAGNITUDE constants, int t0s[4], int DIV_SHR_BITS, int INCREASED_RES)
 
void fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER ()
 
std::vector< int > getLateralityCombination (int latcomb)
 
void segment_fitter (DTSuperLayerId MuonPathSLId, int wires[4], int t0s[4], int valid[4], int reduced_times[4], int cell_horiz_layout[4], LATCOMB_CONSTANTS latcomb_consts, int xwire_mm[4], int coarse_pos, int coarse_offset, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
 

Private Attributes

int cellLayout_ [cmsdt::NUM_LAYERS]
 
double chi2Th_
 
bool debug_
 
std::string geometry_tag_
 
std::shared_ptr
< GlobalCoordsObtainer
globalcoordsobtainer_
 
std::vector
< CELL_VALID_LAYOUT_CONSTANTS
LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
 
double tanPhiTh_
 
double tanPhiThw0_
 
double tanPhiThw1max_
 
double tanPhiThw1min_
 
double tanPhiThw2max_
 
double tanPhiThw2min_
 

Detailed Description

Definition at line 42 of file MuonPathAnalyticAnalyzer.h.

Constructor & Destructor Documentation

MuonPathAnalyticAnalyzer::MuonPathAnalyticAnalyzer ( const edm::ParameterSet pset,
edm::ConsumesCollector iC,
std::shared_ptr< GlobalCoordsObtainer > &  globalcoordsobtainer 
)

Definition at line 11 of file MuonPathAnalyticAnalyzer.cc.

References cms::cuda::assert(), edm::BeginRun, chosen_sl_, debug_, dtGeomH, edm::ConsumesCollector::esConsumes(), Exception, fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), globalcoordsobtainer_, LogDebug, edm::shift, shift_filename_, shift_theta_filename_, shiftinfo_, and shiftthetainfo_.

14  : MuonPathAnalyzer(pset, iC),
15  debug_(pset.getUntrackedParameter<bool>("debug")),
16  chi2Th_(pset.getUntrackedParameter<double>("chi2Th")),
17  tanPhiTh_(pset.getUntrackedParameter<double>("tanPhiTh")),
18  tanPhiThw2max_(pset.getUntrackedParameter<double>("tanPhiThw2max")),
19  tanPhiThw2min_(pset.getUntrackedParameter<double>("tanPhiThw2min")),
20  tanPhiThw1max_(pset.getUntrackedParameter<double>("tanPhiThw1max")),
21  tanPhiThw1min_(pset.getUntrackedParameter<double>("tanPhiThw1min")),
22  tanPhiThw0_(pset.getUntrackedParameter<double>("tanPhiThw0")),
23  geometry_tag_(pset.getUntrackedParameter<std::string>("geometry_tag")) {
24  if (debug_)
25  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyzer: constructor";
26 
28 
29  //shift phi
30  int rawId;
31  shift_filename_ = pset.getParameter<edm::FileInPath>("shift_filename");
32  std::ifstream ifin3(shift_filename_.fullPath());
33  double shift;
34  if (ifin3.fail()) {
35  throw cms::Exception("Missing Input File")
36  << "MuonPathAnalyticAnalyzer::MuonPathAnalyticAnalyzer() - Cannot find " << shift_filename_.fullPath();
37  }
38  while (ifin3.good()) {
39  ifin3 >> rawId >> shift;
40  shiftinfo_[rawId] = shift;
41  }
42 
43  //shift theta
44 
45  shift_theta_filename_ = pset.getParameter<edm::FileInPath>("shift_theta_filename");
46  std::ifstream ifin4(shift_theta_filename_.fullPath());
47  if (ifin4.fail()) {
48  throw cms::Exception("Missing Input File")
49  << "MuonPathAnalyzerPerSL::MuonPathAnalyzerPerSL() - Cannot find " << shift_theta_filename_.fullPath();
50  }
51 
52  while (ifin4.good()) {
53  ifin4 >> rawId >> shift;
54  shiftthetainfo_[rawId] = shift;
55  }
56 
57  chosen_sl_ = pset.getUntrackedParameter<int>("trigger_with_sl");
58 
59  if (chosen_sl_ != 1 && chosen_sl_ != 3 && chosen_sl_ != 4) {
60  LogDebug("MuonPathAnalyticAnalyzer") << "chosen sl must be 1,3 or 4(both superlayers)";
61  assert(chosen_sl_ != 1 && chosen_sl_ != 3 && chosen_sl_ != 4); //4 means run using the two superlayers
62  }
63 
65  globalcoordsobtainer_ = globalcoordsobtainer;
66 }
T getUntrackedParameter(std::string const &, T const &) const
assert(be >=bs)
std::map< int, float > shiftthetainfo_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< int, float > shiftinfo_
static unsigned int const shift
std::string fullPath() const
Definition: FileInPath.cc:161
std::shared_ptr< GlobalCoordsObtainer > globalcoordsobtainer_
MuonPathAnalyzer(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
#define LogDebug(id)
MuonPathAnalyticAnalyzer::~MuonPathAnalyticAnalyzer ( )
override

Definition at line 68 of file MuonPathAnalyticAnalyzer.cc.

References debug_, and LogDebug.

68  {
69  if (debug_)
70  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyzer: destructor";
71 }
#define LogDebug(id)

Member Function Documentation

void MuonPathAnalyticAnalyzer::analyze ( MuonPathPtr inMPath,
std::vector< cmsdt::metaPrimitive > &  metaPrimitives 
)
private

Definition at line 107 of file MuonPathAnalyticAnalyzer.cc.

References chosen_sl_, debug_, dqmiolumiharvest::j, LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER, LogDebug, cmsdt::NOPATH, NUM_LAYERS, funct::pow(), DTChamberId::sector(), segment_fitter(), DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superLayer(), cmsdt::TDCTIME_REDUCED_SIZE, createJobs::tmp, DTChamberId::wheel(), and DigiDM_cff::wires.

Referenced by run().

107  {
108  if (debug_)
109  LogDebug("MuonPathAnalyticAnalyzer") << "DTp2:analyze \t\t\t\t starts";
110  // LOCATE MPATH
111  int selected_Id = 0;
112  if (inMPath->primitive(0)->tdcTimeStamp() != -1)
113  selected_Id = inMPath->primitive(0)->cameraId();
114  else if (inMPath->primitive(1)->tdcTimeStamp() != -1)
115  selected_Id = inMPath->primitive(1)->cameraId();
116  else if (inMPath->primitive(2)->tdcTimeStamp() != -1)
117  selected_Id = inMPath->primitive(2)->cameraId();
118  else if (inMPath->primitive(3)->tdcTimeStamp() != -1)
119  selected_Id = inMPath->primitive(3)->cameraId();
120 
121  DTLayerId thisLId(selected_Id);
122  if (debug_)
123  LogDebug("MuonPathAnalyticAnalyzer") << "Building up MuonPathSLId from rawId in the Primitive";
124  DTSuperLayerId MuonPathSLId(thisLId.wheel(), thisLId.station(), thisLId.sector(), thisLId.superLayer());
125  if (debug_)
126  LogDebug("MuonPathAnalyticAnalyzer") << "The MuonPathSLId is" << MuonPathSLId;
127 
128  if (debug_)
129  LogDebug("MuonPathAnalyticAnalyzer")
130  << "DTp2:analyze \t\t\t\t In analyze function checking if inMPath->isAnalyzable() " << inMPath->isAnalyzable();
131 
132  if (chosen_sl_ < 4 && thisLId.superLayer() != chosen_sl_)
133  return; // avoid running when mpath not in chosen SL (for 1SL fitting)
134 
135  auto mPath = std::make_shared<MuonPath>(inMPath);
136  mPath->setQuality(NOPATH);
137 
138  int wi[4], wires[4], t0s[4], valids[4];
139  // bool is_four_hit = true;
140  for (int j = 0; j < NUM_LAYERS; j++) {
141  if (mPath->primitive(j)->isValidTime()) {
142  wi[j] = mPath->primitive(j)->channelId();
143  wires[j] = mPath->primitive(j)->channelId();
144  t0s[j] = mPath->primitive(j)->tdcTimeStamp();
145  valids[j] = 1;
146  } else {
147  wi[j] = -1;
148  wires[j] = -1;
149  t0s[j] = -1;
150  valids[j] = 0;
151  // is_four_hit = false;
152  }
153  }
154 
155  if (wi[0] < 0)
156  wi[0] = wi[1];
157  else if (wi[1] < 0)
158  wi[1] = wi[0];
159  else if (wi[2] < 0)
160  wi[2] = wi[1] - 1;
161  else if (wi[3] < 0)
162  wi[3] = wi[2];
163 
164  int cell_horiz_layout[4];
165  for (int lay = 0; lay < NUM_LAYERS; lay++) {
166  cell_horiz_layout[lay] = (wi[lay] - wi[0]) * 2;
167  if (lay % 2 != 0)
168  cell_horiz_layout[lay]--;
169  }
170 
171  // calculate the coarse offset position
172  int tmp = 1;
173  if (valids[1] == 0)
174  tmp = 3;
175  int coarse_pos = (wi[tmp] * 2 - cell_horiz_layout[tmp]) * 21 * std::pow(2, 4);
176 
177  //calculate the relative position of wires in mm wrt layer 0's cell wire
178  int xwire_mm[4];
179  for (int lay = 0; lay < NUM_LAYERS; lay++) {
180  xwire_mm[lay] = 21 * cell_horiz_layout[lay];
181  }
182 
183  // divide the timestamps in coarse + reduced part
184  int valid_coarse_times[4], min_coarse_time = 999999, max_coarse_time = -999999;
185  for (int lay = 0; lay < NUM_LAYERS; lay++) {
186  if (valids[lay] == 1) {
187  valid_coarse_times[lay] = (t0s[lay] >> (TDCTIME_REDUCED_SIZE - 1));
188  if (valid_coarse_times[lay] < min_coarse_time) {
189  min_coarse_time = valid_coarse_times[lay];
190  }
191  if (valid_coarse_times[lay] > max_coarse_time) {
192  max_coarse_time = valid_coarse_times[lay];
193  }
194  } else {
195  valid_coarse_times[lay] = -1;
196  }
197  }
198 
199  // if (!is_four_hit) cout << "Found a 3!" << endl;
200 
201  if (max_coarse_time - min_coarse_time >= 2)
202  return;
203  int coarse_offset = max_coarse_time - 1;
204 
205  int reduced_times[4];
206  for (int lay = 0; lay < NUM_LAYERS; lay++) {
207  reduced_times[lay] =
208  ((1 - ((max_coarse_time & 1) ^ ((t0s[lay] >> (TDCTIME_REDUCED_SIZE - 1)) & 1))) << (TDCTIME_REDUCED_SIZE - 1));
209  reduced_times[lay] += (t0s[lay] & std::stoi(std::string(TDCTIME_REDUCED_SIZE - 1, '1'), nullptr, 2));
210  }
211  std::vector<LATCOMB_CONSTANTS> latcomb_consts_arr;
212  for (auto &elem : LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER)
213  if (elem.cell_valid_layout.valid[0] == valids[0] && elem.cell_valid_layout.valid[1] == valids[1] &&
214  elem.cell_valid_layout.valid[2] == valids[2] && elem.cell_valid_layout.valid[3] == valids[3] &&
215  elem.cell_valid_layout.cell_horiz_layout[0] == cell_horiz_layout[0] &&
216  elem.cell_valid_layout.cell_horiz_layout[1] == cell_horiz_layout[1] &&
217  elem.cell_valid_layout.cell_horiz_layout[2] == cell_horiz_layout[2] &&
218  elem.cell_valid_layout.cell_horiz_layout[3] == cell_horiz_layout[3])
219  for (auto &ind_latcomb_consts : elem.latcomb_constants)
220  latcomb_consts_arr.push_back(ind_latcomb_consts);
221  for (auto &latcomb_consts : latcomb_consts_arr) {
222  segment_fitter(MuonPathSLId,
223  wires,
224  t0s,
225  valids,
226  reduced_times,
227  cell_horiz_layout,
228  latcomb_consts,
229  xwire_mm,
230  coarse_pos,
231  coarse_offset,
232  metaPrimitives);
233  }
234 }
std::vector< CELL_VALID_LAYOUT_CONSTANTS > LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
void segment_fitter(DTSuperLayerId MuonPathSLId, int wires[4], int t0s[4], int valid[4], int reduced_times[4], int cell_horiz_layout[4], LATCOMB_CONSTANTS latcomb_consts, int xwire_mm[4], int coarse_pos, int coarse_offset, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
constexpr int TDCTIME_REDUCED_SIZE
Definition: constants.h:227
tuple wires
Definition: DigiDM_cff.py:33
tmp
align.sh
Definition: createJobs.py:716
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
#define LogDebug(id)
int MuonPathAnalyticAnalyzer::compute_parameter ( MAGNITUDE  constants,
int  t0s[4],
int  DIV_SHR_BITS,
int  INCREASED_RES 
)
private

Definition at line 236 of file MuonPathAnalyticAnalyzer.cc.

References MAGNITUDE::add, MAGNITUDE::coeff, MAGNITUDE::mult, NUM_LAYERS, funct::pow(), and mps_fire::result.

Referenced by segment_fitter().

236  {
237  long int result = 0;
238  for (int lay = 0; lay < NUM_LAYERS; lay++) {
239  result += constants.coeff[lay] * t0s[lay];
240  }
241  result = ((result * int(std::pow(2, INCREASED_RES)) + constants.add) * constants.mult) >> DIV_SHR_BITS;
242 
243  return result;
244 }
tuple result
Definition: mps_fire.py:311
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
void MuonPathAnalyticAnalyzer::fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER ( )
private

Definition at line 449 of file MuonPathAnalyticAnalyzer.cc.

References LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.

Referenced by MuonPathAnalyticAnalyzer().

449  {
450  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, -1}, {1, 1, 0, 1}},
451  {
452  {1,
453  {
454  {-6170, {1, 0, 0, -1}, 56936},
455  {239, {0, 1, 0, -1}, 4380},
456  {37, {0, 1, 0, -1}, 3559},
457  {776, {2, 3, 0, -1}, 16384},
458  }},
459  {2,
460  {
461  {-30885, {-1, 3, 0, -2}, 18979},
462  {-1583769, {1, 0, 0, -1}, 2920},
463  {-6133, {1, 0, 0, -1}, 2372},
464  {-771, {2, 3, 0, 1}, 10923},
465  }},
466  {3,
467  {
468  {-6170, {1, 0, 0, -1}, 56936},
469  {-1584008, {-1, 1, 0, 0}, 8759},
470  {-6170, {-1, 1, 0, 0}, 7117},
471  {-773, {-2, 3, 0, 1}, 32768},
472  }},
473  {8,
474  {
475  {-6170, {-1, 0, 0, 1}, 56936},
476  {-1584008, {1, -1, 0, 0}, 8759},
477  {-6170, {1, -1, 0, 0}, 7117},
478  {775, {-2, 3, 0, 1}, 32768},
479  }},
480  {9,
481  {
482  {-30885, {1, -3, 0, 2}, 18979},
483  {-1583769, {-1, 0, 0, 1}, 2920},
484  {-6133, {-1, 0, 0, 1}, 2372},
485  {777, {2, 3, 0, 1}, 10923},
486  }},
487  {10,
488  {
489  {-6170, {-1, 0, 0, 1}, 56936},
490  {239, {0, -1, 0, 1}, 4380},
491  {37, {0, -1, 0, 1}, 3559},
492  {-772, {2, 3, 0, -1}, 16384},
493  }},
494  }});
495  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, 1}, {0, 1, 1, 1}},
496  {
497  {2,
498  {
499  {-6170, {0, 1, -1, 0}, 56936},
500  {1584248, {0, 0, 1, -1}, 8759},
501  {6206, {0, 0, 1, -1}, 7117},
502  {1, {0, 1, 2, -1}, 32768},
503  }},
504  {4,
505  {
506  {-6170, {0, -1, 1, 0}, 56936},
507  {3168495, {0, 1, 0, -1}, 4380},
508  {12413, {0, 1, 0, -1}, 3559},
509  {2, {0, 1, 2, 1}, 16384},
510  }},
511  {6,
512  {
513  {-6170, {0, 2, -1, -1}, 56936},
514  {1584248, {0, -1, 1, 0}, 8759},
515  {6206, {0, -1, 1, 0}, 7117},
516  {1, {0, -1, 2, 1}, 32768},
517  }},
518  {8,
519  {
520  {-6170, {0, -2, 1, 1}, 56936},
521  {1584248, {0, 1, -1, 0}, 8759},
522  {6206, {0, 1, -1, 0}, 7117},
523  {1, {0, -1, 2, 1}, 32768},
524  }},
525  {10,
526  {
527  {-6170, {0, 1, -1, 0}, 56936},
528  {3168495, {0, -1, 0, 1}, 4380},
529  {12413, {0, -1, 0, 1}, 3559},
530  {2, {0, 1, 2, 1}, 16384},
531  }},
532  {12,
533  {
534  {-6170, {0, -1, 1, 0}, 56936},
535  {1584248, {0, 0, -1, 1}, 8759},
536  {6206, {0, 0, -1, 1}, 7117},
537  {1, {0, 1, 2, -1}, 32768},
538  }},
539  }});
540  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -3}, {1, 1, 0, 1}},
541  {
542  {1,
543  {
544  {-18546, {1, 0, 0, -1}, 56936},
545  {-3168017, {0, 1, 0, -1}, 4380},
546  {-12339, {0, 1, 0, -1}, 3559},
547  {2, {2, 3, 0, -1}, 16384},
548  }},
549  {2,
550  {
551  {-55637, {-1, 3, 0, -2}, 18979},
552  {-4752025, {1, 0, 0, -1}, 2920},
553  {-18509, {1, 0, 0, -1}, 2372},
554  {3, {2, 3, 0, 1}, 10923},
555  }},
556  {3,
557  {
558  {-18546, {1, 0, 0, -1}, 56936},
559  {-1584008, {-1, 1, 0, 0}, 8759},
560  {-6170, {-1, 1, 0, 0}, 7117},
561  {1, {-2, 3, 0, 1}, 32768},
562  }},
563  {8,
564  {
565  {-18546, {-1, 0, 0, 1}, 56936},
566  {-1584008, {1, -1, 0, 0}, 8759},
567  {-6170, {1, -1, 0, 0}, 7117},
568  {1, {-2, 3, 0, 1}, 32768},
569  }},
570  {9,
571  {
572  {-55637, {1, -3, 0, 2}, 18979},
573  {-4752025, {-1, 0, 0, 1}, 2920},
574  {-18509, {-1, 0, 0, 1}, 2372},
575  {3, {2, 3, 0, 1}, 10923},
576  }},
577  {10,
578  {
579  {-18546, {-1, 0, 0, 1}, 56936},
580  {-3168017, {0, -1, 0, 1}, 4380},
581  {-12339, {0, -1, 0, 1}, 3559},
582  {2, {2, 3, 0, -1}, 16384},
583  }},
584  }});
585  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, 1}, {0, 1, 1, 1}},
586  {
587  {2,
588  {
589  {6206, {0, 1, -1, 0}, 56936},
590  {1584248, {0, 0, 1, -1}, 8759},
591  {6206, {0, 0, 1, -1}, 7117},
592  {775, {0, 1, 2, -1}, 32768},
593  }},
594  {4,
595  {
596  {6206, {0, -1, 1, 0}, 56936},
597  {239, {0, 1, 0, -1}, 4380},
598  {37, {0, 1, 0, -1}, 3559},
599  {-772, {0, 1, 2, 1}, 16384},
600  }},
601  {6,
602  {
603  {18582, {0, 2, -1, -1}, 56936},
604  {-1584008, {0, -1, 1, 0}, 8759},
605  {-6170, {0, -1, 1, 0}, 7117},
606  {-773, {0, -1, 2, 1}, 32768},
607  }},
608  {8,
609  {
610  {18582, {0, -2, 1, 1}, 56936},
611  {-1584008, {0, 1, -1, 0}, 8759},
612  {-6170, {0, 1, -1, 0}, 7117},
613  {775, {0, -1, 2, 1}, 32768},
614  }},
615  {10,
616  {
617  {6206, {0, 1, -1, 0}, 56936},
618  {239, {0, -1, 0, 1}, 4380},
619  {37, {0, -1, 0, 1}, 3559},
620  {776, {0, 1, 2, 1}, 16384},
621  }},
622  {12,
623  {
624  {6206, {0, -1, 1, 0}, 56936},
625  {1584248, {0, 0, -1, 1}, 8759},
626  {6206, {0, 0, -1, 1}, 7117},
627  {-773, {0, 1, 2, -1}, 32768},
628  }},
629  }});
630  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 1}, {1, 1, 1, 0}},
631  {
632  {1,
633  {
634  {18582, {1, 1, -2, 0}, 56936},
635  {1584248, {0, 1, -1, 0}, 8759},
636  {6206, {0, 1, -1, 0}, 7117},
637  {1, {1, 2, -1, 0}, 32768},
638  }},
639  {2,
640  {
641  {18582, {0, 1, -1, 0}, 56936},
642  {3168495, {1, 0, -1, 0}, 4380},
643  {12413, {1, 0, -1, 0}, 3559},
644  {2, {1, 2, 1, 0}, 16384},
645  }},
646  {3,
647  {
648  {18582, {0, 1, -1, 0}, 56936},
649  {1584248, {-1, 1, 0, 0}, 8759},
650  {6206, {-1, 1, 0, 0}, 7117},
651  {1, {-1, 2, 1, 0}, 32768},
652  }},
653  {4,
654  {
655  {18582, {0, -1, 1, 0}, 56936},
656  {1584248, {1, -1, 0, 0}, 8759},
657  {6206, {1, -1, 0, 0}, 7117},
658  {1, {-1, 2, 1, 0}, 32768},
659  }},
660  {5,
661  {
662  {18582, {0, -1, 1, 0}, 56936},
663  {3168495, {-1, 0, 1, 0}, 4380},
664  {12413, {-1, 0, 1, 0}, 3559},
665  {2, {1, 2, 1, 0}, 16384},
666  }},
667  {6,
668  {
669  {18582, {-1, -1, 2, 0}, 56936},
670  {1584248, {0, -1, 1, 0}, 8759},
671  {6206, {0, -1, 1, 0}, 7117},
672  {1, {1, 2, -1, 0}, 32768},
673  }},
674  }});
675  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, -1}, {1, 0, 1, 1}},
676  {
677  {1,
678  {
679  {-6170, {1, 0, 0, -1}, 56936},
680  {-1584008, {0, 0, 1, -1}, 8759},
681  {-6170, {0, 0, 1, -1}, 7117},
682  {-773, {1, 0, 3, -2}, 32768},
683  }},
684  {4,
685  {
686  {-6133, {-2, 0, 3, -1}, 18979},
687  {-1583769, {1, 0, 0, -1}, 2920},
688  {-6133, {1, 0, 0, -1}, 2372},
689  {777, {1, 0, 3, 2}, 10923},
690  }},
691  {5,
692  {
693  {-6170, {1, 0, 0, -1}, 56936},
694  {239, {-1, 0, 1, 0}, 4380},
695  {37, {-1, 0, 1, 0}, 3559},
696  {776, {-1, 0, 3, 2}, 16384},
697  }},
698  {8,
699  {
700  {-6170, {-1, 0, 0, 1}, 56936},
701  {239, {1, 0, -1, 0}, 4380},
702  {37, {1, 0, -1, 0}, 3559},
703  {-772, {-1, 0, 3, 2}, 16384},
704  }},
705  {9,
706  {
707  {-6133, {2, 0, -3, 1}, 18979},
708  {-1583769, {-1, 0, 0, 1}, 2920},
709  {-6133, {-1, 0, 0, 1}, 2372},
710  {-771, {1, 0, 3, 2}, 10923},
711  }},
712  {12,
713  {
714  {-6170, {-1, 0, 0, 1}, 56936},
715  {-1584008, {0, 0, -1, 1}, 8759},
716  {-6170, {0, 0, -1, 1}, 7117},
717  {775, {1, 0, 3, -2}, 32768},
718  }},
719  }});
720  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -1}, {1, 1, 1, 0}},
721  {
722  {1,
723  {
724  {-18546, {1, 1, -2, 0}, 56936},
725  {-1584008, {0, 1, -1, 0}, 8759},
726  {-6170, {0, 1, -1, 0}, 7117},
727  {1, {1, 2, -1, 0}, 32768},
728  }},
729  {2,
730  {
731  {-18546, {0, 1, -1, 0}, 56936},
732  {-3168017, {1, 0, -1, 0}, 4380},
733  {-12339, {1, 0, -1, 0}, 3559},
734  {2, {1, 2, 1, 0}, 16384},
735  }},
736  {3,
737  {
738  {-18546, {0, 1, -1, 0}, 56936},
739  {-1584008, {-1, 1, 0, 0}, 8759},
740  {-6170, {-1, 1, 0, 0}, 7117},
741  {1, {-1, 2, 1, 0}, 32768},
742  }},
743  {4,
744  {
745  {-18546, {0, -1, 1, 0}, 56936},
746  {-1584008, {1, -1, 0, 0}, 8759},
747  {-6170, {1, -1, 0, 0}, 7117},
748  {1, {-1, 2, 1, 0}, 32768},
749  }},
750  {5,
751  {
752  {-18546, {0, -1, 1, 0}, 56936},
753  {-3168017, {-1, 0, 1, 0}, 4380},
754  {-12339, {-1, 0, 1, 0}, 3559},
755  {2, {1, 2, 1, 0}, 16384},
756  }},
757  {6,
758  {
759  {-18546, {-1, -1, 2, 0}, 56936},
760  {-1584008, {0, -1, 1, 0}, 8759},
761  {-6170, {0, -1, 1, 0}, 7117},
762  {1, {1, 2, -1, 0}, 32768},
763  }},
764  }});
765  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -3}, {0, 1, 1, 1}},
766  {
767  {2,
768  {
769  {-18546, {0, 1, -1, 0}, 56936},
770  {-1584008, {0, 0, 1, -1}, 8759},
771  {-6170, {0, 0, 1, -1}, 7117},
772  {1, {0, 1, 2, -1}, 32768},
773  }},
774  {4,
775  {
776  {-18546, {0, -1, 1, 0}, 56936},
777  {-3168017, {0, 1, 0, -1}, 4380},
778  {-12339, {0, 1, 0, -1}, 3559},
779  {2, {0, 1, 2, 1}, 16384},
780  }},
781  {6,
782  {
783  {-18546, {0, 2, -1, -1}, 56936},
784  {-1584008, {0, -1, 1, 0}, 8759},
785  {-6170, {0, -1, 1, 0}, 7117},
786  {1, {0, -1, 2, 1}, 32768},
787  }},
788  {8,
789  {
790  {-18546, {0, -2, 1, 1}, 56936},
791  {-1584008, {0, 1, -1, 0}, 8759},
792  {-6170, {0, 1, -1, 0}, 7117},
793  {1, {0, -1, 2, 1}, 32768},
794  }},
795  {10,
796  {
797  {-18546, {0, 1, -1, 0}, 56936},
798  {-3168017, {0, -1, 0, 1}, 4380},
799  {-12339, {0, -1, 0, 1}, 3559},
800  {2, {0, 1, 2, 1}, 16384},
801  }},
802  {12,
803  {
804  {-18546, {0, -1, 1, 0}, 56936},
805  {-1584008, {0, 0, -1, 1}, 8759},
806  {-6170, {0, 0, -1, 1}, 7117},
807  {1, {0, 1, 2, -1}, 32768},
808  }},
809  }});
810  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -1}, {0, 1, 1, 1}},
811  {
812  {2,
813  {
814  {-18546, {0, 1, -1, 0}, 56936},
815  {1584248, {0, 0, 1, -1}, 8759},
816  {6206, {0, 0, 1, -1}, 7117},
817  {775, {0, 1, 2, -1}, 32768},
818  }},
819  {4,
820  {
821  {-18546, {0, -1, 1, 0}, 56936},
822  {239, {0, 1, 0, -1}, 4380},
823  {37, {0, 1, 0, -1}, 3559},
824  {-772, {0, 1, 2, 1}, 16384},
825  }},
826  {6,
827  {
828  {-6170, {0, 2, -1, -1}, 56936},
829  {-1584008, {0, -1, 1, 0}, 8759},
830  {-6170, {0, -1, 1, 0}, 7117},
831  {-773, {0, -1, 2, 1}, 32768},
832  }},
833  {8,
834  {
835  {-6170, {0, -2, 1, 1}, 56936},
836  {-1584008, {0, 1, -1, 0}, 8759},
837  {-6170, {0, 1, -1, 0}, 7117},
838  {775, {0, -1, 2, 1}, 32768},
839  }},
840  {10,
841  {
842  {-18546, {0, 1, -1, 0}, 56936},
843  {239, {0, -1, 0, 1}, 4380},
844  {37, {0, -1, 0, 1}, 3559},
845  {776, {0, 1, 2, 1}, 16384},
846  }},
847  {12,
848  {
849  {-18546, {0, -1, 1, 0}, 56936},
850  {1584248, {0, 0, -1, 1}, 8759},
851  {6206, {0, 0, -1, 1}, 7117},
852  {-773, {0, 1, 2, -1}, 32768},
853  }},
854  }});
855  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -3}, {1, 1, 1, 0}},
856  {
857  {1,
858  {
859  {-18546, {1, 1, -2, 0}, 56936},
860  {-1584008, {0, 1, -1, 0}, 8759},
861  {-6170, {0, 1, -1, 0}, 7117},
862  {1, {1, 2, -1, 0}, 32768},
863  }},
864  {2,
865  {
866  {-18546, {0, 1, -1, 0}, 56936},
867  {-3168017, {1, 0, -1, 0}, 4380},
868  {-12339, {1, 0, -1, 0}, 3559},
869  {2, {1, 2, 1, 0}, 16384},
870  }},
871  {3,
872  {
873  {-18546, {0, 1, -1, 0}, 56936},
874  {-1584008, {-1, 1, 0, 0}, 8759},
875  {-6170, {-1, 1, 0, 0}, 7117},
876  {1, {-1, 2, 1, 0}, 32768},
877  }},
878  {4,
879  {
880  {-18546, {0, -1, 1, 0}, 56936},
881  {-1584008, {1, -1, 0, 0}, 8759},
882  {-6170, {1, -1, 0, 0}, 7117},
883  {1, {-1, 2, 1, 0}, 32768},
884  }},
885  {5,
886  {
887  {-18546, {0, -1, 1, 0}, 56936},
888  {-3168017, {-1, 0, 1, 0}, 4380},
889  {-12339, {-1, 0, 1, 0}, 3559},
890  {2, {1, 2, 1, 0}, 16384},
891  }},
892  {6,
893  {
894  {-18546, {-1, -1, 2, 0}, 56936},
895  {-1584008, {0, -1, 1, 0}, 8759},
896  {-6170, {0, -1, 1, 0}, 7117},
897  {1, {1, 2, -1, 0}, 32768},
898  }},
899  }});
900  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 1}, {0, 1, 1, 1}},
901  {
902  {2,
903  {
904  {18582, {0, 1, -1, 0}, 56936},
905  {-1584008, {0, 0, 1, -1}, 8759},
906  {-6170, {0, 0, 1, -1}, 7117},
907  {-773, {0, 1, 2, -1}, 32768},
908  }},
909  {4,
910  {
911  {18582, {0, -1, 1, 0}, 56936},
912  {239, {0, 1, 0, -1}, 4380},
913  {37, {0, 1, 0, -1}, 3559},
914  {776, {0, 1, 2, 1}, 16384},
915  }},
916  {6,
917  {
918  {6206, {0, 2, -1, -1}, 56936},
919  {1584248, {0, -1, 1, 0}, 8759},
920  {6206, {0, -1, 1, 0}, 7117},
921  {775, {0, -1, 2, 1}, 32768},
922  }},
923  {8,
924  {
925  {6206, {0, -2, 1, 1}, 56936},
926  {1584248, {0, 1, -1, 0}, 8759},
927  {6206, {0, 1, -1, 0}, 7117},
928  {-773, {0, -1, 2, 1}, 32768},
929  }},
930  {10,
931  {
932  {18582, {0, 1, -1, 0}, 56936},
933  {239, {0, -1, 0, 1}, 4380},
934  {37, {0, -1, 0, 1}, 3559},
935  {-772, {0, 1, 2, 1}, 16384},
936  }},
937  {12,
938  {
939  {18582, {0, -1, 1, 0}, 56936},
940  {-1584008, {0, 0, -1, 1}, 8759},
941  {-6170, {0, 0, -1, 1}, 7117},
942  {775, {0, 1, 2, -1}, 32768},
943  }},
944  }});
945  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -1}, {1, 1, 1, 1}},
946  {
947  {4,
948  {
949  {-222510, {-6, -5, 14, -3}, 4067},
950  {-6334836, {4, 1, 0, -5}, 626},
951  {-24494, {4, 1, 0, -5}, 508},
952  {-3087, {1, 2, 7, 4}, 4681},
953  }},
954  {6,
955  {
956  {-24715, {-1, 1, 1, -1}, 28468},
957  {-6335315, {3, -1, 1, -3}, 876},
958  {-24568, {3, -1, 1, -3}, 712},
959  {-772, {1, 1, 1, 1}, 16384},
960  }},
961  {7,
962  {
963  {-37018, {5, 2, -1, -6}, 9489},
964  {-3168017, {-1, 0, 1, 0}, 4380},
965  {-12339, {-1, 0, 1, 0}, 3559},
966  {-2318, {-2, 1, 4, 3}, 10923},
967  }},
968  {0,
969  {
970  {0, {0, 0, 0, 0}, 0},
971  {0, {0, 0, 0, 0}, 0},
972  {0, {0, 0, 0, 0}, 0},
973  {0, {0, 0, 0, 0}, 0},
974  }},
975  {0,
976  {
977  {0, {0, 0, 0, 0}, 0},
978  {0, {0, 0, 0, 0}, 0},
979  {0, {0, 0, 0, 0}, 0},
980  {0, {0, 0, 0, 0}, 0},
981  }},
982  {0,
983  {
984  {0, {0, 0, 0, 0}, 0},
985  {0, {0, 0, 0, 0}, 0},
986  {0, {0, 0, 0, 0}, 0},
987  {0, {0, 0, 0, 0}, 0},
988  }},
989  }});
990  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 3}, {0, 1, 1, 1}},
991  {
992  {2,
993  {
994  {18582, {0, 1, -1, 0}, 56936},
995  {1584248, {0, 0, 1, -1}, 8759},
996  {6206, {0, 0, 1, -1}, 7117},
997  {1, {0, 1, 2, -1}, 32768},
998  }},
999  {4,
1000  {
1001  {18582, {0, -1, 1, 0}, 56936},
1002  {3168495, {0, 1, 0, -1}, 4380},
1003  {12413, {0, 1, 0, -1}, 3559},
1004  {2, {0, 1, 2, 1}, 16384},
1005  }},
1006  {6,
1007  {
1008  {18582, {0, 2, -1, -1}, 56936},
1009  {1584248, {0, -1, 1, 0}, 8759},
1010  {6206, {0, -1, 1, 0}, 7117},
1011  {1, {0, -1, 2, 1}, 32768},
1012  }},
1013  {8,
1014  {
1015  {18582, {0, -2, 1, 1}, 56936},
1016  {1584248, {0, 1, -1, 0}, 8759},
1017  {6206, {0, 1, -1, 0}, 7117},
1018  {1, {0, -1, 2, 1}, 32768},
1019  }},
1020  {10,
1021  {
1022  {18582, {0, 1, -1, 0}, 56936},
1023  {3168495, {0, -1, 0, 1}, 4380},
1024  {12413, {0, -1, 0, 1}, 3559},
1025  {2, {0, 1, 2, 1}, 16384},
1026  }},
1027  {12,
1028  {
1029  {18582, {0, -1, 1, 0}, 56936},
1030  {1584248, {0, 0, -1, 1}, 8759},
1031  {6206, {0, 0, -1, 1}, 7117},
1032  {1, {0, 1, 2, -1}, 32768},
1033  }},
1034  }});
1035  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, -1}, {1, 1, 1, 1}},
1036  {
1037  {1,
1038  {
1039  {-37018, {6, 1, -2, -5}, 9489},
1040  {-3168017, {0, 1, 0, -1}, 4380},
1041  {-12339, {0, 1, 0, -1}, 3559},
1042  {-2318, {3, 4, 1, -2}, 10923},
1043  }},
1044  {9,
1045  {
1046  {37, {1, -1, -1, 1}, 28468},
1047  {-6335315, {-3, 1, -1, 3}, 876},
1048  {-24568, {-3, 1, -1, 3}, 712},
1049  {-772, {1, 1, 1, 1}, 16384},
1050  }},
1051  {13,
1052  {
1053  {49762, {3, -14, 5, 6}, 4067},
1054  {-6334836, {-5, 0, 1, 4}, 626},
1055  {-24494, {-5, 0, 1, 4}, 508},
1056  {-3087, {4, 7, 2, 1}, 4681},
1057  }},
1058  {0,
1059  {
1060  {0, {0, 0, 0, 0}, 0},
1061  {0, {0, 0, 0, 0}, 0},
1062  {0, {0, 0, 0, 0}, 0},
1063  {0, {0, 0, 0, 0}, 0},
1064  }},
1065  {0,
1066  {
1067  {0, {0, 0, 0, 0}, 0},
1068  {0, {0, 0, 0, 0}, 0},
1069  {0, {0, 0, 0, 0}, 0},
1070  {0, {0, 0, 0, 0}, 0},
1071  }},
1072  {0,
1073  {
1074  {0, {0, 0, 0, 0}, 0},
1075  {0, {0, 0, 0, 0}, 0},
1076  {0, {0, 0, 0, 0}, 0},
1077  {0, {0, 0, 0, 0}, 0},
1078  }},
1079  }});
1080  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -1}, {1, 1, 0, 1}},
1081  {
1082  {1,
1083  {
1084  {-6170, {1, 0, 0, -1}, 56936},
1085  {239, {0, 1, 0, -1}, 4380},
1086  {37, {0, 1, 0, -1}, 3559},
1087  {776, {2, 3, 0, -1}, 16384},
1088  }},
1089  {2,
1090  {
1091  {-30885, {-1, 3, 0, -2}, 18979},
1092  {-1583769, {1, 0, 0, -1}, 2920},
1093  {-6133, {1, 0, 0, -1}, 2372},
1094  {-771, {2, 3, 0, 1}, 10923},
1095  }},
1096  {3,
1097  {
1098  {-6170, {1, 0, 0, -1}, 56936},
1099  {-1584008, {-1, 1, 0, 0}, 8759},
1100  {-6170, {-1, 1, 0, 0}, 7117},
1101  {-773, {-2, 3, 0, 1}, 32768},
1102  }},
1103  {8,
1104  {
1105  {-6170, {-1, 0, 0, 1}, 56936},
1106  {-1584008, {1, -1, 0, 0}, 8759},
1107  {-6170, {1, -1, 0, 0}, 7117},
1108  {775, {-2, 3, 0, 1}, 32768},
1109  }},
1110  {9,
1111  {
1112  {-30885, {1, -3, 0, 2}, 18979},
1113  {-1583769, {-1, 0, 0, 1}, 2920},
1114  {-6133, {-1, 0, 0, 1}, 2372},
1115  {777, {2, 3, 0, 1}, 10923},
1116  }},
1117  {10,
1118  {
1119  {-6170, {-1, 0, 0, 1}, 56936},
1120  {239, {0, -1, 0, 1}, 4380},
1121  {37, {0, -1, 0, 1}, 3559},
1122  {-772, {2, 3, 0, -1}, 16384},
1123  }},
1124  }});
1125  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 3}, {1, 1, 0, 1}},
1126  {
1127  {1,
1128  {
1129  {18582, {1, 0, 0, -1}, 56936},
1130  {3168495, {0, 1, 0, -1}, 4380},
1131  {12413, {0, 1, 0, -1}, 3559},
1132  {2, {2, 3, 0, -1}, 16384},
1133  }},
1134  {2,
1135  {
1136  {55747, {-1, 3, 0, -2}, 18979},
1137  {4752743, {1, 0, 0, -1}, 2920},
1138  {18619, {1, 0, 0, -1}, 2372},
1139  {3, {2, 3, 0, 1}, 10923},
1140  }},
1141  {3,
1142  {
1143  {18582, {1, 0, 0, -1}, 56936},
1144  {1584248, {-1, 1, 0, 0}, 8759},
1145  {6206, {-1, 1, 0, 0}, 7117},
1146  {1, {-2, 3, 0, 1}, 32768},
1147  }},
1148  {8,
1149  {
1150  {18582, {-1, 0, 0, 1}, 56936},
1151  {1584248, {1, -1, 0, 0}, 8759},
1152  {6206, {1, -1, 0, 0}, 7117},
1153  {1, {-2, 3, 0, 1}, 32768},
1154  }},
1155  {9,
1156  {
1157  {55747, {1, -3, 0, 2}, 18979},
1158  {4752743, {-1, 0, 0, 1}, 2920},
1159  {18619, {-1, 0, 0, 1}, 2372},
1160  {3, {2, 3, 0, 1}, 10923},
1161  }},
1162  {10,
1163  {
1164  {18582, {-1, 0, 0, 1}, 56936},
1165  {3168495, {0, -1, 0, 1}, 4380},
1166  {12413, {0, -1, 0, 1}, 3559},
1167  {2, {2, 3, 0, -1}, 16384},
1168  }},
1169  }});
1170  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, 1}, {1, 1, 1, 0}},
1171  {
1172  {1,
1173  {
1174  {6206, {1, 1, -2, 0}, 56936},
1175  {1584248, {0, 1, -1, 0}, 8759},
1176  {6206, {0, 1, -1, 0}, 7117},
1177  {775, {1, 2, -1, 0}, 32768},
1178  }},
1179  {2,
1180  {
1181  {-6170, {0, 1, -1, 0}, 56936},
1182  {239, {1, 0, -1, 0}, 4380},
1183  {37, {1, 0, -1, 0}, 3559},
1184  {-772, {1, 2, 1, 0}, 16384},
1185  }},
1186  {3,
1187  {
1188  {-6170, {0, 1, -1, 0}, 56936},
1189  {-1584008, {-1, 1, 0, 0}, 8759},
1190  {-6170, {-1, 1, 0, 0}, 7117},
1191  {-773, {-1, 2, 1, 0}, 32768},
1192  }},
1193  {4,
1194  {
1195  {-6170, {0, -1, 1, 0}, 56936},
1196  {-1584008, {1, -1, 0, 0}, 8759},
1197  {-6170, {1, -1, 0, 0}, 7117},
1198  {775, {-1, 2, 1, 0}, 32768},
1199  }},
1200  {5,
1201  {
1202  {-6170, {0, -1, 1, 0}, 56936},
1203  {239, {-1, 0, 1, 0}, 4380},
1204  {37, {-1, 0, 1, 0}, 3559},
1205  {776, {1, 2, 1, 0}, 16384},
1206  }},
1207  {6,
1208  {
1209  {6206, {-1, -1, 2, 0}, 56936},
1210  {1584248, {0, -1, 1, 0}, 8759},
1211  {6206, {0, -1, 1, 0}, 7117},
1212  {-773, {1, 2, -1, 0}, 32768},
1213  }},
1214  }});
1215  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, -1}, {0, 1, 1, 1}},
1216  {
1217  {2,
1218  {
1219  {6206, {0, 1, -1, 0}, 56936},
1220  {-1584008, {0, 0, 1, -1}, 8759},
1221  {-6170, {0, 0, 1, -1}, 7117},
1222  {1, {0, 1, 2, -1}, 32768},
1223  }},
1224  {4,
1225  {
1226  {6206, {0, -1, 1, 0}, 56936},
1227  {-3168017, {0, 1, 0, -1}, 4380},
1228  {-12339, {0, 1, 0, -1}, 3559},
1229  {2, {0, 1, 2, 1}, 16384},
1230  }},
1231  {6,
1232  {
1233  {6206, {0, 2, -1, -1}, 56936},
1234  {-1584008, {0, -1, 1, 0}, 8759},
1235  {-6170, {0, -1, 1, 0}, 7117},
1236  {1, {0, -1, 2, 1}, 32768},
1237  }},
1238  {8,
1239  {
1240  {6206, {0, -2, 1, 1}, 56936},
1241  {-1584008, {0, 1, -1, 0}, 8759},
1242  {-6170, {0, 1, -1, 0}, 7117},
1243  {1, {0, -1, 2, 1}, 32768},
1244  }},
1245  {10,
1246  {
1247  {6206, {0, 1, -1, 0}, 56936},
1248  {-3168017, {0, -1, 0, 1}, 4380},
1249  {-12339, {0, -1, 0, 1}, 3559},
1250  {2, {0, 1, 2, 1}, 16384},
1251  }},
1252  {12,
1253  {
1254  {6206, {0, -1, 1, 0}, 56936},
1255  {-1584008, {0, 0, -1, 1}, 8759},
1256  {-6170, {0, 0, -1, 1}, 7117},
1257  {1, {0, 1, 2, -1}, 32768},
1258  }},
1259  }});
1260  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, -1}, {1, 1, 1, 1}},
1261  {
1262  {2,
1263  {
1264  {-123502, {-3, 14, -5, -6}, 4067},
1265  {-6334836, {5, 0, -1, -4}, 626},
1266  {-24494, {5, 0, -1, -4}, 508},
1267  {-2314, {4, 7, 2, 1}, 4681},
1268  }},
1269  {10,
1270  {
1271  {-12339, {-1, 1, -1, 1}, 28468},
1272  {479, {1, -1, -1, 1}, 2190},
1273  {74, {1, -1, -1, 1}, 1779},
1274  {-1543, {1, 3, 3, 1}, 8192},
1275  }},
1276  {3,
1277  {
1278  {-12339, {1, 1, -1, -1}, 28468},
1279  {-3168017, {-1, 1, 1, -1}, 4380},
1280  {-12339, {-1, 1, 1, -1}, 3559},
1281  {-1545, {-1, 3, 3, -1}, 16384},
1282  }},
1283  {11,
1284  {
1285  {-49246, {6, 5, -14, 3}, 4067},
1286  {-6334836, {-4, -1, 0, 5}, 626},
1287  {-24494, {-4, -1, 0, 5}, 508},
1288  {-2314, {1, 2, 7, 4}, 4681},
1289  }},
1290  {0,
1291  {
1292  {0, {0, 0, 0, 0}, 0},
1293  {0, {0, 0, 0, 0}, 0},
1294  {0, {0, 0, 0, 0}, 0},
1295  {0, {0, 0, 0, 0}, 0},
1296  }},
1297  {0,
1298  {
1299  {0, {0, 0, 0, 0}, 0},
1300  {0, {0, 0, 0, 0}, 0},
1301  {0, {0, 0, 0, 0}, 0},
1302  {0, {0, 0, 0, 0}, 0},
1303  }},
1304  }});
1305  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, -1}, {0, 1, 1, 1}},
1306  {
1307  {2,
1308  {
1309  {-6170, {0, 1, -1, 0}, 56936},
1310  {-1584008, {0, 0, 1, -1}, 8759},
1311  {-6170, {0, 0, 1, -1}, 7117},
1312  {-773, {0, 1, 2, -1}, 32768},
1313  }},
1314  {4,
1315  {
1316  {-6170, {0, -1, 1, 0}, 56936},
1317  {239, {0, 1, 0, -1}, 4380},
1318  {37, {0, 1, 0, -1}, 3559},
1319  {776, {0, 1, 2, 1}, 16384},
1320  }},
1321  {6,
1322  {
1323  {-18546, {0, 2, -1, -1}, 56936},
1324  {1584248, {0, -1, 1, 0}, 8759},
1325  {6206, {0, -1, 1, 0}, 7117},
1326  {775, {0, -1, 2, 1}, 32768},
1327  }},
1328  {8,
1329  {
1330  {-18546, {0, -2, 1, 1}, 56936},
1331  {1584248, {0, 1, -1, 0}, 8759},
1332  {6206, {0, 1, -1, 0}, 7117},
1333  {-773, {0, -1, 2, 1}, 32768},
1334  }},
1335  {10,
1336  {
1337  {-6170, {0, 1, -1, 0}, 56936},
1338  {239, {0, -1, 0, 1}, 4380},
1339  {37, {0, -1, 0, 1}, 3559},
1340  {-772, {0, 1, 2, 1}, 16384},
1341  }},
1342  {12,
1343  {
1344  {-6170, {0, -1, 1, 0}, 56936},
1345  {-1584008, {0, 0, -1, 1}, 8759},
1346  {-6170, {0, 0, -1, 1}, 7117},
1347  {775, {0, 1, 2, -1}, 32768},
1348  }},
1349  }});
1350  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 3}, {1, 1, 1, 1}},
1351  {
1352  {8,
1353  {
1354  {111495, {-5, -2, 1, 6}, 9489},
1355  {3168495, {1, 0, -1, 0}, 4380},
1356  {12413, {1, 0, -1, 0}, 3559},
1357  {3, {-2, 1, 4, 3}, 10923},
1358  }},
1359  {12,
1360  {
1361  {37165, {-1, -1, 1, 1}, 28468},
1362  {3168495, {1, -1, -1, 1}, 4380},
1363  {12413, {1, -1, -1, 1}, 3559},
1364  {2, {-1, 3, 3, -1}, 16384},
1365  }},
1366  {14,
1367  {
1368  {111495, {-6, -1, 2, 5}, 9489},
1369  {3168495, {0, -1, 0, 1}, 4380},
1370  {12413, {0, -1, 0, 1}, 3559},
1371  {3, {3, 4, 1, -2}, 10923},
1372  }},
1373  {1,
1374  {
1375  {111495, {6, 1, -2, -5}, 9489},
1376  {3168495, {0, 1, 0, -1}, 4380},
1377  {12413, {0, 1, 0, -1}, 3559},
1378  {3, {3, 4, 1, -2}, 10923},
1379  }},
1380  {3,
1381  {
1382  {37165, {1, 1, -1, -1}, 28468},
1383  {3168495, {-1, 1, 1, -1}, 4380},
1384  {12413, {-1, 1, 1, -1}, 3559},
1385  {2, {-1, 3, 3, -1}, 16384},
1386  }},
1387  {7,
1388  {
1389  {111495, {5, 2, -1, -6}, 9489},
1390  {3168495, {-1, 0, 1, 0}, 4380},
1391  {12413, {-1, 0, 1, 0}, 3559},
1392  {3, {-2, 1, 4, 3}, 10923},
1393  }},
1394  }});
1395  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, 1}, {1, 0, 1, 1}},
1396  {
1397  {1,
1398  {
1399  {6206, {1, 0, 0, -1}, 56936},
1400  {1584248, {0, 0, 1, -1}, 8759},
1401  {6206, {0, 0, 1, -1}, 7117},
1402  {775, {1, 0, 3, -2}, 32768},
1403  }},
1404  {4,
1405  {
1406  {6243, {-2, 0, 3, -1}, 18979},
1407  {1584487, {1, 0, 0, -1}, 2920},
1408  {6243, {1, 0, 0, -1}, 2372},
1409  {-771, {1, 0, 3, 2}, 10923},
1410  }},
1411  {5,
1412  {
1413  {6206, {1, 0, 0, -1}, 56936},
1414  {239, {-1, 0, 1, 0}, 4380},
1415  {37, {-1, 0, 1, 0}, 3559},
1416  {-772, {-1, 0, 3, 2}, 16384},
1417  }},
1418  {8,
1419  {
1420  {6206, {-1, 0, 0, 1}, 56936},
1421  {239, {1, 0, -1, 0}, 4380},
1422  {37, {1, 0, -1, 0}, 3559},
1423  {776, {-1, 0, 3, 2}, 16384},
1424  }},
1425  {9,
1426  {
1427  {6243, {2, 0, -3, 1}, 18979},
1428  {1584487, {-1, 0, 0, 1}, 2920},
1429  {6243, {-1, 0, 0, 1}, 2372},
1430  {777, {1, 0, 3, 2}, 10923},
1431  }},
1432  {12,
1433  {
1434  {6206, {-1, 0, 0, 1}, 56936},
1435  {1584248, {0, 0, -1, 1}, 8759},
1436  {6206, {0, 0, -1, 1}, 7117},
1437  {-773, {1, 0, 3, -2}, 32768},
1438  }},
1439  }});
1440  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 1}, {1, 1, 0, 1}},
1441  {
1442  {1,
1443  {
1444  {6206, {1, 0, 0, -1}, 56936},
1445  {239, {0, 1, 0, -1}, 4380},
1446  {37, {0, 1, 0, -1}, 3559},
1447  {-772, {2, 3, 0, -1}, 16384},
1448  }},
1449  {2,
1450  {
1451  {30995, {-1, 3, 0, -2}, 18979},
1452  {1584487, {1, 0, 0, -1}, 2920},
1453  {6243, {1, 0, 0, -1}, 2372},
1454  {777, {2, 3, 0, 1}, 10923},
1455  }},
1456  {3,
1457  {
1458  {6206, {1, 0, 0, -1}, 56936},
1459  {1584248, {-1, 1, 0, 0}, 8759},
1460  {6206, {-1, 1, 0, 0}, 7117},
1461  {775, {-2, 3, 0, 1}, 32768},
1462  }},
1463  {8,
1464  {
1465  {6206, {-1, 0, 0, 1}, 56936},
1466  {1584248, {1, -1, 0, 0}, 8759},
1467  {6206, {1, -1, 0, 0}, 7117},
1468  {-773, {-2, 3, 0, 1}, 32768},
1469  }},
1470  {9,
1471  {
1472  {30995, {1, -3, 0, 2}, 18979},
1473  {1584487, {-1, 0, 0, 1}, 2920},
1474  {6243, {-1, 0, 0, 1}, 2372},
1475  {-771, {2, 3, 0, 1}, 10923},
1476  }},
1477  {10,
1478  {
1479  {6206, {-1, 0, 0, 1}, 56936},
1480  {239, {0, -1, 0, 1}, 4380},
1481  {37, {0, -1, 0, 1}, 3559},
1482  {776, {2, 3, 0, -1}, 16384},
1483  }},
1484  }});
1485  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, -1}, {1, 1, 1, 0}},
1486  {
1487  {1,
1488  {
1489  {6206, {1, 1, -2, 0}, 56936},
1490  {1584248, {0, 1, -1, 0}, 8759},
1491  {6206, {0, 1, -1, 0}, 7117},
1492  {775, {1, 2, -1, 0}, 32768},
1493  }},
1494  {2,
1495  {
1496  {-6170, {0, 1, -1, 0}, 56936},
1497  {239, {1, 0, -1, 0}, 4380},
1498  {37, {1, 0, -1, 0}, 3559},
1499  {-772, {1, 2, 1, 0}, 16384},
1500  }},
1501  {3,
1502  {
1503  {-6170, {0, 1, -1, 0}, 56936},
1504  {-1584008, {-1, 1, 0, 0}, 8759},
1505  {-6170, {-1, 1, 0, 0}, 7117},
1506  {-773, {-1, 2, 1, 0}, 32768},
1507  }},
1508  {4,
1509  {
1510  {-6170, {0, -1, 1, 0}, 56936},
1511  {-1584008, {1, -1, 0, 0}, 8759},
1512  {-6170, {1, -1, 0, 0}, 7117},
1513  {775, {-1, 2, 1, 0}, 32768},
1514  }},
1515  {5,
1516  {
1517  {-6170, {0, -1, 1, 0}, 56936},
1518  {239, {-1, 0, 1, 0}, 4380},
1519  {37, {-1, 0, 1, 0}, 3559},
1520  {776, {1, 2, 1, 0}, 16384},
1521  }},
1522  {6,
1523  {
1524  {6206, {-1, -1, 2, 0}, 56936},
1525  {1584248, {0, -1, 1, 0}, 8759},
1526  {6206, {0, -1, 1, 0}, 7117},
1527  {-773, {1, 2, -1, 0}, 32768},
1528  }},
1529  }});
1530  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 1}, {1, 0, 1, 1}},
1531  {
1532  {1,
1533  {
1534  {6206, {1, 0, 0, -1}, 56936},
1535  {-1584008, {0, 0, 1, -1}, 8759},
1536  {-6170, {0, 0, 1, -1}, 7117},
1537  {-1546, {1, 0, 3, -2}, 32768},
1538  }},
1539  {4,
1540  {
1541  {43371, {-2, 0, 3, -1}, 18979},
1542  {1584487, {1, 0, 0, -1}, 2920},
1543  {6243, {1, 0, 0, -1}, 2372},
1544  {1550, {1, 0, 3, 2}, 10923},
1545  }},
1546  {5,
1547  {
1548  {6206, {1, 0, 0, -1}, 56936},
1549  {3168495, {-1, 0, 1, 0}, 4380},
1550  {12413, {-1, 0, 1, 0}, 3559},
1551  {1549, {-1, 0, 3, 2}, 16384},
1552  }},
1553  {8,
1554  {
1555  {6206, {-1, 0, 0, 1}, 56936},
1556  {3168495, {1, 0, -1, 0}, 4380},
1557  {12413, {1, 0, -1, 0}, 3559},
1558  {-1545, {-1, 0, 3, 2}, 16384},
1559  }},
1560  {9,
1561  {
1562  {43371, {2, 0, -3, 1}, 18979},
1563  {1584487, {-1, 0, 0, 1}, 2920},
1564  {6243, {-1, 0, 0, 1}, 2372},
1565  {-1544, {1, 0, 3, 2}, 10923},
1566  }},
1567  {12,
1568  {
1569  {6206, {-1, 0, 0, 1}, 56936},
1570  {-1584008, {0, 0, -1, 1}, 8759},
1571  {-6170, {0, 0, -1, 1}, 7117},
1572  {1548, {1, 0, 3, -2}, 32768},
1573  }},
1574  }});
1575  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, -1}, {1, 1, 1, 0}},
1576  {
1577  {1,
1578  {
1579  {-6170, {1, 1, -2, 0}, 56936},
1580  {-1584008, {0, 1, -1, 0}, 8759},
1581  {-6170, {0, 1, -1, 0}, 7117},
1582  {-773, {1, 2, -1, 0}, 32768},
1583  }},
1584  {2,
1585  {
1586  {6206, {0, 1, -1, 0}, 56936},
1587  {239, {1, 0, -1, 0}, 4380},
1588  {37, {1, 0, -1, 0}, 3559},
1589  {776, {1, 2, 1, 0}, 16384},
1590  }},
1591  {3,
1592  {
1593  {6206, {0, 1, -1, 0}, 56936},
1594  {1584248, {-1, 1, 0, 0}, 8759},
1595  {6206, {-1, 1, 0, 0}, 7117},
1596  {775, {-1, 2, 1, 0}, 32768},
1597  }},
1598  {4,
1599  {
1600  {6206, {0, -1, 1, 0}, 56936},
1601  {1584248, {1, -1, 0, 0}, 8759},
1602  {6206, {1, -1, 0, 0}, 7117},
1603  {-773, {-1, 2, 1, 0}, 32768},
1604  }},
1605  {5,
1606  {
1607  {6206, {0, -1, 1, 0}, 56936},
1608  {239, {-1, 0, 1, 0}, 4380},
1609  {37, {-1, 0, 1, 0}, 3559},
1610  {-772, {1, 2, 1, 0}, 16384},
1611  }},
1612  {6,
1613  {
1614  {-6170, {-1, -1, 2, 0}, 56936},
1615  {-1584008, {0, -1, 1, 0}, 8759},
1616  {-6170, {0, -1, 1, 0}, 7117},
1617  {775, {1, 2, -1, 0}, 32768},
1618  }},
1619  }});
1620  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 3}, {1, 1, 1, 0}},
1621  {
1622  {1,
1623  {
1624  {18582, {1, 1, -2, 0}, 56936},
1625  {1584248, {0, 1, -1, 0}, 8759},
1626  {6206, {0, 1, -1, 0}, 7117},
1627  {1, {1, 2, -1, 0}, 32768},
1628  }},
1629  {2,
1630  {
1631  {18582, {0, 1, -1, 0}, 56936},
1632  {3168495, {1, 0, -1, 0}, 4380},
1633  {12413, {1, 0, -1, 0}, 3559},
1634  {2, {1, 2, 1, 0}, 16384},
1635  }},
1636  {3,
1637  {
1638  {18582, {0, 1, -1, 0}, 56936},
1639  {1584248, {-1, 1, 0, 0}, 8759},
1640  {6206, {-1, 1, 0, 0}, 7117},
1641  {1, {-1, 2, 1, 0}, 32768},
1642  }},
1643  {4,
1644  {
1645  {18582, {0, -1, 1, 0}, 56936},
1646  {1584248, {1, -1, 0, 0}, 8759},
1647  {6206, {1, -1, 0, 0}, 7117},
1648  {1, {-1, 2, 1, 0}, 32768},
1649  }},
1650  {5,
1651  {
1652  {18582, {0, -1, 1, 0}, 56936},
1653  {3168495, {-1, 0, 1, 0}, 4380},
1654  {12413, {-1, 0, 1, 0}, 3559},
1655  {2, {1, 2, 1, 0}, 16384},
1656  }},
1657  {6,
1658  {
1659  {18582, {-1, -1, 2, 0}, 56936},
1660  {1584248, {0, -1, 1, 0}, 8759},
1661  {6206, {0, -1, 1, 0}, 7117},
1662  {1, {1, 2, -1, 0}, 32768},
1663  }},
1664  }});
1665  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, 1}, {1, 1, 1, 0}},
1666  {
1667  {1,
1668  {
1669  {-6170, {1, 1, -2, 0}, 56936},
1670  {-1584008, {0, 1, -1, 0}, 8759},
1671  {-6170, {0, 1, -1, 0}, 7117},
1672  {-773, {1, 2, -1, 0}, 32768},
1673  }},
1674  {2,
1675  {
1676  {6206, {0, 1, -1, 0}, 56936},
1677  {239, {1, 0, -1, 0}, 4380},
1678  {37, {1, 0, -1, 0}, 3559},
1679  {776, {1, 2, 1, 0}, 16384},
1680  }},
1681  {3,
1682  {
1683  {6206, {0, 1, -1, 0}, 56936},
1684  {1584248, {-1, 1, 0, 0}, 8759},
1685  {6206, {-1, 1, 0, 0}, 7117},
1686  {775, {-1, 2, 1, 0}, 32768},
1687  }},
1688  {4,
1689  {
1690  {6206, {0, -1, 1, 0}, 56936},
1691  {1584248, {1, -1, 0, 0}, 8759},
1692  {6206, {1, -1, 0, 0}, 7117},
1693  {-773, {-1, 2, 1, 0}, 32768},
1694  }},
1695  {5,
1696  {
1697  {6206, {0, -1, 1, 0}, 56936},
1698  {239, {-1, 0, 1, 0}, 4380},
1699  {37, {-1, 0, 1, 0}, 3559},
1700  {-772, {1, 2, 1, 0}, 16384},
1701  }},
1702  {6,
1703  {
1704  {-6170, {-1, -1, 2, 0}, 56936},
1705  {-1584008, {0, -1, 1, 0}, 8759},
1706  {-6170, {0, -1, 1, 0}, 7117},
1707  {775, {1, 2, -1, 0}, 32768},
1708  }},
1709  }});
1710  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, 1}, {1, 1, 1, 1}},
1711  {
1712  {2,
1713  {
1714  {-49246, {-3, 14, -5, -6}, 4067},
1715  {6338188, {5, 0, -1, -4}, 626},
1716  {25010, {5, 0, -1, -4}, 508},
1717  {-3087, {4, 7, 2, 1}, 4681},
1718  }},
1719  {6,
1720  {
1721  {37, {-1, 1, 1, -1}, 28468},
1722  {6337709, {3, -1, 1, -3}, 876},
1723  {24936, {3, -1, 1, -3}, 712},
1724  {-772, {1, 1, 1, 1}, 16384},
1725  }},
1726  {14,
1727  {
1728  {37239, {-6, -1, 2, 5}, 9489},
1729  {3168495, {0, -1, 0, 1}, 4380},
1730  {12413, {0, -1, 0, 1}, 3559},
1731  {-2318, {3, 4, 1, -2}, 10923},
1732  }},
1733  {0,
1734  {
1735  {0, {0, 0, 0, 0}, 0},
1736  {0, {0, 0, 0, 0}, 0},
1737  {0, {0, 0, 0, 0}, 0},
1738  {0, {0, 0, 0, 0}, 0},
1739  }},
1740  {0,
1741  {
1742  {0, {0, 0, 0, 0}, 0},
1743  {0, {0, 0, 0, 0}, 0},
1744  {0, {0, 0, 0, 0}, 0},
1745  {0, {0, 0, 0, 0}, 0},
1746  }},
1747  {0,
1748  {
1749  {0, {0, 0, 0, 0}, 0},
1750  {0, {0, 0, 0, 0}, 0},
1751  {0, {0, 0, 0, 0}, 0},
1752  {0, {0, 0, 0, 0}, 0},
1753  }},
1754  }});
1755  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -3}, {1, 0, 1, 1}},
1756  {
1757  {1,
1758  {
1759  {-18546, {1, 0, 0, -1}, 56936},
1760  {-1584008, {0, 0, 1, -1}, 8759},
1761  {-6170, {0, 0, 1, -1}, 7117},
1762  {1, {1, 0, 3, -2}, 32768},
1763  }},
1764  {4,
1765  {
1766  {-55637, {-2, 0, 3, -1}, 18979},
1767  {-4752025, {1, 0, 0, -1}, 2920},
1768  {-18509, {1, 0, 0, -1}, 2372},
1769  {3, {1, 0, 3, 2}, 10923},
1770  }},
1771  {5,
1772  {
1773  {-18546, {1, 0, 0, -1}, 56936},
1774  {-3168017, {-1, 0, 1, 0}, 4380},
1775  {-12339, {-1, 0, 1, 0}, 3559},
1776  {2, {-1, 0, 3, 2}, 16384},
1777  }},
1778  {8,
1779  {
1780  {-18546, {-1, 0, 0, 1}, 56936},
1781  {-3168017, {1, 0, -1, 0}, 4380},
1782  {-12339, {1, 0, -1, 0}, 3559},
1783  {2, {-1, 0, 3, 2}, 16384},
1784  }},
1785  {9,
1786  {
1787  {-55637, {2, 0, -3, 1}, 18979},
1788  {-4752025, {-1, 0, 0, 1}, 2920},
1789  {-18509, {-1, 0, 0, 1}, 2372},
1790  {3, {1, 0, 3, 2}, 10923},
1791  }},
1792  {12,
1793  {
1794  {-18546, {-1, 0, 0, 1}, 56936},
1795  {-1584008, {0, 0, -1, 1}, 8759},
1796  {-6170, {0, 0, -1, 1}, 7117},
1797  {1, {1, 0, 3, -2}, 32768},
1798  }},
1799  }});
1800  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, 1}, {1, 1, 1, 1}},
1801  {
1802  {4,
1803  {
1804  {49762, {-6, -5, 14, -3}, 4067},
1805  {6338188, {4, 1, 0, -5}, 626},
1806  {25010, {4, 1, 0, -5}, 508},
1807  {-2314, {1, 2, 7, 4}, 4681},
1808  }},
1809  {12,
1810  {
1811  {12413, {-1, -1, 1, 1}, 28468},
1812  {3168495, {1, -1, -1, 1}, 4380},
1813  {12413, {1, -1, -1, 1}, 3559},
1814  {-1545, {-1, 3, 3, -1}, 16384},
1815  }},
1816  {5,
1817  {
1818  {12413, {1, -1, 1, -1}, 28468},
1819  {479, {-1, 1, 1, -1}, 2190},
1820  {74, {-1, 1, 1, -1}, 1779},
1821  {-1543, {1, 3, 3, 1}, 8192},
1822  }},
1823  {13,
1824  {
1825  {124018, {3, -14, 5, 6}, 4067},
1826  {6338188, {-5, 0, 1, 4}, 626},
1827  {25010, {-5, 0, 1, 4}, 508},
1828  {-2314, {4, 7, 2, 1}, 4681},
1829  }},
1830  {0,
1831  {
1832  {0, {0, 0, 0, 0}, 0},
1833  {0, {0, 0, 0, 0}, 0},
1834  {0, {0, 0, 0, 0}, 0},
1835  {0, {0, 0, 0, 0}, 0},
1836  }},
1837  {0,
1838  {
1839  {0, {0, 0, 0, 0}, 0},
1840  {0, {0, 0, 0, 0}, 0},
1841  {0, {0, 0, 0, 0}, 0},
1842  {0, {0, 0, 0, 0}, 0},
1843  }},
1844  }});
1845  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, 1}, {1, 0, 1, 1}},
1846  {
1847  {1,
1848  {
1849  {6206, {1, 0, 0, -1}, 56936},
1850  {1584248, {0, 0, 1, -1}, 8759},
1851  {6206, {0, 0, 1, -1}, 7117},
1852  {775, {1, 0, 3, -2}, 32768},
1853  }},
1854  {4,
1855  {
1856  {6243, {-2, 0, 3, -1}, 18979},
1857  {1584487, {1, 0, 0, -1}, 2920},
1858  {6243, {1, 0, 0, -1}, 2372},
1859  {-771, {1, 0, 3, 2}, 10923},
1860  }},
1861  {5,
1862  {
1863  {6206, {1, 0, 0, -1}, 56936},
1864  {239, {-1, 0, 1, 0}, 4380},
1865  {37, {-1, 0, 1, 0}, 3559},
1866  {-772, {-1, 0, 3, 2}, 16384},
1867  }},
1868  {8,
1869  {
1870  {6206, {-1, 0, 0, 1}, 56936},
1871  {239, {1, 0, -1, 0}, 4380},
1872  {37, {1, 0, -1, 0}, 3559},
1873  {776, {-1, 0, 3, 2}, 16384},
1874  }},
1875  {9,
1876  {
1877  {6243, {2, 0, -3, 1}, 18979},
1878  {1584487, {-1, 0, 0, 1}, 2920},
1879  {6243, {-1, 0, 0, 1}, 2372},
1880  {777, {1, 0, 3, 2}, 10923},
1881  }},
1882  {12,
1883  {
1884  {6206, {-1, 0, 0, 1}, 56936},
1885  {1584248, {0, 0, -1, 1}, 8759},
1886  {6206, {0, 0, -1, 1}, 7117},
1887  {-773, {1, 0, 3, -2}, 32768},
1888  }},
1889  }});
1890  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, -1}, {1, 0, 1, 1}},
1891  {
1892  {1,
1893  {
1894  {-6170, {1, 0, 0, -1}, 56936},
1895  {-1584008, {0, 0, 1, -1}, 8759},
1896  {-6170, {0, 0, 1, -1}, 7117},
1897  {-773, {1, 0, 3, -2}, 32768},
1898  }},
1899  {4,
1900  {
1901  {-6133, {-2, 0, 3, -1}, 18979},
1902  {-1583769, {1, 0, 0, -1}, 2920},
1903  {-6133, {1, 0, 0, -1}, 2372},
1904  {777, {1, 0, 3, 2}, 10923},
1905  }},
1906  {5,
1907  {
1908  {-6170, {1, 0, 0, -1}, 56936},
1909  {239, {-1, 0, 1, 0}, 4380},
1910  {37, {-1, 0, 1, 0}, 3559},
1911  {776, {-1, 0, 3, 2}, 16384},
1912  }},
1913  {8,
1914  {
1915  {-6170, {-1, 0, 0, 1}, 56936},
1916  {239, {1, 0, -1, 0}, 4380},
1917  {37, {1, 0, -1, 0}, 3559},
1918  {-772, {-1, 0, 3, 2}, 16384},
1919  }},
1920  {9,
1921  {
1922  {-6133, {2, 0, -3, 1}, 18979},
1923  {-1583769, {-1, 0, 0, 1}, 2920},
1924  {-6133, {-1, 0, 0, 1}, 2372},
1925  {-771, {1, 0, 3, 2}, 10923},
1926  }},
1927  {12,
1928  {
1929  {-6170, {-1, 0, 0, 1}, 56936},
1930  {-1584008, {0, 0, -1, 1}, 8759},
1931  {-6170, {0, 0, -1, 1}, 7117},
1932  {775, {1, 0, 3, -2}, 32768},
1933  }},
1934  }});
1935  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 1}, {1, 1, 1, 1}},
1936  {
1937  {8,
1938  {
1939  {37239, {-5, -2, 1, 6}, 9489},
1940  {3168495, {1, 0, -1, 0}, 4380},
1941  {12413, {1, 0, -1, 0}, 3559},
1942  {-2318, {-2, 1, 4, 3}, 10923},
1943  }},
1944  {9,
1945  {
1946  {24789, {1, -1, -1, 1}, 28468},
1947  {6337709, {-3, 1, -1, 3}, 876},
1948  {24936, {-3, 1, -1, 3}, 712},
1949  {-772, {1, 1, 1, 1}, 16384},
1950  }},
1951  {11,
1952  {
1953  {223026, {6, 5, -14, 3}, 4067},
1954  {6338188, {-4, -1, 0, 5}, 626},
1955  {25010, {-4, -1, 0, 5}, 508},
1956  {-3087, {1, 2, 7, 4}, 4681},
1957  }},
1958  {0,
1959  {
1960  {0, {0, 0, 0, 0}, 0},
1961  {0, {0, 0, 0, 0}, 0},
1962  {0, {0, 0, 0, 0}, 0},
1963  {0, {0, 0, 0, 0}, 0},
1964  }},
1965  {0,
1966  {
1967  {0, {0, 0, 0, 0}, 0},
1968  {0, {0, 0, 0, 0}, 0},
1969  {0, {0, 0, 0, 0}, 0},
1970  {0, {0, 0, 0, 0}, 0},
1971  }},
1972  {0,
1973  {
1974  {0, {0, 0, 0, 0}, 0},
1975  {0, {0, 0, 0, 0}, 0},
1976  {0, {0, 0, 0, 0}, 0},
1977  {0, {0, 0, 0, 0}, 0},
1978  }},
1979  }});
1980  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -1}, {1, 0, 1, 1}},
1981  {
1982  {1,
1983  {
1984  {-6170, {1, 0, 0, -1}, 56936},
1985  {1584248, {0, 0, 1, -1}, 8759},
1986  {6206, {0, 0, 1, -1}, 7117},
1987  {1548, {1, 0, 3, -2}, 32768},
1988  }},
1989  {4,
1990  {
1991  {-43261, {-2, 0, 3, -1}, 18979},
1992  {-1583769, {1, 0, 0, -1}, 2920},
1993  {-6133, {1, 0, 0, -1}, 2372},
1994  {-1544, {1, 0, 3, 2}, 10923},
1995  }},
1996  {5,
1997  {
1998  {-6170, {1, 0, 0, -1}, 56936},
1999  {-3168017, {-1, 0, 1, 0}, 4380},
2000  {-12339, {-1, 0, 1, 0}, 3559},
2001  {-1545, {-1, 0, 3, 2}, 16384},
2002  }},
2003  {8,
2004  {
2005  {-6170, {-1, 0, 0, 1}, 56936},
2006  {-3168017, {1, 0, -1, 0}, 4380},
2007  {-12339, {1, 0, -1, 0}, 3559},
2008  {1549, {-1, 0, 3, 2}, 16384},
2009  }},
2010  {9,
2011  {
2012  {-43261, {2, 0, -3, 1}, 18979},
2013  {-1583769, {-1, 0, 0, 1}, 2920},
2014  {-6133, {-1, 0, 0, 1}, 2372},
2015  {1550, {1, 0, 3, 2}, 10923},
2016  }},
2017  {12,
2018  {
2019  {-6170, {-1, 0, 0, 1}, 56936},
2020  {1584248, {0, 0, -1, 1}, 8759},
2021  {6206, {0, 0, -1, 1}, 7117},
2022  {-1546, {1, 0, 3, -2}, 32768},
2023  }},
2024  }});
2025  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, -1}, {1, 1, 0, 1}},
2026  {
2027  {1,
2028  {
2029  {-6170, {1, 0, 0, -1}, 56936},
2030  {-3168017, {0, 1, 0, -1}, 4380},
2031  {-12339, {0, 1, 0, -1}, 3559},
2032  {-1545, {2, 3, 0, -1}, 16384},
2033  }},
2034  {2,
2035  {
2036  {6243, {-1, 3, 0, -2}, 18979},
2037  {-1583769, {1, 0, 0, -1}, 2920},
2038  {-6133, {1, 0, 0, -1}, 2372},
2039  {1550, {2, 3, 0, 1}, 10923},
2040  }},
2041  {3,
2042  {
2043  {-6170, {1, 0, 0, -1}, 56936},
2044  {1584248, {-1, 1, 0, 0}, 8759},
2045  {6206, {-1, 1, 0, 0}, 7117},
2046  {1548, {-2, 3, 0, 1}, 32768},
2047  }},
2048  {8,
2049  {
2050  {-6170, {-1, 0, 0, 1}, 56936},
2051  {1584248, {1, -1, 0, 0}, 8759},
2052  {6206, {1, -1, 0, 0}, 7117},
2053  {-1546, {-2, 3, 0, 1}, 32768},
2054  }},
2055  {9,
2056  {
2057  {6243, {1, -3, 0, 2}, 18979},
2058  {-1583769, {-1, 0, 0, 1}, 2920},
2059  {-6133, {-1, 0, 0, 1}, 2372},
2060  {-1544, {2, 3, 0, 1}, 10923},
2061  }},
2062  {10,
2063  {
2064  {-6170, {-1, 0, 0, 1}, 56936},
2065  {-3168017, {0, -1, 0, 1}, 4380},
2066  {-12339, {0, -1, 0, 1}, 3559},
2067  {1549, {2, 3, 0, -1}, 16384},
2068  }},
2069  }});
2070  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, -2, -3}, {1, 1, 1, 1}},
2071  {
2072  {8,
2073  {
2074  {-111274, {-5, -2, 1, 6}, 9489},
2075  {-3168017, {1, 0, -1, 0}, 4380},
2076  {-12339, {1, 0, -1, 0}, 3559},
2077  {3, {-2, 1, 4, 3}, 10923},
2078  }},
2079  {12,
2080  {
2081  {-37091, {-1, -1, 1, 1}, 28468},
2082  {-3168017, {1, -1, -1, 1}, 4380},
2083  {-12339, {1, -1, -1, 1}, 3559},
2084  {2, {-1, 3, 3, -1}, 16384},
2085  }},
2086  {14,
2087  {
2088  {-111274, {-6, -1, 2, 5}, 9489},
2089  {-3168017, {0, -1, 0, 1}, 4380},
2090  {-12339, {0, -1, 0, 1}, 3559},
2091  {3, {3, 4, 1, -2}, 10923},
2092  }},
2093  {1,
2094  {
2095  {-111274, {6, 1, -2, -5}, 9489},
2096  {-3168017, {0, 1, 0, -1}, 4380},
2097  {-12339, {0, 1, 0, -1}, 3559},
2098  {3, {3, 4, 1, -2}, 10923},
2099  }},
2100  {3,
2101  {
2102  {-37091, {1, 1, -1, -1}, 28468},
2103  {-3168017, {-1, 1, 1, -1}, 4380},
2104  {-12339, {-1, 1, 1, -1}, 3559},
2105  {2, {-1, 3, 3, -1}, 16384},
2106  }},
2107  {7,
2108  {
2109  {-111274, {5, 2, -1, -6}, 9489},
2110  {-3168017, {-1, 0, 1, 0}, 4380},
2111  {-12339, {-1, 0, 1, 0}, 3559},
2112  {3, {-2, 1, 4, 3}, 10923},
2113  }},
2114  }});
2115  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 0, 1}, {1, 1, 0, 1}},
2116  {
2117  {1,
2118  {
2119  {6206, {1, 0, 0, -1}, 56936},
2120  {239, {0, 1, 0, -1}, 4380},
2121  {37, {0, 1, 0, -1}, 3559},
2122  {-772, {2, 3, 0, -1}, 16384},
2123  }},
2124  {2,
2125  {
2126  {30995, {-1, 3, 0, -2}, 18979},
2127  {1584487, {1, 0, 0, -1}, 2920},
2128  {6243, {1, 0, 0, -1}, 2372},
2129  {777, {2, 3, 0, 1}, 10923},
2130  }},
2131  {3,
2132  {
2133  {6206, {1, 0, 0, -1}, 56936},
2134  {1584248, {-1, 1, 0, 0}, 8759},
2135  {6206, {-1, 1, 0, 0}, 7117},
2136  {775, {-2, 3, 0, 1}, 32768},
2137  }},
2138  {8,
2139  {
2140  {6206, {-1, 0, 0, 1}, 56936},
2141  {1584248, {1, -1, 0, 0}, 8759},
2142  {6206, {1, -1, 0, 0}, 7117},
2143  {-773, {-2, 3, 0, 1}, 32768},
2144  }},
2145  {9,
2146  {
2147  {30995, {1, -3, 0, 2}, 18979},
2148  {1584487, {-1, 0, 0, 1}, 2920},
2149  {6243, {-1, 0, 0, 1}, 2372},
2150  {-771, {2, 3, 0, 1}, 10923},
2151  }},
2152  {10,
2153  {
2154  {6206, {-1, 0, 0, 1}, 56936},
2155  {239, {0, -1, 0, 1}, 4380},
2156  {37, {0, -1, 0, 1}, 3559},
2157  {776, {2, 3, 0, -1}, 16384},
2158  }},
2159  }});
2160  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, 1, 2, 3}, {1, 0, 1, 1}},
2161  {
2162  {1,
2163  {
2164  {18582, {1, 0, 0, -1}, 56936},
2165  {1584248, {0, 0, 1, -1}, 8759},
2166  {6206, {0, 0, 1, -1}, 7117},
2167  {1, {1, 0, 3, -2}, 32768},
2168  }},
2169  {4,
2170  {
2171  {55747, {-2, 0, 3, -1}, 18979},
2172  {4752743, {1, 0, 0, -1}, 2920},
2173  {18619, {1, 0, 0, -1}, 2372},
2174  {3, {1, 0, 3, 2}, 10923},
2175  }},
2176  {5,
2177  {
2178  {18582, {1, 0, 0, -1}, 56936},
2179  {3168495, {-1, 0, 1, 0}, 4380},
2180  {12413, {-1, 0, 1, 0}, 3559},
2181  {2, {-1, 0, 3, 2}, 16384},
2182  }},
2183  {8,
2184  {
2185  {18582, {-1, 0, 0, 1}, 56936},
2186  {3168495, {1, 0, -1, 0}, 4380},
2187  {12413, {1, 0, -1, 0}, 3559},
2188  {2, {-1, 0, 3, 2}, 16384},
2189  }},
2190  {9,
2191  {
2192  {55747, {2, 0, -3, 1}, 18979},
2193  {4752743, {-1, 0, 0, 1}, 2920},
2194  {18619, {-1, 0, 0, 1}, 2372},
2195  {3, {1, 0, 3, 2}, 10923},
2196  }},
2197  {12,
2198  {
2199  {18582, {-1, 0, 0, 1}, 56936},
2200  {1584248, {0, 0, -1, 1}, 8759},
2201  {6206, {0, 0, -1, 1}, 7117},
2202  {1, {1, 0, 3, -2}, 32768},
2203  }},
2204  }});
2205  LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.push_back({{{0, -1, 0, 1}, {1, 1, 0, 1}},
2206  {
2207  {1,
2208  {
2209  {6206, {1, 0, 0, -1}, 56936},
2210  {3168495, {0, 1, 0, -1}, 4380},
2211  {12413, {0, 1, 0, -1}, 3559},
2212  {1549, {2, 3, 0, -1}, 16384},
2213  }},
2214  {2,
2215  {
2216  {-6133, {-1, 3, 0, -2}, 18979},
2217  {1584487, {1, 0, 0, -1}, 2920},
2218  {6243, {1, 0, 0, -1}, 2372},
2219  {-1544, {2, 3, 0, 1}, 10923},
2220  }},
2221  {3,
2222  {
2223  {6206, {1, 0, 0, -1}, 56936},
2224  {-1584008, {-1, 1, 0, 0}, 8759},
2225  {-6170, {-1, 1, 0, 0}, 7117},
2226  {-1546, {-2, 3, 0, 1}, 32768},
2227  }},
2228  {8,
2229  {
2230  {6206, {-1, 0, 0, 1}, 56936},
2231  {-1584008, {1, -1, 0, 0}, 8759},
2232  {-6170, {1, -1, 0, 0}, 7117},
2233  {1548, {-2, 3, 0, 1}, 32768},
2234  }},
2235  {9,
2236  {
2237  {-6133, {1, -3, 0, 2}, 18979},
2238  {1584487, {-1, 0, 0, 1}, 2920},
2239  {6243, {-1, 0, 0, 1}, 2372},
2240  {1550, {2, 3, 0, 1}, 10923},
2241  }},
2242  {10,
2243  {
2244  {6206, {-1, 0, 0, 1}, 56936},
2245  {3168495, {0, -1, 0, 1}, 4380},
2246  {12413, {0, -1, 0, 1}, 3559},
2247  {-1545, {2, 3, 0, -1}, 16384},
2248  }},
2249  }});
2250 }
std::vector< CELL_VALID_LAYOUT_CONSTANTS > LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
void MuonPathAnalyticAnalyzer::finish ( )
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 98 of file MuonPathAnalyticAnalyzer.cc.

References debug_, and LogDebug.

Referenced by progressbar.ProgressBar::__next__().

98  {
99  if (debug_)
100  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyzer: finish";
101 };
#define LogDebug(id)
std::vector< int > MuonPathAnalyticAnalyzer::getLateralityCombination ( int  latcomb)
private

Definition at line 435 of file MuonPathAnalyticAnalyzer.cc.

Referenced by segment_fitter().

435  {
436  // returns the latcomb as a binary number represented in a vector of integers
437  // careful, the output is in reverse order
438  std::vector<int> binaryNum = {};
439  while (latcomb > 1) {
440  binaryNum.push_back(latcomb % 2);
441  latcomb = latcomb / 2;
442  }
443  binaryNum.push_back(latcomb);
444  while (binaryNum.size() < 4)
445  binaryNum.push_back(0);
446  return binaryNum;
447 }
bool MuonPathAnalyticAnalyzer::hasPosRF ( int  wh,
int  sec 
)
inline

Definition at line 65 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

65 { return wh > 0 || (wh == 0 && sec % 4 > 1); };
void MuonPathAnalyticAnalyzer::initialise ( const edm::EventSetup iEventSetup)
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 76 of file MuonPathAnalyticAnalyzer.cc.

References debug_, dtGeo_, relativeConstraints::geom, geometry_tag_, edm::EventSetup::get(), and LogDebug.

76  {
77  if (debug_)
78  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyticAnalyzer::initialiase";
79 
81  iEventSetup.get<MuonGeometryRecord>().get(geometry_tag_, geom);
82  dtGeo_ = &(*geom);
83 }
T get() const
Definition: EventSetup.h:88
#define LogDebug(id)
void MuonPathAnalyticAnalyzer::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
MuonPathPtrs inMpath,
std::vector< cmsdt::metaPrimitive > &  metaPrimitives 
)
overridevirtual

Implements MuonPathAnalyzer.

Definition at line 85 of file MuonPathAnalyticAnalyzer.cc.

References analyze(), debug_, and LogDebug.

88  {
89  if (debug_)
90  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyticAnalyzer: run";
91 
92  // fit per SL (need to allow for multiple outputs for a single mpath)
93  for (auto &muonpath : muonpaths) {
94  analyze(muonpath, metaPrimitives);
95  }
96 }
void analyze(MuonPathPtr &inMPath, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
#define LogDebug(id)
void MuonPathAnalyticAnalyzer::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
MuonPathPtrs inMpath,
MuonPathPtrs outMPath 
)
inlineoverridevirtual

Implements MuonPathAnalyzer.

Definition at line 56 of file MuonPathAnalyticAnalyzer.h.

59  {};
void MuonPathAnalyticAnalyzer::segment_fitter ( DTSuperLayerId  MuonPathSLId,
int  wires[4],
int  t0s[4],
int  valid[4],
int  reduced_times[4],
int  cell_horiz_layout[4],
LATCOMB_CONSTANTS  latcomb_consts,
int  xwire_mm[4],
int  coarse_pos,
int  coarse_offset,
std::vector< cmsdt::metaPrimitive > &  metaPrimitives 
)
private

Definition at line 246 of file MuonPathAnalyticAnalyzer.cc.

References funct::abs(), DTGeometry::chamber(), chi2Th_, compute_parameter(), LATCOMB_CONSTANTS::constants, cmsdt::DIV_SHR_BITS_POS, cmsdt::DIV_SHR_BITS_SLOPE, cmsdt::DIV_SHR_BITS_SLOPE_XHH, cmsdt::DIV_SHR_BITS_T0, cmsdt::DTDD_MULT, cmsdt::DTDD_PREADD, cmsdt::DTDD_SHIFTR_BITS, dtGeo_, getLateralityCombination(), globalcoordsobtainer_, hasPosRF(), cmsdt::HIGHQ, cmsdt::INCREASED_RES_POS, cmsdt::INCREASED_RES_POS_POW, cmsdt::INCREASED_RES_SLOPE, cmsdt::INCREASED_RES_SLOPE_POW, cmsdt::INCREASED_RES_SLOPE_XHH, cmsdt::INCREASED_RES_T0, LATCOMB_CONSTANTS::latcomb, DTGeometry::layer(), cmsdt::LOWQ, cmsdt::MAXDRIFT, NUM_LAYERS, or, phi, PV3DBase< T, PVType, FrameType >::phi(), cmsdt::PHI_CONV, funct::pow(), quality, DetId::rawId(), DTChamberId::sector(), shiftinfo_, shiftthetainfo_, slope, DTLayer::specificTopology(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTGeometry::superLayer(), tanPhiTh_, tanPhiThw0_, tanPhiThw1max_, tanPhiThw1min_, tanPhiThw2max_, tanPhiThw2min_, cmsdt::TDCTIME_REDUCED_SIZE, GeomDet::toGlobal(), GeomDet::toLocal(), DTChamberId::wheel(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), z, cmsdt::Z_POS_SL, and cmsdt::Z_SHIFT_MB4.

Referenced by analyze().

256  {
257  auto latcomb = latcomb_consts.latcomb;
258  auto constants = latcomb_consts.constants;
259  bool is_four_hit = true;
260 
261  if (latcomb == 0)
262  return;
263 
264  int lat_array[4];
265  for (int lay = 0; lay < NUM_LAYERS; lay++) {
266  if (((latcomb >> lay) & 1) != 0) {
267  lat_array[lay] = 1;
268  } else
269  lat_array[lay] = -1;
270  }
271 
272  int time = compute_parameter(constants.t0, reduced_times, DIV_SHR_BITS_T0, INCREASED_RES_T0);
273  int pos = compute_parameter(constants.pos, reduced_times, DIV_SHR_BITS_POS, INCREASED_RES_POS);
275  int slope_xhh =
277 
278  int bx_time = time + (coarse_offset << (TDCTIME_REDUCED_SIZE - 1));
279 
280  pos += coarse_pos;
281 
282  int chi2_mm2_p = 0;
283  for (int lay = 0; lay < NUM_LAYERS; lay++) {
284  int drift_time = reduced_times[lay] - time;
285  if (valid[lay] == 1 && (drift_time < 0 || drift_time > MAXDRIFT))
286  return;
287 
288  int drift_dist = ((((drift_time * INCREASED_RES_POS_POW) + DTDD_PREADD) * DTDD_MULT) >> DTDD_SHIFTR_BITS);
289  int xdist = xwire_mm[lay] * pow(2, 4) - (pos - coarse_pos) + lat_array[lay] * drift_dist;
290  xdist -= (3 - 2 * (3 - lay)) * slope_xhh;
291  int res = xdist;
292  if (valid[lay] == 0) {
293  res = 0;
294  is_four_hit = false;
295  }
296  chi2_mm2_p += res * res * 4;
297  }
298 
299  int quality = HIGHQ;
300  if (!is_four_hit)
301  quality = LOWQ;
302 
303  // Obtain coordinate values in floating point
304  double pos_f, slope_f, chi2_f;
305  DTWireId wireId(MuonPathSLId, 2, 1);
306 
307  pos_f = double(pos) +
308  int(10 * shiftinfo_[wireId.rawId()] * INCREASED_RES_POS_POW); // position in mm * precision in JM RF
309  pos_f /= (10. * INCREASED_RES_POS_POW); // position in cm w.r.t center of the chamber
310  slope_f = -(double(slope) / INCREASED_RES_SLOPE_POW);
311  chi2_f = double(chi2_mm2_p) / (16. * 64. * 100.);
312 
313  // Impose the thresholds
314  if (MuonPathSLId.superLayer() != 2)
315  if (std::abs(slope_f) > tanPhiTh_)
316  return;
317  if (chi2_f > (chi2Th_))
318  return;
319 
320  // Compute phi and phib
321  // Implemented using cmssw geometry and fw-like approach
322  DTChamberId ChId(MuonPathSLId.wheel(), MuonPathSLId.station(), MuonPathSLId.sector());
323  // fw-like variables
324  double phi = -999.;
325  double phiB = -999.;
326  // cmssw-like variables
327  double phi_cmssw = -999.;
328  double phiB_cmssw = -999.;
329  if (MuonPathSLId.superLayer() != 2) {
330  double z = 0;
331  double z1 = Z_POS_SL;
332  double z3 = -1. * z1;
333  if (ChId.station() == 3 or ChId.station() == 4) {
334  z1 = z1 + Z_SHIFT_MB4;
335  z3 = z3 + Z_SHIFT_MB4;
336  }
337  if (MuonPathSLId.superLayer() == 1)
338  z = z1;
339  else if (MuonPathSLId.superLayer() == 3)
340  z = z3;
341 
342  // cmssw-like calculation
343  GlobalPoint jm_x_cmssw_global = dtGeo_->chamber(ChId)->toGlobal(LocalPoint(pos_f, 0., z));
344  int thisec = MuonPathSLId.sector();
345  if (thisec == 13)
346  thisec = 4;
347  if (thisec == 14)
348  thisec = 10;
349  phi_cmssw = jm_x_cmssw_global.phi() - PHI_CONV * (thisec - 1);
350  double psi = atan(slope_f);
351  phiB_cmssw = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? psi - phi_cmssw : -psi - phi_cmssw;
352 
353  auto global_coords =
354  globalcoordsobtainer_->get_global_coordinates(ChId.rawId(), MuonPathSLId.superLayer(), pos, slope);
355  phi = global_coords[0];
356  phiB = global_coords[1];
357  } else {
358  // Impose the thresholds
359  if (std::abs(MuonPathSLId.wheel()) == 2) {
360  if (slope_f > tanPhiThw2max_ or slope_f < tanPhiThw2min_)
361  return;
362  }
363  if (std::abs(MuonPathSLId.wheel()) == 1) {
364  if (slope_f > tanPhiThw1max_ or slope_f < tanPhiThw1min_)
365  return;
366  }
367  if (MuonPathSLId.wheel() == 0) {
368  if (std::abs(slope_f) > tanPhiThw0_)
369  return;
370  }
371 
372  // fw-like calculation
373  DTLayerId SL2_layer2Id(MuonPathSLId, 2);
374  double z_shift = shiftthetainfo_[SL2_layer2Id.rawId()];
375  double jm_y = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? z_shift - pos_f : z_shift + pos_f;
376  phi = jm_y;
377  phiB = slope_f;
378 
379  // cmssw-like calculation
380  LocalPoint wire1_in_layer(dtGeo_->layer(SL2_layer2Id)->specificTopology().wirePosition(1), 0, -0.65);
381  GlobalPoint wire1_in_global = dtGeo_->layer(SL2_layer2Id)->toGlobal(wire1_in_layer);
382  LocalPoint wire1_in_sl = dtGeo_->superLayer(MuonPathSLId)->toLocal(wire1_in_global);
383  double x_shift = wire1_in_sl.x();
384  jm_y = (dtGeo_->superLayer(MuonPathSLId)
385  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
386  .z();
387  phi_cmssw = jm_y;
388  phiB_cmssw = slope_f;
389  }
390 
391  // get the lateralities (in reverse order) in order to fill the metaprimitive
392  std::vector<int> lateralities = getLateralityCombination(latcomb);
393  for (int lay = 0; lay < NUM_LAYERS; lay++) {
394  if (valid[lay] == 0)
395  lateralities[lay] = -1;
396  }
397 
398  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
399  double(bx_time),
400  pos_f,
401  slope_f,
402  phi,
403  phiB,
404  phi_cmssw,
405  phiB_cmssw,
406  chi2_f,
407  quality,
408  wires[0],
409  t0s[0],
410  lateralities[0],
411  wires[1],
412  t0s[1],
413  lateralities[1],
414  wires[2],
415  t0s[2],
416  lateralities[2],
417  wires[3],
418  t0s[3],
419  lateralities[3],
420  -1,
421  -1,
422  -1,
423  -1,
424  -1,
425  -1,
426  -1,
427  -1,
428  -1,
429  -1,
430  -1,
431  -1,
432  -1}));
433 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:59
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
constexpr int INCREASED_RES_SLOPE_XHH
Definition: constants.h:274
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
uint32_t const *__restrict__ Quality * quality
static const double slope[3]
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
constexpr int DIV_SHR_BITS_POS
Definition: constants.h:267
std::map< std::string, int, std::less< std::string > > psi
std::map< int, float > shiftthetainfo_
bool hasPosRF(int wh, int sec)
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
constexpr int DIV_SHR_BITS_T0
Definition: constants.h:266
constexpr int INCREASED_RES_SLOPE_POW
Definition: constants.h:277
constexpr int DIV_SHR_BITS_SLOPE
Definition: constants.h:268
constexpr float Z_SHIFT_MB4
Definition: constants.h:258
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int superLayer() const
Return the superlayer number.
std::vector< int > getLateralityCombination(int latcomb)
constexpr double PHI_CONV
Definition: constants.h:255
constexpr float Z_POS_SL
Definition: constants.h:259
constexpr int TDCTIME_REDUCED_SIZE
Definition: constants.h:227
constexpr int INCREASED_RES_T0
Definition: constants.h:271
constexpr float MAXDRIFT
Definition: constants.h:182
constexpr int DTDD_PREADD
Definition: constants.h:280
std::map< int, float > shiftinfo_
int sector() const
Definition: DTChamberId.h:49
constexpr int INCREASED_RES_SLOPE
Definition: constants.h:273
constexpr int DTDD_MULT
Definition: constants.h:281
constexpr int DTDD_SHIFTR_BITS
Definition: constants.h:282
constexpr int INCREASED_RES_POS_POW
Definition: constants.h:276
tuple wires
Definition: DigiDM_cff.py:33
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
int station() const
Return the station number.
Definition: DTChamberId.h:42
std::shared_ptr< GlobalCoordsObtainer > globalcoordsobtainer_
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
T x() const
Definition: PV3DBase.h:59
int compute_parameter(MAGNITUDE constants, int t0s[4], int DIV_SHR_BITS, int INCREASED_RES)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
constexpr int DIV_SHR_BITS_SLOPE_XHH
Definition: constants.h:269
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92
constexpr int INCREASED_RES_POS
Definition: constants.h:272

Member Data Documentation

int MuonPathAnalyticAnalyzer::cellLayout_[cmsdt::NUM_LAYERS]
private

Definition at line 109 of file MuonPathAnalyticAnalyzer.h.

double MuonPathAnalyticAnalyzer::chi2Th_
private

Definition at line 102 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

int MuonPathAnalyticAnalyzer::chosen_sl_

Definition at line 79 of file MuonPathAnalyticAnalyzer.h.

Referenced by analyze(), and MuonPathAnalyticAnalyzer().

bool MuonPathAnalyticAnalyzer::debug_
private
DTGeometry const* MuonPathAnalyticAnalyzer::dtGeo_

Definition at line 65 of file MuonPathAnalyticAnalyzer.h.

Referenced by initialise(), and segment_fitter().

edm::ESGetToken<DTGeometry, MuonGeometryRecord> MuonPathAnalyticAnalyzer::dtGeomH

Definition at line 69 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer().

std::string MuonPathAnalyticAnalyzer::geometry_tag_
private

Definition at line 110 of file MuonPathAnalyticAnalyzer.h.

Referenced by initialise().

std::shared_ptr<GlobalCoordsObtainer> MuonPathAnalyticAnalyzer::globalcoordsobtainer_
private

Definition at line 114 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer(), and segment_fitter().

std::vector<CELL_VALID_LAYOUT_CONSTANTS> MuonPathAnalyticAnalyzer::LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
private
edm::FileInPath MuonPathAnalyticAnalyzer::shift_filename_

Definition at line 72 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer().

edm::FileInPath MuonPathAnalyticAnalyzer::shift_theta_filename_

Definition at line 76 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer().

std::map<int, float> MuonPathAnalyticAnalyzer::shiftinfo_

Definition at line 73 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer(), and segment_fitter().

std::map<int, float> MuonPathAnalyticAnalyzer::shiftthetainfo_

Definition at line 77 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer(), and segment_fitter().

double MuonPathAnalyticAnalyzer::tanPhiTh_
private

Definition at line 103 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

double MuonPathAnalyticAnalyzer::tanPhiThw0_
private

Definition at line 108 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

double MuonPathAnalyticAnalyzer::tanPhiThw1max_
private

Definition at line 106 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

double MuonPathAnalyticAnalyzer::tanPhiThw1min_
private

Definition at line 107 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

double MuonPathAnalyticAnalyzer::tanPhiThw2max_
private

Definition at line 104 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

double MuonPathAnalyticAnalyzer::tanPhiThw2min_
private

Definition at line 105 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().