CMS 3D CMS Logo

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