00001 //-------------------------------------------------------------------------- 00002 // 00003 // Environment: 00004 // This software is part of models developed at BES collaboration 00005 // based on the EvtGen framework. If you use all or part 00006 // of it, please give an appropriate acknowledgement. 00007 // 00008 // Copyright Information: See EvtGen/BesCopyright 00009 // Copyright (A) 2006 Ping Rong-Gang @IHEP 00010 // 00011 // Module: EvtDecayTag.hh 00012 // 00013 // Description: Class to pick out the final state 00014 // 00015 // Modification history: 00016 // 00017 // Ping R.-G. December, 2011-Mar. Module created 00018 // 00019 //------------------------------------------------------------------------ 00020 // 00021 00022 #include "EvtFSPick.hh" 00023 00024 00025 void EvtFSPick::FSPick(EvtParticle* par){ 00026 00027 int ndaug = par->getNDaug(); 00028 EvtId eid=par->getId(); 00029 if(ndaug < 2 && EvtPDL::getStdHep(eid) != -22){ 00030 _EvtFS.push_back(par); 00031 _fsid.push_back(eid); 00032 // std::cout<<"I get FS "<<EvtPDL::getStdHep(eid)<<std::endl; 00033 } else { 00034 00035 int ND=0; 00036 EvtParticle *theD; 00037 for(int i=0;i<ndaug;i++){ 00038 EvtParticle *theDaug = par->getDaug(i); 00039 FSPick(theDaug); 00040 } 00041 } 00042 } 00043 00044 00045 void EvtFSPick::setFinalStatePar(std::vector <std::string> vnames){ 00046 if(vnames.size()!= _EvtFS.size()) 00047 {std::cout<<"EvtFSPick::The number in final state is inconsistent"<<std::endl;abort();} 00048 for (int i=0;i<vnames.size();i++){ 00049 00050 _vnames.push_back(vnames[i]); 00051 EvtId eid = EvtPDL::getId(std::string(vnames[i])); 00052 _vId.push_back(eid); 00053 00054 // std::cout<<"FS= "<<EvtPDL::getStdHep(_vId[i])<<std::endl; 00055 } 00056 00057 } 00058 00059 00060 00061 std::vector <EvtVector4R> EvtFSPick::getP4(){ 00062 EvtVector4R ptep; 00063 int nfs = _vnames.size(); 00064 std::vector <EvtVector4R> vp4; 00065 for(int i=0;i<nfs;i++) { 00066 int xid = getIndex(_vId[i]); 00067 ptep= _EvtFS[xid]->getP4(); 00068 vp4.push_back(ptep); 00069 } 00070 return vp4; 00071 } 00072 00073 std::vector <EvtVector4R> EvtFSPick::getP4Lab(){ 00074 EvtVector4R ptep; 00075 int nfs = _vnames.size(); 00076 std::vector <EvtVector4R> vp4; 00077 for(int i=0;i<nfs;i++) { 00078 int xid = getIndex(_vId[i]); 00079 ptep= _EvtFS[xid]->getP4Lab(); 00080 vp4.push_back(ptep); 00081 } 00082 return vp4; 00083 } 00084 00085 int EvtFSPick::getIndex(EvtId eid){ 00086 for(int i=0;i<_vId.size();i++){ 00087 EvtId pid = _fsid[i]; 00088 if( eid == pid ){ 00089 EvtId did = EvtPDL::getId("d"); 00090 _fsid[i] = did; 00091 return i; 00092 } 00093 } 00094 std::cout<<"EvtFSPick::Cannot find the particle " 00095 <<EvtPDL::getStdHep(eid) 00096 <<" in the generated final state"<<std::endl; 00097 abort(); 00098 }