![]() |
HepPDT Reference DocumentationHepPDT |
00001 // ---------------------------------------------------------------------- 00002 // 00003 // translateIsajet.cc 00004 // Author: Lynn Garren 00005 // 00006 // translate an ID number to or from the standard numbering scheme and Isajet 00007 // use static maps 00008 // 00009 // Isajet uses a different numbering scheme 00010 // Private methods will attempt to convert mesons and baryons not in the map 00011 // 00012 // The maps are initialized if and only if the public functions are called. 00013 // Because the maps are static, the initialization happens only once. 00014 // 00015 // The user NEVER calls IsajetPDTMapInit() 00016 // We use a data table (struct SList) so that compile time is not impacted. 00017 // 00018 // public functions: 00019 // int translateIsajettoPDT( const int id ) 00020 // int translatePDTtoIsajet( const int id ) 00021 // IsajetPDTMap const & getIsajetPDTMap() 00022 // PDTIsajetMap const & getPDTIsajetMap() 00023 // 00024 // ---------------------------------------------------------------------- 00025 00026 #include <map> 00027 #include <utility> // make_pair 00028 00029 #include "HepPID/Version.hh" 00030 #include "HepPID/ParticleIDTranslations.hh" 00031 #include "HepPID/ParticleIDMethods.hh" 00032 #include "HepPID/ParticleName.hh" 00033 00034 namespace HepPID { 00035 00036 typedef std::map< int, int > IsajetPDTMap; 00037 typedef std::map< int, int > PDTIsajetMap; 00038 00039 namespace { // IsajetPDTMapInit is private 00040 00041 IsajetPDTMap const & getIsajetPDTMap(); 00042 PDTIsajetMap const & getPDTIsajetMap(); 00043 00044 IsajetPDTMap const & IsajetPDTMapInit() 00045 { 00046 00047 static IsajetPDTMap m; 00048 00049 static const struct { 00050 int id; // Isajet 00051 int pid; // PDT 00052 } SList[] = { 00053 { 1, 2 }, 00054 { -1, -2 }, 00055 { 2, 1 }, 00056 { -2, -1 }, 00057 { 3, 3 }, 00058 { -3, -3 }, 00059 { 4, 4 }, 00060 { -4, -4 }, 00061 { 5, 5 }, 00062 { -5, -5 }, 00063 { 6, 6 }, 00064 { -6, -6 }, 00065 { 7, 7 }, 00066 { -7, -7 }, 00067 { 8, 8 }, 00068 { -8, -8 }, 00069 { 9, 21 }, 00070 { 10, 22 }, 00071 { 11, 12 }, 00072 { -11, -12 }, 00073 { 12, 11 }, 00074 { -12, -11 }, 00075 { 13, 14 }, 00076 { -13, -14 }, 00077 { 14, 13 }, 00078 { -14, -13 }, 00079 { 15, 16 }, 00080 { -15, -16 }, 00081 { 16, 15 }, 00082 { -16, -15 }, 00083 { 20, 310 }, 00084 { -20, 130 }, 00085 { 21, 1000002 }, 00086 { -21, -1000002 }, 00087 { 22, 1000001 }, 00088 { -22, -1000001 }, 00089 { 23, 1000003 }, 00090 { -23, -1000003 }, 00091 { 24, 1000004 }, 00092 { -24, -1000004 }, 00093 { 25, 1000005 }, 00094 { -25, -1000005 }, 00095 { 26, 1000006 }, 00096 { -26, -1000006 }, 00097 { 29, 1000021 }, 00098 { 30, 1000022 }, 00099 { 31, 1000012 }, 00100 { -31, -1000012 }, 00101 { 32, 1000011 }, 00102 { -32, -1000011 }, 00103 { 33, 1000014 }, 00104 { -33, -1000014 }, 00105 { 34, 1000013 }, 00106 { -34, -1000013 }, 00107 { 35, 1000016 }, 00108 { -35, -1000016 }, 00109 { 36, 1000015 }, 00110 { -36, -1000015 }, 00111 { 39, 1000024 }, 00112 { -39, -1000024 }, 00113 { 40, 1000023 }, 00114 { 41, 2000002 }, 00115 { -41, -2000002 }, 00116 { 42, 2000001 }, 00117 { -42, -2000001 }, 00118 { 43, 2000003 }, 00119 { -43, -2000003 }, 00120 { 44, 2000004 }, 00121 { -44, -2000004 }, 00122 { 45, 2000005 }, 00123 { -45, -2000005 }, 00124 { 46, 2000006 }, 00125 { -46, -2000006 }, 00126 { 49, 1000037 }, 00127 { -49, -1000037 }, 00128 { 50, 1000025 }, 00129 { 51, 2000012 }, 00130 { -51, -2000012 }, 00131 { 52, 2000011 }, 00132 { -52, -2000011 }, 00133 { 53, 2000014 }, 00134 { -53, -2000014 }, 00135 { 54, 2000013 }, 00136 { -54, -2000013 }, 00137 { 55, 2000016 }, 00138 { -55, -2000016 }, 00139 { 56, 2000015 }, 00140 { -56, -2000015 }, 00141 { 60, 1000035 }, 00142 { 80, 24 }, 00143 { -80, -24 }, 00144 { 81, 25 }, 00145 { 82, 51 }, 00146 { 83, 35 }, 00147 { 84, 36 }, 00148 { 85, 55 }, 00149 { -85, -55 }, 00150 { 86, 37 }, 00151 { -86, -37 }, 00152 { 87, 53 }, 00153 { -87, -53 }, 00154 { 88, 52 }, 00155 { -88, -52 }, 00156 { 89, 54 }, 00157 { -89, -54 }, 00158 { 90, 23 }, 00159 { 91, 1000039 }, 00160 { 92, 39 }, 00161 { 110, 111 }, 00162 { 111, 113 }, 00163 { 112, 225 }, 00164 { 120, 211 }, 00165 { -120, -211 }, 00166 { 121, 213 }, 00167 { -121, -213 }, 00168 { 130, 321 }, 00169 { -130, -321 }, 00170 { 131, 323 }, 00171 { -131, -323 }, 00172 { 132, 325 }, 00173 { -132, -325 }, 00174 { 140, -421 }, 00175 { -140, 421 }, 00176 { 141, -423 }, 00177 { -141, 423 }, 00178 { 150, 521 }, 00179 { -150, -521 }, 00180 { 151, 523 }, 00181 { -151, -523 }, 00182 { 160, -621 }, 00183 { -160, 621 }, 00184 { 161, -623 }, 00185 { -161, 623 }, 00186 { 170, 721 }, 00187 { -170, -721 }, 00188 { 171, 723 }, 00189 { -171, -723 }, 00190 { 180, 821 }, 00191 { -180, -821 }, 00192 { 181, 823 }, 00193 { -181, -823 }, 00194 { 220, 221 }, 00195 { 221, 223 }, 00196 { 230, 311 }, 00197 { -230, -311 }, 00198 { 231, 313 }, 00199 { -231, -313 }, 00200 { 232, 315 }, 00201 { -232, -315 }, 00202 { 240, -411 }, 00203 { -240, 411 }, 00204 { 241, -413 }, 00205 { -241, 413 }, 00206 { 250, 511 }, 00207 { -250, -511 }, 00208 { 251, 513 }, 00209 { -251, -513 }, 00210 { 260, -611 }, 00211 { -260, 611 }, 00212 { 261, -613 }, 00213 { -261, 613 }, 00214 { 270, 711 }, 00215 { -270, -711 }, 00216 { 271, 713 }, 00217 { -271, -713 }, 00218 { 280, 811 }, 00219 { -280, -811 }, 00220 { 281, 813 }, 00221 { -281, -813 }, 00222 { 330, 331 }, 00223 { 331, 333 }, 00224 { 340, -431 }, 00225 { -340, 431 }, 00226 { 341, -433 }, 00227 { -341, 433 }, 00228 { 350, 531 }, 00229 { -350, -531 }, 00230 { 351, 533 }, 00231 { -351, -533 }, 00232 { 360, -631 }, 00233 { -360, 631 }, 00234 { 361, -633 }, 00235 { -361, 633 }, 00236 { 370, 731 }, 00237 { -370, -731 }, 00238 { 371, 733 }, 00239 { -371, -733 }, 00240 { 380, 831 }, 00241 { -380, -831 }, 00242 { 381, 833 }, 00243 { -381, -833 }, 00244 { 440, 441 }, 00245 { 441, 443 }, 00246 { 450, 541 }, 00247 { -450, -541 }, 00248 { 451, 543 }, 00249 { -451, -543 }, 00250 { 460, 641 }, 00251 { -460, -641 }, 00252 { 461, 643 }, 00253 { -461, -643 }, 00254 { 470, 741 }, 00255 { -470, -741 }, 00256 { 471, 743 }, 00257 { -471, -743 }, 00258 { 480, 841 }, 00259 { -480, -841 }, 00260 { 481, 843 }, 00261 { -481, -843 }, 00262 { 550, 551 }, 00263 { 551, 553 }, 00264 { 560, -651 }, 00265 { -560, 651 }, 00266 { 561, -653 }, 00267 { -561, 653 }, 00268 { 570, 751 }, 00269 { -570, -751 }, 00270 { 571, 753 }, 00271 { -571, -753 }, 00272 { 580, 851 }, 00273 { -580, -851 }, 00274 { 581, 853 }, 00275 { -581, -853 }, 00276 { 660, 661 }, 00277 { 661, 663 }, 00278 { 670, 761 }, 00279 { -670, -761 }, 00280 { 671, 763 }, 00281 { -671, -763 }, 00282 { 680, 861 }, 00283 { -680, -861 }, 00284 { 681, 863 }, 00285 { -681, -863 }, 00286 { 770, 771 }, 00287 { 771, 773 }, 00288 { 780, 871 }, 00289 { -780, -871 }, 00290 { 781, 873 }, 00291 { -781, -873 }, 00292 { 880, 881 }, 00293 { 881, 883 }, 00294 { 1100, 2203 }, 00295 { -1100, -2203 }, 00296 { 1111, 2224 }, 00297 { -1111, -2224 }, 00298 { 1120, 2212 }, 00299 { -1120, -2212 }, 00300 { 1121, 2214 }, 00301 { -1121, -2214 }, 00302 { 1130, 3222 }, 00303 { -1130, -3222 }, 00304 { 1131, 3224 }, 00305 { -1131, -3224 }, 00306 { 1140, 4222 }, 00307 { -1140, -4222 }, 00308 { 1141, 4224 }, 00309 { -1141, -4224 }, 00310 { 1150, 5222 }, 00311 { -1150, -5222 }, 00312 { 1151, 5224 }, 00313 { -1151, -5224 }, 00314 { 1160, 6222 }, 00315 { -1160, -6222 }, 00316 { 1161, 6224 }, 00317 { -1161, -6224 }, 00318 { 1170, 7222 }, 00319 { -1170, -7222 }, 00320 { 1171, 7224 }, 00321 { -1171, -7224 }, 00322 { 1180, 8222 }, 00323 { -1180, -8222 }, 00324 { 1181, 8224 }, 00325 { -1181, -8224 }, 00326 { 1200, 2101 }, 00327 { -1200, -2101 }, 00328 { 1220, 2112 }, 00329 { -1220, -2112 }, 00330 { 1221, 2114 }, 00331 { -1221, -2114 }, 00332 { 1230, 3212 }, 00333 { -1230, -3212 }, 00334 { 1231, 3214 }, 00335 { -1231, -3214 }, 00336 { 1240, 4212 }, 00337 { -1240, -4212 }, 00338 { 1241, 4214 }, 00339 { -1241, -4214 }, 00340 { 1250, 5212 }, 00341 { -1250, -5212 }, 00342 { 1251, 5214 }, 00343 { -1251, -5214 }, 00344 { 1260, 6212 }, 00345 { -1260, -6212 }, 00346 { 1261, 6214 }, 00347 { -1261, -6214 }, 00348 { 1270, 7212 }, 00349 { -1270, -7212 }, 00350 { 1271, 7214 }, 00351 { -1271, -7214 }, 00352 { 1280, 8212 }, 00353 { -1280, -8212 }, 00354 { 1281, 8214 }, 00355 { -1281, -8214 }, 00356 { 1300, 3201 }, 00357 { -1300, -3201 }, 00358 { 1330, 3322 }, 00359 { -1330, -3322 }, 00360 { 1331, 3324 }, 00361 { -1331, -3324 }, 00362 { 1340, 4322 }, 00363 { -1340, -4322 }, 00364 { 1341, 4324 }, 00365 { -1341, -4324 }, 00366 { 1350, 5322 }, 00367 { -1350, -5322 }, 00368 { 1351, 5324 }, 00369 { -1351, -5324 }, 00370 { 1360, 6322 }, 00371 { -1360, -6322 }, 00372 { 1361, 6324 }, 00373 { -1361, -6324 }, 00374 { 1370, 7322 }, 00375 { -1370, -7322 }, 00376 { 1371, 7324 }, 00377 { -1371, -7324 }, 00378 { 1380, 8322 }, 00379 { -1380, -8322 }, 00380 { 1381, 8324 }, 00381 { -1381, -8324 }, 00382 { 1400, -4201 }, 00383 { -1400, 4201 }, 00384 { 1440, 4422 }, 00385 { -1440, -4422 }, 00386 { 1441, 4424 }, 00387 { -1441, -4424 }, 00388 { 1450, 5422 }, 00389 { -1450, -5422 }, 00390 { 1451, 5424 }, 00391 { -1451, -5424 }, 00392 { 1460, 6422 }, 00393 { -1460, -6422 }, 00394 { 1461, 6424 }, 00395 { -1461, -6424 }, 00396 { 1500, 5201 }, 00397 { -1500, -5201 }, 00398 { 1550, 5522 }, 00399 { -1550, -5522 }, 00400 { 1551, 5524 }, 00401 { -1551, -5524 }, 00402 { 1560, 6522 }, 00403 { -1560, -6522 }, 00404 { 1561, 6524 }, 00405 { -1561, -6524 }, 00406 { 1600, -6201 }, 00407 { -1600, 6201 }, 00408 { 1660, 6622 }, 00409 { -1660, -6622 }, 00410 { 1661, 6624 }, 00411 { -1661, -6624 }, 00412 { 2130, 3122 }, 00413 { -2130, -3122 }, 00414 { 2140, 4122 }, 00415 { -2140, -4122 }, 00416 { 2150, 5122 }, 00417 { -2150, -5122 }, 00418 { 2160, 6122 }, 00419 { -2160, -6122 }, 00420 { 2170, 7122 }, 00421 { -2170, -7122 }, 00422 { 2180, 8122 }, 00423 { -2180, -8122 }, 00424 { 2200, 1103 }, 00425 { -2200, -1103 }, 00426 { 2221, 1114 }, 00427 { -2221, -1114 }, 00428 { 2230, 3112 }, 00429 { -2230, -3112 }, 00430 { 2231, 3114 }, 00431 { -2231, -3114 }, 00432 { 2240, 4112 }, 00433 { -2240, -4112 }, 00434 { 2241, 4114 }, 00435 { -2241, -4114 }, 00436 { 2250, 5112 }, 00437 { -2250, -5112 }, 00438 { 2251, 5114 }, 00439 { -2251, -5114 }, 00440 { 2260, 6112 }, 00441 { -2260, -6112 }, 00442 { 2261, 6114 }, 00443 { -2261, -6114 }, 00444 { 2270, 7112 }, 00445 { -2270, -7112 }, 00446 { 2271, 7114 }, 00447 { -2271, -7114 }, 00448 { 2280, 8112 }, 00449 { -2280, -8112 }, 00450 { 2281, 8114 }, 00451 { -2281, -8114 }, 00452 { 2300, 3101 }, 00453 { -2300, -3101 }, 00454 { 2330, 3312 }, 00455 { -2330, -3312 }, 00456 { 2331, 3314 }, 00457 { -2331, -3314 }, 00458 { 2340, 4312 }, 00459 { -2340, -4312 }, 00460 { 2341, 4314 }, 00461 { -2341, -4314 }, 00462 { 2350, 5312 }, 00463 { -2350, -5312 }, 00464 { 2351, 5314 }, 00465 { -2351, -5314 }, 00466 { 2360, 6312 }, 00467 { -2360, -6312 }, 00468 { 2361, 6314 }, 00469 { -2361, -6314 }, 00470 { 2370, 7312 }, 00471 { -2370, -7312 }, 00472 { 2371, 7314 }, 00473 { -2371, -7314 }, 00474 { 2380, 8312 }, 00475 { -2380, -8312 }, 00476 { 2381, 8314 }, 00477 { -2381, -8314 }, 00478 { 2400, -4101 }, 00479 { -2400, 4101 }, 00480 { 2440, 4412 }, 00481 { -2440, -4412 }, 00482 { 2441, 4414 }, 00483 { -2441, -4414 }, 00484 { 2450, 5412 }, 00485 { -2450, -5412 }, 00486 { 2451, 5414 }, 00487 { -2451, -5414 }, 00488 { 2460, 6412 }, 00489 { -2460, -6412 }, 00490 { 2461, 6414 }, 00491 { -2461, -6414 }, 00492 { 2500, 5101 }, 00493 { -2500, -5101 }, 00494 { 2550, 5512 }, 00495 { -2550, -5512 }, 00496 { 2551, 5514 }, 00497 { -2551, -5514 }, 00498 { 2560, 6512 }, 00499 { -2560, -6512 }, 00500 { 2561, 6514 }, 00501 { -2561, -6514 }, 00502 { 2600, -6101 }, 00503 { -2600, 6101 }, 00504 { 2660, 6612 }, 00505 { -2660, -6612 }, 00506 { 2661, 6614 }, 00507 { -2661, -6614 }, 00508 { 3140, 4232 }, 00509 { -3140, -4232 }, 00510 { 3150, 5232 }, 00511 { -3150, -5232 }, 00512 { 3160, 6232 }, 00513 { -3160, -6232 }, 00514 { 3170, 7232 }, 00515 { -3170, -7232 }, 00516 { 3180, 8232 }, 00517 { -3180, -8232 }, 00518 { 3240, 4132 }, 00519 { -3240, -4132 }, 00520 { 3250, 5132 }, 00521 { -3250, -5132 }, 00522 { 3260, 6132 }, 00523 { -3260, -6132 }, 00524 { 3270, 7132 }, 00525 { -3270, -7132 }, 00526 { 3280, 8132 }, 00527 { -3280, -8132 }, 00528 { 3300, 3303 }, 00529 { -3300, -3303 }, 00530 { 3331, 3334 }, 00531 { -3331, -3334 }, 00532 { 3340, 4332 }, 00533 { -3340, -4332 }, 00534 { 3341, 4334 }, 00535 { -3341, -4334 }, 00536 { 3350, 5332 }, 00537 { -3350, -5332 }, 00538 { 3351, 5334 }, 00539 { -3351, -5334 }, 00540 { 3360, 6332 }, 00541 { -3360, -6332 }, 00542 { 3361, 6334 }, 00543 { -3361, -6334 }, 00544 { 3370, 7332 }, 00545 { -3370, -7332 }, 00546 { 3371, 7334 }, 00547 { -3371, -7334 }, 00548 { 3380, 8332 }, 00549 { -3380, -8332 }, 00550 { 3381, 8334 }, 00551 { -3381, -8334 }, 00552 { 3400, -4301 }, 00553 { -3400, 4301 }, 00554 { 3440, 4432 }, 00555 { -3440, -4432 }, 00556 { 3441, 4434 }, 00557 { -3441, -4434 }, 00558 { 3450, 5432 }, 00559 { -3450, -5432 }, 00560 { 3451, 5434 }, 00561 { -3451, -5434 }, 00562 { 3460, 6432 }, 00563 { -3460, -6432 }, 00564 { 3461, 6434 }, 00565 { -3461, -6434 }, 00566 { 3500, 5301 }, 00567 { -3500, -5301 }, 00568 { 3550, 5532 }, 00569 { -3550, -5532 }, 00570 { 3551, 5534 }, 00571 { -3551, -5534 }, 00572 { 3560, 6532 }, 00573 { -3560, -6532 }, 00574 { 3561, 6534 }, 00575 { -3561, -6534 }, 00576 { 3600, -6301 }, 00577 { -3600, 6301 }, 00578 { 3660, 6632 }, 00579 { -3660, -6632 }, 00580 { 3661, 6634 }, 00581 { -3661, -6634 }, 00582 { 4150, 5242 }, 00583 { -4150, -5242 }, 00584 { 4160, 6242 }, 00585 { -4160, -6242 }, 00586 { 4250, 5142 }, 00587 { -4250, -5142 }, 00588 { 4260, 6142 }, 00589 { -4260, -6142 }, 00590 { 4350, 5342 }, 00591 { -4350, -5342 }, 00592 { 4360, 6342 }, 00593 { -4360, -6342 }, 00594 { 4400, 4403 }, 00595 { -4400, -4403 }, 00596 { 4441, 4444 }, 00597 { -4441, -4444 }, 00598 { 4450, 5442 }, 00599 { -4450, -5442 }, 00600 { 4451, 5444 }, 00601 { -4451, -5444 }, 00602 { 4460, 6442 }, 00603 { -4460, -6442 }, 00604 { 4461, 6444 }, 00605 { -4461, -6444 }, 00606 { 4500, 5401 }, 00607 { -4500, -5401 }, 00608 { 4550, 5542 }, 00609 { -4550, -5542 }, 00610 { 4551, 5544 }, 00611 { -4551, -5544 }, 00612 { 4560, 6542 }, 00613 { -4560, -6542 }, 00614 { 4561, 6544 }, 00615 { -4561, -6544 }, 00616 { 4600, 6401 }, 00617 { -4600, -6401 }, 00618 { 4660, 6642 }, 00619 { -4660, -6642 }, 00620 { 4661, 6644 }, 00621 { -4661, -6644 }, 00622 { 5160, 6252 }, 00623 { -5160, -6252 }, 00624 { 5260, 6152 }, 00625 { -5260, -6152 }, 00626 { 5360, 6352 }, 00627 { -5360, -6352 }, 00628 { 5460, 6452 }, 00629 { -5460, -6452 }, 00630 { 5500, 5503 }, 00631 { -5500, -5503 }, 00632 { 5551, 5554 }, 00633 { -5551, -5554 }, 00634 { 5560, 6552 }, 00635 { -5560, -6552 }, 00636 { 5561, 6554 }, 00637 { -5561, -6554 }, 00638 { 5600, -6501 }, 00639 { -5600, 6501 }, 00640 { 5660, 6652 }, 00641 { -5660, -6652 }, 00642 { 5661, 6654 }, 00643 { -5661, -6654 }, 00644 { 6600, 6603 }, 00645 { -6600, -6603 }, 00646 { 6661, 6664 }, 00647 { -6661, -6664 }, 00648 { 10016, 93 }, 00649 { -10016, -93 }, 00650 { 20016, 94 }, 00651 { -20016, -94 }, 00652 { 10110, 9010221 }, 00653 { 10111, 20113 }, 00654 { 10121, 20213 }, 00655 { -10121, -20213 }, 00656 { 10131, 10323 }, 00657 { -10131, -10323 }, 00658 { 10231, 10313 }, 00659 { -10231, -10313 }, 00660 { 10441, 100443 }, 00661 { 20440, 10441 }, 00662 { 20441, 20443 }, 00663 { 20442, 445 }, 00664 { 30131, 100323 }, 00665 { -30131, -100323 }, 00666 { 30231, 100313 }, 00667 { -30231, -100313 } 00668 }; 00669 00670 int listSize = sizeof(SList)/sizeof(SList[0]); 00671 for( int k=0; k!=listSize; ++k) { 00672 m.insert( std::make_pair( SList[k].id, SList[k].pid) ); 00673 } 00674 return m; 00675 } // IsajetPDTMapInit() 00676 00677 PDTIsajetMap const & PDTIsajetMapInit() 00678 { 00679 static PDTIsajetMap m; 00680 static IsajetPDTMap const & hmap = getIsajetPDTMap(); 00681 00682 for(IsajetPDTMap::const_iterator cit=hmap.begin(), mend=hmap.end(); cit!=mend; ++cit ) { 00683 m.insert( std::make_pair( cit->second, cit->first )); 00684 } 00685 return m; 00686 } 00687 00688 // if a number isn't in the map, we try to convert it 00689 int convIsajettoPDT( const int id ) 00690 { 00691 // we have no idea what to do, these numbers must be in the map 00692 if( abspid(id) <= 100 ) { return 0; } 00693 if( abspid(id) > 99999 ) { return 0; } 00694 00695 // find constituents 00696 int istran; 00697 unsigned short js = digit(nj,id); 00698 unsigned short i1 = digit(nq3,id); 00699 unsigned short i2 = digit(nq2,id); 00700 unsigned short i3 = digit(nq1,id); 00701 unsigned short i4 = digit(nl,id); 00702 00703 // mesons 00704 if(i1 != 0 && i2 != 0 && i3 == 0) { 00705 // u and d have opposite definitions - sometimes 00706 if(i2 <= 2 && i1 <= 2){ 00707 // don't change 00708 } else { 00709 if(i1 == 2) { 00710 i1 = 1; 00711 } else if(i1 == 1) { 00712 i1 = 2; 00713 } 00714 if(i2 == 2) { 00715 i2 = 1; 00716 } else if(i2 == 1) { 00717 i2 = 2; 00718 } 00719 } 00720 istran=i1*100 + i2*10 + 2*js+1 + i4*10000; 00721 if( id < 0 ) { istran = -istran; } 00722 // charmed and top mesons have wrong sign 00723 if(i1 == 4 && i2 != 4) { istran = -istran; } 00724 if(i1 == 6 && i2 != 6 && i2 != 4) { istran = -istran; } 00725 // ...check for illegal antiparticles 00726 if(i2 == i1 && id < 0) { istran=0; } 00727 return istran; 00728 } 00729 // diquarks 00730 if(i2 != 0 && i3 != 0 && i1 == 0) { 00731 // ... u and d have opposite definitions 00732 if(i3 == 2) { 00733 i3 = 1; 00734 } else if(i3 == 1) { 00735 i3 = 2; 00736 } 00737 if(i2 == 2) { 00738 i2 = 1; 00739 } else if(i2 == 1) { 00740 i2 = 2; 00741 } 00742 istran = 0; 00743 if(i2 < i3){ 00744 istran=i3*1000 + i2*100 + 1; 00745 } else if(i2 == i3){ 00746 istran=i2*1000 + i3*100 + 3; 00747 } else { 00748 istran=i2*1000 + i3*100 + 1; 00749 } 00750 if( id < 0 ) { istran = -istran; } 00751 // ... charmed and top quarks have wrong sign 00752 if(i2 == 4 && i3 != 4) { istran=-istran; } 00753 if(i2 == 6 && i3 != 6 && i3 != 4) { istran=-istran; } 00754 return istran; 00755 } 00756 // baryons 00757 if( i1 != 0 && i3 != 0 && i2 != 0 ) { 00758 // u and d have opposite definitions 00759 if(i3 == 2) { 00760 i3 = 1; 00761 } else if(i3 == 1) { 00762 i3 = 2; 00763 } 00764 if(i2 == 2) { 00765 i2 = 1; 00766 } else if(i2 == 1) { 00767 i2 = 2; 00768 } 00769 if(i1 == 2) { 00770 i1 = 1; 00771 } else if(i1 == 1) { 00772 i1 = 2; 00773 } 00774 istran = 0; 00775 if(i1 <= 2){ 00776 istran=i3*1000 + i2*100 + i1*10 + 2*js+2; 00777 } else if(i3 <= 2 && i2 <= 2){ 00778 istran=i1*1000 + i3*100 + i2*10 + 2*js+2; 00779 } else { 00780 istran=i1*1000 + i2*100 + i3*10 + 2*js+2; 00781 } 00782 if( id < 0 ) { istran = -istran; } 00783 } 00784 // unknown 00785 return 0; 00786 00787 } 00788 00789 // if a number isn't in the map, we try to convert it 00790 int convPDTtoIsajet( const int id ) 00791 { 00792 // we have no idea what to do, these numbers must be in the map 00793 if( fundamentalID(id) != 0 ) { return 0; } 00794 if( abspid(id) > 99999 ) { return 0; } 00795 00796 // find constituents 00797 int istran; 00798 unsigned short js = digit(nj,id); 00799 unsigned short i1 = digit(nq3,id); 00800 unsigned short i2 = digit(nq2,id); 00801 unsigned short i3 = digit(nq1,id); 00802 unsigned short i4 = digit(nl,id); 00803 00804 // mesons 00805 if(i1 != 0 && i2 != 0 && i3 == 0) { 00806 // u and d have opposite definitions - sometimes 00807 if(i2 <= 2 && i1 <= 2){ 00808 // don't change 00809 } else { 00810 if(i1 == 2) { 00811 i1 = 1; 00812 } else if(i1 == 1) { 00813 i1 = 2; 00814 } 00815 if(i2 == 2) { 00816 i2 = 1; 00817 } else if(i2 == 1) { 00818 i2 = 2; 00819 } 00820 } 00821 istran=i1*100 + i2*10 + (js-1)/2 + i4*10000; 00822 if( id < 0 ) { istran = -istran; } 00823 // ... charmed and top mesons have wrong sign 00824 if(i2 == 4 && i1 != 4) { istran = -istran; } 00825 if(i2 == 6 && i1 != 6 && i1 != 4) { istran = -istran; } 00826 // ...check for illegal antiparticles 00827 if(i2 == i1 && id < 0) { istran=0; } 00828 return istran; 00829 } 00830 // diquarks 00831 if(i1 == 0){ 00832 // ... u and d have opposite definitions 00833 if(i3 == 2) { 00834 i3 = 1; 00835 } else if(i3 == 1) { 00836 i3 = 2; 00837 } 00838 if(i2 == 2) { 00839 i2 = 1; 00840 } else if(i2 == 1) { 00841 i2 = 2; 00842 } 00843 istran = 0; 00844 if(i3 < i2){ 00845 istran=i3*1000 + i2*100 + (js-1)/2; 00846 } else { 00847 istran=i2*1000 + i3*100 + (js-1)/2; 00848 } 00849 if( id < 0 ) { istran = -istran; } 00850 // ... charmed and top mesons have wrong sign 00851 if(i2 == 4 && i3 != 4) { istran=-istran; } 00852 if(i2 == 6 && i3 != 6 && i3 != 4) { istran=-istran; } 00853 return istran; 00854 } 00855 // ...spin 1/2 or spin 3/2 baryons 00856 if( i1 != 0 && i3 != 0 && i2 != 0 && ( js == 2 || js == 4) && i4 == 0 ) { 00857 // u and d have opposite definitions 00858 if(i3 == 2) { 00859 i3 = 1; 00860 } else if(i3 == 1) { 00861 i3 = 2; 00862 } 00863 if(i2 == 2) { 00864 i2 = 1; 00865 } else if(i2 == 1) { 00866 i2 = 2; 00867 } 00868 if(i1 == 2) { 00869 i1 = 1; 00870 } else if(i1 == 1) { 00871 i1 = 2; 00872 } 00873 istran = 0; 00874 if(i3 <= 2){ 00875 istran=i3*1000 + i2*100 + i1*10 + (js-2)/2; 00876 } else if(i1 <= 2 && i2 <= 2){ 00877 istran=i2*1000 + i1*100 + i3*10 + (js-2)/2; 00878 } else { 00879 istran=i1*1000 + i2*100 + i3*10 + (js-2)/2; 00880 } 00881 if( id < 0 ) { istran = -istran; } 00882 return istran; 00883 } 00884 // unknown 00885 return 0; 00886 } 00887 00888 // 00889 // getIsajetPDTMap is the ONLY function allowed to call IsajetPDTMapInit 00890 // 00891 IsajetPDTMap const & getIsajetPDTMap() 00892 { 00893 static IsajetPDTMap const & hmap = IsajetPDTMapInit(); 00894 return hmap; 00895 } // getIsajetPDTMap() 00896 00897 // 00898 // getPDTIsajetMap is the ONLY function allowed to call IsajetPDTMapInit 00899 // 00900 PDTIsajetMap const & getPDTIsajetMap() 00901 { 00902 static PDTIsajetMap const & hmap = PDTIsajetMapInit(); 00903 return hmap; 00904 } // getPDTIsajetMap() 00905 00906 } // unnamed namespace 00907 00908 int translateIsajettoPDT( const int id ) 00909 { 00910 static IsajetPDTMap const & hmap = getIsajetPDTMap(); 00911 00912 IsajetPDTMap::const_iterator const cit = hmap.find( id ); 00913 // found it in the map 00914 if ( cit != hmap.end() ) { return cit->second; } 00915 // try converting anyway 00916 return convIsajettoPDT(id); 00917 } 00918 00919 int translatePDTtoIsajet( const int id ) 00920 { 00921 static PDTIsajetMap const & pmap = getPDTIsajetMap(); 00922 00923 PDTIsajetMap::const_iterator const cit = pmap.find( id ); 00924 // found it in the map 00925 if ( cit != pmap.end() ) { return cit->second; } 00926 // try converting anyway 00927 return convPDTtoIsajet(id); 00928 } 00929 00930 void writeIsajetTranslationLine( int i, std::ostream & os ) 00931 { 00932 // only write map entries 00933 static IsajetPDTMap const & hmap = getIsajetPDTMap(); 00934 00935 IsajetPDTMap::const_iterator const cit = hmap.find( i ); 00936 // found it in the map 00937 if ( cit != hmap.end() ) { 00938 int id = cit->second; 00939 os << " Isajet number: " ; 00940 os.width(10); 00941 os << i << " HepPID number: " ; 00942 os.width(10); 00943 os << id << " " << particleName(id) << std::endl; 00944 // check reverse translation 00945 int iback = translatePDTtoIsajet(id); 00946 if(iback != i) { 00947 os << " WARNING: " << id << " translates back to " 00948 << iback << " not to " << i << std::endl; 00949 } 00950 } 00951 return; 00952 } // writeIsajetTranslationLine() 00953 00954 void writeIsajetTranslation( std::ostream & os ) 00955 { 00956 writeVersion( os ); 00957 os << " HepPID Particle List" << std::endl; 00958 os << std::endl; 00959 00960 int id, j, q1, q2, q3, m; 00961 // special cases 00962 for( id=1; id<101; ++id) { 00963 writeIsajetTranslationLine( id, os ); 00964 writeIsajetTranslationLine( -id, os ); 00965 } 00966 // diquark 00967 for( q2=1; q2<7; ++q2) { 00968 for( q1=1; q1<7; ++q1) { 00969 for( j=0; j<2; ++j) { 00970 id = 1000*q2+100*q1+j; 00971 writeIsajetTranslationLine( id, os ); 00972 writeIsajetTranslationLine( -id, os ); 00973 } 00974 } 00975 } 00976 // mesons 00977 for( q2=1; q2<9; ++q2) { 00978 for( q1=1; q1<9; ++q1) { 00979 for( j=0; j<3; ++j) { 00980 for( m=0; m<4; ++m) { 00981 id = 10000*m+100*q2+10*q1+j; 00982 writeIsajetTranslationLine( id, os ); 00983 writeIsajetTranslationLine( -id, os ); 00984 } 00985 } 00986 } 00987 } 00988 // baryons 00989 for( q3=1; q3<7; ++q3) { 00990 for( q2=1; q2<7; ++q2) { 00991 for( q1=1; q1<7; ++q1) { 00992 for( j=1; j<2; ++j) { 00993 id = 1000*q3+100*q2+10*q1+j; 00994 writeIsajetTranslationLine( id, os ); 00995 writeIsajetTranslationLine( -id, os ); 00996 } 00997 } 00998 } 00999 } 01000 return; 01001 } // writeIsajetTranslation() 01002 01003 } // HepPID