GCC Code Coverage Report


Directory: ./
File: src/util/mm-layout.c
Date: 2025-09-01 06:19:01
Exec Total Coverage
Lines: 0 17 0.0%
Functions: 0 3 0.0%
Branches: 0 5 0.0%

Line Branch Exec Source
1 #include "na64util/mm-layout.h"
2
3 #include <stdlib.h>
4
5 /**\file
6 * \brief File containing static data related to APV-managed detectors.
7 *
8 * Strip mapping for GEMs and Micromegas is described here.
9 * */
10
11 // In DDD remapping is already done, so we should return identity.
12 // However, it may be useful to store remapping formula for
13 // future usage and for possible reference.
14 # define GEM_APV_IDENTITY
15
16 const NA64DP_APVStripNo_t na64dp_MM_JointWires[64][5] = {
17 { 0, 64, 128, 192, 256 },
18 { 1, 119, 133, 219, 297 },
19 { 2, 110, 138, 246, 274 },
20 { 3, 101, 143, 209, 315 },
21 { 4, 92, 148, 236, 292 },
22 { 5, 83, 153, 199, 269 },
23 { 6, 74, 158, 226, 310 },
24 { 7, 65, 163, 253, 287 },
25 { 8, 120, 168, 216, 264 },
26 { 9, 111, 173, 243, 305 },
27 { 10, 102, 178, 206, 282 },
28 { 11, 93, 183, 233, 259 },
29 { 12, 84, 188, 196, 300 },
30 { 13, 75, 129, 223, 277 },
31 { 14, 66, 134, 250, 318 },
32 { 15, 121, 139, 213, 295 },
33 { 16, 112, 144, 240, 272 },
34 { 17, 103, 149, 203, 313 },
35 { 18, 94, 154, 230, 290 },
36 { 19, 85, 159, 193, 267 },
37 { 20, 76, 164, 220, 308 },
38 { 21, 67, 169, 247, 285 },
39 { 22, 122, 174, 210, 262 },
40 { 23, 113, 179, 237, 303 },
41 { 24, 104, 184, 200, 280 },
42 { 25, 95, 189, 227, 257 },
43 { 26, 86, 130, 254, 298 },
44 { 27, 77, 135, 217, 275 },
45 { 28, 68, 140, 244, 316 },
46 { 29, 123, 145, 207, 293 },
47 { 30, 114, 150, 234, 270 },
48 { 31, 105, 155, 197, 311 },
49 { 32, 96, 160, 224, 288 },
50 { 33, 87, 165, 251, 265 },
51 { 34, 78, 170, 214, 306 },
52 { 35, 69, 175, 241, 283 },
53 { 36, 124, 180, 204, 260 },
54 { 37, 115, 185, 231, 301 },
55 { 38, 106, 190, 194, 278 },
56 { 39, 97, 131, 221, 319 },
57 { 40, 88, 136, 248, 296 },
58 { 41, 79, 141, 211, 273 },
59 { 42, 70, 146, 238, 314 },
60 { 43, 125, 151, 201, 291 },
61 { 44, 116, 156, 228, 268 },
62 { 45, 107, 161, 255, 309 },
63 { 46, 98, 166, 218, 286 },
64 { 47, 89, 171, 245, 263 },
65 { 48, 80, 176, 208, 304 },
66 { 49, 71, 181, 235, 281 },
67 { 50, 126, 186, 198, 258 },
68 { 51, 117, 191, 225, 299 },
69 { 52, 108, 132, 252, 276 },
70 { 53, 99, 137, 215, 317 },
71 { 54, 90, 142, 242, 294 },
72 { 55, 81, 147, 205, 271 },
73 { 56, 72, 152, 232, 312 },
74 { 57, 127, 157, 195, 289 },
75 { 58, 118, 162, 222, 266 },
76 { 59, 109, 167, 249, 307 },
77 { 60, 100, 172, 212, 284 },
78 { 61, 91, 177, 239, 261 },
79 { 62, 82, 182, 202, 302 },
80 { 63, 73, 187, 229, 279 },
81 };
82
83
84 const NA64DP_APVStripNo_t *
85 na64_APV_strip_mapper__micromegas_joints( NA64DP_APVWireNo_t wN, NA64DP_APVNWires_t * lPtr ) {
86 if( wN >= sizeof(na64dp_MM_JointWires) / (sizeof(*na64dp_MM_JointWires)) ) {
87 return NULL;
88 }
89 if( lPtr ) {
90 *lPtr = 5;
91 }
92 return na64dp_MM_JointWires[wN];
93 }
94
95 # ifndef GEM_APV_IDENTITY
96 static NA64DP_APVStripNo_t _static_na64_tripleGEMMappingDummy;
97 # endif
98
99 /**The particular relation may be seen in Sebastian Uhl diploma thesis, Nov. 2008,
100 * (4.7), p.30, or in gemMonitor/src/gemDecode.cpp:556 :
101 * strip nr. = 32*(n mod 4) + 8*int(n/4) - 31*int(n/16)
102 */
103 const NA64DP_APVStripNo_t *
104 na64_APV_strip_mapper__GEM_demultiplexing_scheme( NA64DP_APVWireNo_t n, NA64DP_APVNWires_t * lPtr ) {
105 if( lPtr ) {
106 *lPtr = 1;
107 }
108 if( n > 256 ) { // TODO: check this value!
109 return NULL;
110 }
111 # ifdef GEM_APV_IDENTITY
112 return na64_APV_strip_mapper__identity( n, lPtr );
113 # else
114 _static_na64_tripleGEMMappingDummy
115 = 32*(n%4) + 8*(n/4) - 31*(n/16);
116 return &_static_na64_tripleGEMMappingDummy;
117 # endif
118 }
119
120 static NA64DP_APVStripNo_t _static_na64_identityStripMappingDummy;
121 const NA64DP_APVStripNo_t *
122 na64_APV_strip_mapper__identity( NA64DP_APVWireNo_t wn, NA64DP_APVNWires_t * lPtr ) {
123 if( lPtr ) {
124 *lPtr = 1;
125 }
126 _static_na64_identityStripMappingDummy = wn;
127 return &_static_na64_identityStripMappingDummy;
128 }
129
130
131
132