00001 //-------------------------------------------------------------------------- 00002 // 00003 // Environment: 00004 // This software is part of the EvtGen package developed jointly 00005 // for the BaBar and CLEO collaborations. If you use all or part 00006 // of it, please give an appropriate acknowledgement. 00007 // 00008 // Copyright Information: See EvtGen/COPYRIGHT 00009 // Copyright (C) 1998 Caltech, UCSB 00010 // 00011 // Module: EvtSecondary.cc 00012 // 00013 // Description: Class to store the decays of the secondary particles. 00014 // 00015 // Modification history: 00016 // 00017 // RYD March 12, 1998 Module created 00018 // 00019 //------------------------------------------------------------------------ 00020 // 00021 #include "EvtGenBase/EvtPatches.hh" 00022 #include "EvtGenBase/EvtPatches.hh" 00023 #include <iostream> 00024 #include "EvtGenBase/EvtParticle.hh" 00025 #include "EvtGenBase/EvtPDL.hh" 00026 #include "EvtGenBase/EvtSecondary.hh" 00027 #include "EvtGenBase/EvtReport.hh" 00028 using std::endl; 00029 using std::ostream; 00030 00031 00032 void EvtSecondary::init(){ 00033 _npart=0; 00034 } 00035 00036 int EvtSecondary::getNPart(){ 00037 return _npart; 00038 } 00039 00040 void EvtSecondary::createSecondary(int stdhepindex,EvtParticle* prnt){ 00041 00042 _stdhepindex[_npart]=stdhepindex; 00043 if (prnt->getNDaug()==0){ 00044 _id1[_npart]=0; 00045 _id2[_npart]=0; 00046 _id3[_npart]=0; 00047 _npart++; 00048 return; 00049 } 00050 if (prnt->getNDaug()==1){ 00051 _id1[_npart]=EvtPDL::getStdHep(prnt->getDaug(0)->getId()); 00052 _id2[_npart]=0; 00053 _id3[_npart]=0; 00054 _npart++; 00055 return; 00056 } 00057 if (prnt->getNDaug()==2){ 00058 _id1[_npart]=EvtPDL::getStdHep(prnt->getDaug(0)->getId()); 00059 _id2[_npart]=EvtPDL::getStdHep(prnt->getDaug(1)->getId()); 00060 _id3[_npart]=0; 00061 _npart++; 00062 return; 00063 } 00064 if (prnt->getNDaug()==3){ 00065 _id1[_npart]=EvtPDL::getStdHep(prnt->getDaug(0)->getId()); 00066 _id2[_npart]=EvtPDL::getStdHep(prnt->getDaug(1)->getId()); 00067 _id3[_npart]=EvtPDL::getStdHep(prnt->getDaug(2)->getId()); 00068 _npart++; 00069 return; 00070 } 00071 00072 report(ERROR,"EvtGen") << 00073 "More than 3 decay products in a secondary particle!"<<endl; 00074 00075 00076 } 00077 00078 00079 ostream& operator<<(ostream& s, const EvtSecondary& secondary){ 00080 00081 s <<endl; 00082 s << "Secondary decays:"<<endl; 00083 00084 int i; 00085 for(i=0;i<secondary._npart;i++){ 00086 00087 report(INFO,"EvtGen") <<i<<" " 00088 <<secondary._stdhepindex[i]<<" " 00089 <<secondary._id1[i]<<" " 00090 <<secondary._id2[i]<<" " 00091 <<secondary._id3[i]<<endl; 00092 00093 } 00094 00095 s<<endl; 00096 00097 return s; 00098 00099 } 00100