00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: DecayMode.cxx,v 1.1.1.1 2005/04/21 01:15:12 zhangy Exp $ 00004 // 00005 //------------------------------------------------------------------------ 00006 // 00007 // Moved some stuff here from DecayMode.hh to avoid nested includes 00008 // 00009 #include "MdcRecoUtil/DecayMode.h" 00010 #include "MdcRecoUtil/PdtEntry.h" 00011 00012 #include <iomanip> 00013 #include <vector> 00014 using std::ostream; 00015 using std::setprecision; 00016 using std::setw; 00017 using std::vector; 00018 00019 DecayMode::DecayMode(float bf, vector<PdtEntry*> *l ) { 00020 _branchingFraction = bf; 00021 _children = l; 00022 } 00023 00024 DecayMode::~DecayMode() { 00025 if ( _children ) { 00026 //need to destroy also -4602 00027 vector<PdtEntry*>::iterator iter=_children->begin(); 00028 while ( iter != _children->end() ) { delete *iter; ++iter; } 00029 _children->clear(); 00030 } 00031 delete _children; 00032 _children=0; 00033 } 00034 00035 void 00036 DecayMode::printOn(ostream& os) const { 00037 os << " " << setw(5) << setprecision(3) 00038 << _branchingFraction 00039 << " ->"; 00040 int l = _children->size(); 00041 for(int i=0; i<l; i++) 00042 os << " " << (*_children)[i]->name(); 00043 os << '\n'; 00044 } 00045