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, 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, 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_
 
const bool debug_
 
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.

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_.

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

◆ ~MuonPathAnalyticAnalyzer()

MuonPathAnalyticAnalyzer::~MuonPathAnalyticAnalyzer ( )
override

Definition at line 67 of file MuonPathAnalyticAnalyzer.cc.

References debug_, and LogDebug.

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

Member Function Documentation

◆ analyze()

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

Definition at line 105 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().

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

◆ compute_parameter()

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

Definition at line 232 of file MuonPathAnalyticAnalyzer.cc.

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

Referenced by segment_fitter().

232  {
233  long int result = 0;
234  for (int lay = 0; lay < NUM_LAYERS; lay++) {
235  result += constants.coeff[lay] * t0s[lay];
236  }
237  result = ((result * int(std::pow(2, INCREASED_RES)) + constants.add) * constants.mult) >> DIV_SHR_BITS;
238 
239  return result;
240 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER()

void MuonPathAnalyticAnalyzer::fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER ( )
private

Definition at line 445 of file MuonPathAnalyticAnalyzer.cc.

References LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER.

Referenced by MuonPathAnalyticAnalyzer().

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

◆ finish()

void MuonPathAnalyticAnalyzer::finish ( )
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 96 of file MuonPathAnalyticAnalyzer.cc.

References debug_, and LogDebug.

Referenced by progressbar.ProgressBar::__next__().

96  {
97  if (debug_)
98  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyzer: finish";
99 };
#define LogDebug(id)

◆ getLateralityCombination()

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

Definition at line 431 of file MuonPathAnalyticAnalyzer.cc.

Referenced by segment_fitter().

431  {
432  // returns the latcomb as a binary number represented in a vector of integers
433  // careful, the output is in reverse order
434  std::vector<int> binaryNum = {};
435  while (latcomb > 1) {
436  binaryNum.push_back(latcomb % 2);
437  latcomb = latcomb / 2;
438  }
439  binaryNum.push_back(latcomb);
440  while (binaryNum.size() < 4)
441  binaryNum.push_back(0);
442  return binaryNum;
443 }

◆ hasPosRF()

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

Definition at line 65 of file MuonPathAnalyticAnalyzer.h.

References fileinputsource_cfi::sec.

Referenced by segment_fitter().

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

◆ initialise()

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

Reimplemented from MuonPathAnalyzer.

Definition at line 75 of file MuonPathAnalyticAnalyzer.cc.

References debug_, dtGeo_, dtGeomH, relativeConstraints::geom, edm::EventSetup::getHandle(), and LogDebug.

75  {
76  if (debug_)
77  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyticAnalyzer::initialiase";
78 
79  auto geom = iEventSetup.getHandle(dtGeomH);
80  dtGeo_ = &(*geom);
81 }
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH
#define LogDebug(id)

◆ run() [1/2]

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

Implements MuonPathAnalyzer.

Definition at line 83 of file MuonPathAnalyticAnalyzer.cc.

References analyze(), debug_, and LogDebug.

86  {
87  if (debug_)
88  LogDebug("MuonPathAnalyticAnalyzer") << "MuonPathAnalyticAnalyzer: run";
89 
90  // fit per SL (need to allow for multiple outputs for a single mpath)
91  for (auto &muonpath : muonpaths) {
92  analyze(muonpath, metaPrimitives);
93  }
94 }
void analyze(MuonPathPtr &inMPath, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
#define LogDebug(id)

◆ run() [2/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  {};

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

References funct::abs(), DTGeometry::chamber(), chi2Th_, IntegrityClient_cfi::ChId, 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(), validateGeometry_cfg::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().

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

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

◆ debug_

const bool MuonPathAnalyticAnalyzer::debug_
private

◆ dtGeo_

DTGeometry const* 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 initialise(), and MuonPathAnalyticAnalyzer().

◆ globalcoordsobtainer_

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

Definition at line 113 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().