HepPDT Reference Documentation

HepPDT

translateQQ.cc

Go to the documentation of this file.
00001 // ------------------------------------
00002 //
00003 // translateQQ.cc
00004 // Author: Lynn Garren
00005 //
00006 // translate an ID number to or from the standard numbering scheme and QQ
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 QQPDTMapInit()
00013 //  We use a data table (struct SList) so that compile time is not impacted.
00014 //
00015 //  public functions:
00016 //        int translateQQtoPDT( const int id )
00017 //        int translatePDTtoQQ( const int id )
00018 //        QQPDTMap const & getQQPDTMap()
00019 //        PDTQQMap const & getPDTQQMap()
00020 //        int translateQQbar( const int id )
00021 //        int translateInverseQQbar( const int id )
00022 //        QQbarMap const & getQQbarMap()
00023 //        InverseQQbarMap const & getInverseQQbarMap()
00024 //
00025 // ------------------------------------
00026 
00027 #include <map>
00028 #include <utility>      // make_pair
00029 
00030 #include "HepPID/Version.hh"
00031 #include "HepPID/ParticleIDTranslations.hh"
00032 #include "HepPID/ParticleIDMethods.hh"
00033 #include "HepPID/ParticleName.hh"
00034 
00035 namespace HepPID {
00036 
00037  typedef  std::map< int, int >  QQPDTMap;
00038  typedef  std::map< int, int >  PDTQQMap;
00039  typedef  std::map< int, int >  QQbarMap;
00040  typedef  std::map< int, int >  InverseQQbarMap;
00041 
00042 namespace {     // QQPDTMapInit is private
00043 
00044  QQPDTMap const & getQQPDTMap();
00045  PDTQQMap const & getPDTQQMap();
00046  QQbarMap const & getQQbarMap();
00047  InverseQQbarMap const & getInverseQQbarMap();
00048 
00049 QQPDTMap const & QQPDTMapInit()
00050 {
00051 
00052   static QQPDTMap  m;
00053 
00054   static const struct {
00055       int hid;  // Pythia
00056       int pid;  // PDT
00057   } SList[] = {
00058     {    -13,         21 },
00059     {    -12,         -6 },
00060     {    -11,         -5 },
00061     {    -10,         -4 },
00062     {     -9,         -3 },
00063     {     -8,         -1 },
00064     {     -7,         -2 },
00065     {     -6,          6 },
00066     {     -5,          5 },
00067     {     -4,          4 },
00068     {     -3,          3 },
00069     {     -2,          1 },
00070     {     -1,          2 },
00071     {      0,       10022},
00072     {      1,         22 },
00073     {      2,         23 },
00074     {      3,         24 },
00075     {      4,        -24 },
00076     {      5,         82 },
00077     {      7,         11 },
00078     {      8,        -11 },
00079     {      9,         12 },
00080     {     10,        -12 },
00081     {     11,         13 },
00082     {     12,        -13 },
00083     {     13,         14 },
00084     {     14,        -14 },
00085     {     15,         15 },
00086     {     16,        -15 },
00087     {     17,         16 },
00088     {     18,        -16 },
00089     {     19,      20313 },
00090     {     20,     -20313 },
00091     {     21,        211 },
00092     {     22,       -211 },
00093     {     23,        321 },
00094     {     24,       -321 },
00095     {     25,        311 },
00096     {     26,       -311 },
00097     {     27,        421 },
00098     {     28,       -421 },
00099     {     29,        411 },
00100     {     30,       -411 },
00101     {     31,        431 },
00102     {     32,       -431 },
00103     {     33,       -521 },
00104     {     34,        521 },
00105     {     35,       -511 },
00106     {     36,        511 },
00107     {     37,       -531 },
00108     {     38,        531 },
00109     {     39,       -541 },
00110     {     40,        541 },
00111     {     41,        621 },
00112     {     42,       -621 },
00113     {     43,        611 },
00114     {     44,       -611 },
00115     {     45,        631 },
00116     {     46,       -631 },
00117     {     47,        641 },
00118     {     48,       -641 },
00119     {     49,        651 },
00120     {     50,       -651 },
00121     {     51,        111 },
00122     {     52,        221 },
00123     {     53,        331 },
00124     {     54,        441 },
00125     {     55,        551 },
00126     {     56,        661 },
00127     {     57,        310 },
00128     {     58,        130 },
00129     {     59,      10313 },
00130     {     60,     -10313 },
00131     {     61,        213 },
00132     {     62,       -213 },
00133     {     63,        323 },
00134     {     64,       -323 },
00135     {     65,        313 },
00136     {     66,       -313 },
00137     {     67,        423 },
00138     {     68,       -423 },
00139     {     69,        413 },
00140     {     70,       -413 },
00141     {     71,        433 },
00142     {     72,       -433 },
00143     {     73,       -523 },
00144     {     74,        523 },
00145     {     75,       -513 },
00146     {     76,        513 },
00147     {     77,       -533 },
00148     {     78,        533 },
00149     {     79,       -543 },
00150     {     80,        543 },
00151     {     81,        623 },
00152     {     82,       -623 },
00153     {     83,        613 },
00154     {     84,       -613 },
00155     {     85,        633 },
00156     {     86,       -633 },
00157     {     87,        643 },
00158     {     88,       -643 },
00159     {     89,        653 },
00160     {     90,       -653 },
00161     {     91,        113 },
00162     {     92,        223 },
00163     {     93,        333 },
00164     {     94,        443 },
00165     {     95,        553 },
00166     {     96,        663 },
00167     {     97,     100553 },
00168     {     98,     200553 },
00169     {     99,     300553 },
00170     {    100,      10551 },
00171     {    101,      20553 },
00172     {    102,        555 },
00173     {    103,     110551 },
00174     {    104,     120553 },
00175     {    105,     100555 },
00176     {    106,      30113 },
00177     {    107,      20213 },
00178     {    108,      20113 },
00179     {    109,     -20213 },
00180     {    110,      10441 },
00181     {    111,      20443 },
00182     {    112,        445 },
00183     {    121,       3122 },
00184     {    122,      -3122 },
00185     {    123,       4122 },
00186     {    124,      -4122 },
00187     {    125,       4232 },
00188     {    126,      -4232 },
00189     {    127,       4132 },
00190     {    128,      -4132 },
00191     {    129,       3212 },
00192     {    130,      -3212 },
00193     {    131,       4212 },
00194     {    132,      -4212 },
00195     {    133,       4322 },
00196     {    134,      -4322 },
00197     {    135,       4312 },
00198     {    136,      -4312 },
00199     {    137,       2212 },
00200     {    138,      -2212 },
00201     {    139,       3222 },
00202     {    140,      -3222 },
00203     {    141,       4222 },
00204     {    142,      -4222 },
00205     {    143,       2112 },
00206     {    144,      -2112 },
00207     {    145,       3112 },
00208     {    146,      -3112 },
00209     {    147,       4112 },
00210     {    148,      -4112 },
00211     {    149,       3322 },
00212     {    150,      -3322 },
00213     {    151,       3312 },
00214     {    152,      -3312 },
00215     {    153,       4332 },
00216     {    154,      -4332 },
00217     {    155,       4422 },
00218     {    156,      -4422 },
00219     {    157,       4412 },
00220     {    158,      -4412 },
00221     {    159,       4432 },
00222     {    160,      -4432 },
00223     {    161,       3214 },
00224     {    162,      -3214 },
00225     {    163,       4214 },
00226     {    164,      -4214 },
00227     {    165,       4324 },
00228     {    166,      -4324 },
00229     {    167,       4314 },
00230     {    168,      -4314 },
00231     {    169,       2214 },
00232     {    170,      -2214 },
00233     {    171,       3224 },
00234     {    172,      -3224 },
00235     {    173,       4224 },
00236     {    174,      -4224 },
00237     {    175,       2114 },
00238     {    176,      -2114 },
00239     {    177,       3114 },
00240     {    178,      -3114 },
00241     {    179,       4114 },
00242     {    180,      -4114 },
00243     {    181,       3324 },
00244     {    182,      -3324 },
00245     {    183,       3314 },
00246     {    184,      -3314 },
00247     {    185,       4334 },
00248     {    186,      -4334 },
00249     {    187,       4424 },
00250     {    188,      -4424 },
00251     {    189,       4414 },
00252     {    190,      -4414 },
00253     {    191,       4434 },
00254     {    192,      -4434 },
00255     {    193,       2224 },
00256     {    194,      -2224 },
00257     {    195,       1114 },
00258     {    196,      -1114 },
00259     {    197,       3334 },
00260     {    198,      -3334 },
00261     {    199,       4444 },
00262     {    200,      -4444 },
00263     {    201,      10323 },
00264     {    202,     -10323 },
00265     {    203,      20323 },
00266     {    204,     -20323 },
00267     {    205,      30213 },
00268     {    206,     -30213 },
00269     {    207,         84 },
00270     {    208,        -84 },
00271     {    209,         85 },
00272     {    210,        -85 },
00273     {    211,      30443 },
00274     {    212,    9000443 },
00275     {    213,    9010443 },
00276     {    214,    9020443 },
00277     {    215,      10443 },
00278     {    216,    9000553 },
00279     {    217,    9010553 },
00280     {    218,      10553 },
00281     {    219,     100443 },
00282     {    220,    9020553 },
00283     {    221,      10411 },
00284     {    222,      20413 },
00285     {    223,      10413 },
00286     {    224,        415 },
00287     {    225,     -10411 },
00288     {    226,     -20413 },
00289     {    227,     -10413 },
00290     {    228,       -415 },
00291     {    229,      10421 },
00292     {    230,      20423 },
00293     {    231,      10423 },
00294     {    232,        425 },
00295     {    233,     -10421 },
00296     {    234,     -20423 },
00297     {    235,     -10423 },
00298     {    236,       -425 },
00299     {    237,      10431 },
00300     {    238,      20433 },
00301     {    239,      10433 },
00302     {    240,        435 },
00303     {    241,     -10431 },
00304     {    242,     -20433 },
00305     {    243,     -10433 },
00306     {    244,       -435 },
00307     {    251,    9000111 },
00308     {    252,    9000211 },
00309     {    253,   -9000211 },
00310     {    254,        115 },
00311     {    255,        215 },
00312     {    256,       -215 },
00313     {    257,    9010221 },
00314     {    258,      10221 },
00315     {    259,      20223 },
00316     {    260,      20333 },
00317     {    261,        225 },
00318     {    262,        335 },
00319     {    263,      10223 },
00320     {    264,      10333 },
00321     {    265,      10113 },
00322     {    266,      10213 },
00323     {    267,     -10213 },
00324     {    268,      10311 },
00325     {    269,     -10311 },
00326     {    270,      10321 },
00327     {    271,     -10321 },
00328     {    272,        315 },
00329     {    273,       -315 },
00330     {    274,        325 },
00331     {    275,       -325 },
00332     {    276,         86 },
00333     {    277,        -86 },
00334     {    278,        317 },
00335     {    279,       -317 },
00336     {    280,        327 },
00337     {    281,       -327 },
00338     {    291,         87 },
00339     {    292,        -87 },
00340     {    293,         88 },
00341     {    294,        -88 },
00342     {    295,         89 },
00343     {    296,        -89 },
00344     {    297,         90 },
00345     {    298,        -90 },
00346     {    401,       5122 },
00347     {    402,      -5122 },
00348     {    403,       5232 },
00349     {    404,      -5232 },
00350     {    405,       5132 },
00351     {    406,      -5132 },
00352     {    407,       5242 },
00353     {    408,      -5242 },
00354     {    409,       5142 },
00355     {    410,      -5142 },
00356     {    411,       5342 },
00357     {    412,      -5342 },
00358     {    413,       5212 },
00359     {    414,      -5212 },
00360     {    415,       5322 },
00361     {    416,      -5322 },
00362     {    417,       5312 },
00363     {    418,      -5312 },
00364     {    419,       5422 },
00365     {    420,      -5422 },
00366     {    421,       5412 },
00367     {    422,      -5412 },
00368     {    423,       5432 },
00369     {    424,      -5432 },
00370     {    425,       5222 },
00371     {    426,      -5222 },
00372     {    427,       5112 },
00373     {    428,      -5112 },
00374     {    429,       5332 },
00375     {    430,      -5332 },
00376     {    431,       5442 },
00377     {    432,      -5442 },
00378     {    433,       5522 },
00379     {    434,      -5522 },
00380     {    435,       5512 },
00381     {    436,      -5512 },
00382     {    437,       5532 },
00383     {    438,      -5532 },
00384     {    439,       5542 },
00385     {    440,      -5542 },
00386     {    441,       5214 },
00387     {    442,      -5214 },
00388     {    443,       5324 },
00389     {    444,      -5324 },
00390     {    445,       5314 },
00391     {    446,      -5314 },
00392     {    447,       5424 },
00393     {    448,      -5424 },
00394     {    449,       5414 },
00395     {    450,      -5414 },
00396     {    451,       5434 },
00397     {    452,      -5434 },
00398     {    453,       5224 },
00399     {    454,      -5224 },
00400     {    455,       5114 },
00401     {    456,      -5114 },
00402     {    457,       5334 },
00403     {    458,      -5334 },
00404     {    459,       5444 },
00405     {    460,      -5444 },
00406     {    461,       5524 },
00407     {    462,      -5524 },
00408     {    463,       5514 },
00409     {    464,      -5514 },
00410     {    465,       5534 },
00411     {    466,      -5534 },
00412     {    467,       5544 },
00413     {    468,      -5544 },
00414     {    469,       5554 },
00415     {    470,      -5554 },
00416     {    471,      10521 },
00417     {    472,      20523 },
00418     {    473,      10523 },
00419     {    474,        525 },
00420     {    475,     -10521 },
00421     {    476,     -20523 },
00422     {    477,     -10523 },
00423     {    478,       -525 },
00424     {    479,      10511 },
00425     {    480,      20513 },
00426     {    481,      10513 },
00427     {    482,        515 },
00428     {    483,     -10511 },
00429     {    484,     -20513 },
00430     {    485,     -10513 },
00431     {    486,       -515 },
00432     {    487,      10531 },
00433     {    488,      20533 },
00434     {    489,      10533 },
00435     {    490,        535 },
00436     {    491,     -10531 },
00437     {    492,     -20533 },
00438     {    493,     -10533 },
00439     {    494,       -535 },
00440     {    495,         92 },
00441     {    496,        -92 },
00442     {    497,         93 },
00443     {    498,        -93 }
00444   };
00445 
00446   int listSize = sizeof(SList)/sizeof(SList[0]);
00447   for( int k=0; k!=listSize; ++k) {
00448       m.insert( std::make_pair( SList[k].hid, SList[k].pid) );
00449   }
00450   return m;
00451 }  // QQPDTMapInit()
00452 
00453 // we need a separate map for the QQ quark pair pseudo-particles
00454 // use diquark particle ID numbers
00455 QQbarMap const & QQbarMapInit()
00456 {
00457   static QQbarMap  m;
00458 
00459   static const struct {
00460       int hid;  // Pythia
00461       int pid;  // PDT
00462   } SList[] = {
00463     {      1, 2203 },
00464     {      2, 2101 },
00465     {      3, 3203 },
00466     {      4, 4203 },
00467     {      5, 5203 },
00468     {      6, 6203 },
00469     {      7, 2103 },
00470     {      8, 1103 },
00471     {      9, 3103 },
00472     {     10, 4103 },
00473     {     11, 5103 },
00474     {     12, 6103 },
00475     {     13, 3201 },
00476     {     14, 3101 },
00477     {     15, 3303 },
00478     {     16, 4303 },
00479     {     17, 5303 },
00480     {     18, 6303 },
00481     {     19, 4201 },
00482     {     20, 4101 },
00483     {     21, 4301 },
00484     {     22, 4403 },
00485     {     23, 5403 },
00486     {     24, 6403 },
00487     {     25, 5201 },
00488     {     26, 5101 },
00489     {     27, 5301 },
00490     {     28, 5401 },
00491     {     29, 5503 },
00492     {     30, 6503 },
00493     {     31, 6201 },
00494     {     32, 6101 },
00495     {     33, 6301 },
00496     {     34, 6401 },
00497     {     35, 6501 },
00498     {     36, 6603 },
00499     {     37,   81 }
00500   };
00501 
00502   int listSize = sizeof(SList)/sizeof(SList[0]);
00503   for( int k=0; k!=listSize; ++k) {
00504       m.insert( std::make_pair( SList[k].hid, SList[k].pid) );
00505   }
00506   return m;
00507 }  // QQbarMapInit()
00508 
00509 PDTQQMap const & PDTQQMapInit()
00510 {
00511     static PDTQQMap m;
00512     static QQPDTMap const & hmap = getQQPDTMap();
00513     
00514     for(QQPDTMap::const_iterator cit=hmap.begin(), mend=hmap.end(); cit!=mend; ++cit ) {
00515         m.insert( std::make_pair( cit->second, cit->first ));
00516     }
00517     return m;
00518 }
00519 
00520 InverseQQbarMap const & InverseQQbarMapInit()
00521 {
00522     static InverseQQbarMap m;
00523     static QQbarMap const & hmap = getQQbarMap();
00524     
00525     for(QQbarMap::const_iterator cit=hmap.begin(), mend=hmap.end(); cit!=mend; ++cit ) {
00526         m.insert( std::make_pair( cit->second, cit->first ));
00527     }
00528     return m;
00529 }
00530   
00531 //
00532 // getQQPDTMap is the ONLY function allowed to call QQPDTMapInit
00533 //
00534 QQPDTMap const & getQQPDTMap()
00535 {
00536   static QQPDTMap const & hmap = QQPDTMapInit();
00537   return hmap;
00538 }  // getQQPDTMap()
00539 
00540 //
00541 // getPDTQQMap is the ONLY function allowed to call QQPDTMapInit
00542 //
00543 PDTQQMap const & getPDTQQMap()
00544 {
00545   static PDTQQMap const & hmap = PDTQQMapInit();
00546   return hmap;
00547 }  // getPDTQQMap()
00548 //
00549 // getQQbarMap is the ONLY function allowed to call QQbarMapInit
00550 //
00551 QQbarMap const & getQQbarMap()
00552 {
00553   static QQbarMap const & hmap = QQbarMapInit();
00554   return hmap;
00555 }  // getQQbarMap()
00556 
00557 //
00558 // getInverseQQbarMap is the ONLY function allowed to call QQbarMapInit
00559 //
00560 InverseQQbarMap const & getInverseQQbarMap()
00561 {
00562   static InverseQQbarMap const & hmap = InverseQQbarMapInit();
00563   return hmap;
00564 }  // getInverseQQbarMap()
00565 
00566 } // unnamed namespace
00567   
00568 int translateQQbar( const int id )
00569 {
00570     static QQbarMap const & hmap = getQQbarMap();
00571 
00572     QQbarMap::const_iterator const cit = hmap.find( id );
00573     // found it in the map
00574     if ( cit != hmap.end() ) { return cit->second; }
00575     // for QQ, you can only use the map
00576     return 0;
00577 }
00578 
00579 int translateInverseQQbar( const int id )
00580 {
00581     static InverseQQbarMap const & pmap = getInverseQQbarMap();
00582 
00583     InverseQQbarMap::const_iterator const cit = pmap.find( id );
00584     // found it in the map
00585     if ( cit != pmap.end() ) { return cit->second; }
00586     // for QQ, you can only use the map
00587     return 0;
00588 }
00589 
00590 int translateQQtoPDT( const int id )
00591 {
00592     static QQPDTMap const & hmap = getQQPDTMap();
00593 
00594     QQPDTMap::const_iterator const cit = hmap.find( id );
00595     // found it in the map
00596     if ( cit != hmap.end() ) { return cit->second; }
00597     // for QQ, you can only use the map
00598     return 0;
00599 }
00600 
00601 int translatePDTtoQQ( const int id )
00602 {
00603     static PDTQQMap const & pmap = getPDTQQMap();
00604 
00605     PDTQQMap::const_iterator const cit = pmap.find( id );
00606     // found it in the map
00607     if ( cit != pmap.end() ) { return cit->second; }
00608     // for QQ, you can only use the map
00609     return 0;
00610 }
00611 
00612 void  writeQQTranslation ( std::ostream & os )
00613 {
00614     int id, iq, iback;
00615     writeVersion( os );
00616     os << "     HepPID Particle List" << std::endl;
00617     os << std::endl;
00618 
00619     // quark pairs have overlapping QQ ID numbers
00620     for( iq=1; iq<40; ++iq) {
00621         id = translateQQbar( iq );
00622         if ( id != 0 ) {
00623             os << " QQ number: " ;
00624             os.width(10);
00625             os << iq << "  HepPID number: " ;
00626             os.width(10);
00627             os << id << "  " << particleName(id) << std::endl;
00628             // check reverse translation
00629             iback =  translateInverseQQbar(id);
00630             if(iback != iq) {
00631                 os << " WARNING: " << id << " translates back to " 
00632                    << iback << " not to " << iq << std::endl;
00633             }
00634         }
00635     }
00636     // regular QQ particles
00637     for( iq=-13; iq<501; ++iq) {
00638         id = translateQQtoPDT( iq );
00639         if ( id != 0 ) {
00640             os << " QQ number: " ;
00641             os.width(10);
00642             os << iq << "  HepPID number: " ;
00643             os.width(10);
00644             os << id << "  " << particleName(id) << std::endl;
00645             // check reverse translation
00646             iback =  translatePDTtoQQ(id);
00647             if(iback != iq) {
00648                 os << " WARNING: " << id << " translates back to " 
00649                    << iback << " not to " << iq << std::endl;
00650             }
00651         }
00652     }
00653     return;
00654 }  // writeQQTranslation()
00655 
00656 }       // HepPID

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