CMS 3D CMS Logo

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, MuonPathPtrs &outMPath) override
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, MuonPathPtrs &inMpath, std::vector< cmsdt::metaPrimitive > &metaPrimitives) override
 
 ~MuonPathAnalyticAnalyzer () override
 
- Public Member Functions inherited from MuonPathAnalyzer
 MuonPathAnalyzer (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
virtual ~MuonPathAnalyzer ()
 

Public Attributes

int chosen_sl_
 
const DTGeometrydtGeo_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomH
 
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 cmssw_for_global_
 
bool debug_
 
std::string geometry_tag_
 
std::shared_ptr< GlobalCoordsObtainerglobalcoordsobtainer_
 
std::vector< CELL_VALID_LAYOUT_CONSTANTSLAYOUT_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::MuonPathAnalyticAnalyzer ( const edm::ParameterSet pset,
edm::ConsumesCollector iC,
std::shared_ptr< GlobalCoordsObtainer > &  globalcoordsobtainer 
)

Definition at line 11 of file MuonPathAnalyticAnalyzer.cc.

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  cmssw_for_global_(pset.getUntrackedParameter<bool>("cmssw_for_global")),
24  geometry_tag_(pset.getUntrackedParameter<std::string>("geometry_tag")) {
25  if (debug_)
26  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyzer: constructor";
27 
29 
30  //shift phi
31  int rawId;
32  shift_filename_ = pset.getParameter<edm::FileInPath>("shift_filename");
33  std::ifstream ifin3(shift_filename_.fullPath());
34  double shift;
35  if (ifin3.fail()) {
36  throw cms::Exception("Missing Input File")
37  << "MuonPathAnalyticAnalyzer::MuonPathAnalyticAnalyzer() - Cannot find " << shift_filename_.fullPath();
38  }
39  while (ifin3.good()) {
40  ifin3 >> rawId >> shift;
41  shiftinfo_[rawId] = shift;
42  }
43 
44  //shift theta
45 
46  shift_theta_filename_ = pset.getParameter<edm::FileInPath>("shift_theta_filename");
47  std::ifstream ifin4(shift_theta_filename_.fullPath());
48  if (ifin4.fail()) {
49  throw cms::Exception("Missing Input File")
50  << "MuonPathAnalyzerPerSL::MuonPathAnalyzerPerSL() - Cannot find " << shift_theta_filename_.fullPath();
51  }
52 
53  while (ifin4.good()) {
54  ifin4 >> rawId >> shift;
55  shiftthetainfo_[rawId] = shift;
56  }
57 
58  chosen_sl_ = pset.getUntrackedParameter<int>("trigger_with_sl");
59 
60  if (chosen_sl_ != 1 && chosen_sl_ != 3 && chosen_sl_ != 4) {
61  LogDebug("MuonPathAnalyticAnalyzer") << "chosen sl must be 1,3 or 4(both superlayers)";
62  assert(chosen_sl_ != 1 && chosen_sl_ != 3 && chosen_sl_ != 4); //4 means run using the two superlayers
63  }
64 
66  globalcoordsobtainer_ = globalcoordsobtainer;
67 }

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

◆ ~MuonPathAnalyticAnalyzer()

MuonPathAnalyticAnalyzer::~MuonPathAnalyticAnalyzer ( )
override

Definition at line 69 of file MuonPathAnalyticAnalyzer.cc.

69  {
70  if (debug_)
71  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyzer: destructor";
72 }

References debug_, and LogDebug.

Member Function Documentation

◆ analyze()

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

Definition at line 108 of file MuonPathAnalyticAnalyzer.cc.

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

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

◆ compute_parameter()

int MuonPathAnalyticAnalyzer::compute_parameter ( MAGNITUDE  constants,
int  t0s[4],
int  DIV_SHR_BITS,
int  INCREASED_RES 
)
private

Definition at line 237 of file MuonPathAnalyticAnalyzer.cc.

237  {
238  long int result = 0;
239  for (int lay = 0; lay < NUM_LAYERS; lay++) {
240  result += constants.coeff[lay] * t0s[lay];
241  }
242  result = ((result * int(std::pow(2, INCREASED_RES)) + constants.add) * constants.mult) >> DIV_SHR_BITS;
243 
244  return result;
245 }

References createfilelist::int, NUM_LAYERS, funct::pow(), and mps_fire::result.

Referenced by segment_fitter().

◆ fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER()

void MuonPathAnalyticAnalyzer::fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER ( )
private

Definition at line 452 of file MuonPathAnalyticAnalyzer.cc.

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

References LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.

Referenced by MuonPathAnalyticAnalyzer().

◆ finish()

void MuonPathAnalyticAnalyzer::finish ( )
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 99 of file MuonPathAnalyticAnalyzer.cc.

99  {
100  if (debug_)
101  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyzer: finish";
102 };

References debug_, and LogDebug.

Referenced by progressbar.ProgressBar::__next__().

◆ getLateralityCombination()

std::vector< int > MuonPathAnalyticAnalyzer::getLateralityCombination ( int  latcomb)
private

Definition at line 438 of file MuonPathAnalyticAnalyzer.cc.

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

Referenced by segment_fitter().

◆ hasPosRF()

bool MuonPathAnalyticAnalyzer::hasPosRF ( int  wh,
int  sec 
)
inline

Definition at line 65 of file MuonPathAnalyticAnalyzer.h.

65 { return wh > 0 || (wh == 0 && sec % 4 > 1); };

References fileinputsource_cfi::sec.

Referenced by segment_fitter().

◆ initialise()

void MuonPathAnalyticAnalyzer::initialise ( const edm::EventSetup iEventSetup)
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 77 of file MuonPathAnalyticAnalyzer.cc.

77  {
78  if (debug_)
79  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyticAnalyzer::initialiase";
80 
82  iEventSetup.get<MuonGeometryRecord>().get(geometry_tag_, geom);
83  dtGeo_ = &(*geom);
84 }

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

◆ run() [1/2]

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  {};

◆ run() [2/2]

void MuonPathAnalyticAnalyzer::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
MuonPathPtrs inMpath,
std::vector< cmsdt::metaPrimitive > &  metaPrimitives 
)
overridevirtual

Implements MuonPathAnalyzer.

Definition at line 86 of file MuonPathAnalyticAnalyzer.cc.

89  {
90  if (debug_)
91  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyticAnalyzer: run";
92 
93  // fit per SL (need to allow for multiple outputs for a single mpath)
94  for (auto &muonpath : muonpaths) {
95  analyze(muonpath, metaPrimitives);
96  }
97 }

References analyze(), debug_, and LogDebug.

◆ segment_fitter()

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 247 of file MuonPathAnalyticAnalyzer.cc.

257  {
258  auto latcomb = latcomb_consts.latcomb;
259  auto constants = latcomb_consts.constants;
260  bool is_four_hit = true;
261 
262  if (latcomb == 0)
263  return;
264 
265  int lat_array[4];
266  for (int lay = 0; lay < NUM_LAYERS; lay++) {
267  if (((latcomb >> lay) & 1) != 0) {
268  lat_array[lay] = 1;
269  } else
270  lat_array[lay] = -1;
271  }
272 
276  int slope_xhh =
278 
279  int bx_time = time + (coarse_offset << (TDCTIME_REDUCED_SIZE - 1));
280 
281  pos += coarse_pos;
282 
283  int chi2_mm2_p = 0;
284  for (int lay = 0; lay < NUM_LAYERS; lay++) {
285  int drift_time = reduced_times[lay] - time;
286  if (valid[lay] == 1 && (drift_time < 0 || drift_time > MAXDRIFT))
287  return;
288 
289  int drift_dist = ((((drift_time * INCREASED_RES_POS_POW) + DTDD_PREADD) * DTDD_MULT) >> DTDD_SHIFTR_BITS);
290  int xdist = xwire_mm[lay] * pow(2, 4) - (pos - coarse_pos) + lat_array[lay] * drift_dist;
291  xdist -= (3 - 2 * (3 - lay)) * slope_xhh;
292  int res = xdist;
293  if (valid[lay] == 0) {
294  res = 0;
295  is_four_hit = false;
296  }
297  chi2_mm2_p += res * res * 4;
298  }
299 
300  int quality = HIGHQ;
301  if (!is_four_hit)
302  quality = LOWQ;
303 
304  // Obtain coordinate values in floating point
305  double pos_f, slope_f, chi2_f;
306  DTWireId wireId(MuonPathSLId, 2, 1);
307 
308  pos_f = double(pos) +
309  int(10 * shiftinfo_[wireId.rawId()] * INCREASED_RES_POS_POW); // position in mm * precision in JM RF
310  pos_f /= (10. * INCREASED_RES_POS_POW); // position in cm w.r.t center of the chamber
311  slope_f = -(double(slope) / INCREASED_RES_SLOPE_POW);
312  chi2_f = double(chi2_mm2_p) / (16. * 64. * 100.);
313 
314  // Impose the thresholds
315  if (MuonPathSLId.superLayer() != 2)
316  if (std::abs(slope_f) > tanPhiTh_)
317  return;
318  if (chi2_f > (chi2Th_))
319  return;
320 
321  // Compute phi and phib
322  // Implemented using cmssw geometry as of now, will implemented fw-like in the near future
323  DTChamberId ChId(MuonPathSLId.wheel(), MuonPathSLId.station(), MuonPathSLId.sector());
324  double phi = -999.;
325  double phiB = -999.;
326  if (cmssw_for_global_ && MuonPathSLId.superLayer() != 2) {
327  double z = 0;
328  double z1 = Z_POS_SL;
329  double z3 = -1. * z1;
330  if (ChId.station() == 3 or ChId.station() == 4) {
331  z1 = z1 + Z_SHIFT_MB4;
332  z3 = z3 + Z_SHIFT_MB4;
333  }
334  if (MuonPathSLId.superLayer() == 1)
335  z = z1;
336  else if (MuonPathSLId.superLayer() == 3)
337  z = z3;
338 
339  GlobalPoint jm_x_cmssw_global = dtGeo_->chamber(ChId)->toGlobal(LocalPoint(pos_f, 0., z));
340  int thisec = MuonPathSLId.sector();
341  if (thisec == 13)
342  thisec = 4;
343  if (thisec == 14)
344  thisec = 10;
345  phi = jm_x_cmssw_global.phi() - PHI_CONV * (thisec - 1);
346  double psi = atan(slope_f);
347  phiB = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? psi - phi : -psi - phi;
348 
349  } else if (MuonPathSLId.superLayer() != 2) {
350  auto global_coords =
351  globalcoordsobtainer_->get_global_coordinates(ChId.rawId(), MuonPathSLId.superLayer(), pos, slope);
352  phi = global_coords[0];
353  phiB = global_coords[1];
354 
355  } else {
356  DTLayerId SL2_layer2Id(MuonPathSLId, 2);
357  double z_shift = shiftthetainfo_[SL2_layer2Id.rawId()];
358  double jm_y = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? z_shift - pos_f : z_shift + pos_f;
359  phi = jm_y;
360  phiB = slope_f; //
361  }
362 
363  // get the lateralities (in reverse order) in order to fill the metaprimitive
364  std::vector<int> lateralities = getLateralityCombination(latcomb);
365  for (int lay = 0; lay < NUM_LAYERS; lay++) {
366  if (valid[lay] == 0)
367  lateralities[lay] = -1;
368  }
369 
370  if (MuonPathSLId.superLayer() == 2) {
371  // Impose the thresholds
372  if (std::abs(MuonPathSLId.wheel()) == 2) {
373  if (slope_f > tanPhiThw2max_ or slope_f < tanPhiThw2min_)
374  return;
375  }
376 
377  if (std::abs(MuonPathSLId.wheel()) == 1) {
378  if (slope_f > tanPhiThw1max_ or slope_f < tanPhiThw1min_)
379  return;
380  }
381 
382  if (MuonPathSLId.wheel() == 0) {
383  if (std::abs(slope_f) > tanPhiThw0_)
384  return;
385  }
386 
387  DTLayerId SL2_layer2Id(MuonPathSLId, 2);
388  double z_shift = shiftthetainfo_[SL2_layer2Id.rawId()];
389  double jm_y = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? z_shift - pos_f : z_shift + pos_f;
390  if (cmssw_for_global_) {
391  LocalPoint wire1_in_layer(dtGeo_->layer(SL2_layer2Id)->specificTopology().wirePosition(1), 0, -0.65);
392  GlobalPoint wire1_in_global = dtGeo_->layer(SL2_layer2Id)->toGlobal(wire1_in_layer);
393  LocalPoint wire1_in_sl = dtGeo_->superLayer(MuonPathSLId)->toLocal(wire1_in_global);
394  double x_shift = wire1_in_sl.x();
395  jm_y = (dtGeo_->superLayer(MuonPathSLId)
396  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
397  .z();
398  }
399  phi = jm_y;
400  phiB = slope_f;
401  }
402 
403  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
404  double(bx_time),
405  pos_f,
406  slope_f,
407  phi,
408  phiB,
409  chi2_f,
410  quality,
411  wires[0],
412  t0s[0],
413  lateralities[0],
414  wires[1],
415  t0s[1],
416  lateralities[1],
417  wires[2],
418  t0s[2],
419  lateralities[2],
420  wires[3],
421  t0s[3],
422  lateralities[3],
423  -1,
424  -1,
425  -1,
426  -1,
427  -1,
428  -1,
429  -1,
430  -1,
431  -1,
432  -1,
433  -1,
434  -1,
435  -1}));
436 }

References funct::abs(), DTGeometry::chamber(), chi2Th_, IntegrityClient_cfi::ChId, cmssw_for_global_, 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, createfilelist::int, 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, protons_cff::time, GeomDet::toGlobal(), GeomDet::toLocal(), RunInfoPI::valid, DTChamberId::wheel(), DTTopology::wirePosition(), DigiDM_cff::wires, PV3DBase< T, PVType, FrameType >::x(), z, cmsdt::Z_POS_SL, and cmsdt::Z_SHIFT_MB4.

Referenced by analyze().

Member Data Documentation

◆ cellLayout_

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

Definition at line 109 of file MuonPathAnalyticAnalyzer.h.

◆ chi2Th_

double MuonPathAnalyticAnalyzer::chi2Th_
private

Definition at line 102 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

◆ chosen_sl_

int MuonPathAnalyticAnalyzer::chosen_sl_

Definition at line 79 of file MuonPathAnalyticAnalyzer.h.

Referenced by analyze(), and MuonPathAnalyticAnalyzer().

◆ cmssw_for_global_

bool MuonPathAnalyticAnalyzer::cmssw_for_global_
private

Definition at line 110 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

◆ debug_

bool MuonPathAnalyticAnalyzer::debug_
private

◆ dtGeo_

const DTGeometry* MuonPathAnalyticAnalyzer::dtGeo_

Definition at line 65 of file MuonPathAnalyticAnalyzer.h.

Referenced by initialise(), and segment_fitter().

◆ dtGeomH

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

Definition at line 69 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer().

◆ geometry_tag_

std::string MuonPathAnalyticAnalyzer::geometry_tag_
private

Definition at line 111 of file MuonPathAnalyticAnalyzer.h.

Referenced by initialise().

◆ globalcoordsobtainer_

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

Definition at line 115 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer(), and segment_fitter().

◆ LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER

std::vector<CELL_VALID_LAYOUT_CONSTANTS> MuonPathAnalyticAnalyzer::LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
private

◆ shift_filename_

edm::FileInPath MuonPathAnalyticAnalyzer::shift_filename_

Definition at line 72 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer().

◆ shift_theta_filename_

edm::FileInPath MuonPathAnalyticAnalyzer::shift_theta_filename_

Definition at line 76 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer().

◆ shiftinfo_

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

Definition at line 73 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer(), and segment_fitter().

◆ shiftthetainfo_

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

Definition at line 77 of file MuonPathAnalyticAnalyzer.h.

Referenced by MuonPathAnalyticAnalyzer(), and segment_fitter().

◆ tanPhiTh_

double MuonPathAnalyticAnalyzer::tanPhiTh_
private

Definition at line 103 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

◆ tanPhiThw0_

double MuonPathAnalyticAnalyzer::tanPhiThw0_
private

Definition at line 108 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

◆ tanPhiThw1max_

double MuonPathAnalyticAnalyzer::tanPhiThw1max_
private

Definition at line 106 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

◆ tanPhiThw1min_

double MuonPathAnalyticAnalyzer::tanPhiThw1min_
private

Definition at line 107 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

◆ tanPhiThw2max_

double MuonPathAnalyticAnalyzer::tanPhiThw2max_
private

Definition at line 104 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

◆ tanPhiThw2min_

double MuonPathAnalyticAnalyzer::tanPhiThw2min_
private

Definition at line 105 of file MuonPathAnalyticAnalyzer.h.

Referenced by segment_fitter().

DTGeometry
Definition: DTGeometry.h:28
cmsdt::metaPrimitive
Definition: constants.h:49
DTSuperLayerId
Definition: DTSuperLayerId.h:12
cmsdt::INCREASED_RES_SLOPE_XHH
constexpr int INCREASED_RES_SLOPE_XHH
Definition: constants.h:268
cmsdt::TDCTIME_REDUCED_SIZE
constexpr int TDCTIME_REDUCED_SIZE
Definition: constants.h:221
cmsdt::NOPATH
Definition: constants.h:42
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
MuonPathAnalyticAnalyzer::shift_filename_
edm::FileInPath shift_filename_
Definition: MuonPathAnalyticAnalyzer.h:72
DigiDM_cff.wires
wires
Definition: DigiDM_cff.py:33
MuonPathAnalyticAnalyzer::shiftinfo_
std::map< int, float > shiftinfo_
Definition: MuonPathAnalyticAnalyzer.h:73
pos
Definition: PixelAliasList.h:18
cmsdt::DTDD_PREADD
constexpr int DTDD_PREADD
Definition: constants.h:274
cmsdt::HIGHQ
Definition: constants.h:42
MuonPathAnalyticAnalyzer::tanPhiThw1max_
double tanPhiThw1max_
Definition: MuonPathAnalyticAnalyzer.h:106
cmsdt::DIV_SHR_BITS_T0
constexpr int DIV_SHR_BITS_T0
Definition: constants.h:260
cms::cuda::assert
assert(be >=bs)
protons_cff.time
time
Definition: protons_cff.py:39
cmsdt::INCREASED_RES_SLOPE_POW
constexpr int INCREASED_RES_SLOPE_POW
Definition: constants.h:271
cmsdt::INCREASED_RES_POS
constexpr int INCREASED_RES_POS
Definition: constants.h:266
MuonPathAnalyticAnalyzer::tanPhiThw2min_
double tanPhiThw2min_
Definition: MuonPathAnalyticAnalyzer.h:105
constants
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
MuonPathAnalyticAnalyzer::shiftthetainfo_
std::map< int, float > shiftthetainfo_
Definition: MuonPathAnalyticAnalyzer.h:77
cmsdt::INCREASED_RES_POS_POW
constexpr int INCREASED_RES_POS_POW
Definition: constants.h:270
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
DTGeometry::chamber
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
MuonPathAnalyticAnalyzer::dtGeomH
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH
Definition: MuonPathAnalyticAnalyzer.h:69
edm::FileInPath
Definition: FileInPath.h:64
DTTopology::wirePosition
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:59
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
DTWireId
Definition: DTWireId.h:12
MuonPathAnalyticAnalyzer::tanPhiThw0_
double tanPhiThw0_
Definition: MuonPathAnalyticAnalyzer.h:108
cmsdt::DTDD_MULT
constexpr int DTDD_MULT
Definition: constants.h:275
MuonPathAnalyticAnalyzer::getLateralityCombination
std::vector< int > getLateralityCombination(int latcomb)
Definition: MuonPathAnalyticAnalyzer.cc:438
DDAxes::z
edm::ESHandle< DTGeometry >
cmsdt::Z_POS_SL
constexpr float Z_POS_SL
Definition: constants.h:253
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, GlobalTag >
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
DTLayerId
Definition: DTLayerId.h:12
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonPathAnalyticAnalyzer::compute_parameter
int compute_parameter(MAGNITUDE constants, int t0s[4], int DIV_SHR_BITS, int INCREASED_RES)
Definition: MuonPathAnalyticAnalyzer.cc:237
cmsdt::PHI_CONV
constexpr double PHI_CONV
Definition: constants.h:249
cmsdt::DTDD_SHIFTR_BITS
constexpr int DTDD_SHIFTR_BITS
Definition: constants.h:276
MuonPathAnalyticAnalyzer::analyze
void analyze(MuonPathPtr &inMPath, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
Definition: MuonPathAnalyticAnalyzer.cc:108
MuonPathAnalyticAnalyzer::hasPosRF
bool hasPosRF(int wh, int sec)
Definition: MuonPathAnalyticAnalyzer.h:65
cmsdt::INCREASED_RES_T0
constexpr int INCREASED_RES_T0
Definition: constants.h:265
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LATCOMB_CONSTANTS::latcomb
int latcomb
Definition: MuonPathAnalyticAnalyzer.h:24
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
DTGeometry::layer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
IntegrityClient_cfi.ChId
ChId
Definition: IntegrityClient_cfi.py:18
createfilelist.int
int
Definition: createfilelist.py:10
cmsdt::DIV_SHR_BITS_SLOPE_XHH
constexpr int DIV_SHR_BITS_SLOPE_XHH
Definition: constants.h:263
MuonPathAnalyticAnalyzer::cmssw_for_global_
bool cmssw_for_global_
Definition: MuonPathAnalyticAnalyzer.h:110
cmsdt::INCREASED_RES_SLOPE
constexpr int INCREASED_RES_SLOPE
Definition: constants.h:267
NUM_LAYERS
Definition: CSCALCTDigi.cc:14
cmsdt::DIV_SHR_BITS_SLOPE
constexpr int DIV_SHR_BITS_SLOPE
Definition: constants.h:262
get
#define get
MuonPathAnalyticAnalyzer::shift_theta_filename_
edm::FileInPath shift_theta_filename_
Definition: MuonPathAnalyticAnalyzer.h:76
MuonPathAnalyzer::MuonPathAnalyzer
MuonPathAnalyzer(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
Definition: MuonPathAnalyzer.cc:9
res
Definition: Electron.h:6
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
cmsdt::Z_SHIFT_MB4
constexpr float Z_SHIFT_MB4
Definition: constants.h:252
MuonPathAnalyticAnalyzer::LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
std::vector< CELL_VALID_LAYOUT_CONSTANTS > LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
Definition: MuonPathAnalyticAnalyzer.h:112
DDAxes::phi
MuonPathAnalyticAnalyzer::tanPhiThw1min_
double tanPhiThw1min_
Definition: MuonPathAnalyticAnalyzer.h:107
LATCOMB_CONSTANTS::constants
CONSTANTS constants
Definition: MuonPathAnalyticAnalyzer.h:25
MuonPathAnalyticAnalyzer::debug_
bool debug_
Definition: MuonPathAnalyticAnalyzer.h:101
psi
std::map< std::string, int, std::less< std::string > > psi
Definition: CountProcessesAction.h:15
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
cmsdt::LOWQ
Definition: constants.h:42
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
edm::Transition::BeginRun
Exception
Definition: hltDiff.cc:245
MuonPathAnalyticAnalyzer::segment_fitter
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)
Definition: MuonPathAnalyticAnalyzer.cc:247
MuonPathAnalyticAnalyzer::globalcoordsobtainer_
std::shared_ptr< GlobalCoordsObtainer > globalcoordsobtainer_
Definition: MuonPathAnalyticAnalyzer.h:115
MuonPathAnalyticAnalyzer::geometry_tag_
std::string geometry_tag_
Definition: MuonPathAnalyticAnalyzer.h:111
or
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
MuonPathAnalyticAnalyzer::fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER
void fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER()
Definition: MuonPathAnalyticAnalyzer.cc:452
DTLayer::specificTopology
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
mps_fire.result
result
Definition: mps_fire.py:311
cmsdt::DIV_SHR_BITS_POS
constexpr int DIV_SHR_BITS_POS
Definition: constants.h:261
DTGeometry::superLayer
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
DTChamberId
Definition: DTChamberId.h:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
MuonPathAnalyticAnalyzer::tanPhiTh_
double tanPhiTh_
Definition: MuonPathAnalyticAnalyzer.h:103
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
MuonPathAnalyticAnalyzer::chi2Th_
double chi2Th_
Definition: MuonPathAnalyticAnalyzer.h:102
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
MuonPathAnalyticAnalyzer::tanPhiThw2max_
double tanPhiThw2max_
Definition: MuonPathAnalyticAnalyzer.h:104
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
MuonPathAnalyticAnalyzer::chosen_sl_
int chosen_sl_
Definition: MuonPathAnalyticAnalyzer.h:79
MuonPathAnalyticAnalyzer::dtGeo_
const DTGeometry * dtGeo_
Definition: MuonPathAnalyticAnalyzer.h:65
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
cmsdt::MAXDRIFT
constexpr float MAXDRIFT
Definition: constants.h:176