Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
cosLUT.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef GLOBALSIM_COSLUT_H
5 #define GLOBALSIM_COSLUT_H
6 
7 /*
8  Comments from the original vhd file:
9  --! @file
10  --! @brief Internal entity to calculate Cos(phi) using a LUT.
11  --! @details
12  --! Internal entity to calculate Cos(phi) using a LUT. The bitwidths are chosen such that
13  --! no duplicate values occur in the output.
14  --! @author Johannes Damp
15 
16  signal phiLutIndex : integer range 0 to 127;
17 
18  -- 1 sign bit + -- 1 integer bit(s) 9 decimal bit(s); (128 entries)
19  -- 1 sign bit + -- 1 integer bit(s) 10 decimal bit(s); (128 entries)
20 */
21 
22 #include <array>
23 
24 namespace GlobalSim {
25 
26  constexpr std::array<unsigned, 128> cosLUT {
27  // cosh(arg) arg
28 
29  0b010000000000, // 1.0(1.0), 0.0
30  0b001111111111, // 0.9987954562051724(0.9990234375), 0.04908738521234052
31  0b001111111011, // 0.9951847266721969(0.9951171875), 0.09817477042468103
32  0b001111110101, // 0.989176509964781(0.9892578125), 0.14726215563702155
33  0b001111101100, // 0.9807852804032304(0.98046875), 0.19634954084936207
34  0b001111100001, // 0.970031253194544(0.9697265625), 0.2454369260617026
35  0b001111010100, // 0.9569403357322088(0.95703125), 0.2945243112740431
36  0b001111000100, // 0.9415440651830208(0.94140625), 0.3436116964863836
37  0b001110110010, // 0.9238795325112867(0.923828125), 0.39269908169872414
38  0b001110011110, // 0.9039892931234433(0.904296875), 0.44178646691106466
39  0b001110000111, // 0.881921264348355(0.8818359375), 0.4908738521234052
40  0b001101101110, // 0.8577286100002721(0.857421875), 0.5399612373357456
41  0b001101010011, // 0.8314696123025452(0.8310546875), 0.5890486225480862
42  0b001100110110, // 0.8032075314806449(0.802734375), 0.6381360077604268
43  0b001100011000, // 0.773010453362737(0.7734375), 0.6872233929727672
44  0b001011110111, // 0.7409511253549591(0.7412109375), 0.7363107781851077
45  0b001011010100, // 0.7071067811865476(0.70703125), 0.7853981633974483
46  0b001010110000, // 0.6715589548470183(0.671875), 0.8344855486097889
47  0b001010001010, // 0.6343932841636455(0.634765625), 0.8835729338221293
48  0b001001100010, // 0.5956993044924335(0.595703125), 0.9326603190344698
49  0b001000111001, // 0.5555702330196023(0.5556640625), 0.9817477042468103
50  0b001000001110, // 0.5141027441932217(0.513671875), 1.030835089459151
51  0b000111100011, // 0.4713967368259978(0.4716796875), 1.0799224746714913
52  0b000110110110, // 0.4275550934302822(0.427734375), 1.1290098598838318
53  0b000110001000, // 0.38268343236508984(0.3828125), 1.1780972450961724
54  0b000101011001, // 0.33688985339222005(0.3369140625), 1.227184630308513
55  0b000100101001, // 0.29028467725446233(0.2900390625), 1.2762720155208536
56  0b000011111001, // 0.24298017990326398(0.2431640625), 1.325359400733194
57  0b000011001000, // 0.19509032201612833(0.1953125), 1.3744467859455345
58  0b000010010110, // 0.14673047445536175(0.146484375), 1.423534171157875
59  0b000001100100, // 0.09801714032956077(0.09765625), 1.4726215563702154
60  0b000000110010, // 0.049067674327418126(0.048828125), 1.521708941582556
61  0b000000000000, // 6.123233995736766e-17(0.0), 1.5707963267948966
62  0b111111001110, // -0.04906767432741801(-0.048828125), 1.6198837120072371
63  0b111110011100, // -0.09801714032956065(-0.09765625), 1.6689710972195777
64  0b111101101010, // -0.14673047445536164(-0.146484375), 1.7180058482431918
65  0b111100111000, // -0.1950903220161282(-0.1953125), 1.7671458676442586
66  0b111100000111, // -0.24298017990326387(-0.2431640625), 1.8162332528565992
67  0b111011010111, // -0.29028467725446216(-0.2900390625), 1.8653206380689396
68  0b111010100111, // -0.33688985339221994(-0.3369140625), 1.9144080232812801
69  0b111001111000, // -0.3826834323650897(-0.3828125), 1.9634954084936207
70  0b111001001010, // -0.42755509343028186(-0.427734375), 2.012582793705961
71  0b111000011101, // -0.4713967368259977(-0.4716796875), 2.061670178918302
72  0b110111110010, // -0.5141027441932217(-0.513671875), 2.110757564130642
73  0b110111000111, // -0.555570233019602(-0.5556640625), 2.1598449493429825
74  0b110110011110, // -0.5956993044924334(-0.595703125), 2.2089323345553233
75  0b110101110110, // -0.6343932841636454(-0.634765625), 2.2580197197676637
76  0b110101010000, // -0.6715589548470184(-0.671875), 2.3071071049800045
77  0b110100101100, // -0.7071067811865475(-0.70703125), 2.356194490192345
78  0b110100001001, // -0.7409511253549589(-0.7412109375), 2.405281875404685
79  0b110011101000, // -0.773010453362737(-0.7734375), 2.454369260617026
80  0b110011001010, // -0.8032075314806448(-0.802734375), 2.5034566458293663
81  0b110010101101, // -0.8314696123025453(-0.8310546875), 2.552544031041707
82  0b110010010010, // -0.857728610000272(-0.857421875), 2.6016314162540475
83  0b110001111001, // -0.8819212643483549(-0.8818359375), 2.650718801466388
84  0b110001100010, // -0.9039892931234433(-0.904296875), 2.6998061866787286
85  0b110001001110, // -0.9238795325112867(-0.923828125), 2.748893571891069
86  0b110000111100, // -0.9415440651830207(-0.94140625), 2.7979809571034093
87  0b110000101100, // -0.9569403357322088(-0.95703125), 2.84706834231575
88  0b110000011111, // -0.970031253194544(-0.9697265625), 2.8961557275280905
89  0b110000010100, // -0.9807852804032304(-0.98046875), 2.945243112740431
90  0b110000001011, // -0.989176509964781(-0.9892578125), 2.9943304979527716
91  0b110000000101, // -0.9951847266721968(-0.9951171875), 3.043417883165112
92  0b110000000001, // -0.9987954562051724(-0.9990234375), 3.0925052683774528
93  0b110000000000, // -1.0(-1.0), 3.141592653589793
94  0b110000000001, // -0.9987954562051724(-0.9990234375), 3.1906800388021335
95  0b110000000101, // -0.9951847266721969(-0.9951171875), 3.2397674240144743
96  0b110000001011, // -0.989176509964781(-0.9892578125), 3.2888548092268146
97  0b110000010100, // -0.9807852804032304(-0.98046875), 3.3379421944391554
98  0b110000011111, // -0.970031253194544(-0.9697265625), 3.3870295796514958
99  0b110000101100, // -0.9569403357322089(-0.95703125), 3.436116964863836
100  0b110000111100, // -0.9415440651830208(-0.94140625), 3.485204350076177
101  0b110001001110, // -0.9238795325112868(-0.923828125), 3.5342917352885173
102  0b110001100010, // -0.9039892931234434(-0.904296875), 3.5833791205008576
103  0b110001111001, // -0.881921264348355(-0.8818359375), 3.6324665057131984
104  0b110010010010, // -0.8577286100002721(-0.857421875), 3.6815538909255388
105  0b110010101101, // -0.8314696123025455(-0.8310546875), 3.730641276137879
106  0b110011001010, // -0.8032075314806449(-0.802734375), 3.77972866135022
107  0b110011101000, // -0.7730104533627371(-0.7734375), 3.8288160465625602
108  0b110100001001, // -0.7409511253549591(-0.7412109375), 3.877903431774901
109  0b110100101100, // -0.7071067811865477(-0.70703125), 3.9269908169872414
110  0b110101010000, // -0.6715589548470187(-0.671875), 3.9760782021995817
111  0b110101110110, // -0.6343932841636459(-0.634765625), 4.025165587411922
112  0b110110011110, // -0.5956993044924331(-0.595703125), 4.074252972624263
113  0b110111000111, // -0.5555702330196022(-0.5556640625), 4.123340357836604
114  0b110111110010, // -0.5141027441932218(-0.513671875), 4.172427743048944
115  0b111000011101, // -0.47139673682599786(-0.4716796875), 4.221515128261284
116  0b111001001010, // -0.4275550934302825(-0.427734375), 4.270602513473625
117  0b111001111000, // -0.38268343236509034(-0.3828125), 4.319689898685965
118  0b111010100111, // -0.33688985339221994(-0.3369140625), 4.368777283898306
119  0b111011010111, // -0.29028467725446244(-0.2900390625), 4.417864669110647
120  0b111100000111, // -0.24298017990326412(-0.2431640625), 4.466952054322987
121  0b111100111000, // -0.19509032201612866(-0.1953125), 4.516039439535327
122  0b111101101010, // -0.1467304744553623(-0.146484375), 4.565126824747668
123  0b111110011100, // -0.09801714032956045(-0.09765625), 4.614214209960009
124  0b111111001110, // -0.04906767432741803(-0.048828125), 4.663301595172349
125  0b000000000000, // -1.8369701987210297e-16(0.0), 4.71238898038469
126  0b000000110010, // 0.04906767432741766(0.048828125), 4.76147636559703
127  0b000001100100, // 0.09801714032956009(0.09765625), 4.81056375080937
128  0b000010010110, // 0.14673047445536194(0.146484375), 4.859651136021712
129  0b000011001000, // 0.1950903220161283(0.1953125), 4.908738521234052
130  0b000011111001, // 0.24298017990326376(0.2431640625), 4.957825906446392
131  0b000100101001, // 0.29028467725446205(0.2900390625), 5.006913291658733
132  0b000101011001, // 0.3368898533922196(0.3369140625), 5.056000676871073
133  0b000110001000, // 0.38268343236509(0.3828125), 5.105088062083414
134  0b000110110110, // 0.42755509343028214(0.427734375), 5.154175447295755
135  0b000111100011, // 0.4713967368259976(0.4716796875), 5.203262832508095
136  0b001000001110, // 0.5141027441932216(0.513671875), 5.252350217720435
137  0b001000111001, // 0.5555702330196018(0.5556640625), 5.301437602932776
138  0b001001100010, // 0.5956993044924329(0.595703125), 5.350524988145116
139  0b001010001010, // 0.6343932841636456(0.634765625), 5.399612373357457
140  0b001010110000, // 0.6715589548470183(0.671875), 5.448699758569798
141  0b001011010100, // 0.7071067811865474(0.70703125), 5.497787143782138
142  0b001011110111, // 0.7409511253549589(0.7412109375), 5.546874528994478
143  0b001100011000, // 0.7730104533627367(0.7734375), 5.595961914206819
144  0b001100110110, // 0.803207531480645(0.802734375), 5.64504929941916
145  0b001101010011, // 0.8314696123025452(0.8310546875), 5.6941366846315
146  0b001101101110, // 0.857728610000272(0.857421875), 5.743224069843841
147  0b001110000111, // 0.8819212643483548(0.8818359375), 5.792311455056181
148  0b001110011110, // 0.9039892931234431(0.904296875), 5.841398840268521
149  0b001110110010, // 0.9238795325112865(0.923828125), 5.890486225480862
150  0b001111000100, // 0.9415440651830208(0.94140625), 5.939573610693203
151  0b001111010100, // 0.9569403357322088(0.95703125), 5.988660995905543
152  0b001111100001, // 0.970031253194544(0.9697265625), 6.037748381117884
153  0b001111101100, // 0.9807852804032303(0.98046875), 6.086835766330224
154  0b001111110101, // 0.9891765099647809(0.9892578125), 6.135923151542564
155  0b001111111011, // 0.9951847266721969(0.9951171875), 6.1850105367549055
156  0b001111111111 // 0.9987954562051724(0.9990234375), 6.234097921967246
157  };
158 }
159 #endif
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
GlobalSim::cosLUT
constexpr std::array< unsigned, 128 > cosLUT
Definition: cosLUT.h:26