/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Types | Public Member Functions | Private Attributes
HepMC::ParticleDataTable Class Reference

an example ParticleDataTable class More...

#include <ParticleDataTable.h>

List of all members.

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.
ParticleDataTableoperator= (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
ParticleDataoperator[] (int id) const
 return pointer to requested ParticleData
ParticleDatafind (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

Detailed Description

an example ParticleDataTable class

Example container for ParticleData instances. Basically just an interface to STL map.

Definition at line 35 of file ParticleDataTable.h.


Member Typedef Documentation

iterator for ParticleData map

Definition at line 75 of file ParticleDataTable.h.

const iterator for ParticleData map

Definition at line 77 of file ParticleDataTable.h.


Constructor & Destructor Documentation

HepMC::ParticleDataTable::ParticleDataTable ( std::string  description = std::string()) [inline]

constructor with optional description

Definition at line 107 of file ParticleDataTable.h.

        : m_description(description) {
        std::cout << "-------------------------------------------------------" << std::endl;
        std::cout << "Use of HepMC/ParticleDataTable is deprecated" << std::endl;
        std::cout << "-------------------------------------------------------" << std::endl;
    }
HepMC::ParticleDataTable::ParticleDataTable ( const char  description) [inline]

constructor with description

Definition at line 114 of file ParticleDataTable.h.

                                                                        {
        m_description = description; 

        std::cout << "-------------------------------------------------------" << std::endl;
        std::cout << "Use of HepMC/ParticleDataTable is deprecated" << std::endl;
        std::cout << "-------------------------------------------------------" << std::endl;
    }
HepMC::ParticleDataTable::ParticleDataTable ( const ParticleDataTable pdt) [inline]

copy constructor

Definition at line 122 of file ParticleDataTable.h.

                                                                            {
        *this = pdt;
    }
HepMC::ParticleDataTable::~ParticleDataTable ( ) [inline, virtual]

Shallow: does not delete ParticleData entries.

Definition at line 126 of file ParticleDataTable.h.

{}

Member Function Documentation

ParticleDataTable & HepMC::ParticleDataTable::operator= ( const ParticleDataTable pdt) [inline]

shallow: does not copy the entries, only makes new pointers

Definition at line 128 of file ParticleDataTable.h.

                                                                 {
        m_description = pdt.m_description;
        m_data_table = pdt.m_data_table;
        return *this;
    }
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.

                                                                     {
        ParticleDataTable new_data;
        for ( ParticleDataTable::iterator p = begin(); p != end(); ++p ) {
            ParticleData* pdata = p->second;
            if ( pdata->charge() ) {
                new_data.insert( new ParticleData( pdata->name()+"~",
                                                   -1*pdata->pdg_id(),
                                                   -1.*pdata->charge(), 
                                                   pdata->mass(),
                                                   pdata->clifetime(), 
                                                   pdata->spin() ));
            }
        }
        merge_table( new_data );
    }
int HepMC::ParticleDataTable::merge_table ( const ParticleDataTable pdt) [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.

                                                                            {
        int count_number_insertions =0;
        for ( ParticleDataTable::const_iterator p = pdt.begin(); 
              p != pdt.end(); ++p ) {
            if ( insert(p->second) ) ++count_number_insertions;
        }
        return count_number_insertions;
    }
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.

                                                                 {
        //
        ostr << "________________________________________"
             << "________________________________________\n";
        ostr << "ParticleData:   *****  ParticleDataTable"
             << "  *****   ( " << size() 
             << " entries )\n";
        ostr << " Description: " << m_description << "\n";
        ostr << "   PDG ID " << "       PARTICLE NAME "
             << "CHARGE" <<    "     MASS     "
             << "  C*LIFETIME (CM) " << " SPIN\n";
        for ( std::map< int,ParticleData* >::const_iterator pd 
                  = m_data_table.begin(); pd != m_data_table.end(); pd++ ) {
            ostr << *(pd->second) << "\n";
        }
        ostr << "________________________________________"
             << "________________________________________" << std::endl;
    }      
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.

                                              {
        for ( std::map<int,ParticleData*>::iterator pd = m_data_table.begin();
              pd != m_data_table.end(); pd++) delete pd->second;
        clear();
    }
void HepMC::ParticleDataTable::clear ( ) [inline]

clears table without deleting

Definition at line 249 of file ParticleDataTable.h.

{ 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.

                                                                     {
        return find(id);
    }
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.

                                                               {
        std::map<int,ParticleData*>::const_iterator iter 
            = m_data_table.find(id);
        return ( iter == m_data_table.end() ) ? 0 : iter->second;
    }
int HepMC::ParticleDataTable::size ( ) const [inline]

size of table

Definition at line 185 of file ParticleDataTable.h.

                                             { 
        return (int)m_data_table.size();
    }
bool HepMC::ParticleDataTable::empty ( ) const [inline]

true if the table is empty

Definition at line 189 of file ParticleDataTable.h.

                                               {
        return (bool)m_data_table.empty();
    }
bool HepMC::ParticleDataTable::insert ( ParticleData pdata) [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.

                                                               {
        if ( m_data_table.count(pdata->pdg_id()) ) return 0;
        return ( m_data_table[pdata->pdg_id()] = pdata ); // true is success
    }
bool HepMC::ParticleDataTable::erase ( ParticleData pdata) [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.

                                                              {
        return (bool)m_data_table.erase( pdata->pdg_id() );
    }
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.

                                                 {
        return (bool)m_data_table.erase( id );
    }
ParticleDataTable::iterator HepMC::ParticleDataTable::begin ( ) [inline]

begin iteration

Definition at line 214 of file ParticleDataTable.h.

                                                              { 
        return m_data_table.begin(); 
    }
ParticleDataTable::iterator HepMC::ParticleDataTable::end ( ) [inline]

end iteration

Definition at line 218 of file ParticleDataTable.h.

                                                            { 
        return m_data_table.end(); 
    }
ParticleDataTable::const_iterator HepMC::ParticleDataTable::begin ( ) const [inline]

begin const iteration

Definition at line 222 of file ParticleDataTable.h.

                                                                          {
        return m_data_table.begin(); 
    }
ParticleDataTable::const_iterator HepMC::ParticleDataTable::end ( ) const [inline]

end const iteration

Definition at line 226 of file ParticleDataTable.h.

                                                                        { 
        return m_data_table.end(); 
    }
std::string HepMC::ParticleDataTable::description ( ) const [inline]

table description

Definition at line 230 of file ParticleDataTable.h.

                                                          { 
        return m_description; 
    }
void HepMC::ParticleDataTable::set_description ( std::string  description) [inline]

set table description

Definition at line 234 of file ParticleDataTable.h.

void HepMC::ParticleDataTable::set_description ( const char  description) [inline]

set table description

Definition at line 238 of file ParticleDataTable.h.


Member Data Documentation

Definition at line 99 of file ParticleDataTable.h.

Definition at line 100 of file ParticleDataTable.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:49:37 for HepMC by doxygen 1.7.4