Commit 3a3e2941 authored by Lynn Garren's avatar Lynn Garren
Browse files

Isajet translations now use static maps

parent c28b7f94
......@@ -15,26 +15,32 @@ namespace HepPDT {
// translate between generator ID's and standard numbering scheme
int translatePythiatoPDT( const int pythiaID );
int translateIsajettoPDT( const int isajetID );
int translateQQtoPDT( const int qqID);
int translateGeanttoPDT( const int geantID);
int translatePDGtabletoPDT( const int pdgID);
int translateEvtGentoPDT( const int evtGenID );
int translatePDTtoPythia( const int pid );
int translatePDTtoIsajet( const int pid );
int translatePDTtoQQ( const int pid );
int translatePDTtoGeant( const int pid );
int translatePDTtoPDGtable( const int pid );
int translatePDTtoEvtGen( const int pid );
// Herwig methods and maps
// Herwig translations
typedef std::map< int, int > HerwigPDTMap;
typedef std::map< int, int > PDTHerwigMap;
int translateHerwigtoPDT( const int herwigID);
int translatePDTtoHerwig( const int pid );
HerwigPDTMap const & getHerwigPDTMap();
PDTHerwigMap const & getPDTHerwigMap();
int translateHerwigtoPDT( const int herwigID);
int translatePDTtoHerwig( const int pid );
// Isajet translations
typedef std::map< int, int > IsajetPDTMap;
typedef std::map< int, int > PDTIsajetMap;
IsajetPDTMap const & getIsajetPDTMap();
PDTIsajetMap const & getPDTIsajetMap();
int translateIsajettoPDT( const int isajetID );
int translatePDTtoIsajet( const int pid );
} // namespace HepPDT
......
// $Id: examListIsajet.cc,v 1.1.4.1 2004/04/21 23:06:33 garren Exp $
// $Id: examListIsajet.cc,v 1.1.4.2 2005/03/16 18:10:33 garren Exp $
// -------------------------------------------------------------------
//
// List the isajet translation
......@@ -16,17 +16,12 @@
extern "C" {
void list_isajet_init_ ( );
void get_isajet_name_( int * i, int * id, int * aid, char *name, char *aname );
void flavor_( int *, int *, int *, int *, int *, int * );
void get_label_( int * id, char *name );
}
int main()
{
int i, j;
int aid, id, hid;
char cname[10];
char acname[10];
std::string hname;
std::string pn;
static char outfile[] = "examListIsajet.out";
std::string title = "HepPDT listing of Isajet translations";
......@@ -42,38 +37,71 @@ int main()
os << " " << title << std::endl;
for( i=1; i<100001; ++i ) {
// get info from isajet
int i, j;
int id, aid, fl1, fl2, fl3, js, indx;
int pid;
char cname[10];
char acname[10];
std::string hname;
std::string pn;
for( i=1; i<100005; ++i ) {
// make sure names are empty
for( j=0; j<10; ++j) { cname[j] = '\0'; }
for( j=0; j<10; ++j) { acname[j] = '\0'; }
get_isajet_name_( & i, & id, &aid, cname, acname );
// particle
// get info from isajet
id = i;
aid = 0;
flavor_(&id, &fl1, &fl2, &fl3, &js, &indx );
// we need both a valid index and a valid label
// check the label only if there is a valid translation
if ( indx > 0 ) {
get_label_(&id,cname);
aid = -id;
get_label_(&aid,acname);
} else {
id = aid = 0;
}
// print particle
if( id != 0 ) {
pid = HepPDT::translateIsajettoPDT( id );
hname = std::string( cname );
hid = HepPDT::translateIsajettoPDT( id );
pn = HepPDT::particleName( hid );
os << "Isajet: ";
os.width(10);
os << id << " " << hname;
os << " HepPDT: " ;
os.width(12);
os << hid << " " << pn << std::endl;
if ( pid != 0 ) {
pn = HepPDT::particleName( pid );
os << "Isajet: ";
os.width(10);
os << id << " " << hname;
os << " HepPDT: " ;
os.width(12);
os << pid << " " << pn << std::endl;
} else if ( strncmp( cname, "ERR", 3 ) != 0 ) {
os << "Isajet: ";
os.width(10);
os << id << " with name \"" << hname;
os << "\" has no HepPDT translation " << std::endl;
}
}
// antiparticle
// print antiparticle
if( aid != 0 ) {
hname = std::string( acname );
hid = HepPDT::translateIsajettoPDT( aid );
pn = HepPDT::particleName( hid );
os << "Isajet: ";
os.width(10);
os << aid << " " << hname;
os << " HepPDT: " ;
os.width(12);
os << hid << " " << pn << std::endl;
pid = HepPDT::translateIsajettoPDT( aid );
if ( pid != 0 ) {
pn = HepPDT::particleName( pid );
os << "Isajet: ";
os.width(10);
os << aid << " " << hname;
os << " HepPDT: " ;
os.width(12);
os << pid << " " << pn << std::endl;
} else if ( strncmp( acname, "ERR", 3 ) != 0 ) {
os << "Isajet: ";
os.width(10);
os << aid << " with name \"" << hname;
os << "\" has no HepPDT translation " << std::endl;
}
}
}
return 0;
}
......@@ -594,8 +594,8 @@ Isajet: 6600 TT0. HepPDT: 6603 tt_1
Isajet: -6600 ATT0. HepPDT: -6603 tt_1~
Isajet: 6661 TTT* HepPDT: 6664 Omega*_ttt++
Isajet: -6661 ATTT* HepPDT: -6664 Omega*_ttt~--
Isajet: 10000 HepPDT: 0
Isajet: -10000 HepPDT: 0
Isajet: 10000 with name "" has no HepPDT translation
Isajet: -10000 with name "" has no HepPDT translation
Isajet: 10110 F0 HepPDT: 9010221 f_0(980)
Isajet: 10111 A10 HepPDT: 20113 a_1(1260)0
Isajet: 10121 A1+ HepPDT: 20213 a_1(1260)+
......
......@@ -51,29 +51,16 @@ C
return
END
subroutine get_isajet_name( i, id1, id2, lb1, lb2 )
subroutine get_label( id, lb)
integer I,ifL1,ifL2,ifL3,JSPIN,IDEX
integer id,ID1,ID2
character*8 LB1,LB2,LABEL
integer id
character*8 LB,LABEL
ID1 = I
ID2=-ID1
lb1 = ' '
lb2 = ' '
call FLAVOR(ID1,ifL1,ifL2,ifL3,JSPIN,IDEX)
if(IDEX.GT.0)then
LB1 = LABEL(ID1)
if(LB1.NE.'LERR' .AND. LB1.NE.'ERR')then
LB2=LABEL(ID2)
if(LB2.EQ.'LERR' .OR. LB2.EQ.'ERR') id2 = 0
else
id1 = 0
id2 = 0
endif
else
id1 = 0
id2 = 0
lb = ' '
if ( id.ne.0) then
lb = LABEL(id)
endif
return
end
......@@ -50,11 +50,10 @@ libCLHEP_HepPDT_@VERSION@_a_SOURCES = \
translateEvtGentoPDT.cc \
translateGeanttoPDT.cc \
translateHerwig.cc \
translateIsajettoPDT.cc \
translateIsajet.cc \
translatePDGtabletoPDT.cc \
translatePDTtoEvtGen.cc \
translatePDTtoGeant.cc \
translatePDTtoIsajet.cc \
translatePDTtoPDGtable.cc \
translatePDTtoPythia.cc \
translatePDTtoQQ.cc \
......
This diff is collapsed.
// $Id: translateIsajettoPDT.cc,v 1.1.1.1.2.1 2004/04/21 23:06:33 garren Exp $
// ----------------------------------------------------------------------
//
// translateIsajettoPDT.cc
//
// translate an Isajet ID number to the standard numbering scheme
//
// ----------------------------------------------------------------------
#include <iostream>
#include "CLHEP/HepPDT/ParticleID.hh"
namespace HepPDT {
int translateIsajettoPDT( const int id )
{
// ... itabi(I) converts miscellaneous ISAJET particle ID's to a standard scheme
static int itabi[100]={2,1,3,4,5,6,7,8,21,22,
12,11,14,13,16,15,0,0,0,310,
1000002,1000001,1000003,1000004,1000005,1000006,
0,0,1000021,1000022,
1000012,1000011,1000014,1000013,1000016,1000015,
0,0,1000024,1000023,
2000002,2000001,2000003,2000004,2000005,2000006,
0,0,1000037,1000025,
2000012,2000011,2000014,2000013,2000016,2000015,
0,0,0,1000035,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,24,
25,51,35,36,55,37,53,52,54,23,
1000039,39,0,0,0,0,0,0,0,0};
static int noant[10]={-21,-22,-23,-25,-32,-33,-35,-36,-51,-56};
int i;
int istran=0;
ParticleID pid(id);
int ida=pid.abspid();
int js=ida%10;
int i1=(ida/10)%10;
int i2=(ida/100)%10;
int i3=(ida/1000)%10;
int i4=(ida/10000)%10;
if(ida == 0) {
std::cout << " ISTRAN: particle ID is zero" << std::endl;
} else if(ida <= 100) {
istran = itabi[ida-1];
if( id < 0 ) { istran = -itabi[ida-1]; }
if( id == -20) { istran=130; }
// ...check for illegal antiparticles
if( istran < 0 ) {
for( i=0; i<10; ++i ) {
if( istran == noant[i] ) { istran = 0; }
}
}
} else if(i1 != 0 && i2 != 0 && i3 == 0) {
// ...mesons
// u and d have opposite definitions - sometimes
if(i2 <= 2 && i1 <= 2){
// don't change
} else if(i2 <= 2) {
i2=itabi[i2-1];
} else if(i1 <= 2) {
i1=itabi[i1-1];
}
istran=i1*100 + i2*10 + 2*js+1 + i4*10000;
if( id < 0 ) { istran = -istran; }
// charmed and top mesons have wrong sign
if(i1 == 4 && i2 != 4) { istran = -istran; }
if(i1 == 6 && i2 != 6 && i2 != 4) { istran = -istran; }
// special cases
if(id == 112) { istran = 225; }
if(id == 10110) { istran = 9010221; }
if(id == 10111) { istran = 20113; }
if(id == 10121) { istran = 20213; }
if(id == -10121) { istran = -20213; }
if(id == 30231) { istran = 100313; }
if(id == -30231) { istran = -100313; }
if(id == 30131) { istran = 100323; }
if(id == -30131) { istran = -100323; }
if(id == 10441) { istran = 100443; }
if(id == 20440) { istran = 10441; }
if(id == 20442) { istran = 445; }
// ...check for illegal antiparticles
if(i2 == i1 && id < 0) { istran=0; }
} else if(i2 != 0 && i3 != 0 && i1 == 0) {
// ...diquarks
// ... u and d have opposite definitions
if(i3 <= 2) i3=itabi[i3-1];
if(i2 <= 2) i2=itabi[i2-1];
if(i2 < i3){
istran=i3*1000 + i2*100 + 1;
} else if(i2 == i3){
istran=i2*1000 + i3*100 + 3;
} else {
istran=i2*1000 + i3*100 + 1;
}
if( id < 0 ) { istran = -istran; }
// ... charmed and top quarks have wrong sign
if(i2 == 4 && i3 != 4) { istran=-istran; }
if(i2 == 6 && i3 != 6 && i3 != 4) { istran=-istran; }
} else if( i1 != 0 && i3 != 0 && i2 != 0 ) {
// ...baryons
// u and d have opposite definitions
if(i3 <= 2) i3=itabi[i3-1];
if(i2 <= 2) i2=itabi[i2-1];
if(i1 <= 2) i1=itabi[i1-1];
if(i1 <= 2){
istran=i3*1000 + i2*100 + i1*10 + 2*js+2;
} else if(i3 <= 2 && i2 <= 2){
istran=i1*1000 + i3*100 + i2*10 + 2*js+2;
} else {
istran=i1*1000 + i2*100 + i3*10 + 2*js+2;
}
if( id < 0 ) { istran = -istran; }
}
return istran;
}
} // HepPDT
// $Id: translatePDTtoIsajet.cc,v 1.1.1.1.2.1 2004/04/21 23:06:33 garren Exp $
// ----------------------------------------------------------------------
//
// translatePDTtoIsajet.cc
//
// translate an ID number from the standard numbering scheme to Isajet
//
// ----------------------------------------------------------------------
#include <iostream>
#include "CLHEP/HepPDT/ParticleID.hh"
namespace HepPDT {
int translatePDTtoIsajet( const int id )
{
// ... itabi(I) converts miscellaneous ISAJET particle ID's to a standard scheme
static int itabi[100]={2,1,3,4,5,6,7,8,0,0,
12,11,14,13,16,15,0,0,0,0,
9,10,90,80,81,0,0,0,0,0,
0,0,0,0,83,84,86,0,92,0,
0,0,0,0,0,0,0,0,0,0,
82,88,87,89,85,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0};
static int noant[11]={-21,-22,-23,-25,-32,-33,-35,-36,-51,-55,-56};
int i;
int istran=0;
ParticleID pid(id);
int ida=pid.abspid();
int j1=ida%10;
int i1=(ida/10)%10;
int i2=(ida/100)%10;
int i3=(ida/1000)%10;
int i4=(ida/10000)%10;
int ksusy = (ida/1000000)%10;
int kqn=pid.extraBits();
if(ida == 0){
std::cout << " ISTRAN: particle ID is zero" << std::endl;
} else if(kqn > 0 ) {
// ... ion
std::cout << " ISTRAN 2: ion is not allowed" << std::endl;
} else if(ksusy == 1 || ksusy == 2) {
// ...SUSY
if(ida == 1000001) { istran = 22; }
if(ida == 1000002) { istran = 21; }
if(ida == 1000003) { istran = 23; }
if(ida == 1000004) { istran = 24; }
if(ida == 1000005) { istran = 25; }
if(ida == 1000006) { istran = 26; }
if(ida == 1000011) { istran = 32; }
if(ida == 1000012) { istran = 31; }
if(ida == 1000013) { istran = 34; }
if(ida == 1000014) { istran = 33; }
if(ida == 1000015) { istran = 36; }
if(ida == 1000016) { istran = 35; }
if(ida == 2000001) { istran = 42; }
if(ida == 2000002) { istran = 41; }
if(ida == 2000003) { istran = 43; }
if(ida == 2000004) { istran = 44; }
if(ida == 2000005) { istran = 45; }
if(ida == 2000006) { istran = 46; }
if(ida == 2000011) { istran = 52; }
if(ida == 2000012) { istran = 51; }
if(ida == 2000013) { istran = 54; }
if(ida == 2000014) { istran = 53; }
if(ida == 2000015) { istran = 56; }
if(ida == 2000016) { istran = 55; }
if(ida == 1000021) { istran = 29; }
if(ida == 1000022) { istran = 30; }
if(ida == 1000023) { istran = 40; }
if(ida == 1000025) { istran = 50; }
if(ida == 1000035) { istran = 60; }
if(ida == 1000024) { istran = 39; }
if(ida == 1000037) { istran = 49; }
if(ida == 1000039) { istran = 91; }
if(id < 0){
istran = -istran;
// ...check for illegal antiparticles
int irt = pid.fundamentalID();
for( i=0; i<11; ++i ){
if(irt == noant[i]) { istran=0; }
}
}
} else if(ksusy > 2 ) {
// no translation for these
} else if(ida <= 100){
// ...elementary particles
istran=itabi[ida-1];
if(id < 0){
istran = -istran;
// ...check for illegal antiparticles
for( i=0; i<11; ++i ){
if(id == noant[i]) { istran=0; }
}
}
} else if(id == 130){
// ...K short and K long
istran=-20;
} else if(id == 310){
istran=20;
} else if(i1 != 0 && i2 != 0 && i3 == 0) {
// ...mesons
// u and d have opposite definitions - sometimes
if(i2 <= 2 && i1 <= 2){
// don't change
} else if(i2 <= 2) {
i2=itabi[i2-1];
} else if(i1 <= 2) {
i1=itabi[i1-1];
}
istran=i1*100 + i2*10 + (j1-1)/2 + i4*10000;
if( id < 0 ) { istran = -istran; }
// ... charmed and top mesons have wrong sign
if(i2 == 4 && i1 != 4) { istran = -istran; }
if(i2 == 6 && i1 != 6 && i1 != 4) { istran = -istran; }
// ...
if(ida == 10221) { istran=0; }
if(id == 225) { istran = 112; }
if(id == 9010221) { istran = 10110; }
if(id == 20113) { istran = 10111; }
if(id == 20213) { istran = 10121; }
if(id == -20213) { istran = -10121; }
if(id == 100313) { istran = 30231; }
if(id == 100323) { istran = 30131; }
if(id == -100313) { istran = -30231; }
if(id == -100323) { istran = -30131; }
if(id == 100443) { istran = 10441; }
if(id == 10441) { istran = 20440; }
if(id == 445) { istran = 20442; }
// ...check for illegal antiparticles
if(i2 == i1 && id < 0) { istran=0; }
} else if(i1 == 0){
// ...diquarks
// ... u and d have opposite definitions
if(i3 <= 2) i3=itabi[i3-1];
if(i2 <= 2) i2=itabi[i2-1];
if(i3 < i2){
istran=i3*1000 + i2*100 + (j1-1)/2;
} else {
istran=i2*1000 + i3*100 + (j1-1)/2;
}
if( id < 0 ) { istran = -istran; }
// ... charmed and top mesons have wrong sign
if(i2 == 4 && i3 != 4) { istran=-istran; }
if(i2 == 6 && i3 != 6 && i3 != 4) { istran=-istran; }
} else if( i1 != 0 && i3 != 0 && i2 != 0 && ( j1 == 2 || j1 == 4)) {
// ...spin 1/2 or spin 3/2 baryons
// ... u and d have opposite definitions
if(i3 <= 2) { i3=itabi[i3-1]; }
if(i2 <= 2) { i2=itabi[i2-1]; }
if(i1 <= 2) { i1=itabi[i1-1]; }
if(i3 <= 2){
istran=i3*1000 + i2*100 + i1*10 + (j1-2)/2;
} else if(i1 <= 2 && i2 <= 2){
istran=i2*1000 + i1*100 + i3*10 + (j1-2)/2;
} else {
istran=i1*1000 + i2*100 + i3*10 + (j1-2)/2;
}
if( id < 0 ) { istran = -istran; }
// isajet has only spin
if( i4 > 0 ) { istran=0; }
}
return istran;
}
} // HepPDT
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment