# Project CMSSW displayed by LXR

File indexing completed on 2023-03-17 11:12:46

```0001 from __future__ import print_function
0002 # Generate 2^6 = 64 entries
0003 # a=12, b=23, c=34, d=13, e=14, f=24
0004
0005 entries = []
0006 for a in [1,0]:
0007   for b in [1,0]:
0008     for c in [1,0]:
0009       for d in [1,0]:
0010         for e in [1,0]:
0011           for f in [1,0]:
0012             entry = (a,b,c,d,e,f)
0013             entries.append(entry)
0014
0015 ## Debug
0016 #for entry in entries:
0017 #  print entry
0018
0019 # ______________________________________________________________________________
0020 # Encode the truth table logic
0021 #
0022 # From Andrew Brinkerhoff (2017-11-30):
0023 #   * All stations which are kept in the track must have a valid dTheta (< max) to all other stations kept in the track.
0024 #   * 3-station tracks are always preferred over 2-station tracks.
0025 #   * Tracks where the first station is ME1 are most-preferred, followed by ME2, followed by ME3.
0026 #   * After that, tracks where the second station is ME2 are most-preferred, followed by ME3, followed by ME4.
0027
0028 results = []
0029 for entry in entries:
0030   (a,b,c,d,e,f) = entry
0031
0032   # Everyone is good
0033   if a and b and c and d and e and f:
0035
0036   # 12, 23, 13 are good
0037   elif a and b and d:
0039
0040   # 12, 24, 14 are good
0041   elif a and f and e:
0043
0044   # 13, 34, 14 are good
0045   elif d and c and e:
0047
0048   # 23, 34, 24 are good
0049   elif b and c and f:
0051
0052   # 12 is good
0053   elif a:
0055
0056   # 13 is good
0057   elif d:
0059
0060   # 14 is good
0061   elif e:
0063
0064   # 23 is good
0065   elif b:
0067
0068   # 24 is good
0069   elif f:
0071
0072   # 34 is good
0073   elif c:
0075
0076   # else
0077   else:
0078     vmask = (0,0,0,0)  # fail
0079
0081
0082
0083 # ______________________________________________________________________________
0084 # Output
0085 for result in results:
0086   (w,x,y,z) = result
0087   print("%i%i%i%i" % (z,y,x,w))
0088
0089 # Output as C++ array
0090 generate_cpp_array = False
0091 if generate_cpp_array:
0092   linebreak = "\n    "
0093   sep = ", "
0094   s = "static const int trk_bld[64] = {"
0095   s += linebreak
0096   i = 0
0097   for result in results:
0098     (w,x,y,z) = result
0099     s += "0b%i%i%i%i" % (z,y,x,w)
0100     if i != 63: s += sep
0101     if i%8 == 7 and i != 63:  s += linebreak
0102     i += 1
0103   s += "\n};"
0104   print(s)```