//-------------------------------------------------------------------------- // // Environment: // This software is part of the EvtGen package developed jointly // for the BaBar and CLEO collaborations. If you use all or part // of it, please give an appropriate acknowledgement. // // Copyright Information: See EvtGen/COPYRIGHT // Copyright (C) 1998 Caltech, UCSB // // Module: EvtPDL.cc // // Description: routines to store particle properties in EvtPDL structure. // // Modification history: // // DJL/RYD September 25, 1996 Module created // //------------------------------------------------------------------------ // #include "EvtGenBase/EvtPatches.hh" #include #include #include #include #include #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtPartProp.hh" #include "EvtGenBase/EvtId.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtReport.hh" using std::endl; using std::fstream; using std::ifstream; static int first=1; unsigned int EvtPDL::_firstAlias; int EvtPDL::_nentries; std::map EvtPDL::_particleNameLookup; EvtPDL::EvtPDL() { if (first!=0) { first=0; _nentries=0; _firstAlias=999999; } } EvtPDL::~EvtPDL(){ } void EvtPDL::read(const char* fname) { readPDT(fname); } void EvtPDL::readPDT(const std::string fname){ ifstream indec; indec.open(fname.c_str()); char cmnd[100]; char xxxx[100]; char pname[100]; int stdhepid; double mass; double pwidth; double pmaxwidth; int chg3; int spin2; double ctau; int lundkc; EvtId i; if (!indec) { report(ERROR,"EvtGen") << "Could not open:"<> cmnd; if (strcmp(cmnd,"end")){ if (!strcmp(cmnd,"add")){ indec >> xxxx; indec >> xxxx; indec >> pname; indec >> stdhepid; indec >> mass; indec >> pwidth; indec >> pmaxwidth; indec >> chg3; indec >> spin2; indec >> ctau; indec >> lundkc; i=EvtId(_nentries,_nentries); EvtPartProp tmp; tmp.setSpinType(EvtSpinType::SCALAR); if (spin2==0) tmp.setSpinType(EvtSpinType::SCALAR); if (spin2==1) tmp.setSpinType(EvtSpinType::DIRAC); if (spin2==2) tmp.setSpinType(EvtSpinType::VECTOR); if (spin2==3) tmp.setSpinType(EvtSpinType::RARITASCHWINGER); if (spin2==4) tmp.setSpinType(EvtSpinType::TENSOR); if (spin2==5) tmp.setSpinType(EvtSpinType::SPIN5HALF); if (spin2==6) tmp.setSpinType(EvtSpinType::SPIN3); if (spin2==7) tmp.setSpinType(EvtSpinType::SPIN7HALF); if (spin2==8) tmp.setSpinType(EvtSpinType::SPIN4); if (spin2==2 && mass < 0.0001 ) tmp.setSpinType(EvtSpinType::PHOTON); if (spin2==1 && mass < 0.0001 ) tmp.setSpinType(EvtSpinType::NEUTRINO); if (!strcmp(pname,"string")){ tmp.setSpinType(EvtSpinType::STRING); } if (!strcmp(pname,"vpho")){ tmp.setSpinType(EvtSpinType::VECTOR); } tmp.setId(i); tmp.setIdChgConj(EvtId(-1,-1)); tmp.setStdHep(stdhepid); tmp.setLundKC(lundkc); tmp.setName(pname); if (_particleNameLookup.find(std::string(pname))!= _particleNameLookup.end()) { report(ERROR,"EvtGen")<<"The particle name:"<> xxxx; indec >> xxxx; indec >> xxxx; indec >> xxxx; } } }while(strcmp(cmnd,"end")); setUpConstsPdt(); } void EvtPDL::aliasChgConj(EvtId a,EvtId abar){ if (EvtPDL::chargeConj(EvtId(a.getId(),a.getId()))!= EvtId(abar.getId(),abar.getId())) { report(ERROR,"EvtGen")<<"Can't charge conjugate the two aliases:" <::iterator it=_particleNameLookup.find(std::string(name)); if (it==_particleNameLookup.end()) return EvtId(-1,-1); return partlist()[it->second].getId(); } void EvtPDL::setUpConstsPdt(){ } // Function to get EvtId from LundKC ( == Pythia Hep Code , KF ) EvtId EvtPDL::evtIdFromLundKC(int pythiaId){ unsigned int i; for (i=0;i