HepPDT Reference Documentation

HepPDT

translatePythia.cc

Go to the documentation of this file.
00001 // ------------------------------------
00002 //
00003 // translatePythia.cc
00004 // Author: Lynn Garren
00005 //
00006 // translate an ID number to or from the standard numbering scheme and Pythia
00007 // use static maps
00008 //
00009 //  The maps are initialized if and only if the public functions are called.
00010 //  Because the maps are static, the initialization happens only once.
00011 //
00012 //  The user NEVER calls PythiaPDTMapInit()
00013 //  We use a data table (struct SList) so that compile time is not impacted.
00014 //
00015 //  public functions:
00016 //        int translatePythiatoPDT( const int id )
00017 //        int translatePDTtoPythia( const int id )
00018 //        PythiaPDTMap const & getPythiaPDTMap()
00019 //        PDTPythiaMap const & getPDTPythiaMap()
00020 //
00021 // ------------------------------------
00022 
00023 #include <map>
00024 #include <utility>      // make_pair
00025 
00026 #include "HepPID/Version.hh"
00027 #include "HepPID/ParticleIDTranslations.hh"
00028 #include "HepPID/ParticleIDMethods.hh"
00029 #include "HepPID/ParticleName.hh"
00030 
00031 namespace HepPID {
00032 
00033  typedef  std::map< int, int >  PythiaPDTMap;
00034  typedef  std::map< int, int >  PDTPythiaMap;
00035 
00036 namespace {     // PythiaPDTMapInit is private
00037 
00038  PythiaPDTMap const & getPythiaPDTMap();
00039  PDTPythiaMap const & getPDTPythiaMap();
00040 
00041 PythiaPDTMap const & PythiaPDTMapInit()
00042 {
00043 
00044   static PythiaPDTMap  m;
00045 
00046   static const struct {
00047       int hid;  // Pythia
00048       int pid;  // PDT
00049   } SList[] = {
00050     {            1,            1 },
00051     {           -1,           -1 },
00052     {            2,            2 },
00053     {           -2,           -2 },
00054     {            3,            3 },
00055     {           -3,           -3 },
00056     {            4,            4 },
00057     {           -4,           -4 },
00058     {            5,            5 },
00059     {           -5,           -5 },
00060     {            6,            6 },
00061     {           -6,           -6 },
00062     {            7,            7 },
00063     {           -7,           -7 },
00064     {            8,            8 },
00065     {           -8,           -8 },
00066     {           11,           11 },
00067     {          -11,          -11 },
00068     {           12,           12 },
00069     {          -12,          -12 },
00070     {           13,           13 },
00071     {          -13,          -13 },
00072     {           14,           14 },
00073     {          -14,          -14 },
00074     {           15,           15 },
00075     {          -15,          -15 },
00076     {           16,           16 },
00077     {          -16,          -16 },
00078     {           17,           17 },
00079     {          -17,          -17 },
00080     {           18,           18 },
00081     {          -18,          -18 },
00082     {           21,           21 },
00083     {           22,           22 },
00084     {           23,           23 },
00085     {           24,           24 },
00086     {          -24,          -24 },
00087     {           25,           25 },
00088     {           32,           32 },
00089     {           33,           33 },
00090     {           34,           34 },
00091     {          -34,          -34 },
00092     {           35,           35 },
00093     {           36,           36 },
00094     {           37,           37 },
00095     {          -37,          -37 },
00096     {           39,           39 },
00097     {           41,           41 },
00098     {          -41,          -41 },
00099     {           42,           42 },
00100     {          -42,          -42 },
00101     {           81,           81 },
00102     {           82,           82 },
00103     {          -82,          -82 },
00104     {           83,           83 },
00105     {           84,           84 },
00106     {          -84,          -84 },
00107     {           85,           85 },
00108     {          -85,          -85 },
00109     {           88,           88 },
00110     {           90,           90 },
00111     {           91,           91 },
00112     {           92,           92 },
00113     {           93,           93 },
00114     {           94,           94 },
00115     {           95,           95 },
00116     {           96,           96 },
00117     {           97,           97 },
00118     {           98,           98 },
00119     {           99,           99 },
00120     {          110,          110 },
00121     {          990,          990 },
00122     {          111,          111 },
00123     {          113,          113 },
00124     {          115,          115 },
00125     {          130,          130 },
00126     {          211,          211 },
00127     {         -211,         -211 },
00128     {          213,          213 },
00129     {         -213,         -213 },
00130     {          215,          215 },
00131     {         -215,         -215 },
00132     {          221,          221 },
00133     {          223,          223 },
00134     {          225,          225 },
00135     {          310,          310 },
00136     {          311,          311 },
00137     {         -311,         -311 },
00138     {          313,          313 },
00139     {         -313,         -313 },
00140     {          315,          315 },
00141     {         -315,         -315 },
00142     {          321,          321 },
00143     {         -321,         -321 },
00144     {          323,          323 },
00145     {         -323,         -323 },
00146     {          325,          325 },
00147     {         -325,         -325 },
00148     {          331,          331 },
00149     {          333,          333 },
00150     {          335,          335 },
00151     {          411,          411 },
00152     {         -411,         -411 },
00153     {          413,          413 },
00154     {         -413,         -413 },
00155     {          415,          415 },
00156     {         -415,         -415 },
00157     {          421,          421 },
00158     {         -421,         -421 },
00159     {          423,          423 },
00160     {         -423,         -423 },
00161     {          425,          425 },
00162     {         -425,         -425 },
00163     {          431,          431 },
00164     {         -431,         -431 },
00165     {          433,          433 },
00166     {         -433,         -433 },
00167     {          435,          435 },
00168     {         -435,         -435 },
00169     {          441,          441 },
00170     {          443,          443 },
00171     {          445,          445 },
00172     {          511,          511 },
00173     {         -511,         -511 },
00174     {          513,          513 },
00175     {         -513,         -513 },
00176     {          515,          515 },
00177     {         -515,         -515 },
00178     {          521,          521 },
00179     {         -521,         -521 },
00180     {          523,          523 },
00181     {         -523,         -523 },
00182     {          525,          525 },
00183     {         -525,         -525 },
00184     {          531,          531 },
00185     {         -531,         -531 },
00186     {          533,          533 },
00187     {         -533,         -533 },
00188     {          535,          535 },
00189     {         -535,         -535 },
00190     {          541,          541 },
00191     {         -541,         -541 },
00192     {          543,          543 },
00193     {         -543,         -543 },
00194     {          545,          545 },
00195     {         -545,         -545 },
00196     {          551,          551 },
00197     {          553,          553 },
00198     {          555,          555 },
00199     {         1103,         1103 },
00200     {        -1103,        -1103 },
00201     {         1114,         1114 },
00202     {        -1114,        -1114 },
00203     {         2101,         2101 },
00204     {        -2101,        -2101 },
00205     {         2103,         2103 },
00206     {        -2103,        -2103 },
00207     {         2112,         2112 },
00208     {        -2112,        -2112 },
00209     {         2114,         2114 },
00210     {        -2114,        -2114 },
00211     {         2203,         2203 },
00212     {        -2203,        -2203 },
00213     {         2212,         2212 },
00214     {        -2212,        -2212 },
00215     {         2214,         2214 },
00216     {        -2214,        -2214 },
00217     {         2224,         2224 },
00218     {        -2224,        -2224 },
00219     {         3101,         3101 },
00220     {        -3101,        -3101 },
00221     {         3103,         3103 },
00222     {        -3103,        -3103 },
00223     {         3112,         3112 },
00224     {        -3112,        -3112 },
00225     {         3114,         3114 },
00226     {        -3114,        -3114 },
00227     {         3122,         3122 },
00228     {        -3122,        -3122 },
00229     {         3201,         3201 },
00230     {        -3201,        -3201 },
00231     {         3203,         3203 },
00232     {        -3203,        -3203 },
00233     {         3212,         3212 },
00234     {        -3212,        -3212 },
00235     {         3214,         3214 },
00236     {        -3214,        -3214 },
00237     {         3222,         3222 },
00238     {        -3222,        -3222 },
00239     {         3224,         3224 },
00240     {        -3224,        -3224 },
00241     {         3303,         3303 },
00242     {        -3303,        -3303 },
00243     {         3312,         3312 },
00244     {        -3312,        -3312 },
00245     {         3314,         3314 },
00246     {        -3314,        -3314 },
00247     {         3322,         3322 },
00248     {        -3322,        -3322 },
00249     {         3324,         3324 },
00250     {        -3324,        -3324 },
00251     {         3334,         3334 },
00252     {        -3334,        -3334 },
00253     {         4101,         4101 },
00254     {        -4101,        -4101 },
00255     {         4103,         4103 },
00256     {        -4103,        -4103 },
00257     {         4112,         4112 },
00258     {        -4112,        -4112 },
00259     {         4114,         4114 },
00260     {        -4114,        -4114 },
00261     {         4122,         4122 },
00262     {        -4122,        -4122 },
00263     {         4132,         4132 },
00264     {        -4132,        -4132 },
00265     {         4201,         4201 },
00266     {        -4201,        -4201 },
00267     {         4203,         4203 },
00268     {        -4203,        -4203 },
00269     {         4212,         4212 },
00270     {        -4212,        -4212 },
00271     {         4214,         4214 },
00272     {        -4214,        -4214 },
00273     {         4222,         4222 },
00274     {        -4222,        -4222 },
00275     {         4224,         4224 },
00276     {        -4224,        -4224 },
00277     {         4232,         4232 },
00278     {        -4232,        -4232 },
00279     {         4301,         4301 },
00280     {        -4301,        -4301 },
00281     {         4303,         4303 },
00282     {        -4303,        -4303 },
00283     {         4312,         4312 },
00284     {        -4312,        -4312 },
00285     {         4314,         4314 },
00286     {        -4314,        -4314 },
00287     {         4322,         4322 },
00288     {        -4322,        -4322 },
00289     {         4324,         4324 },
00290     {        -4324,        -4324 },
00291     {         4332,         4332 },
00292     {        -4332,        -4332 },
00293     {         4334,         4334 },
00294     {        -4334,        -4334 },
00295     {         4403,         4403 },
00296     {        -4403,        -4403 },
00297     {         4412,         4412 },
00298     {        -4412,        -4412 },
00299     {         4414,         4414 },
00300     {        -4414,        -4414 },
00301     {         4422,         4422 },
00302     {        -4422,        -4422 },
00303     {         4424,         4424 },
00304     {        -4424,        -4424 },
00305     {         4432,         4432 },
00306     {        -4432,        -4432 },
00307     {         4434,         4434 },
00308     {        -4434,        -4434 },
00309     {         4444,         4444 },
00310     {        -4444,        -4444 },
00311     {         5101,         5101 },
00312     {        -5101,        -5101 },
00313     {         5103,         5103 },
00314     {        -5103,        -5103 },
00315     {         5112,         5112 },
00316     {        -5112,        -5112 },
00317     {         5114,         5114 },
00318     {        -5114,        -5114 },
00319     {         5122,         5122 },
00320     {        -5122,        -5122 },
00321     {         5132,         5132 },
00322     {        -5132,        -5132 },
00323     {         5142,         5142 },
00324     {        -5142,        -5142 },
00325     {         5201,         5201 },
00326     {        -5201,        -5201 },
00327     {         5203,         5203 },
00328     {        -5203,        -5203 },
00329     {         5212,         5212 },
00330     {        -5212,        -5212 },
00331     {         5214,         5214 },
00332     {        -5214,        -5214 },
00333     {         5222,         5222 },
00334     {        -5222,        -5222 },
00335     {         5224,         5224 },
00336     {        -5224,        -5224 },
00337     {         5232,         5232 },
00338     {        -5232,        -5232 },
00339     {         5242,         5242 },
00340     {        -5242,        -5242 },
00341     {         5301,         5301 },
00342     {        -5301,        -5301 },
00343     {         5303,         5303 },
00344     {        -5303,        -5303 },
00345     {         5312,         5312 },
00346     {        -5312,        -5312 },
00347     {         5314,         5314 },
00348     {        -5314,        -5314 },
00349     {         5322,         5322 },
00350     {        -5322,        -5322 },
00351     {         5324,         5324 },
00352     {        -5324,        -5324 },
00353     {         5332,         5332 },
00354     {        -5332,        -5332 },
00355     {         5334,         5334 },
00356     {        -5334,        -5334 },
00357     {         5342,         5342 },
00358     {        -5342,        -5342 },
00359     {         5401,         5401 },
00360     {        -5401,        -5401 },
00361     {         5403,         5403 },
00362     {        -5403,        -5403 },
00363     {         5412,         5412 },
00364     {        -5412,        -5412 },
00365     {         5414,         5414 },
00366     {        -5414,        -5414 },
00367     {         5422,         5422 },
00368     {        -5422,        -5422 },
00369     {         5424,         5424 },
00370     {        -5424,        -5424 },
00371     {         5432,         5432 },
00372     {        -5432,        -5432 },
00373     {         5434,         5434 },
00374     {        -5434,        -5434 },
00375     {         5442,         5442 },
00376     {        -5442,        -5442 },
00377     {         5444,         5444 },
00378     {        -5444,        -5444 },
00379     {         5503,         5503 },
00380     {        -5503,        -5503 },
00381     {         5512,         5512 },
00382     {        -5512,        -5512 },
00383     {         5514,         5514 },
00384     {        -5514,        -5514 },
00385     {         5522,         5522 },
00386     {        -5522,        -5522 },
00387     {         5524,         5524 },
00388     {        -5524,        -5524 },
00389     {         5532,         5532 },
00390     {        -5532,        -5532 },
00391     {         5534,         5534 },
00392     {        -5534,        -5534 },
00393     {         5542,         5542 },
00394     {        -5542,        -5542 },
00395     {         5544,         5544 },
00396     {        -5544,        -5544 },
00397     {         5554,         5554 },
00398     {        -5554,        -5554 },
00399     {        10111,      9000111 },
00400     {        10113,        10113 },
00401     {        10211,      9000211 },
00402     {       -10211,     -9000211 },
00403     {        10213,        10213 },
00404     {       -10213,       -10213 },
00405     {        10221,      9010221 },
00406     {        10223,        10223 },
00407     {        10311,        10311 },
00408     {       -10311,       -10311 },
00409     {        10313,        10313 },
00410     {       -10313,       -10313 },
00411     {        10321,        10321 },
00412     {       -10321,       -10321 },
00413     {        10323,        10323 },
00414     {       -10323,       -10323 },
00415     {        10331,        10221 },
00416     {        10333,        10333 },
00417     {        10411,        10411 },
00418     {       -10411,       -10411 },
00419     {        10413,        10413 },
00420     {       -10413,       -10413 },
00421     {        10421,        10421 },
00422     {       -10421,       -10421 },
00423     {        10423,        10423 },
00424     {       -10423,       -10423 },
00425     {        10431,        10431 },
00426     {       -10431,       -10431 },
00427     {        10433,        10433 },
00428     {       -10433,       -10433 },
00429     {        10441,        10441 },
00430     {        10443,        10443 },
00431     {        10511,        10511 },
00432     {       -10511,       -10511 },
00433     {        10513,        10513 },
00434     {       -10513,       -10513 },
00435     {        10521,        10521 },
00436     {       -10521,       -10521 },
00437     {        10523,        10523 },
00438     {       -10523,       -10523 },
00439     {        10531,        10531 },
00440     {       -10531,       -10531 },
00441     {        10533,        10533 },
00442     {       -10533,       -10533 },
00443     {        10541,        10541 },
00444     {       -10541,       -10541 },
00445     {        10543,        10543 },
00446     {       -10543,       -10543 },
00447     {        10551,        10551 },
00448     {        10553,        10553 },
00449     {        20113,        20113 },
00450     {        20213,        20213 },
00451     {       -20213,       -20213 },
00452     {        20223,        20223 },
00453     {        20313,        20313 },
00454     {       -20313,       -20313 },
00455     {        20323,        20323 },
00456     {       -20323,       -20323 },
00457     {        20333,        20333 },
00458     {        20413,        20413 },
00459     {       -20413,       -20413 },
00460     {        20423,        20423 },
00461     {       -20423,       -20423 },
00462     {        20433,        20433 },
00463     {       -20433,       -20433 },
00464     {        20443,        20443 },
00465     {        20513,        20513 },
00466     {       -20513,       -20513 },
00467     {        20523,        20523 },
00468     {       -20523,       -20523 },
00469     {        20533,        20533 },
00470     {       -20533,       -20533 },
00471     {        20543,        20543 },
00472     {       -20543,       -20543 },
00473     {        20553,        20553 },
00474     {       100443,       100443 },
00475     {       100553,       100553 },
00476     {      1000001,      1000001 },
00477     {     -1000001,     -1000001 },
00478     {      1000002,      1000002 },
00479     {     -1000002,     -1000002 },
00480     {      1000003,      1000003 },
00481     {     -1000003,     -1000003 },
00482     {      1000004,      1000004 },
00483     {     -1000004,     -1000004 },
00484     {      1000005,      1000005 },
00485     {     -1000005,     -1000005 },
00486     {      1000006,      1000006 },
00487     {     -1000006,     -1000006 },
00488     {      1000011,      1000011 },
00489     {     -1000011,     -1000011 },
00490     {      1000012,      1000012 },
00491     {     -1000012,     -1000012 },
00492     {      1000013,      1000013 },
00493     {     -1000013,     -1000013 },
00494     {      1000014,      1000014 },
00495     {     -1000014,     -1000014 },
00496     {      1000015,      1000015 },
00497     {     -1000015,     -1000015 },
00498     {      1000016,      1000016 },
00499     {     -1000016,     -1000016 },
00500     {      1000021,      1000021 },
00501     {      1000022,      1000022 },
00502     {      1000023,      1000023 },
00503     {      1000024,      1000024 },
00504     {     -1000024,     -1000024 },
00505     {      1000025,      1000025 },
00506     {      1000035,      1000035 },
00507     {      1000037,      1000037 },
00508     {     -1000037,     -1000037 },
00509     {      1000039,      1000039 },
00510     {      2000001,      2000001 },
00511     {     -2000001,     -2000001 },
00512     {      2000002,      2000002 },
00513     {     -2000002,     -2000002 },
00514     {      2000003,      2000003 },
00515     {     -2000003,     -2000003 },
00516     {      2000004,      2000004 },
00517     {     -2000004,     -2000004 },
00518     {      2000005,      2000005 },
00519     {     -2000005,     -2000005 },
00520     {      2000006,      2000006 },
00521     {     -2000006,     -2000006 },
00522     {      2000011,      2000011 },
00523     {     -2000011,     -2000011 },
00524     {      2000012,      2000012 },
00525     {     -2000012,     -2000012 },
00526     {      2000013,      2000013 },
00527     {     -2000013,     -2000013 },
00528     {      2000014,      2000014 },
00529     {     -2000014,     -2000014 },
00530     {      2000015,      2000015 },
00531     {     -2000015,     -2000015 },
00532     {      2000016,      2000016 },
00533     {     -2000016,     -2000016 },
00534     {      3000111,      3000111 },
00535     {      3000211,      3000211 },
00536     {     -3000211,     -3000211 },
00537     {      3000115,      3000115 },
00538     {      3000215,      3000215 },
00539     {     -3000215,     -3000215 },
00540     {      3000221,      3000221 },
00541     {      3000331,      3100221 },
00542     {      3000113,      3000113 },
00543     {      3000213,      3000213 },
00544     {     -3000213,     -3000213 },
00545     {      3000223,      3000223 },
00546     {      3100021,      3100021 },
00547     {      3100111,      3060111 },
00548     {      3200111,      3160111 },
00549     {      3100113,      3130113 },
00550     {      3200113,      3140113 },
00551     {      3300113,      3150113 },
00552     {      3400113,      3160113 },
00553     {      4000001,      4000001 },
00554     {     -4000001,     -4000001 },
00555     {      4000002,      4000002 },
00556     {     -4000002,     -4000002 },
00557     {      4000011,      4000011 },
00558     {     -4000011,     -4000011 },
00559     {      4000012,      4000012 },
00560     {     -4000012,     -4000012 },
00561     {      5000039,      4000039 },
00562     {      5100001,      5100001 },    
00563     {      5100002,      5100002 },    
00564     {      5100003,      5100003 },    
00565     {      5100004,      5100004 },    
00566     {      5100005,      5100005 },    
00567     {      5100006,      5100006 },    
00568     {      5100011,      5100011 },    
00569     {      5100012,      5100012 },    
00570     {      5100013,      5100013 },    
00571     {      5100014,      5100014 },    
00572     {      5100015,      5100015 },    
00573     {      5100016,      5100016 },    
00574     {      5100021,      5100021 },    
00575     {      5100022,      5100022 },    
00576     {      5100023,      5100023 },    
00577     {      5100024,      5100024 },    
00578     {      6100001,      6100001 },    
00579     {      6100002,      6100002 },    
00580     {      6100003,      6100003 },    
00581     {      6100004,      6100004 },    
00582     {      6100005,      6100005 },    
00583     {      6100006,      6100006 },    
00584     {      6100011,      6100011 },    
00585     {      6100012,      6100012 },    
00586     {      6100013,      6100013 },    
00587     {      6100014,      6100014 },    
00588     {      6100015,      6100015 },    
00589     {      6100016,      6100016 },    
00590     {      9900012,      9900012 },
00591     {      9900014,      9900014 },
00592     {      9900016,      9900016 },
00593     {      9900023,      9900023 },
00594     {      9900024,      9900024 },
00595     {     -9900024,     -9900024 },
00596     {      9900041,      9900041 },
00597     {     -9900041,     -9900041 },
00598     {      9900042,      9900042 },
00599     {     -9900042,     -9900042 },
00600     {      9900110,      9910113 },
00601     {      9900210,      9910211 },
00602     {     -9900210,     -9910211 },
00603     {      9900220,      9910223 },
00604     {      9900330,      9910333 },
00605     {      9900440,      9910443 },
00606     {      9902110,      9912112 },
00607     {     -9902110,     -9912112 },
00608     {      9902210,      9912212 },
00609     {     -9902210,     -9912212 },
00610     {      9900441,      9900441 },     
00611     {      9910441,      9910441 },     
00612     {      9900443,      9900443 },     
00613     {      9900551,      9900551 },     
00614     {      9910551,      9910551 },     
00615     {      9900553,      9900553 },    
00616     {   1000010020,   1000010020 },
00617     {  -1000010020,  -1000010020 },
00618     {   1000010030,   1000010030 },
00619     {  -1000010030,  -1000010030 },
00620     {   1000020030,   1000020030 },
00621     {  -1000020030,  -1000020030 },
00622     {   1000020040,   1000020040 },
00623     {  -1000020040,  -1000020040 }
00624   };
00625 
00626   int listSize = sizeof(SList)/sizeof(SList[0]);
00627   for( int k=0; k!=listSize; ++k) {
00628       m.insert( std::make_pair( SList[k].hid, SList[k].pid) );
00629   }
00630   return m;
00631 }  // PythiaPDTMapInit()
00632 
00633 PDTPythiaMap const & PDTPythiaMapInit()
00634 {
00635     static PDTPythiaMap m;
00636     static PythiaPDTMap const & hmap = getPythiaPDTMap();
00637     
00638     for(PythiaPDTMap::const_iterator cit=hmap.begin(), mend=hmap.end(); cit!=mend; ++cit ) {
00639         m.insert( std::make_pair( cit->second, cit->first ));
00640     }
00641     return m;
00642 }
00643   
00644 //
00645 // getPythiaPDTMap is the ONLY function allowed to call PythiaPDTMapInit
00646 //
00647 PythiaPDTMap const & getPythiaPDTMap()
00648 {
00649   static PythiaPDTMap const & hmap = PythiaPDTMapInit();
00650   return hmap;
00651 }  // getPythiaPDTMap()
00652 
00653 //
00654 // getPDTPythiaMap is the ONLY function allowed to call PythiaPDTMapInit
00655 //
00656 PDTPythiaMap const & getPDTPythiaMap()
00657 {
00658   static PDTPythiaMap const & hmap = PDTPythiaMapInit();
00659   return hmap;
00660 }  // getPDTPythiaMap()
00661 
00662 } // unnamed namespace
00663   
00664 int translatePythiatoPDT( const int id )
00665 {
00666     static PythiaPDTMap const & hmap = getPythiaPDTMap();
00667 
00668     PythiaPDTMap::const_iterator const cit = hmap.find( id );
00669     // found it in the map
00670     if ( cit != hmap.end() ) { return cit->second; }
00671     // check to see if someone has defined a valid particle type
00672     // that isn't in the map
00673     if( isValid(id) ) { return id; }
00674     return 0;
00675 }
00676 
00677 int translatePDTtoPythia( const int id )
00678 {
00679     static PDTPythiaMap const & pmap = getPDTPythiaMap();
00680 
00681     PDTPythiaMap::const_iterator const cit = pmap.find( id );
00682     // found it in the map
00683     if ( cit != pmap.end() ) { return cit->second; }
00684     // check to see if someone has defined a valid particle type
00685     // that isn't in the map
00686     if( isValid(id) ) { return id; }
00687     return 0;
00688 }
00689 
00690 void writePythiaTranslationLine( int i, std::ostream & os  )
00691 {
00692     // only write map entries
00693     static PythiaPDTMap const & hmap = getPythiaPDTMap();
00694 
00695     PythiaPDTMap::const_iterator const cit = hmap.find( i );
00696     // found it in the map
00697     if ( cit != hmap.end() ) { 
00698         int id = cit->second;
00699         os << " Pythia number: " ;
00700         os.width(10);
00701         os << i << "  HepPID number: " ;
00702         os.width(10);
00703         os << id << "  " << particleName(id) << std::endl;
00704         // check reverse translation
00705         int iback =  translatePDTtoPythia(id);
00706         if(iback != i) {
00707             os << " WARNING: " << id << " translates back to " 
00708                << iback << " not to " << i << std::endl;
00709         }
00710     }
00711     return;
00712 }  // writePythiaTranslationLine()
00713 
00714 void  writePythiaTranslation( std::ostream & os )
00715 {
00716     writeVersion( os );
00717     os << "     HepPID Particle List" << std::endl;
00718     os << std::endl;
00719 
00720     int id, i, j, q1, q2, q3, l, m, n;
00721     // special cases
00722     for( id=1; id<101; ++id) {
00723         writePythiaTranslationLine(  id, os );
00724         writePythiaTranslationLine( -id, os );
00725     }
00726     for( i=11; i<1000; ++i) {
00727         id = i*10;
00728         writePythiaTranslationLine(  id, os );
00729         writePythiaTranslationLine( -id, os );
00730     }
00731     // SUSY
00732     for( n=1; n<3; ++n) {
00733         for( i=1; i<40; ++i) {
00734              id = 1000000*n+i;
00735              writePythiaTranslationLine(  id, os );
00736              writePythiaTranslationLine( -id, os );
00737         }
00738     }
00739     // technicolor
00740     for( q2=1; q2<4; ++q2) {
00741         for( q1=1; q1<4; ++q1) {
00742             for( j=1; j<6; ++j) {
00743                 for( m=0; m<5; ++m) {
00744                     id = 3000000+100000*m+100*q2+10*q1+j;
00745                     writePythiaTranslationLine(  id, os );
00746                     writePythiaTranslationLine( -id, os );
00747                 }
00748             }
00749         }
00750     }
00751     // excited particles
00752     for( n=4; n<6; ++n) {
00753         for( i=1; i<40; ++i) {
00754             id = 1000000*n+i;
00755             writePythiaTranslationLine(  id, os );
00756             writePythiaTranslationLine( -id, os );
00757         }
00758     }
00759     // miscellaneous generator particles
00760     for( l=0; l<9; ++l) {
00761         for( q3=0; q3<10; ++q3) {
00762             for( q2=0; q2<10; ++q2) {
00763                 for( q1=0; q1<10; ++q1) {
00764                     for( j=0; j<10; ++j) {
00765                         id = 9900000+10000*l+1000*q3+100*q2+10*q1+j;
00766                         writePythiaTranslationLine(  id, os );
00767                         writePythiaTranslationLine( -id, os );
00768                     }
00769                 }
00770             }
00771         }
00772     }
00773     // diquark
00774     for( i=11; i<100; ++i) {
00775         for( j=0; j<10; ++j) {
00776             id = 100*i+j;
00777             writePythiaTranslationLine(  id, os );
00778             writePythiaTranslationLine( -id, os );
00779         }
00780     }
00781     // mesons
00782     for( q2=1; q2<10; ++q2) {
00783         for( q1=1; q1<10; ++q1) {
00784             for( j=1; j<10; ++j) {
00785                 for( m=0; m<9; ++m) {
00786                     for( l=0; l<10; ++l) {
00787                         id = 100000*m+10000*l+100*q2+10*q1+j;
00788                         writePythiaTranslationLine(  id, os );
00789                         writePythiaTranslationLine( -id, os );
00790                         id = 9000000+100000*m+10000*l+100*q2+10*q1+j;
00791                         writePythiaTranslationLine(  id, os );
00792                         writePythiaTranslationLine( -id, os );
00793                     }
00794                 }
00795             }
00796         }
00797     }
00798     // baryons
00799     for( q3=1; q3<10; ++q3) {
00800         for( q2=1; q2<10; ++q2) {
00801             for( q1=1; q1<10; ++q1) {
00802                 for( j=1; j<10; ++j) {
00803                     id = 1000*q3+100*q2+10*q1+j;
00804                     writePythiaTranslationLine(  id, os );
00805                     writePythiaTranslationLine( -id, os );
00806                 }
00807             }
00808         }
00809     }
00810     // pentaquarks
00811     for( l=1; l<9; ++l ) {
00812         for ( m=1; m<9; ++m ) {
00813             for( q3=1; q3<9; ++q3) {
00814                 for( q2=1; q2<9; ++q2) {
00815                     for( q1=1; q1<9; ++q1) {
00816                         id = 9*1000000+l*100000+m*10000+1000*q3+100*q2+10*q1+2;
00817                         writePythiaTranslationLine(  id, os );
00818                         writePythiaTranslationLine( -id, os );
00819                     }
00820                 }
00821             }
00822         }
00823     }
00824     return;
00825 }  // writePythiaTranslation()
00826 
00827 }       // HepPID

Generated on Fri Dec 4 14:05:24 2009 for HepPDT by  doxygen 1.4.7