CMS 3D CMS Logo

TrackDerTable.cc
Go to the documentation of this file.
5 
7 
8 using namespace std;
9 using namespace trklet;
10 
11 TrackDerTable::TrackDerTable(Settings const& settings) : settings_(settings) {
12  Nlay_ = N_LAYER;
13  Ndisk_ = N_DISK;
14 
15  LayerMemBits_ = 6;
16  DiskMemBits_ = 7;
17  LayerDiskMemBits_ = 18;
18 
20 
21  nextLayerValue_ = 0;
22  nextDiskValue_ = 0;
24  lastMultiplicity_ = (1 << (3 * alphaBits_));
25 
26  for (int i = 0; i < (1 << Nlay_); i++) {
27  LayerMem_.push_back(-1);
28  }
29 
30  for (int i = 0; i < (1 << (2 * Ndisk_)); i++) {
31  DiskMem_.push_back(-1);
32  }
33 
34  for (int i = 0; i < (1 << (LayerMemBits_ + DiskMemBits_)); i++) {
35  LayerDiskMem_.push_back(-1);
36  }
37 }
38 
39 const TrackDer* TrackDerTable::getDerivatives(unsigned int layermask,
40  unsigned int diskmask,
41  unsigned int alphaindex,
42  unsigned int rinvindex) const {
43  int index = getIndex(layermask, diskmask);
44  if (index < 0) {
45  return nullptr;
46  }
47  return &derivatives_[index + alphaindex * (1 << settings_.nrinvBitsTable()) + rinvindex];
48 }
49 
50 int TrackDerTable::getIndex(unsigned int layermask, unsigned int diskmask) const {
51  assert(layermask < LayerMem_.size());
52 
53  assert(diskmask < DiskMem_.size());
54 
55  int layercode = LayerMem_[layermask];
56  int diskcode = DiskMem_[diskmask];
57 
58  if (diskcode < 0 || layercode < 0) {
59  if (settings_.warnNoDer()) {
60  edm::LogPrint("Tracklet") << "layermask diskmask : " << layermask << " " << diskmask;
61  }
62  return -1;
63  }
64 
65  assert(layercode >= 0);
66  assert(layercode < (1 << LayerMemBits_));
67  assert(diskcode >= 0);
68  assert(diskcode < (1 << DiskMemBits_));
69 
70  int layerdiskaddress = layercode + (diskcode << LayerMemBits_);
71 
72  assert(layerdiskaddress >= 0);
73  assert(layerdiskaddress < (1 << (LayerMemBits_ + DiskMemBits_)));
74 
75  int address = LayerDiskMem_[layerdiskaddress];
76 
77  if (address < 0) {
78  if (settings_.warnNoDer()) {
79  edm::LogVerbatim("Tracklet") << "layermask diskmask : " << layermask << " " << diskmask;
80  }
81  return -1;
82  }
83 
84  assert(address >= 0);
85  assert(address < (1 << LayerDiskMemBits_));
86 
87  return address;
88 }
89 
90 void TrackDerTable::addEntry(unsigned int layermask, unsigned int diskmask, int multiplicity, int nrinv) {
91  assert(multiplicity <= (1 << (3 * alphaBits_)));
92 
93  assert(layermask < (unsigned int)(1 << Nlay_));
94 
95  assert(diskmask < (unsigned int)(1 << (2 * Ndisk_)));
96 
97  if (LayerMem_[layermask] == -1) {
98  LayerMem_[layermask] = nextLayerValue_++;
99  }
100  if (DiskMem_[diskmask] == -1) {
101  DiskMem_[diskmask] = nextDiskValue_++;
102  }
103 
104  int layercode = LayerMem_[layermask];
105  int diskcode = DiskMem_[diskmask];
106 
107  assert(layercode >= 0);
108  assert(layercode < (1 << LayerMemBits_));
109  assert(diskcode >= 0);
110  assert(diskcode < (1 << DiskMemBits_));
111 
112  int layerdiskaddress = layercode + (diskcode << LayerMemBits_);
113 
114  assert(layerdiskaddress >= 0);
115  assert(layerdiskaddress < (1 << (LayerMemBits_ + DiskMemBits_)));
116 
117  int address = LayerDiskMem_[layerdiskaddress];
118 
119  if (address != -1) {
120  edm::LogPrint("Tracklet") << "Duplicate entry: layermask=" << layermask << " diskmaks=" << diskmask;
121  }
122 
123  assert(address == -1);
124 
125  LayerDiskMem_[layerdiskaddress] = nextLayerDiskValue_;
126 
127  nextLayerDiskValue_ += multiplicity * nrinv;
128 
129  lastMultiplicity_ = multiplicity * nrinv;
130 
131  for (int i = 0; i < multiplicity; i++) {
132  for (int irinv = 0; irinv < nrinv; irinv++) {
133  TrackDer tmp;
134  tmp.setIndex(layermask, diskmask, i, irinv);
135  derivatives_.push_back(tmp);
136  }
137  }
138 }
139 
141  ifstream in(fileName.c_str());
142  if (settings_.debugTracklet()) {
143  edm::LogVerbatim("Tracklet") << "reading fit pattern file " << fileName;
144  edm::LogVerbatim("Tracklet") << " flags (good/eof/fail/bad): " << in.good() << " " << in.eof() << " " << in.fail()
145  << " " << in.bad();
146  }
147 
148  while (in.good()) {
149  std::string layerstr, diskstr;
150  int multiplicity;
151 
152  in >> layerstr >> diskstr >> multiplicity;
153 
154  //correct multiplicity if you dont want 3 bits of alpha.
155  if (alphaBits_ == 2) {
156  if (multiplicity == 8)
157  multiplicity = 4;
158  if (multiplicity == 64)
159  multiplicity = 16;
160  if (multiplicity == 512)
161  multiplicity = 64;
162  }
163 
164  if (alphaBits_ == 1) {
165  if (multiplicity == 8)
166  multiplicity = 2;
167  if (multiplicity == 64)
168  multiplicity = 4;
169  if (multiplicity == 512)
170  multiplicity = 8;
171  }
172 
173  if (!in.good())
174  continue;
175 
176  char** tmpptr = nullptr;
177 
178  int layers = strtol(layerstr.c_str(), tmpptr, 2);
179  int disks = strtol(diskstr.c_str(), tmpptr, 2);
180 
181  addEntry(layers, disks, multiplicity, (1 << settings_.nrinvBitsTable()));
182  }
183 }
184 
186  int nentries = getEntries();
187 
188  for (int i = 0; i < nentries; i++) {
189  TrackDer& der = derivatives_[i];
190  int layermask = der.layerMask();
191  int diskmask = der.diskMask();
192  int alphamask = der.alphaMask();
193  int irinv = der.irinv();
194 
195  double rinv = (irinv - ((1 << (settings_.nrinvBitsTable() - 1)) - 0.5)) * settings_.rinvmax() /
196  (1 << (settings_.nrinvBitsTable() - 1));
197 
198  bool print = false;
199 
200  if (print) {
201  edm::LogVerbatim("Tracklet") << "PRINT i " << i << " " << layermask << " " << diskmask << " " << alphamask << " "
202  << print;
203  }
204 
205  int nlayers = 0;
206  double r[N_LAYER];
207 
208  for (unsigned l = 0; l < N_LAYER; l++) {
209  if (layermask & (1 << (N_LAYER - 1 - l))) {
210  r[nlayers] = settings_.rmean(l);
211  nlayers++;
212  }
213  }
214 
215  int ndisks = 0;
216  double z[N_DISK];
217  double alpha[N_DISK];
218 
219  double t = tpar(settings_, diskmask, layermask);
220 
221  for (unsigned d = 0; d < N_DISK; d++) {
222  if (diskmask & (3 << (2 * (N_DISK - 1 - d)))) {
223  z[ndisks] = settings_.zmean(d);
224  alpha[ndisks] = 0.0;
225  double r = settings_.zmean(d) / t;
226  double r2 = r * r;
227  if (diskmask & (1 << (2 * (N_DISK - 1 - d)))) {
228  if (alphaBits_ == 3) {
229  int ialpha = alphamask & 7;
230  alphamask = alphamask >> 3;
231  alpha[ndisks] = settings_.half2SmoduleWidth() * (ialpha - 3.5) / 4.0 / r2;
232  if (print)
233  edm::LogVerbatim("Tracklet") << "PRINT 3 alpha ialpha : " << alpha[ndisks] << " " << ialpha;
234  }
235  if (alphaBits_ == 2) {
236  int ialpha = alphamask & 3;
237  alphamask = alphamask >> 2;
238  alpha[ndisks] = settings_.half2SmoduleWidth() * (ialpha - 1.5) / 2.0 / r2;
239  }
240  if (alphaBits_ == 1) {
241  int ialpha = alphamask & 1;
242  alphamask = alphamask >> 1;
243  alpha[ndisks] = settings_.half2SmoduleWidth() * (ialpha - 0.5) / r2;
244  if (print)
245  edm::LogVerbatim("Tracklet") << "PRINT 1 alpha ialpha : " << alpha[ndisks] << " " << ialpha;
246  }
247  }
248  ndisks++;
249  }
250  }
251 
252  double D[N_FITPARAM][N_FITSTUB * 2];
253  int iD[N_FITPARAM][N_FITSTUB * 2];
254  double MinvDt[N_FITPARAM][N_FITSTUB * 2];
255  double MinvDtDelta[N_FITPARAM][N_FITSTUB * 2];
256  int iMinvDt[N_FITPARAM][N_FITSTUB * 2];
257  double sigma[N_FITSTUB * 2];
258  double kfactor[N_FITSTUB * 2];
259 
260  if (print) {
261  edm::LogVerbatim("Tracklet") << "PRINT ndisks alpha[0] z[0] t: " << ndisks << " " << alpha[0] << " " << z[0]
262  << " " << t;
263  for (int iii = 0; iii < nlayers; iii++) {
264  edm::LogVerbatim("Tracklet") << "PRINT iii r: " << iii << " " << r[iii];
265  }
266  }
267 
268  calculateDerivatives(settings_, nlayers, r, ndisks, z, alpha, t, rinv, D, iD, MinvDt, iMinvDt, sigma, kfactor);
269 
270  double delta = 0.1;
271 
272  for (int i = 0; i < nlayers; i++) {
273  if (r[i] > settings_.rPS2S())
274  continue;
275 
276  r[i] += delta;
277 
279  settings_, nlayers, r, ndisks, z, alpha, t, rinv, D, iD, MinvDtDelta, iMinvDt, sigma, kfactor);
280 
281  for (int ii = 0; ii < nlayers; ii++) {
282  if (r[ii] > settings_.rPS2S())
283  continue;
284  double tder = (MinvDtDelta[2][2 * ii + 1] - MinvDt[2][2 * ii + 1]) / delta;
285  int itder = (1 << (settings_.fittbitshift() + settings_.rcorrbits())) * tder * settings_.kr() * settings_.kz() /
286  settings_.ktpars();
287  double zder = (MinvDtDelta[3][2 * ii + 1] - MinvDt[3][2 * ii + 1]) / delta;
288  int izder = (1 << (settings_.fitz0bitshift() + settings_.rcorrbits())) * zder * settings_.kr() *
290  der.settdzcorr(i, ii, tder);
291  der.setz0dzcorr(i, ii, zder);
292  der.setitdzcorr(i, ii, itder);
293  der.setiz0dzcorr(i, ii, izder);
294  }
295 
296  r[i] -= delta;
297  }
298 
299  if (print) {
300  edm::LogVerbatim("Tracklet") << "iMinvDt table build : " << iMinvDt[0][10] << " " << iMinvDt[1][10] << " "
301  << iMinvDt[2][10] << " " << iMinvDt[3][10] << " " << t << " " << nlayers << " "
302  << ndisks;
303 
304  std::string oss = "alpha :";
305  for (int iii = 0; iii < ndisks; iii++) {
306  oss += " ";
307  oss += std::to_string(alpha[iii]);
308  }
309  edm::LogVerbatim("Tracklet") << oss;
310  oss = "z :";
311  for (int iii = 0; iii < ndisks; iii++) {
312  oss += " ";
313  oss += std::to_string(z[iii]);
314  }
315  edm::LogVerbatim("Tracklet") << oss;
316  }
317 
318  if (print) {
319  edm::LogVerbatim("Tracklet") << "PRINT nlayers ndisks : " << nlayers << " " << ndisks;
320  }
321 
322  for (int j = 0; j < nlayers + ndisks; j++) {
323  der.settpar(t);
324 
325  //integer
326  assert(std::abs(iMinvDt[0][2 * j]) < (1 << 23));
327  assert(std::abs(iMinvDt[0][2 * j + 1]) < (1 << 23));
328  assert(std::abs(iMinvDt[1][2 * j]) < (1 << 23));
329  assert(std::abs(iMinvDt[1][2 * j + 1]) < (1 << 23));
330  assert(std::abs(iMinvDt[2][2 * j]) < (1 << 19));
331  assert(std::abs(iMinvDt[2][2 * j + 1]) < (1 << 19));
332  assert(std::abs(iMinvDt[3][2 * j]) < (1 << 19));
333  assert(std::abs(iMinvDt[3][2 * j + 1]) < (1 << 19));
334 
335  if (print) {
336  edm::LogVerbatim("Tracklet") << "PRINT i " << i << " " << j << " " << iMinvDt[1][2 * j] << " "
337  << std::abs(iMinvDt[1][2 * j]);
338  }
339 
340  der.setirinvdphi(j, iMinvDt[0][2 * j]);
341  der.setirinvdzordr(j, iMinvDt[0][2 * j + 1]);
342  der.setiphi0dphi(j, iMinvDt[1][2 * j]);
343  der.setiphi0dzordr(j, iMinvDt[1][2 * j + 1]);
344  der.setitdphi(j, iMinvDt[2][2 * j]);
345  der.setitdzordr(j, iMinvDt[2][2 * j + 1]);
346  der.setiz0dphi(j, iMinvDt[3][2 * j]);
347  der.setiz0dzordr(j, iMinvDt[3][2 * j + 1]);
348  //floating point
349  der.setrinvdphi(j, MinvDt[0][2 * j]);
350  der.setrinvdzordr(j, MinvDt[0][2 * j + 1]);
351  der.setphi0dphi(j, MinvDt[1][2 * j]);
352  der.setphi0dzordr(j, MinvDt[1][2 * j + 1]);
353  der.settdphi(j, MinvDt[2][2 * j]);
354  der.settdzordr(j, MinvDt[2][2 * j + 1]);
355  der.setz0dphi(j, MinvDt[3][2 * j]);
356  der.setz0dzordr(j, MinvDt[3][2 * j + 1]);
357  }
358  }
359 
360  if (settings_.writeTable()) {
361  ofstream outL = openfile(settings_.tablePath(), "FitDerTableNew_LayerMem.tab", __FILE__, __LINE__);
362 
363  int nbits = 6;
364  for (unsigned int i = 0; i < LayerMem_.size(); i++) {
365  FPGAWord tmp;
366  int tmp1 = LayerMem_[i];
367  if (tmp1 < 0)
368  tmp1 = (1 << nbits) - 1;
369  tmp.set(tmp1, nbits, true, __LINE__, __FILE__);
370  outL << tmp.str() << endl;
371  }
372  outL.close();
373 
374  ofstream outD = openfile(settings_.tablePath(), "FitDerTableNew_DiskMem.tab", __FILE__, __LINE__);
375 
376  nbits = 7;
377  for (int tmp1 : DiskMem_) {
378  if (tmp1 < 0)
379  tmp1 = (1 << nbits) - 1;
380  FPGAWord tmp;
381  tmp.set(tmp1, nbits, true, __LINE__, __FILE__);
382  outD << tmp.str() << endl;
383  }
384  outD.close();
385 
386  ofstream outLD = openfile(settings_.tablePath(), "FitDerTableNew_LayerDiskMem.tab", __FILE__, __LINE__);
387 
388  nbits = 15;
389  for (int tmp1 : LayerDiskMem_) {
390  if (tmp1 < 0)
391  tmp1 = (1 << nbits) - 1;
392  FPGAWord tmp;
393  tmp.set(tmp1, nbits, true, __LINE__, __FILE__);
394  outLD << tmp.str() << endl;
395  }
396  outLD.close();
397 
398  const std::array<string, N_TRKLSEED> seedings = {{"L1L2", "L3L4", "L5L6", "D1D2", "D3D4", "D1L1", "D1L2"}};
399  const string prefix = settings_.tablePath() + "FitDerTableNew_";
400 
401  // open files for derivative tables
402 
403  ofstream outrinvdphi[N_TRKLSEED];
404  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
405  const string fname = prefix + "Rinvdphi_" + seedings[i] + ".tab";
406  outrinvdphi[i].open(fname);
407  if (outrinvdphi[i].fail())
408  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
409  }
410 
411  ofstream outrinvdzordr[N_TRKLSEED];
412  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
413  const string fname = prefix + "Rinvdzordr_" + seedings[i] + ".tab";
414  outrinvdzordr[i].open(fname);
415  if (outrinvdzordr[i].fail())
416  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
417  }
418 
419  ofstream outphi0dphi[N_TRKLSEED];
420  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
421  const string fname = prefix + "Phi0dphi_" + seedings[i] + ".tab";
422  outphi0dphi[i].open(fname);
423  if (outphi0dphi[i].fail())
424  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
425  }
426 
427  ofstream outphi0dzordr[N_TRKLSEED];
428  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
429  const string fname = prefix + "Phi0dzordr_" + seedings[i] + ".tab";
430  outphi0dzordr[i].open(fname);
431  if (outphi0dzordr[i].fail())
432  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
433  }
434 
435  ofstream outtdphi[N_TRKLSEED];
436  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
437  const string fname = prefix + "Tdphi_" + seedings[i] + ".tab";
438  outtdphi[i].open(fname);
439  if (outtdphi[i].fail())
440  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
441  }
442 
443  ofstream outtdzordr[N_TRKLSEED];
444  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
445  const string fname = prefix + "Tdzordr_" + seedings[i] + ".tab";
446  outtdzordr[i].open(fname);
447  if (outtdzordr[i].fail())
448  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
449  }
450 
451  ofstream outz0dphi[N_TRKLSEED];
452  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
453  const string fname = prefix + "Z0dphi_" + seedings[i] + ".tab";
454  outz0dphi[i].open(fname);
455  if (outz0dphi[i].fail())
456  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
457  }
458 
459  ofstream outz0dzordr[N_TRKLSEED];
460  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
461  string fname = prefix + "Z0dzordr_" + seedings[i] + ".tab";
462  outz0dzordr[i].open(fname);
463  if (outz0dzordr[i].fail())
464  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
465  }
466 
467  for (auto& der : derivatives_) {
468  unsigned int layerhits = der.layerMask(); // 6 bits layer hit pattern
469  unsigned int diskmask = der.diskMask(); // 10 bits disk hit pattern
470  unsigned int diskhits = 0;
471  if (diskmask & (3 << 8))
472  diskhits += 16;
473  if (diskmask & (3 << 6))
474  diskhits += 8;
475  if (diskmask & (3 << 4))
476  diskhits += 4;
477  if (diskmask & (3 << 2))
478  diskhits += 2;
479  if (diskmask & (3 << 0))
480  diskhits += 1;
481  assert(diskhits < 32); // 5 bits
482  unsigned int hits = (layerhits << 5) + diskhits; // 11 bits hit pattern
483  assert(hits < 4096);
484 
485  // loop over all seedings
486  int i = 0; // seeding index
487  for (const string& seed : seedings) {
488  unsigned int iseed1 = 0;
489  unsigned int iseed2 = 0;
490  // check if the seeding is good for the current hit pattern
491  if (seed == "L1L2") {
492  iseed1 = 1;
493  iseed2 = 2;
494  }
495  if (seed == "L3L4") {
496  iseed1 = 3;
497  iseed2 = 4;
498  }
499  if (seed == "L5L6") {
500  iseed1 = 5;
501  iseed2 = 6;
502  }
503  if (seed == "D1D2") {
504  iseed1 = 7;
505  iseed2 = 8;
506  }
507  if (seed == "D3D4") {
508  iseed1 = 9;
509  iseed2 = 10;
510  }
511  if (seed == "D1L1") {
512  iseed1 = 7;
513  iseed2 = 1;
514  }
515  if (seed == "D1L2") {
516  iseed1 = 7;
517  iseed2 = 2;
518  }
519 
520  bool goodseed = (hits & (1 << (11 - iseed1))) and (hits & (1 << (11 - iseed2)));
521 
522  int itmprinvdphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
523  int itmprinvdzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
524  int itmpphi0dphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
525  int itmpphi0dzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
526  int itmptdphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
527  int itmptdzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
528  int itmpz0dphi[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
529  int itmpz0dzordr[N_PROJ] = {9999999, 9999999, 9999999, 9999999};
530 
531  // loop over bits in hit pattern
532  int ider = 0;
533  if (goodseed) {
534  for (unsigned int ihit = 1; ihit < N_FITSTUB * 2; ++ihit) {
535  // skip seeding layers
536  if (ihit == iseed1 or ihit == iseed2) {
537  ider++;
538  continue;
539  }
540  // skip if no hit
541  if (not(hits & (1 << (11 - ihit))))
542  continue;
543 
544  int inputI = -1;
545  if (seed == "L1L2") {
546  if (ihit == 3 or ihit == 10)
547  inputI = 0; // L3 or D4
548  if (ihit == 4 or ihit == 9)
549  inputI = 1; // L4 or D3
550  if (ihit == 5 or ihit == 8)
551  inputI = 2; // L5 or D2
552  if (ihit == 6 or ihit == 7)
553  inputI = 3; // L6 or D1
554  } else if (seed == "L3L4") {
555  if (ihit == 1)
556  inputI = 0; // L1
557  if (ihit == 2)
558  inputI = 1; // L2
559  if (ihit == 5 or ihit == 8)
560  inputI = 2; // L5 or D2
561  if (ihit == 6 or ihit == 7)
562  inputI = 3; // L6 or D1
563  } else if (seed == "L5L6") {
564  if (ihit == 1)
565  inputI = 0; // L1
566  if (ihit == 2)
567  inputI = 1; // L2
568  if (ihit == 3)
569  inputI = 2; // L3
570  if (ihit == 4)
571  inputI = 3; // L4
572  } else if (seed == "D1D2") {
573  if (ihit == 1)
574  inputI = 0; // L1
575  if (ihit == 9)
576  inputI = 1; // D3
577  if (ihit == 10)
578  inputI = 2; // D4
579  if (ihit == 2 or ihit == 11)
580  inputI = 3; // L2 or D5
581  } else if (seed == "D3D4") {
582  if (ihit == 1)
583  inputI = 0; // L1
584  if (ihit == 7)
585  inputI = 1; // D1
586  if (ihit == 8)
587  inputI = 2; // D2
588  if (ihit == 2 or ihit == 11)
589  inputI = 3; // L2 or D5
590  } else if (seed == "D1L1" or "D1L2") {
591  if (ihit == 8)
592  inputI = 0; // D2
593  if (ihit == 9)
594  inputI = 1; // D3
595  if (ihit == 10)
596  inputI = 2; // D4
597  if (ihit == 11)
598  inputI = 3; // D5
599  }
600  if (inputI >= 0 and inputI < (int)N_PROJ) {
601  itmprinvdphi[inputI] = der.irinvdphi(ider);
602  itmprinvdzordr[inputI] = der.irinvdzordr(ider);
603  itmpphi0dphi[inputI] = der.iphi0dphi(ider);
604  itmpphi0dzordr[inputI] = der.iphi0dzordr(ider);
605  itmptdphi[inputI] = der.itdphi(ider);
606  itmptdzordr[inputI] = der.itdzordr(ider);
607  itmpz0dphi[inputI] = der.iz0dphi(ider);
608  itmpz0dzordr[inputI] = der.iz0dzordr(ider);
609  }
610 
611  ider++;
612 
613  } // for (unsigned int ihit = 1; ihit < 12; ++ihit)
614  } // if (goodseed)
615 
616  FPGAWord tmprinvdphi[N_PROJ];
617  int nbits = 16;
618  for (unsigned int j = 0; j < N_PROJ; ++j) {
619  if (itmprinvdphi[j] > (1 << nbits))
620  itmprinvdphi[j] = (1 << nbits) - 1;
621  tmprinvdphi[j].set(itmprinvdphi[j], nbits + 1, false, __LINE__, __FILE__);
622  }
623  outrinvdphi[i] << tmprinvdphi[0].str() << tmprinvdphi[1].str() << tmprinvdphi[2].str() << tmprinvdphi[3].str()
624  << endl;
625 
626  FPGAWord tmprinvdzordr[N_PROJ];
627  nbits = 15;
628  for (unsigned int j = 0; j < N_PROJ; ++j) {
629  if (itmprinvdzordr[j] > (1 << nbits))
630  itmprinvdzordr[j] = (1 << nbits) - 1;
631  tmprinvdzordr[j].set(itmprinvdzordr[j], nbits + 1, false, __LINE__, __FILE__);
632  }
633  outrinvdzordr[i] << tmprinvdzordr[0].str() << tmprinvdzordr[1].str() << tmprinvdzordr[2].str()
634  << tmprinvdzordr[3].str() << endl;
635 
636  FPGAWord tmpphi0dphi[N_PROJ];
637  nbits = 13;
638  for (unsigned int j = 0; j < N_PROJ; ++j) {
639  if (itmpphi0dphi[j] > (1 << nbits))
640  itmpphi0dphi[j] = (1 << nbits) - 1;
641  tmpphi0dphi[j].set(itmpphi0dphi[j], nbits + 1, false, __LINE__, __FILE__);
642  }
643  outphi0dphi[i] << tmpphi0dphi[0].str() << tmpphi0dphi[1].str() << tmpphi0dphi[2].str() << tmpphi0dphi[3].str()
644  << endl;
645 
646  FPGAWord tmpphi0dzordr[N_PROJ];
647  nbits = 15;
648  for (unsigned int j = 0; j < N_PROJ; ++j) {
649  if (itmpphi0dzordr[j] > (1 << nbits))
650  itmpphi0dzordr[j] = (1 << nbits) - 1;
651  tmpphi0dzordr[j].set(itmpphi0dzordr[j], nbits + 1, false, __LINE__, __FILE__);
652  }
653  outphi0dzordr[i] << tmpphi0dzordr[0].str() << tmpphi0dzordr[1].str() << tmpphi0dzordr[2].str()
654  << tmpphi0dzordr[3].str() << endl;
655 
656  FPGAWord tmptdphi[N_PROJ];
657  nbits = 14;
658  for (unsigned int j = 0; j < N_PROJ; ++j) {
659  if (itmptdphi[j] > (1 << nbits))
660  itmptdphi[j] = (1 << nbits) - 1;
661  tmptdphi[j].set(itmptdphi[j], nbits + 1, false, __LINE__, __FILE__);
662  }
663  outtdphi[i] << tmptdphi[0].str() << tmptdphi[1].str() << tmptdphi[2].str() << tmptdphi[3].str() << endl;
664 
665  FPGAWord tmptdzordr[N_PROJ];
666  nbits = 15;
667  for (unsigned int j = 0; j < N_PROJ; ++j) {
668  if (itmptdzordr[j] > (1 << nbits))
669  itmptdzordr[j] = (1 << nbits) - 1;
670  tmptdzordr[j].set(itmptdzordr[j], nbits + 1, false, __LINE__, __FILE__);
671  }
672  outtdzordr[i] << tmptdzordr[0].str() << tmptdzordr[1].str() << tmptdzordr[2].str() << tmptdzordr[3].str()
673  << endl;
674 
675  FPGAWord tmpz0dphi[N_PROJ];
676  nbits = 13;
677  for (unsigned int j = 0; j < N_PROJ; ++j) {
678  if (itmpz0dphi[j] > (1 << nbits))
679  itmpz0dphi[j] = (1 << nbits) - 1;
680  tmpz0dphi[j].set(itmpz0dphi[j], nbits + 1, false, __LINE__, __FILE__);
681  }
682  outz0dphi[i] << tmpz0dphi[0].str() << tmpz0dphi[1].str() << tmpz0dphi[2].str() << tmpz0dphi[3].str() << endl;
683 
684  FPGAWord tmpz0dzordr[N_PROJ];
685  nbits = 15;
686  for (unsigned int j = 0; j < N_PROJ; ++j) {
687  if (itmpz0dzordr[j] > (1 << nbits))
688  itmpz0dzordr[j] = (1 << nbits) - 1;
689  tmpz0dzordr[j].set(itmpz0dzordr[j], nbits + 1, false, __LINE__, __FILE__);
690  }
691  outz0dzordr[i] << tmpz0dzordr[0].str() << tmpz0dzordr[1].str() << tmpz0dzordr[2].str() << tmpz0dzordr[3].str()
692  << endl;
693 
694  i++;
695  } // for (const string & seed : seedings)
696 
697  } // for (auto & der : derivatives_)
698 
699  // close files
700  for (unsigned int i = 0; i < N_TRKLSEED; ++i) {
701  outrinvdphi[i].close();
702  outrinvdzordr[i].close();
703  outphi0dphi[i].close();
704  outphi0dzordr[i].close();
705  outtdphi[i].close();
706  outtdzordr[i].close();
707  outz0dphi[i].close();
708  outz0dzordr[i].close();
709  }
710 
711  } // if (writeFitDerTable)
712 }
713 
714 void TrackDerTable::invert(double M[4][8], unsigned int n) {
715  assert(n <= 4);
716 
717  unsigned int i, j, k;
718  double ratio, a;
719 
720  for (i = 0; i < n; i++) {
721  for (j = n; j < 2 * n; j++) {
722  if (i == (j - n))
723  M[i][j] = 1.0;
724  else
725  M[i][j] = 0.0;
726  }
727  }
728 
729  for (i = 0; i < n; i++) {
730  for (j = 0; j < n; j++) {
731  if (i != j) {
732  ratio = M[j][i] / M[i][i];
733  for (k = 0; k < 2 * n; k++) {
734  M[j][k] -= ratio * M[i][k];
735  }
736  }
737  }
738  }
739 
740  for (i = 0; i < n; i++) {
741  a = M[i][i];
742  for (j = 0; j < 2 * n; j++) {
743  M[i][j] /= a;
744  }
745  }
746 }
747 
748 void TrackDerTable::invert(std::vector<std::vector<double> >& M, unsigned int n) {
749  assert(M.size() == n);
750  assert(M[0].size() == 2 * n);
751 
752  unsigned int i, j, k;
753  double ratio, a;
754 
755  for (i = 0; i < n; i++) {
756  for (j = n; j < 2 * n; j++) {
757  if (i == (j - n))
758  M[i][j] = 1.0;
759  else
760  M[i][j] = 0.0;
761  }
762  }
763 
764  for (i = 0; i < n; i++) {
765  for (j = 0; j < n; j++) {
766  if (i != j) {
767  ratio = M[j][i] / M[i][i];
768  for (k = 0; k < 2 * n; k++) {
769  M[j][k] -= ratio * M[i][k];
770  }
771  }
772  }
773  }
774 
775  for (i = 0; i < n; i++) {
776  a = M[i][i];
777  for (j = 0; j < 2 * n; j++) {
778  M[i][j] /= a;
779  }
780  }
781 }
782 
784  unsigned int nlayers,
785  double r[N_LAYER],
786  unsigned int ndisks,
787  double z[N_DISK],
788  double alpha[N_DISK],
789  double t,
790  double rinv,
791  double D[N_FITPARAM][N_FITSTUB * 2],
792  int iD[N_FITPARAM][N_FITSTUB * 2],
793  double MinvDt[N_FITPARAM][N_FITSTUB * 2],
794  int iMinvDt[N_FITPARAM][N_FITSTUB * 2],
795  double sigma[N_FITSTUB * 2],
796  double kfactor[N_FITSTUB * 2]) {
797  double sigmax = settings.stripPitch(true) / sqrt(12.0);
798  double sigmaz = settings.stripLength(true) / sqrt(12.0);
799  double sigmaz2 = settings.stripLength(false) / sqrt(12.0);
800 
801  double sigmazpsbarrel = sigmaz; //This is a bit of a hack - these weights should be properly determined
802  if (std::abs(t) > 2.0)
803  sigmazpsbarrel = sigmaz * std::abs(t) / 2.0;
804  if (std::abs(t) > 3.8)
805  sigmazpsbarrel = sigmaz * std::abs(t);
806 
807  double sigmax2sdisk = settings.stripPitch(false) / sqrt(12.0);
808  double sigmaz2sdisk = settings.stripLength(false) / sqrt(12.0);
809 
810  double sigmaxpsdisk = settings.stripPitch(true) / sqrt(12.0);
811  double sigmazpsdisk = settings.stripLength(true) / sqrt(12.0);
812 
813  unsigned int n = nlayers + ndisks;
814 
815  assert(n <= N_FITSTUB);
816 
817  double rnew[N_FITSTUB];
818 
819  int j = 0;
820 
821  //here we handle a barrel hit
822  for (unsigned int i = 0; i < nlayers; i++) {
823  double ri = r[i];
824 
825  rnew[i] = ri;
826 
827  //first we have the phi position
828  D[0][j] = -0.5 * ri * ri / sqrt(1 - 0.25 * ri * ri * rinv * rinv) / sigmax;
829  D[1][j] = ri / sigmax;
830  D[2][j] = 0.0;
831  D[3][j] = 0.0;
832  sigma[j] = sigmax;
833  kfactor[j] = settings.kphi1();
834  j++;
835  //second the z position
836  D[0][j] = 0.0;
837  D[1][j] = 0.0;
838  if (ri < settings.rPS2S()) {
839  D[2][j] = (2 / rinv) * asin(0.5 * ri * rinv) / sigmazpsbarrel;
840  D[3][j] = 1.0 / sigmazpsbarrel;
841  sigma[j] = sigmazpsbarrel;
842  kfactor[j] = settings.kz();
843  } else {
844  D[2][j] = (2 / rinv) * asin(0.5 * ri * rinv) / sigmaz2;
845  D[3][j] = 1.0 / sigmaz2;
846  sigma[j] = sigmaz2;
847  kfactor[j] = settings.kz();
848  }
849 
850  j++;
851  }
852 
853  for (unsigned int i = 0; i < ndisks; i++) {
854  double zi = z[i];
855 
856  double z0 = 0.0;
857 
858  double rmultiplier = alpha[i] * zi / t;
859 
860  double phimultiplier = zi / t;
861 
862  double drdrinv = -2.0 * sin(0.5 * rinv * (zi - z0) / t) / (rinv * rinv) +
863  (zi - z0) * cos(0.5 * rinv * (zi - z0) / t) / (rinv * t);
864  double drdphi0 = 0;
865  double drdt = -(zi - z0) * cos(0.5 * rinv * (zi - z0) / t) / (t * t);
866  double drdz0 = -cos(0.5 * rinv * (zi - z0) / t) / t;
867 
868  double dphidrinv = -0.5 * (zi - z0) / t;
869  double dphidphi0 = 1.0;
870  double dphidt = 0.5 * rinv * (zi - z0) / (t * t);
871  double dphidz0 = 0.5 * rinv / t;
872 
873  double r = (zi - z0) / t;
874 
875  rnew[i + nlayers] = r;
876 
877  sigma[j] = sigmax2sdisk;
878  if (std::abs(alpha[i]) < 1e-10) {
879  sigma[j] = sigmaxpsdisk;
880  }
881 
882  D[0][j] = (phimultiplier * dphidrinv + rmultiplier * drdrinv) / sigma[j];
883  D[1][j] = (phimultiplier * dphidphi0 + rmultiplier * drdphi0) / sigma[j];
884  D[2][j] = (phimultiplier * dphidt + rmultiplier * drdt) / sigma[j];
885  D[3][j] = (phimultiplier * dphidz0 + rmultiplier * drdz0) / sigma[j];
886  kfactor[j] = settings.kphi();
887 
888  j++;
889 
890  if (std::abs(alpha[i]) < 1e-10) {
891  D[0][j] = drdrinv / sigmazpsdisk;
892  D[1][j] = drdphi0 / sigmazpsdisk;
893  D[2][j] = drdt / sigmazpsdisk;
894  D[3][j] = drdz0 / sigmazpsdisk;
895  sigma[j] = sigmazpsdisk;
896  kfactor[j] = settings.kr();
897  } else {
898  D[0][j] = drdrinv / sigmaz2sdisk;
899  D[1][j] = drdphi0 / sigmaz2sdisk;
900  D[2][j] = drdt / sigmaz2sdisk;
901  D[3][j] = drdz0 / sigmaz2sdisk;
902  sigma[j] = sigmaz2sdisk;
903  kfactor[j] = settings.kr();
904  }
905 
906  j++;
907  }
908 
909  double M[4][8];
910 
911  for (unsigned int i1 = 0; i1 < 4; i1++) {
912  for (unsigned int i2 = 0; i2 < 4; i2++) {
913  M[i1][i2] = 0.0;
914  for (unsigned int j = 0; j < 2 * n; j++) {
915  M[i1][i2] += D[i1][j] * D[i2][j];
916  }
917  }
918  }
919 
920  invert(M, 4);
921 
922  for (unsigned int j = 0; j < N_FITSTUB * 2; j++) {
923  for (unsigned int i1 = 0; i1 < N_FITPARAM; i1++) {
924  MinvDt[i1][j] = 0.0;
925  iMinvDt[i1][j] = 0;
926  }
927  }
928 
929  for (unsigned int j = 0; j < 2 * n; j++) {
930  for (unsigned int i1 = 0; i1 < 4; i1++) {
931  for (unsigned int i2 = 0; i2 < 4; i2++) {
932  MinvDt[i1][j] += M[i1][i2 + 4] * D[i2][j];
933  }
934  }
935  }
936 
937  for (unsigned int i = 0; i < n; i++) {
938  iD[0][2 * i] =
939  D[0][2 * i] * (1 << settings.chisqphifactbits()) * settings.krinvpars() / (1 << settings.fitrinvbitshift());
940  iD[1][2 * i] =
941  D[1][2 * i] * (1 << settings.chisqphifactbits()) * settings.kphi0pars() / (1 << settings.fitphi0bitshift());
942  iD[2][2 * i] =
943  D[2][2 * i] * (1 << settings.chisqphifactbits()) * settings.ktpars() / (1 << settings.fittbitshift());
944  iD[3][2 * i] =
945  D[3][2 * i] * (1 << settings.chisqphifactbits()) * settings.kz0pars() / (1 << settings.fitz0bitshift());
946 
947  iD[0][2 * i + 1] =
948  D[0][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.krinvpars() / (1 << settings.fitrinvbitshift());
949  iD[1][2 * i + 1] =
950  D[1][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.kphi0pars() / (1 << settings.fitphi0bitshift());
951  iD[2][2 * i + 1] =
952  D[2][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.ktpars() / (1 << settings.fittbitshift());
953  iD[3][2 * i + 1] =
954  D[3][2 * i + 1] * (1 << settings.chisqzfactbits()) * settings.kz0pars() / (1 << settings.fitz0bitshift());
955 
956  //First the barrel
957  if (i < nlayers) {
958  MinvDt[0][2 * i] *= rnew[i] / sigmax;
959  MinvDt[1][2 * i] *= rnew[i] / sigmax;
960  MinvDt[2][2 * i] *= rnew[i] / sigmax;
961  MinvDt[3][2 * i] *= rnew[i] / sigmax;
962 
963  iMinvDt[0][2 * i] =
964  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i] * settings.kphi1() / settings.krinvpars();
965  iMinvDt[1][2 * i] =
966  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i] * settings.kphi1() / settings.kphi0pars();
967  iMinvDt[2][2 * i] = (1 << settings.fittbitshift()) * MinvDt[2][2 * i] * settings.kphi1() / settings.ktpars();
968  iMinvDt[3][2 * i] = (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i] * settings.kphi1() / settings.kz0pars();
969 
970  if (rnew[i] < settings.rPS2S()) {
971  MinvDt[0][2 * i + 1] /= sigmazpsbarrel;
972  MinvDt[1][2 * i + 1] /= sigmazpsbarrel;
973  MinvDt[2][2 * i + 1] /= sigmazpsbarrel;
974  MinvDt[3][2 * i + 1] /= sigmazpsbarrel;
975 
976  iMinvDt[0][2 * i + 1] =
977  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i + 1] * settings.kz() / settings.krinvpars();
978  iMinvDt[1][2 * i + 1] =
979  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i + 1] * settings.kz() / settings.kphi0pars();
980  iMinvDt[2][2 * i + 1] =
981  (1 << settings.fittbitshift()) * MinvDt[2][2 * i + 1] * settings.kz() / settings.ktpars();
982  iMinvDt[3][2 * i + 1] =
983  (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i + 1] * settings.kz() / settings.kz0pars();
984  } else {
985  MinvDt[0][2 * i + 1] /= sigmaz2;
986  MinvDt[1][2 * i + 1] /= sigmaz2;
987  MinvDt[2][2 * i + 1] /= sigmaz2;
988  MinvDt[3][2 * i + 1] /= sigmaz2;
989 
990  int fact = (1 << (settings.nzbitsstub(0) - settings.nzbitsstub(5)));
991 
992  iMinvDt[0][2 * i + 1] =
993  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i + 1] * fact * settings.kz() / settings.krinvpars();
994  iMinvDt[1][2 * i + 1] =
995  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i + 1] * fact * settings.kz() / settings.kphi0pars();
996  iMinvDt[2][2 * i + 1] =
997  (1 << settings.fittbitshift()) * MinvDt[2][2 * i + 1] * fact * settings.kz() / settings.ktpars();
998  iMinvDt[3][2 * i + 1] =
999  (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i + 1] * fact * settings.kz() / settings.kz0pars();
1000  }
1001  }
1002 
1003  //Secondly the disks
1004  else {
1005  double denom = (std::abs(alpha[i - nlayers]) < 1e-10) ? sigmaxpsdisk : sigmax2sdisk;
1006 
1007  MinvDt[0][2 * i] *= (rnew[i] / denom);
1008  MinvDt[1][2 * i] *= (rnew[i] / denom);
1009  MinvDt[2][2 * i] *= (rnew[i] / denom);
1010  MinvDt[3][2 * i] *= (rnew[i] / denom);
1011 
1012  assert(MinvDt[0][2 * i] == MinvDt[0][2 * i]);
1013 
1014  iMinvDt[0][2 * i] = (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i] * settings.kphi() / settings.krinvpars();
1015  iMinvDt[1][2 * i] = (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i] * settings.kphi() / settings.kphi0pars();
1016  iMinvDt[2][2 * i] = (1 << settings.fittbitshift()) * MinvDt[2][2 * i] * settings.kphi() / settings.ktpars();
1017  iMinvDt[3][2 * i] = (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i] * settings.kphi() / settings.kz();
1018 
1019  denom = (std::abs(alpha[i - nlayers]) < 1e-10) ? sigmazpsdisk : sigmaz2sdisk;
1020 
1021  MinvDt[0][2 * i + 1] /= denom;
1022  MinvDt[1][2 * i + 1] /= denom;
1023  MinvDt[2][2 * i + 1] /= denom;
1024  MinvDt[3][2 * i + 1] /= denom;
1025 
1026  iMinvDt[0][2 * i + 1] =
1027  (1 << settings.fitrinvbitshift()) * MinvDt[0][2 * i + 1] * settings.krprojshiftdisk() / settings.krinvpars();
1028  iMinvDt[1][2 * i + 1] =
1029  (1 << settings.fitphi0bitshift()) * MinvDt[1][2 * i + 1] * settings.krprojshiftdisk() / settings.kphi0pars();
1030  iMinvDt[2][2 * i + 1] =
1031  (1 << settings.fittbitshift()) * MinvDt[2][2 * i + 1] * settings.krprojshiftdisk() / settings.ktpars();
1032  iMinvDt[3][2 * i + 1] =
1033  (1 << settings.fitz0bitshift()) * MinvDt[3][2 * i + 1] * settings.krprojshiftdisk() / settings.kz();
1034  }
1035  }
1036 }
1037 
1038 double TrackDerTable::tpar(Settings const& settings, int diskmask, int layermask) {
1039  if (diskmask == 0)
1040  return 0.0;
1041 
1042  double tmax = 1000.0;
1043  double tmin = 0.0;
1044 
1045  for (int d = 1; d <= (int)N_DISK; d++) {
1046  if (diskmask & (1 << (2 * (5 - d) + 1))) { //PS hit
1047  double dmax = settings.zmean(d - 1) / 22.0;
1048  if (dmax > sinh(2.4))
1049  dmax = sinh(2.4);
1050  double dmin = settings.zmean(d - 1) / 65.0;
1051  if (dmax < tmax)
1052  tmax = dmax;
1053  if (dmin > tmin)
1054  tmin = dmin;
1055  }
1056 
1057  if (diskmask & (1 << (2 * (5 - d)))) { //2S hit
1058  double dmax = settings.zmean(d - 1) / 65.0;
1059  double dmin = settings.zmean(d - 1) / 105.0;
1060  if (dmax < tmax)
1061  tmax = dmax;
1062  if (dmin > tmin)
1063  tmin = dmin;
1064  }
1065  }
1066 
1067  for (int l = 1; l <= (int)N_LAYER; l++) {
1068  if (layermask & (1 << (6 - l))) {
1069  double lmax = settings.zlength() / settings.rmean(l - 1);
1070  if (lmax < tmax)
1071  tmax = lmax;
1072  }
1073  }
1074 
1075  return 0.5 * (tmax + tmin) * 1.07;
1076 }
void setz0dzordr(int i, double z0dzordr)
Definition: TrackDer.h:52
Log< level::Info, true > LogVerbatim
unsigned int alphaBits_
Definition: TrackDerTable.h:72
double kz() const
Definition: Settings.h:342
double stripLength(bool isPSmodule) const
Definition: Settings.h:290
int chisqzfactbits() const
Definition: Settings.h:421
int nrinvBitsTable() const
Definition: Settings.h:231
constexpr int N_DISK
Definition: Settings.h:26
double rPS2S() const
Definition: Settings.h:362
bool writeTable() const
Definition: Settings.h:201
static void calculateDerivatives(Settings const &settings, unsigned int nlayers, double r[N_LAYER], unsigned int ndisks, double z[N_DISK], double alpha[N_DISK], double t, double rinv, double D[N_FITPARAM][N_FITSTUB *2], int iD[N_FITPARAM][N_FITSTUB *2], double MinvDt[N_FITPARAM][N_FITSTUB *2], int iMinvDt[N_FITPARAM][N_FITSTUB *2], double sigma[N_FITSTUB *2], double kfactor[N_FITSTUB *2])
double kphi1() const
Definition: Settings.h:339
int alphaBitsTable() const
Definition: Settings.h:230
std::vector< int > LayerMem_
Definition: TrackDerTable.h:65
double kz0pars() const
Definition: Settings.h:431
tuple disks
Definition: alignBH_cfg.py:13
void setitdphi(int i, int itdphi)
Definition: TrackDer.h:37
Settings const & settings_
Definition: TrackDerTable.h:63
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int getEntries() const
Definition: TrackDerTable.h:37
double zlength() const
Definition: Settings.h:133
void setirinvdphi(int i, int irinvdphi)
Definition: TrackDer.h:33
double rinvmax() const
Definition: Settings.h:226
constexpr unsigned int N_PROJ
Definition: Settings.h:1069
std::vector< int > LayerDiskMem_
Definition: TrackDerTable.h:67
unsigned int LayerMemBits_
Definition: TrackDerTable.h:69
void setrinvdzordr(int i, double rinvdzordr)
Definition: TrackDer.h:46
double ktpars() const
Definition: Settings.h:430
double krinvpars() const
Definition: Settings.h:425
int diskMask() const
Definition: TrackDer.h:29
assert(be >=bs)
void setirinvdzordr(int i, int irinvdzordr)
Definition: TrackDer.h:34
int fittbitshift() const
Definition: Settings.h:414
void setz0dphi(int i, double z0dphi)
Definition: TrackDer.h:51
unsigned int DiskMemBits_
Definition: TrackDerTable.h:70
int getIndex(unsigned int layermask, unsigned int diskmask) const
static std::string to_string(const XMLCh *ch)
int fitz0bitshift() const
Definition: Settings.h:415
void setz0dzcorr(int i, int j, double z0dzcorr)
Definition: TrackDer.h:55
double kphi0pars() const
Definition: Settings.h:429
void settdzordr(int i, double tdzordr)
Definition: TrackDer.h:50
int rcorrbits() const
Definition: Settings.h:418
unsigned int LayerDiskMemBits_
Definition: TrackDerTable.h:71
std::string tablePath() const
Definition: Settings.h:205
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:91
double half2SmoduleWidth() const
Definition: Settings.h:140
static double tpar(Settings const &settings, int diskmask, int layermask)
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
constexpr unsigned int N_TRKLSEED
Definition: Settings.h:1068
T sqrt(T t)
Definition: SSEVec.h:19
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
std::vector< int > DiskMem_
Definition: TrackDerTable.h:66
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double stripPitch(bool isPSmodule) const
Definition: Settings.h:284
void settdphi(int i, double tdphi)
Definition: TrackDer.h:49
int layerMask() const
Definition: TrackDer.h:28
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setphi0dzordr(int i, double phi0dzordr)
Definition: TrackDer.h:48
const TrackDer * getDerivatives(int index) const
Definition: TrackDerTable.h:24
static void invert(double M[4][8], unsigned int n)
Log< level::Warning, true > LogPrint
d
Definition: ztail.py:151
double zmean(unsigned int iDisk) const
Definition: Settings.h:176
ii
Definition: cuy.py:589
int irinv() const
Definition: TrackDer.h:31
bool debugTracklet() const
Definition: Settings.h:194
void settpar(double t)
Definition: TrackDer.h:81
void addEntry(unsigned int layermask, unsigned int diskmask, int multiplicity, int nrinv)
void setiz0dzcorr(int i, int j, int iz0dzcorr)
Definition: TrackDer.h:43
static const double tmax[3]
double kr() const
Definition: Settings.h:344
const double fact
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
void setitdzcorr(int i, int j, int itdzcorr)
Definition: TrackDer.h:42
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
void set(int value, int nbits, bool positive=true, int line=-1, const char *file=nullptr)
Definition: FPGAWord.cc:14
constexpr unsigned int N_FITPARAM
Definition: Settings.h:1072
void readPatternFile(std::string fileName)
void setiz0dzordr(int i, int iz0dzordr)
Definition: TrackDer.h:40
void setiphi0dphi(int i, int iphi0dphi)
Definition: TrackDer.h:35
string fname
main script
void settdzcorr(int i, int j, double tdzcorr)
Definition: TrackDer.h:54
double a
Definition: hdecay.h:121
int alphaMask() const
Definition: TrackDer.h:30
void setiz0dphi(int i, int iz0dphi)
Definition: TrackDer.h:39
constexpr unsigned int N_FITSTUB
Definition: Settings.h:1073
void setitdzordr(int i, int itdzordr)
Definition: TrackDer.h:38
void setphi0dphi(int i, double phi0dphi)
Definition: TrackDer.h:47
int fitrinvbitshift() const
Definition: Settings.h:412
int chisqphifactbits() const
Definition: Settings.h:420
double krprojshiftdisk() const
Definition: Settings.h:441
const unsigned int kfactor
double kphi() const
Definition: Settings.h:338
tmp
align.sh
Definition: createJobs.py:716
void setiphi0dzordr(int i, int iphi0dzordr)
Definition: TrackDer.h:36
int fitphi0bitshift() const
Definition: Settings.h:413
std::vector< TrackDer > derivatives_
Definition: TrackDerTable.h:77
std::string str() const
Definition: FPGAWord.cc:54
void setrinvdphi(int i, double rinvdphi)
Definition: TrackDer.h:45
bool warnNoDer() const
Definition: Settings.h:198
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:154
constexpr int N_LAYER
Definition: Settings.h:25