Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCLHashing.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// INCL++ intra-nuclear cascade model
27// Alain Boudard, CEA-Saclay, France
28// Joseph Cugnon, University of Liege, Belgium
29// Jean-Christophe David, CEA-Saclay, France
30// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31// Sylvie Leray, CEA-Saclay, France
32// Davide Mancusi, CEA-Saclay, France
33//
34#define INCLXX_IN_GEANT4_MODE 1
35
36#include "globals.hh"
37
38/** \file G4INCLHashing.hh
39 * \brief Functions for hashing a collection of NucleonItems.
40 *
41 * \date 12th October 2012
42 * \author Davide Mancusi
43 */
44
45#ifndef G4INCLHASHING_HH_
46#define G4INCLHASHING_HH_
47
48#ifdef INCLXX_IN_GEANT4_MODE
49#define INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set 1
50#endif // INCLXX_IN_GEANT4_MODE
51
52#ifdef INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask
53
54#include <algorithm>
55#include <numeric>
56#include <climits>
57// #include <cassert>
58
59namespace G4INCL {
60
61 namespace Hashing {
62
63 typedef G4int NucleonItem;
64
65 // the C++ standard guarantees that unsigned long is at least 32-bit long
66 typedef unsigned long HashType;
67
68 /* Depending on the size of the HashType type, we use 32-bit or 64-bit
69 * binary masks. 64-bit masks guarantee lower collision rates (about a
70 * factor of 3). Checks are done using compile-time constants defined in
71 * the standard <climits> header.
72 */
73
74 namespace {
75 const G4int maskTableSize = 500;
76 HashType mask[maskTableSize] = {
77#if ULONG_MAX >= 18446744073709551615UL // 2^64-1
78 // unsigned longs have at least 64 bits here
79 4702504706864814267UL,
80 15867743096752998125UL,
81 1925133831785711339UL,
82 3063678697824149615UL,
83 3234475698548538313UL,
84 7917662962824220875UL,
85 9924018995951912525UL,
86 4682901166658838314UL,
87 981361508296534881UL,
88 18376824469534567556UL,
89 5343971687892173674UL,
90 10169451505660710328UL,
91 7865786236744900341UL,
92 10279352445822536091UL,
93 7089630702066408548UL,
94 4808534960882600398UL,
95 12538238618753707399UL,
96 16091508301730012097UL,
97 14073498192850855514UL,
98 9966250765115558375UL,
99 5718582854016674314UL,
100 5837057680281951483UL,
101 1596870119086046964UL,
102 15866877264435719977UL,
103 12743659579234384899UL,
104 13589152059793213451UL,
105 3364441792317801205UL,
106 17190534087980602002UL,
107 2252844317879582875UL,
108 16883577324406774376UL,
109 15985239218161130895UL,
110 3661288085782215193UL,
111 17294313791381397188UL,
112 9405115097872546015UL,
113 2834208340246893214UL,
114 15589349083551097162UL,
115 7475687940900359446UL,
116 2706367355862311522UL,
117 17987211229193808759UL,
118 6863833750504706813UL,
119 3685392250678121047UL,
120 11759380240055300923UL,
121 13403449794574083242UL,
122 1985973959990096358UL,
123 15223952677867744295UL,
124 6118509595165778043UL,
125 815155895778500187UL,
126 18185573450595916074UL,
127 5501350898920817482UL,
128 382043392356382894UL,
129 7212372096396984419UL,
130 17216082813533838272UL,
131 11664929762302443627UL,
132 12742534429666211769UL,
133 10885936672907243422UL,
134 7408809357861601856UL,
135 7235809803254354851UL,
136 10923449527984005964UL,
137 11846584293234382222UL,
138 10656509822128626836UL,
139 2129734486054336774UL,
140 4595091378435214061UL,
141 9874818728883580365UL,
142 5946304945334907747UL,
143 10039693308935676801UL,
144 13281974385330546238UL,
145 18100260506304059768UL,
146 2874169620796400411UL,
147 7108218580097801290UL,
148 1609767302727070556UL,
149 11296708194993589343UL,
150 13937355006285948174UL,
151 4714440178991372538UL,
152 16551309706022489963UL,
153 10000176812340548792UL,
154 11878058786115320873UL,
155 17227685596830233118UL,
156 6913194524255335692UL,
157 8581157771211862326UL,
158 7692516248830269819UL,
159 4834805303668841320UL,
160 17683695285788382628UL,
161 3163270552620053128UL,
162 7501354178009882428UL,
163 18032292064795682158UL,
164 14903091228667847945UL,
165 12658813769564311973UL,
166 11071671991853641692UL,
167 1898680911275368123UL,
168 11850012838739454071UL,
169 11605340059702017433UL,
170 1993475538032240150UL,
171 14225643076178260981UL,
172 6073746146812460969UL,
173 10427646200541715974UL,
174 8534830515125041658UL,
175 12137748989343460832UL,
176 401619354176178507UL,
177 10566842722928406433UL,
178 2726007197202736953UL,
179 12070986965363522186UL,
180 14306741808513945796UL,
181 9411600548893210409UL,
182 10677814577847517837UL,
183 2524629524427176799UL,
184 13769537677295179355UL,
185 2202164469715649820UL,
186 18048299992904550974UL,
187 11620367199819191275UL,
188 12863789957300408274UL,
189 9470331939464407385UL,
190 1530202837192022943UL,
191 8835064955139736011UL,
192 8145200231008682998UL,
193 7839809942742909916UL,
194 9138434136821323472UL,
195 14559393378324131957UL,
196 17365140272468484867UL,
197 12986052322695094991UL,
198 15032117076709947810UL,
199 3710476151324188272UL,
200 1301282554894996635UL,
201 10667152340954078766UL,
202 6983777770664759713UL,
203 16611664140947488647UL,
204 12136122930610106551UL,
205 15900825787656229127UL,
206 10248132639811024681UL,
207 11698219706208598358UL,
208 12307261434875431124UL,
209 14365082098869236341UL,
210 7765033571440697089UL,
211 14810290195054154855UL,
212 9618298383970391972UL,
213 5541541247731255102UL,
214 16567733959804019203UL,
215 17600930129818672877UL,
216 5232016726685772558UL,
217 226023602797856284UL,
218 3268675878373668427UL,
219 15412168229420758040UL,
220 9483353024934253554UL,
221 12957711733854877641UL,
222 13202855362863795860UL,
223 14659098127488639325UL,
224 5642266569510167780UL,
225 8405185641276686415UL,
226 12567678120796482638UL,
227 5572663458795121052UL,
228 11292924459778654315UL,
229 12907130784326268258UL,
230 2781503111506861655UL,
231 14052031913630628463UL,
232 7662091316495917798UL,
233 12388345726433231307UL,
234 2855096782092770172UL,
235 143760647337486211UL,
236 5268378935483038729UL,
237 14347085534022186031UL,
238 8226804542313416051UL,
239 503042565036387930UL,
240 13277939264481364629UL,
241 4807934385534294767UL,
242 6554792055682376182UL,
243 3505789456125861647UL,
244 17485983928210687457UL,
245 6551825177685364660UL,
246 6530399878351375719UL,
247 11618616536378075323UL,
248 8710939588645435621UL,
249 15913776342681996234UL,
250 12975832615100357766UL,
251 11385194348110364656UL,
252 7334273726237402463UL,
253 18215307287507846020UL,
254 108052987233117093UL,
255 14819872198639686030UL,
256 7651108032227837181UL,
257 7326148382022660565UL,
258 15520843621422491193UL,
259 14890169031248899249UL,
260 3302880341533628710UL,
261 17509231796729795392UL,
262 6938974810266312299UL,
263 9904104728819873047UL,
264 10277854813228565819UL,
265 8062859346560164933UL,
266 11953220042241400520UL,
267 8905905195342696566UL,
268 8620925171331846539UL,
269 15354008279539346333UL,
270 16255477929425666651UL,
271 15625465014312179739UL,
272 6560194503171884780UL,
273 458508474659358201UL,
274 11178141379033004711UL,
275 7025589002713530514UL,
276 6196040542056180472UL,
277 1771599404396005753UL,
278 490848885681539136UL,
279 15438702070227423706UL,
280 8790555204480314499UL,
281 6572556090639551862UL,
282 3282457245646221158UL,
283 4239195535437592000UL,
284 16001734625059485025UL,
285 14396081511655033925UL,
286 10261432601192522025UL,
287 9247260218125952769UL,
288 16080570631414044686UL,
289 15656989589485934942UL,
290 10761254633620277391UL,
291 1363122333823743651UL,
292 14847079675279608117UL,
293 6077849015756077442UL,
294 15290828636077500470UL,
295 220281240092237795UL,
296 15760968530563963031UL,
297 1364939791854189821UL,
298 5997510653682588941UL,
299 2006088633984038082UL,
300 1383498232486134285UL,
301 17859041093815211104UL,
302 15894184107946313879UL,
303 18173079296415961736UL,
304 3443997055549483358UL,
305 5294019672823936930UL,
306 1341830676613088487UL,
307 581727297735446503UL,
308 18219577357392561487UL,
309 17639313299012264080UL,
310 14222133713791167321UL,
311 5879505043799386532UL,
312 7557129766625449226UL,
313 13360075610958017985UL,
314 12724115904336527780UL,
315 16753075547920915484UL,
316 4116411708112171871UL,
317 16025692682808517910UL,
318 4003328942103420939UL,
319 9811320057930109787UL,
320 3576072849789367484UL,
321 17075748046009610792UL,
322 12833406223291392866UL,
323 9648248336540660688UL,
324 17476583957989300837UL,
325 16827359136787046510UL,
326 4345039153564047180UL,
327 1224716260729000059UL,
328 13959598322342824445UL,
329 10743140873520517726UL,
330 13340880620026565045UL,
331 9192556363923792986UL,
332 3841907957831078749UL,
333 246438482871824834UL,
334 4260787342534664069UL,
335 17100720253388227686UL,
336 11544966922599678750UL,
337 9293075407897592921UL,
338 1610905992411273162UL,
339 2239787421847352995UL,
340 15182496755963432304UL,
341 1823665993529743824UL,
342 7263153004799849282UL,
343 11497980475724160945UL,
344 1274355111868335897UL,
345 15057972526005432563UL,
346 11823052640709049475UL,
347 15927429045819933119UL,
348 14618154733049321749UL,
349 16861991482751749049UL,
350 5936874228331837512UL,
351 15290754097890487720UL,
352 9191375772889979508UL,
353 6816129633576113785UL,
354 12923817606396645484UL,
355 8875993281327238816UL,
356 123714282527043508UL,
357 7179882084825590703UL,
358 3925024599322075567UL,
359 2426048646574757412UL,
360 10665962527629258587UL,
361 12646312850531314143UL,
362 528129165734836933UL,
363 3701120955488573646UL,
364 15861534485058814280UL,
365 14022467189115595098UL,
366 9502851142036471883UL,
367 12432213096681522867UL,
368 751500370320404802UL,
369 1606345595406828785UL,
370 10313713517508959984UL,
371 6565609239876268324UL,
372 8654149379457545096UL,
373 6548830896464452248UL,
374 1464368532414012445UL,
375 4302937696445584032UL,
376 17063664947863781419UL,
377 8038577586991861682UL,
378 10951259595021013980UL,
379 7709630466255725074UL,
380 609806407111517279UL,
381 13860208046684354033UL,
382 15140303568956907423UL,
383 4803057729274452412UL,
384 4367455766719288283UL,
385 320027280359511727UL,
386 16020877306388137190UL,
387 3764882323315346488UL,
388 11972546313392727283UL,
389 7977601566213555124UL,
390 15148378244947865280UL,
391 4483722253329626321UL,
392 16560836625841776840UL,
393 14666077208671482135UL,
394 9298193298119711211UL,
395 12015014023744623893UL,
396 10191703760489555596UL,
397 1316913070589847725UL,
398 15881746492947991011UL,
399 13665807677473998048UL,
400 14390309917106480591UL,
401 17231567872468478469UL,
402 4562957401728953232UL,
403 11501454621029854493UL,
404 10252134323451005656UL,
405 12021948387925309670UL,
406 3525149157835967069UL,
407 10292558937206299109UL,
408 13725724605985217856UL,
409 175033751151696127UL,
410 14720951489402332470UL,
411 11927624343611332814UL,
412 567437266624809204UL,
413 14161392585443694227UL,
414 8725463779420655722UL,
415 12063468735510140344UL,
416 12026523736635889408UL,
417 16565599419781878456UL,
418 7086470817660744490UL,
419 14809513609573064984UL,
420 10898762682820885052UL,
421 13982083571459739493UL,
422 15656618354974864372UL,
423 4239583100143107224UL,
424 4322769551545487304UL,
425 13825585217369415084UL,
426 5136324433139686016UL,
427 8179080547263771206UL,
428 8279259187088296150UL,
429 6381371846375303738UL,
430 3142014871877744388UL,
431 3417815453103862427UL,
432 5556557018553548625UL,
433 7788492627093668219UL,
434 2446537327809742760UL,
435 7165731799178534002UL,
436 10969060298437286606UL,
437 16392640790529049402UL,
438 4905600830298563047UL,
439 12442106640046578583UL,
440 7139041375816724964UL,
441 18098103947732186633UL,
442 2078238351823174321UL,
443 9929562085097862277UL,
444 14231090695955652612UL,
445 16914810114016502414UL,
446 9172887937989634160UL,
447 10057184693043820912UL,
448 8739867056556181319UL,
449 1879322488574672564UL,
450 6706469496298082633UL,
451 17962793280504692541UL,
452 2796622365685518391UL,
453 14206454203780509608UL,
454 11911505185092294091UL,
455 13188421404411005493UL,
456 1002631262698104372UL,
457 16116424222649594941UL,
458 731059841323644991UL,
459 16630196285890835221UL,
460 6275370517569960592UL,
461 2762335813606797964UL,
462 1550415195017045798UL,
463 8084777285994689863UL,
464 4858045103923411134UL,
465 13517076072140006105UL,
466 16656029182431041189UL,
467 6076064496187725305UL,
468 15281271591975529160UL,
469 2275428871306187428UL,
470 15396744606475751109UL,
471 15460778948302864604UL,
472 6107847787338713474UL,
473 9357621545767658217UL,
474 4805014239018879550UL,
475 17869119773972988965UL,
476 17868495682315323441UL,
477 10660808254721474616UL,
478 7308276872489783138UL,
479 4234856545479982050UL,
480 1223334879029033304UL,
481 10995800624761949288UL,
482 16283797325974965665UL,
483 12410167362078398820UL,
484 12918484557456873081UL,
485 14423314551522087679UL,
486 4967867692111402622UL,
487 16197846038770304940UL,
488 11809884480603742831UL,
489 16802686488973843640UL,
490 2354077987008574056UL,
491 9978003576519895777UL,
492 5506048811554826358UL,
493 18433781523380564149UL,
494 4302137793340917657UL,
495 978195094879846769UL,
496 2377823329880292548UL,
497 3464291122006072777UL,
498 18046845603455616162UL,
499 13944776942598500463UL,
500 4000590694056817931UL,
501 496833875371241644UL,
502 16247695245933522501UL,
503 1505779951058046438UL,
504 11430822963532124358UL,
505 4729903064888922231UL,
506 8864507718425611027UL,
507 14643598183997536338UL,
508 4480511581250357378UL,
509 11133239898726463704UL,
510 17471052555928421508UL,
511 15541989708583753235UL,
512 7461560065837635158UL,
513 13956421526574063689UL,
514 3743280538841219763UL,
515 12020611143801404565UL,
516 6618703997501212010UL,
517 3729371474666129836UL,
518 17869245751809494685UL,
519 1833331385744685838UL,
520 1506104207003999508UL,
521 8158509169843256229UL,
522 10212507222875597491UL,
523 7211593336579637715UL,
524 14341253648497092530UL,
525 4511202703905924031UL,
526 8043833010361144102UL,
527 2512875450160943286UL,
528 18235665817864664213UL,
529 8317446467730476132UL,
530 11182884000969346056UL,
531 548357546399462395UL,
532 1960628024952592835UL,
533 4650095513901192085UL,
534 12679676177772217157UL,
535 3487733703240934135UL,
536 6446640077094538365UL,
537 1114715573562175630UL,
538 16622874083185883281UL,
539 17081932748524927392UL,
540 17192402071367355968UL,
541 15013800339030843048UL,
542 3718961432784285989UL,
543 14953817216655866296UL,
544 11410118254031919487UL,
545 17718071771819733200UL,
546 6970769915355275987UL,
547 14244261541942962860UL,
548 295778071941084510UL,
549 553041658124347434UL,
550 571128341496031343UL,
551 6867891970504820807UL,
552 16515587447694198371UL,
553 3932569386063656416UL,
554 15542525920467376967UL,
555 4513384432419818675UL,
556 7336705434792969335UL,
557 1342984449178439078UL,
558 10672151960711459277UL,
559 11668091039787926587UL,
560 15308742994910314323UL,
561 8337161158579684228UL,
562 5390473811288298369UL,
563 444117188512458090UL,
564 8602531868090961223UL,
565 1632809043568697774UL,
566 11829254858211213981UL,
567 4634227867572760505UL,
568 16086237486731074061UL,
569 4844172753138751369UL,
570 4992022238300904271UL,
571 11132360655811360102UL,
572 11660714643785469458UL,
573 2468480999090126185UL,
574 10912054708474512716UL,
575 12659667168896228555UL,
576 11988368921832936489UL,
577 5116996783249524791UL,
578 253818271896405507UL
579#else // ULONG_MAX >= 18446744073709551615
580 // unsigned longs have less than 64 bits here
581 4218046471UL,
582 1917139952UL,
583 2103556369UL,
584 1588695878UL,
585 4215491346UL,
586 216507845UL,
587 2296134958UL,
588 1868314761UL,
589 3228779327UL,
590 1785085484UL,
591 4228225705UL,
592 1165369009UL,
593 3142089765UL,
594 431503981UL,
595 3369606777UL,
596 745480828UL,
597 2744780773UL,
598 689045082UL,
599 1900506313UL,
600 2497498204UL,
601 368683604UL,
602 2225005389UL,
603 781333974UL,
604 4132002528UL,
605 2847677322UL,
606 343783736UL,
607 2901322050UL,
608 3337243677UL,
609 1665993590UL,
610 233599841UL,
611 1022462535UL,
612 1680112766UL,
613 500144658UL,
614 3013714463UL,
615 1102944137UL,
616 424404167UL,
617 1616048503UL,
618 3058072676UL,
619 2626558419UL,
620 2270217197UL,
621 1042360030UL,
622 1406615072UL,
623 2817651072UL,
624 3066388841UL,
625 3595996753UL,
626 2530300747UL,
627 1068533293UL,
628 3850615434UL,
629 2000952241UL,
630 500251219UL,
631 2785863467UL,
632 116749905UL,
633 2534901578UL,
634 2762569636UL,
635 441176494UL,
636 3611264136UL,
637 708254627UL,
638 3107133154UL,
639 3498823450UL,
640 3710248321UL,
641 3408201403UL,
642 2483680087UL,
643 1593406496UL,
644 2358632005UL,
645 1113775647UL,
646 1296788200UL,
647 866750108UL,
648 1511795181UL,
649 2007682240UL,
650 1383572622UL,
651 2747177348UL,
652 751086457UL,
653 3862498228UL,
654 1330825518UL,
655 1893848486UL,
656 3716728436UL,
657 257714096UL,
658 1129572537UL,
659 3411765329UL,
660 1445308638UL,
661 1675128925UL,
662 1177771214UL,
663 610662193UL,
664 308703855UL,
665 3766028156UL,
666 2406778266UL,
667 1614133721UL,
668 3094138658UL,
669 644181699UL,
670 3585820756UL,
671 228354647UL,
672 3895845225UL,
673 837654579UL,
674 2423338235UL,
675 3626844735UL,
676 4004795529UL,
677 1966777404UL,
678 4099992662UL,
679 561993057UL,
680 478026097UL,
681 2726060916UL,
682 160900471UL,
683 4067242522UL,
684 2107667107UL,
685 2291883857UL,
686 3366222014UL,
687 804030225UL,
688 815232690UL,
689 4173469665UL,
690 3680594736UL,
691 1812916838UL,
692 953829049UL,
693 645064420UL,
694 893103776UL,
695 1484445384UL,
696 1704310224UL,
697 3169988691UL,
698 994674462UL,
699 3348302238UL,
700 420911742UL,
701 3997852732UL,
702 3006569532UL,
703 244288857UL,
704 3012303255UL,
705 3091414730UL,
706 3919806716UL,
707 815658776UL,
708 396540369UL,
709 2296675021UL,
710 3199014033UL,
711 2569108436UL,
712 3862344457UL,
713 4058338881UL,
714 1161706542UL,
715 2972997031UL,
716 2099532487UL,
717 160888949UL,
718 427549488UL,
719 3061518659UL,
720 66373532UL,
721 3444886884UL,
722 2530414305UL,
723 3380064368UL,
724 937051782UL,
725 1302891919UL,
726 2463653477UL,
727 3547879633UL,
728 2260320717UL,
729 832678359UL,
730 2453616965UL,
731 2193052461UL,
732 799622604UL,
733 3629014225UL,
734 1522933084UL,
735 2498150583UL,
736 1976833008UL,
737 1725662928UL,
738 1733324678UL,
739 3374380020UL,
740 818903650UL,
741 718472891UL,
742 411252729UL,
743 3187730653UL,
744 798673927UL,
745 1222802842UL,
746 1985038219UL,
747 1623995355UL,
748 2603784033UL,
749 4261727525UL,
750 3939193905UL,
751 2256923068UL,
752 507372076UL,
753 229897092UL,
754 3447212333UL,
755 1015331998UL,
756 1624914646UL,
757 3270616777UL,
758 1922996004UL,
759 2303929294UL,
760 3083527264UL,
761 3511924852UL,
762 651582997UL,
763 2830297570UL,
764 2541981492UL,
765 3229134142UL,
766 535111766UL,
767 2531439891UL,
768 1176474835UL,
769 1746643607UL,
770 196953906UL,
771 190859135UL,
772 1471944757UL,
773 3764050027UL,
774 2300961517UL,
775 1200836119UL,
776 1934885757UL,
777 1017153529UL,
778 864626426UL,
779 65215191UL,
780 3649915955UL,
781 2649000649UL,
782 3056185941UL,
783 2895789221UL,
784 2705123786UL,
785 3486894128UL,
786 1764275188UL,
787 800856520UL,
788 1121637219UL,
789 3470689154UL,
790 2031015368UL,
791 1799564405UL,
792 412027838UL,
793 3505785501UL,
794 819633830UL,
795 2841515279UL,
796 397789381UL,
797 3850545068UL,
798 4038096561UL,
799 702453020UL,
800 298184560UL,
801 1331143206UL,
802 3832472400UL,
803 483752162UL,
804 3365506546UL,
805 2403178818UL,
806 2588604760UL,
807 3630868707UL,
808 2672754775UL,
809 3834743541UL,
810 625254315UL,
811 3404805826UL,
812 2758773926UL,
813 3539158313UL,
814 1304746437UL,
815 4228336097UL,
816 1790470857UL,
817 2017211747UL,
818 2823780770UL,
819 1361022238UL,
820 2442638132UL,
821 3465700788UL,
822 2602256049UL,
823 61072285UL,
824 1290754848UL,
825 1365538365UL,
826 2885926246UL,
827 3366937675UL,
828 1976271220UL,
829 4274857987UL,
830 2846551234UL,
831 3730952612UL,
832 785655762UL,
833 2640747064UL,
834 2479569674UL,
835 2988213501UL,
836 238402214UL,
837 2736968438UL,
838 1273211556UL,
839 2993298676UL,
840 2076907296UL,
841 169664466UL,
842 3590743418UL,
843 2853715414UL,
844 1494116982UL,
845 3408636076UL,
846 1354085945UL,
847 2121174096UL,
848 557203192UL,
849 2005947221UL,
850 2790204730UL,
851 3673048078UL,
852 2710286579UL,
853 2759941695UL,
854 2554805430UL,
855 1565053908UL,
856 1516728908UL,
857 457211737UL,
858 4053842378UL,
859 1926452932UL,
860 121166907UL,
861 1884552326UL,
862 2050083102UL,
863 783329973UL,
864 1002934724UL,
865 2916755028UL,
866 1574390275UL,
867 4246041184UL,
868 112940213UL,
869 4213344814UL,
870 3831377539UL,
871 3593710048UL,
872 184196123UL,
873 62388243UL,
874 1824724968UL,
875 1553056630UL,
876 2471314862UL,
877 1580248726UL,
878 1641907471UL,
879 4182117804UL,
880 244827601UL,
881 2673787044UL,
882 1245428424UL,
883 1254024234UL,
884 1944146503UL,
885 2068525708UL,
886 1452126855UL,
887 1368763640UL,
888 2063660828UL,
889 306042674UL,
890 668216774UL,
891 2002594576UL,
892 3192370193UL,
893 4189750176UL,
894 1815590529UL,
895 2838559664UL,
896 3322933511UL,
897 708460425UL,
898 3093499804UL,
899 219970021UL,
900 2136064297UL,
901 1281979964UL,
902 3437613761UL,
903 544003806UL,
904 2998811936UL,
905 1481470929UL,
906 2880899873UL,
907 3617899122UL,
908 2269535287UL,
909 2964733041UL,
910 1437018425UL,
911 4136436935UL,
912 2892386937UL,
913 2312588208UL,
914 3470825412UL,
915 3048839250UL,
916 3124535567UL,
917 74106735UL,
918 740534715UL,
919 780483498UL,
920 1703009387UL,
921 3908417545UL,
922 2925498568UL,
923 570244170UL,
924 768611579UL,
925 2561901277UL,
926 3369289022UL,
927 298430172UL,
928 3399976658UL,
929 2781253163UL,
930 2203229433UL,
931 4083764265UL,
932 1813739940UL,
933 2495956219UL,
934 1733876904UL,
935 2961522297UL,
936 2806638528UL,
937 210215678UL,
938 3179651913UL,
939 3488143624UL,
940 2162063032UL,
941 2230441611UL,
942 3104777333UL,
943 1901009578UL,
944 2357529595UL,
945 1661659881UL,
946 2275001257UL,
947 1089779619UL,
948 1019581619UL,
949 3676689000UL,
950 2363224232UL,
951 3087179246UL,
952 2521585396UL,
953 1172580989UL,
954 3363959227UL,
955 1379171244UL,
956 2568664929UL,
957 2716951910UL,
958 634711458UL,
959 1881366407UL,
960 2339310622UL,
961 1437137856UL,
962 775517573UL,
963 2403816337UL,
964 3643691625UL,
965 2796142813UL,
966 2636271743UL,
967 3548645335UL,
968 2401818065UL,
969 1430955355UL,
970 1529261488UL,
971 2672050975UL,
972 1824816344UL,
973 437321422UL,
974 1010469737UL,
975 975873927UL,
976 3808619211UL,
977 1306922849UL,
978 2306306586UL,
979 3492263153UL,
980 915764428UL,
981 4049080639UL,
982 2584666827UL,
983 2248503228UL,
984 1156685342UL,
985 3545089377UL,
986 2927987815UL,
987 1188340469UL,
988 1983809416UL,
989 2359080396UL,
990 3026745995UL,
991 1020085481UL,
992 2455748822UL,
993 2973731428UL,
994 1685598150UL,
995 2459914554UL,
996 222412187UL,
997 1550326895UL,
998 3808681066UL,
999 910364646UL,
1000 4011483211UL,
1001 3449464402UL,
1002 3094973082UL,
1003 3370230650UL,
1004 1693151952UL,
1005 3574854040UL,
1006 3557103099UL,
1007 4108399894UL,
1008 3762036621UL,
1009 2337346271UL,
1010 1005455572UL,
1011 3860207735UL,
1012 1771002576UL,
1013 199004943UL,
1014 1578846676UL,
1015 2676995104UL,
1016 4076948954UL,
1017 830057378UL,
1018 459065499UL,
1019 3804368733UL,
1020 3499868406UL,
1021 852696530UL,
1022 514613423UL,
1023 1584281952UL,
1024 985799155UL,
1025 1895009366UL,
1026 3825253357UL,
1027 1782693174UL,
1028 2196979238UL,
1029 1308429445UL,
1030 2960767408UL,
1031 2285337396UL,
1032 2065293874UL,
1033 1306724979UL,
1034 4056398081UL,
1035 4047112430UL,
1036 3606840914UL,
1037 3117829644UL,
1038 3877872838UL,
1039 3297977849UL,
1040 336255855UL,
1041 3794593369UL,
1042 2534532716UL,
1043 3726226824UL,
1044 2067902083UL,
1045 1289138711UL,
1046 615241845UL,
1047 3711156810UL,
1048 4069284324UL,
1049 3829237942UL,
1050 3615667378UL,
1051 750506440UL,
1052 3851304132UL,
1053 1159089146UL,
1054 2459260597UL,
1055 2955574874UL,
1056 1775846339UL,
1057 1872505027UL,
1058 3021810567UL,
1059 2498812392UL,
1060 2388439890UL,
1061 3509540924UL,
1062 4132084900UL,
1063 1762358900UL,
1064 3005639020UL,
1065 961559514UL,
1066 5499771UL,
1067 2114442568UL,
1068 2725996306UL,
1069 2213448586UL,
1070 3041192141UL,
1071 2318358424UL,
1072 4199956637UL,
1073 508024672UL,
1074 2898231491UL,
1075 985807031UL,
1076 3712119117UL,
1077 487464412UL,
1078 1443950379UL,
1079 2897942828UL,
1080 2942321529UL
1081#endif
1082 };
1083
1084 /// \brief Helper function for hashing
1085 inline HashType xorrer(HashType const &l, NucleonItem const &r) {
1086 return l^mask[r];
1087 }
1088
1089 }
1090
1091 /** \brief Compute the hash of a nucleon configuration
1092 *
1093 * The hash is computed as
1094 *
1095 * \f[ \mathrm{mask}_{i_1} \oplus \mathrm{mask}_{i_2} \oplus \ldots \oplus \mathrm{mask}_{i_n} \f]
1096 *
1097 * where \f$\oplus\f$ represents logical exclusive OR (XOR), \f$i_1,\ldots,
1098 * i_n\f$ represent the indices of the nucleons in the
1099 * ClusteringModelIntercomparison::consideredPartners
1100 * array, and \f$\mathrm{mask}_i\f$ is a static look-up table of 500
1101 * \f$n\f$-bit integers such that their binary representations have exactly
1102 * \f$n/2\f$ true bits and \f$n/2\f$ false bits, at random positions. The
1103 * value of \f$n\f$ is 32 if unsigned longs are less than 64-bit wide, and
1104 * 64 otherwise.
1105 *
1106 * Folding the mask values using XOR has two advantages: first, XOR is a
1107 * commutative operation, so the result is independent of the order in
1108 * which the nucleons appear in the configuration (which is what we want).
1109 * Second, it's very fast. Profiling shows that the time spent hashing
1110 * configurations is negligible compared to the time spent evaluating
1111 * phase-space proximity.
1112 */
1113 inline HashType hashConfig(NucleonItem *config, G4int n) {
1114// assert(n<maskTableSize);
1115 return std::accumulate(config, config+n, ((HashType)0), xorrer);
1116 }
1117
1118 }
1119}
1120
1121#endif // INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask
1122
1123#endif // G4INCLHASHING_HH_
int G4int
Definition G4Types.hh:85