#include <ParticleDataTable.h>
Public Types | |
typedef std::map< int, HepMC::ParticleData * >::iterator | iterator |
iterator for ParticleData map | |
typedef std::map< int, HepMC::ParticleData * >::const_iterator | const_iterator |
const iterator for ParticleData map | |
Public Member Functions | |
ParticleDataTable (std::string description=std::string()) | |
constructor with optional description | |
ParticleDataTable (const char description) | |
constructor with description | |
ParticleDataTable (const ParticleDataTable &) | |
copy constructor | |
virtual | ~ParticleDataTable () |
Shallow: does not delete ParticleData entries. | |
ParticleDataTable & | operator= (const ParticleDataTable &) |
shallow: does not copy the entries, only makes new pointers | |
void | make_antiparticles_from_particles () |
make corresponding anti-particles for all particles in table | |
int | merge_table (const ParticleDataTable &) |
merge two tables | |
void | print (std::ostream &ostr=std::cout) const |
write the table to ostr | |
void | delete_all () |
delete all ParticleData instances in this table | |
void | clear () |
clears table without deleting | |
ParticleData * | operator[] (int id) const |
return pointer to requested ParticleData | |
ParticleData * | find (int id) const |
return pointer to requested ParticleData | |
int | size () const |
size of table | |
bool | empty () const |
true if the table is empty | |
bool | insert (ParticleData *) |
true if successful | |
bool | erase (ParticleData *) |
removes from table - does not delete | |
bool | erase (int id) |
removes from table - does not delete | |
iterator | begin () |
begin iteration | |
iterator | end () |
end iteration | |
const_iterator | begin () const |
begin const iteration | |
const_iterator | end () const |
end const iteration | |
std::string | description () const |
table description | |
void | set_description (std::string) |
set table description | |
void | set_description (const char) |
set table description | |
Private Attributes | |
std::string | m_description |
std::map< int, HepMC::ParticleData * > | m_data_table |
Basically just an interface to STL map.
Definition at line 35 of file ParticleDataTable.h.
typedef std::map<int,HepMC::ParticleData*>::iterator HepMC::ParticleDataTable::iterator |
typedef std::map<int,HepMC::ParticleData*>::const_iterator HepMC::ParticleDataTable::const_iterator |
HepMC::ParticleDataTable::ParticleDataTable | ( | std::string | description = std::string() |
) | [inline] |
constructor with optional description
Definition at line 107 of file ParticleDataTable.h.
00108 : m_description(description) { 00109 std::cout << "-------------------------------------------------------" << std::endl; 00110 std::cout << "Use of HepMC/ParticleDataTable is deprecated" << std::endl; 00111 std::cout << "-------------------------------------------------------" << std::endl; 00112 }
HepMC::ParticleDataTable::ParticleDataTable | ( | const char | description | ) | [inline] |
constructor with description
Definition at line 114 of file ParticleDataTable.h.
00114 { 00115 m_description = description; 00116 00117 std::cout << "-------------------------------------------------------" << std::endl; 00118 std::cout << "Use of HepMC/ParticleDataTable is deprecated" << std::endl; 00119 std::cout << "-------------------------------------------------------" << std::endl; 00120 }
HepMC::ParticleDataTable::ParticleDataTable | ( | const ParticleDataTable & | ) | [inline] |
HepMC::ParticleDataTable::~ParticleDataTable | ( | ) | [inline, virtual] |
ParticleDataTable & HepMC::ParticleDataTable::operator= | ( | const ParticleDataTable & | ) | [inline] |
shallow: does not copy the entries, only makes new pointers
Definition at line 128 of file ParticleDataTable.h.
00130 { 00131 m_description = pdt.m_description; 00132 m_data_table = pdt.m_data_table; 00133 return *this; 00134 }
void HepMC::ParticleDataTable::make_antiparticles_from_particles | ( | ) | [inline] |
make corresponding anti-particles for all particles in table
make corresponding anti-particles for all particles in table
Definition at line 136 of file ParticleDataTable.h.
00136 { 00138 ParticleDataTable new_data; 00139 for ( ParticleDataTable::iterator p = begin(); p != end(); ++p ) { 00140 ParticleData* pdata = p->second; 00141 if ( pdata->charge() ) { 00142 new_data.insert( new ParticleData( pdata->name()+"~", 00143 -1*pdata->pdg_id(), 00144 -1.*pdata->charge(), 00145 pdata->mass(), 00146 pdata->clifetime(), 00147 pdata->spin() )); 00148 } 00149 } 00150 merge_table( new_data ); 00151 }
int HepMC::ParticleDataTable::merge_table | ( | const ParticleDataTable & | ) | [inline] |
merge two tables
merges pdt into this table each entry from pdt is inserted only if this table does not already have an entry matching the ParticleData's id returns the number of new entries inserted into this table.
Definition at line 251 of file ParticleDataTable.h.
00251 { 00256 int count_number_insertions =0; 00257 for ( ParticleDataTable::const_iterator p = pdt.begin(); 00258 p != pdt.end(); ++p ) { 00259 if ( insert(p->second) ) ++count_number_insertions; 00260 } 00261 return count_number_insertions; 00262 }
void HepMC::ParticleDataTable::print | ( | std::ostream & | ostr = std::cout |
) | const [inline] |
write the table to ostr
prints a summary of all particle Data currently in memory
Definition at line 153 of file ParticleDataTable.h.
00153 { 00155 // 00156 ostr << "________________________________________" 00157 << "________________________________________\n"; 00158 ostr << "ParticleData: ***** ParticleDataTable" 00159 << " ***** ( " << size() 00160 << " entries )\n"; 00161 ostr << " Description: " << m_description << "\n"; 00162 ostr << " PDG ID " << " PARTICLE NAME " 00163 << "CHARGE" << " MASS " 00164 << " C*LIFETIME (CM) " << " SPIN\n"; 00165 for ( std::map< int,ParticleData* >::const_iterator pd 00166 = m_data_table.begin(); pd != m_data_table.end(); pd++ ) { 00167 ostr << *(pd->second) << "\n"; 00168 } 00169 ostr << "________________________________________" 00170 << "________________________________________" << std::endl; 00171 }
void HepMC::ParticleDataTable::delete_all | ( | ) | [inline] |
delete all ParticleData instances in this table
deletes all ParticleData instances in this table
Definition at line 242 of file ParticleDataTable.h.
00242 { 00244 for ( std::map<int,ParticleData*>::iterator pd = m_data_table.begin(); 00245 pd != m_data_table.end(); pd++) delete pd->second; 00246 clear(); 00247 }
void HepMC::ParticleDataTable::clear | ( | ) | [inline] |
clears table without deleting
Definition at line 249 of file ParticleDataTable.h.
00249 { m_data_table.clear(); }
ParticleData * HepMC::ParticleDataTable::operator[] | ( | int | id | ) | const [inline] |
return pointer to requested ParticleData
Definition at line 181 of file ParticleDataTable.h.
00181 { 00182 return find(id); 00183 }
ParticleData * HepMC::ParticleDataTable::find | ( | int | id | ) | const [inline] |
return pointer to requested ParticleData
finds a ParticleData pointer corresponding to id IF it exists in the table. If not returns NULL
Definition at line 173 of file ParticleDataTable.h.
00173 { 00176 std::map<int,ParticleData*>::const_iterator iter 00177 = m_data_table.find(id); 00178 return ( iter == m_data_table.end() ) ? 0 : iter->second; 00179 }
int HepMC::ParticleDataTable::size | ( | ) | const [inline] |
size of table
Definition at line 185 of file ParticleDataTable.h.
00185 { 00186 return (int)m_data_table.size(); 00187 }
bool HepMC::ParticleDataTable::empty | ( | ) | const [inline] |
true if the table is empty
Definition at line 189 of file ParticleDataTable.h.
00189 { 00190 return (bool)m_data_table.empty(); 00191 }
bool HepMC::ParticleDataTable::insert | ( | ParticleData * | ) | [inline] |
true if successful
inserts pdata in the table IFF pdata's id has not already been used. It does NOT replace entries with the same id. True if successful. If you wish to overwrite another entry, first use erase()
Definition at line 193 of file ParticleDataTable.h.
00193 { 00197 if ( m_data_table.count(pdata->pdg_id()) ) return 0; 00198 return ( m_data_table[pdata->pdg_id()] = pdata ); // true is success 00199 }
bool HepMC::ParticleDataTable::erase | ( | ParticleData * | ) | [inline] |
removes from table - does not delete
removes from table does not delete returns True is an entry pdata existed in the table and was erased
Definition at line 201 of file ParticleDataTable.h.
00201 { 00204 return (bool)m_data_table.erase( pdata->pdg_id() ); 00205 }
bool HepMC::ParticleDataTable::erase | ( | int | id | ) | [inline] |
removes from table - does not delete
removes from table does not delete returns True is an entry pdata existed in the table and was erased
Definition at line 208 of file ParticleDataTable.h.
00208 { 00211 return (bool)m_data_table.erase( id ); 00212 }
ParticleDataTable::iterator HepMC::ParticleDataTable::begin | ( | ) | [inline] |
begin iteration
Definition at line 214 of file ParticleDataTable.h.
00214 { 00215 return m_data_table.begin(); 00216 }
ParticleDataTable::iterator HepMC::ParticleDataTable::end | ( | ) | [inline] |
end iteration
Definition at line 218 of file ParticleDataTable.h.
00218 { 00219 return m_data_table.end(); 00220 }
ParticleDataTable::const_iterator HepMC::ParticleDataTable::begin | ( | ) | const [inline] |
begin const iteration
Definition at line 222 of file ParticleDataTable.h.
00222 { 00223 return m_data_table.begin(); 00224 }
ParticleDataTable::const_iterator HepMC::ParticleDataTable::end | ( | ) | const [inline] |
end const iteration
Definition at line 226 of file ParticleDataTable.h.
00226 { 00227 return m_data_table.end(); 00228 }
std::string HepMC::ParticleDataTable::description | ( | ) | const [inline] |
table description
Definition at line 230 of file ParticleDataTable.h.
00230 { 00231 return m_description; 00232 }
void HepMC::ParticleDataTable::set_description | ( | std::string | ) | [inline] |
set table description
Definition at line 234 of file ParticleDataTable.h.
00234 { 00235 m_description = description; 00236 }
void HepMC::ParticleDataTable::set_description | ( | const | char | ) | [inline] |
set table description
Definition at line 238 of file ParticleDataTable.h.
00238 { 00239 m_description = description; 00240 }
std::string HepMC::ParticleDataTable::m_description [private] |
Definition at line 99 of file ParticleDataTable.h.
std::map<int,HepMC::ParticleData*> HepMC::ParticleDataTable::m_data_table [private] |
Definition at line 100 of file ParticleDataTable.h.