| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Attributes

# ParticlePropertySvc Class Reference

This service provides access to particle properties. More...

`#include <ParticlePropertySvc.h>`

Inheritance diagram for ParticlePropertySvc:
[legend]
Collaboration diagram for ParticlePropertySvc:
[legend]

List of all members.

## Public Types
typedef ParticleProperty * | mapped_type
typedef std::map< int, mapped_type > | MapID
typedef std::map< std::string, mapped_type > | MapName
typedef std::map< int, mapped_type > | MapStdHepID
typedef std::map< int, mapped_type > | MapPythiaID
typedef IParticlePropertySvc::VectPP | VectPP
typedef IParticlePropertySvc::const_iterator | const_iterator
typedef IParticlePropertySvc::iterator | iterator
typedef std::set < ParticleProperty * > | Set
## Public Member Functions
virtual StatusCode | initialize ()
| Initialise the service.
virtual StatusCode | finalize ()
| Finalise the service.
virtual StatusCode | push_back (const std::string &particle, int geantId, int jetsetId, double charge, double mass, double tlife, const std::string &evtName, int pythiaId, double maxWidth)
| Create a new particle property.
virtual StatusCode | push_back (ParticleProperty *pp)
| Add a new particle property.
virtual const_iterator | begin () const
| Get a const reference to the begining of the container.
virtual const_iterator | end () const
| Get a const reference to the end of the container.
virtual int | size () const
| Get the container size.
virtual ParticleProperty * | find (int geantId)
| Retrieve a property by geant3 id.
virtual ParticleProperty * | find (const std::string &name)
| Retrieve a property by particle name.
virtual ParticleProperty * | findByStdHepID (int stdHepId)
| Retrieve a property by StdHep id.
virtual ParticleProperty * | findByPythiaID (int pythiaID)
| Retrieve a property by Pythia id.
virtual StatusCode | erase (int geantId)
| Erase a property by geant3 id.
virtual StatusCode | erase (const std::string &name)
| Erase a property by particle name.
virtual StatusCode | eraseByStdHepID (int stdHepId)
| Erase a property by StdHep id ???
| ParticlePropertySvc (const std::string &name, ISvcLocator *svc)
| Standard Constructor.
virtual | ~ParticlePropertySvc ()
| Destructor.
## Protected Member Functions
const ParticleProperty * | anti (const ParticleProperty *pp) const
| helper (protected) function to find an antiparticle for the given particle ID (StdHepID)
StatusCode | setAntiParticles ()
| helper (protected) function to set the valid particle<-->antiparticle relations
StatusCode | rebuild ()
| rebuild "the linear container" from the map
StatusCode | erase (const ParticleProperty *pp)
| remove particle property from all maps
StatusCode | parse (const std::string &file)
| parse the file
StatusCode | parse ()
| Parses the file and fill all the maps.
StatusCode | addParticles ()
bool | diff (const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const
## Private Types
typedef std::vector< std::string > | Files
typedef std::vector< std::string > | Particles
## Private Attributes
std::string | m_filename
| Filename of the particle properties file.
Files | m_other
| additional file names
Particles | m_particles
VectPP | m_vectpp
| Vector of all particle properties.
MapID | m_idmap
| Map for geant IDs.
MapName | m_namemap
| Map for particle names.
MapStdHepID | m_stdhepidmap
| Map for StdHep Ids.
MapPythiaID | m_pythiaidmap
| Map for Pythia Ids.
Set | m_owned
std::set< std::string > | m_replaced
IFileAccess * | m_fileAccess

## Detailed Description

This service provides access to particle properties.

The settable property of this service is the ParticlePropertiesFile, an ASCII file containing the list of properties for the particles. The default file is: "$PARAMFILESROOT/data/ParticleTable.txt" or if $PARAMFILESROOT is not defined "ParticleTable.txt"

Author:
  Iain Last
  Gloria Corti 8/11/1999 change default file from $CDF/particle.cdf to $LHCBDBASE/cdf/particle.cdf on Unix and use environment variable also on WinNT Also introduce finding of particle by StdHepID
  Vanya BELYAEV

Date:
  2006-09-22 1) Modified to add possibility to redefine properties of existing particles and to read addiitonal files. New propeety "OtherFiles" (default is empty vector) is introduces. Service parsed additional files after the main one.

        // read additional properties
        ParticlePropertySvc.OtherFiles = {
           "$SOMELOCATION1/file1.txt" ,
           "$SOMELOCATION2/file2.txt"
        } ;

2) Add possibility to modify only certain partiles through the new property "Particles" (default is enpty list), Each line is interpreted as a line in particle data table, e.g.

       // redefine the properties of H_20 and H_30 particles:
       ParticlePropertySvc.Particles = {
           "H_20 88 35 0.0 120.0 9.4e-26 Higgs'0 35 0.0e+00" ,
           "H_30 89 36 0.0  40.0 1.0e-12      A0 36 0.0e+00"
         } ;

The replaces/modified particles are reported.

Definition at line 75 of file ParticlePropertySvc.h.

## Member Typedef Documentation

typedef IParticlePropertySvc::const_iterator ParticlePropertySvc::const_iterator

Reimplemented from IParticlePropertySvc.

Definition at line 85 of file ParticlePropertySvc.h.

typedef std::vector<std::string> ParticlePropertySvc::Files`[private]`

Definition at line 186 of file ParticlePropertySvc.h.

typedef IParticlePropertySvc::iterator ParticlePropertySvc::iterator

Reimplemented from IParticlePropertySvc.

Definition at line 86 of file ParticlePropertySvc.h.

typedef std::map< int, mapped_type > ParticlePropertySvc::MapID

Definition at line 80 of file ParticlePropertySvc.h.

typedef std::map< std::string, mapped_type > ParticlePropertySvc::MapName

Definition at line 81 of file ParticlePropertySvc.h.

typedef ParticleProperty* ParticlePropertySvc::mapped_type

Definition at line 79 of file ParticlePropertySvc.h.

typedef std::map< int, mapped_type > ParticlePropertySvc::MapPythiaID

Definition at line 83 of file ParticlePropertySvc.h.

typedef std::map< int, mapped_type > ParticlePropertySvc::MapStdHepID

Definition at line 82 of file ParticlePropertySvc.h.

typedef std::vector<std::string> ParticlePropertySvc::Particles`[private]`

Definition at line 187 of file ParticlePropertySvc.h.

typedef std::set<ParticleProperty*> ParticlePropertySvc::Set

Definition at line 87 of file ParticlePropertySvc.h.

typedef IParticlePropertySvc::VectPP ParticlePropertySvc::VectPP

Reimplemented from IParticlePropertySvc.

Definition at line 84 of file ParticlePropertySvc.h.

## Constructor & Destructor Documentation

ParticlePropertySvc::ParticlePropertySvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

Standard Constructor.

Parameters:

  name | String with service name
  svc | Pointer to service locator interface

Todo:
  : remove reference to LHCb-specific environment variable

Definition at line 47 of file ParticlePropertySvc.cpp.

      : base_class( name, svc )
      // the default name of input data file
      , m_filename ( "ParticleTable.txt" )
      , m_other ()
      , m_particles ()
      // storages :
      , m_vectpp  ()
      , m_idmap   ()
      , m_namemap ()
      , m_stdhepidmap()
      , m_pythiaidmap()
      //
      , m_owned ()
      , m_replaced ()
      , m_fileAccess (0)
    {
      // Redefine the default name:
      if( System::getEnv("PARAMFILESROOT", m_filename) )
      {
        m_filename += "/data/ParticleTable.txt";
      }
      //
      declareProperty ( "ParticlePropertiesFile" , m_filename  ) ;
      declareProperty ( "OtherFiles"             , m_other     ) ;
      declareProperty ( "Particles"              , m_particles ) ;
    }

ParticlePropertySvc::~ParticlePropertySvc | ( | ) | `[virtual]`

Destructor.

destructor

Definition at line 79 of file ParticlePropertySvc.cpp.

    {
      for ( Set::iterator i = m_owned.begin(); i != m_owned.end() ; ++i )
      { if ( 0 != *i ) { delete *i ; } }
    }

## Member Function Documentation

StatusCode ParticlePropertySvc::addParticles | ( | ) | `[protected]`

Definition at line 482 of file ParticlePropertySvc.cpp.

    {

      MsgStream log ( msgSvc() , name() ) ;
      // loop over all "explicit" particles
      for ( Particles::const_iterator ip = m_particles.begin() ;
            m_particles.end() != ip ; ++ip )
      {
        const std::string item = *ip ;
        std::istringstream input( item ) ;
        // get the name
        std::string p_name   ;
        int         p_geant  ;
        int         p_jetset ;
        double      p_charge ;
        double      p_mass   ;
        double      p_ltime  ;
        std::string p_evtgen ;
        int         p_pythia ;
        double      p_maxwid ;
        if ( input
             >> p_name
             >> p_geant
             >> p_jetset
             >> p_charge
             >> p_mass
             >> p_ltime
             >> p_evtgen
             >> p_pythia
             >> p_maxwid )
        {
          log << MSG::ALWAYS
              << " Add/Modify the particle: "
              << " name='"   << p_name   << "'"
              << " geant="   << p_geant
              << " jetset="  << p_jetset
              << " charge="  << p_charge
              << " mass="    << p_mass
              << " ltime="   << p_ltime
              << " evtgen='" << p_evtgen << "'"
              << " pythia="  << p_pythia
              << " maxwid="  << p_maxwid << endmsg ;
          //
          StatusCode sc = push_back
            ( p_name                        ,
              p_geant                       ,
              p_jetset                      ,
              p_charge                      ,
              p_mass    * Gaudi::Units::GeV ,
              p_ltime   * Gaudi::Units::s   ,
              p_evtgen                      ,
              p_pythia                      ,
              p_maxwid  * Gaudi::Units::GeV ) ;
          if ( sc.isFailure() ) { return sc ; }                        // RETURN
        }
        else
        {
          log << MSG::ERROR
              << " could not parse '" << item << "'" << endmsg ;
          return StatusCode::FAILURE ;                                 // RETURN
        }
      }
      //
      return StatusCode::SUCCESS ;
    }

const ParticleProperty * ParticlePropertySvc::anti | ( | const ParticleProperty * | pp ) | const`[protected]`

helper (protected) function to find an antiparticle for the given particle ID (StdHepID)

Helper (protected) function to find an antiparticle for the given particle ID (StdHepID)

Parameters:

  pp | pointer to particle property

Returns:
  pointer to antiparticle

Definition at line 418 of file ParticlePropertySvc.cpp.

    {
      if ( 0 == pp ) { return 0 ; }
      const int     ID = pp->pdgID() ;
      const int antiID = -1 * ID     ;
      for ( const_iterator it = m_vectpp.begin() ; m_vectpp.end() != it ; ++it )
      {
        const ParticleProperty* ap = *it ;
        if ( 0 == ap               ) { continue  ; }                // CONTINUE
        if ( antiID == ap->pdgID() ) { return ap ; }                // RETURN
      };
      //
      return pp ;                                                   // RETURN
    }

virtual const_iterator ParticlePropertySvc::begin | ( | void | ) | const`[inline, virtual]`

Get a const reference to the begining of the container.

Implements IParticlePropertySvc.

Definition at line 123 of file ParticlePropertySvc.h.

    { return m_vectpp.begin() ; }

bool ParticlePropertySvc::diff | ( | const ParticleProperty * | o,
|  | const ParticleProperty * | n,
|  | const MSG::Level | l = `MSG::DEBUG`
| ) |  | const`[protected]`

Definition at line 555 of file ParticlePropertySvc.cpp.

    {
      //
      if ( o == n ) { return false ; }
      //
      MsgStream log ( msgSvc() , name() ) ;
      log << l ;
      if ( 0 == o || 0 == n  )
      {
        log << MSG::WARNING << " ParticleProperty* point to NULL" << endmsg ;
        return true ;                                                    // RETURN
      }
      //
      bool result = false ;
      if ( o -> particle () != n -> particle () )
      {
        result = true ;
        log << " Name:'"  << o -> particle () << "'/'" << n -> particle () << "'" ;
      }
      if ( o -> geantID  () != n -> geantID  () )
      {
        result = true ;
        log << " G3ID:"   << o -> geantID  () << "/"   << n -> geantID  () << "'" ;
      }
      if ( o -> pdgID    () != n -> pdgID    () )
      {
        result = true ;
        log << " PDGID:"  << o -> pdgID    () << "/"   << n -> pdgID    () << "'" ;
      }
      if ( o -> pythiaID () != n -> pythiaID () )
      {
        result = true ;
        log << " PYID:"   << o -> pythiaID () << "/"   << n -> pythiaID () << "'" ;
      }
      if ( o -> charge   () != n -> charge   () )
      {
        result = true ;
        log << " Q:"      << o -> charge   () << "/"   << n -> charge   () << "'" ;
      }
      if ( o -> mass     () != n -> mass     () )
      {
        result = true ;
        log << " M:"      << o -> mass     () << "/"   << n -> mass     () << "'" ;
      }
      if ( o -> lifetime () != n -> lifetime () )
      {
        result = true ;
        log << " T:"      << o -> lifetime () << "/"   << n -> lifetime () << "'" ;
      }
      if ( o -> evtGenName () != n -> evtGenName () )
      {
        result = true ;
        log << " EvtGen:" << o -> evtGenName () << "/"   << n -> evtGenName () << "'" ;
      }
      if ( o -> maxWidth () != n -> maxWidth () )
      {
        result = true ;
        log << " WMAX:"   << o -> maxWidth () << "/"   << n -> maxWidth () << "'" ;
      }
      if ( result ) { log << endmsg ; }
      //
      return result ;
    }

virtual const_iterator ParticlePropertySvc::end | ( | void | ) | const`[inline, virtual]`

Get a const reference to the end of the container.

Implements IParticlePropertySvc.

Definition at line 125 of file ParticlePropertySvc.h.

    { return m_vectpp.end() ; }

StatusCode ParticlePropertySvc::erase | ( | const ParticleProperty * | pp ) | `[protected]`

remove particle property from all maps

Definition at line 288 of file ParticlePropertySvc.cpp.

    {
      if ( 0 == pp ) { return StatusCode::FAILURE ; }

      _remove_ ( m_idmap       , pp ) ;
      _remove_ ( m_namemap     , pp ) ;
      _remove_ ( m_stdhepidmap , pp ) ;
      _remove_ ( m_pythiaidmap , pp ) ;
      //
      return rebuild() ;
    }

virtual StatusCode ParticlePropertySvc::erase | ( | int | geantId ) | `[inline, virtual]`

Erase a property by geant3 id.

Implements IParticlePropertySvc.

Definition at line 141 of file ParticlePropertySvc.h.

      { return erase ( find ( geantId ) ) ; }

virtual StatusCode ParticlePropertySvc::erase | ( | const std::string & | name ) | `[inline, virtual]`

Erase a property by particle name.

Implements IParticlePropertySvc.

Definition at line 144 of file ParticlePropertySvc.h.

      { return erase ( find ( name ) ) ; }

virtual StatusCode ParticlePropertySvc::eraseByStdHepID | ( | int | stdHepId ) | `[inline, virtual]`

Erase a property by StdHep id ???

Implements IParticlePropertySvc.

Definition at line 147 of file ParticlePropertySvc.h.

      { return erase( findByStdHepID ( stdHepId ) ) ; }

StatusCode ParticlePropertySvc::finalize | ( | void | ) | `[virtual]`

Finalise the service.

finalize

finalize the base class

Reimplemented from Service.

Definition at line 153 of file ParticlePropertySvc.cpp.

    {
      if ( !m_other.empty() )
      {
        MsgStream log( msgSvc() , name() ) ;
        log << MSG::INFO
            << "Additional Properties have been read from files: "
            << Gaudi::Utils::toString ( m_other )
            << endmsg ;
      }

      if ( !m_replaced.empty() )
      {
        MsgStream log( msgSvc() , name() ) ;
        log << MSG::ALWAYS
            << "Properties have been redefined for "
            << m_replaced.size() << " particles : "
            << Gaudi::Utils::toString( m_replaced )
            << endmsg ;
      }

      if (m_fileAccess) {
        m_fileAccess->release();
        m_fileAccess = 0;
      }

      return Service::finalize () ;
    }

virtual ParticleProperty* ParticlePropertySvc::find | ( | const std::string & | name ) | `[inline, virtual]`

Retrieve a property by particle name.

Implements IParticlePropertySvc.

Definition at line 132 of file ParticlePropertySvc.h.

      { return m_namemap[ name ] ; }

virtual ParticleProperty* ParticlePropertySvc::find | ( | int | geantId ) | `[inline, virtual]`

Retrieve a property by geant3 id.

Implements IParticlePropertySvc.

Definition at line 129 of file ParticlePropertySvc.h.

      { return m_idmap[ geantId ] ; }

virtual ParticleProperty* ParticlePropertySvc::findByPythiaID | ( | int | pythiaID ) | `[inline, virtual]`

Retrieve a property by Pythia id.

Implements IParticlePropertySvc.

Definition at line 138 of file ParticlePropertySvc.h.

      { return m_pythiaidmap[ pythiaID ]; }

virtual ParticleProperty* ParticlePropertySvc::findByStdHepID | ( | int | stdHepId ) | `[inline, virtual]`

Retrieve a property by StdHep id.

Implements IParticlePropertySvc.

Definition at line 135 of file ParticlePropertySvc.h.

      { return m_stdhepidmap[ stdHepId ] ; }

StatusCode ParticlePropertySvc::initialize | ( | ) | `[virtual]`

Initialise the service.

initialize the service and setProperties

Reimplemented from Service.

Definition at line 87 of file ParticlePropertySvc.cpp.

    {
      StatusCode sc = Service::initialize();
      if ( sc.isFailure() ) { return sc ; }

      MsgStream log( msgSvc() , name() ) ;

      sc = setProperties();
      if ( sc.isFailure() )
      {
        log << MSG::ERROR << " Could not set the properties " << endmsg ;
        return sc ;
      }

      sc = service("VFSSvc",m_fileAccess);
      if ( sc.isFailure() )
      {
        log << MSG::ERROR << " Cannot retrieve the VFS service " << endmsg ;
        return sc ;
      }

      sc = parse();
      if ( sc.isFailure() )
      {
        log << MSG::ERROR << " Could not parse the file " << endmsg ;
        return sc ;
      }
      if ( !m_particles.empty() )
      {
        sc = addParticles () ;
        if ( sc.isFailure() )
        {
          log << MSG::ERROR << " Could not treat particles! " << endmsg ;
          return sc ;
        }
      }
      log << MSG::DEBUG << "ParticleProperties parsed successfully" << endmsg;

      log << MSG::DEBUG << "Access properties" << endmsg;
      // For debugging purposes print out the size of the internal maps
      // particle name as key: all particles in database are present here
      log << MSG::DEBUG << "NameMap size =" << m_namemap.size() << endmsg;
      // Geant3 ID as key: all particles in database are present here
      log << MSG::DEBUG << "GeantID Map size =" << m_idmap.size() << endmsg;
      // StdHep ID as key: some particles have no valid StdHep ID
      log << MSG::DEBUG << "StdHepID Map size =" << m_stdhepidmap.size()
          << endmsg;
      // Pythia ID as key: some particles are not defined in Pythia
      log << MSG::DEBUG << "PythiaID Map size =" << m_pythiaidmap.size()
          << endmsg;

      if ( !m_replaced.empty() )
      {
        log << MSG::INFO
            << "Properties have been redefined for "
            << m_replaced.size() << " particles : "
            << Gaudi::Utils::toString( m_replaced )
            << endmsg ;
      }

      return StatusCode::SUCCESS ;
    }

StatusCode ParticlePropertySvc::parse | ( | ) | `[protected]`

Parses the file and fill all the maps.

Definition at line 302 of file ParticlePropertySvc.cpp.

    {

      // parse "the main" file
      StatusCode sc = parse ( m_filename ) ;
      if ( sc.isFailure() ) { return sc ; }

      // parse "other" files
      for ( Files::const_iterator file = m_other.begin() ;
            m_other.end() != file ; ++file )
      {
        sc = parse ( *file ) ;
        if ( sc.isFailure() ) { return sc ; }
      }

      // Now check that the file format was consistent with what parser
      // expected
      if ( m_namemap.size() == 0 )
      {
        MsgStream log( msgSvc(), name() );
        log << MSG::ERROR
            << "Format of input file inconsistent with what expected"
            << " - Check you are using ParticleData.txt" << endmsg;
        return StatusCode::FAILURE;
      }

      return sc;
    }

StatusCode ParticlePropertySvc::parse | ( | const std::string & | file ) | `[protected]`

parse the file

Todo:
  : This PPS should be removed from Gaudi, if not, the parser must be improved

Definition at line 331 of file ParticlePropertySvc.cpp.

    {
      StatusCode sc = StatusCode::FAILURE;

      MsgStream log( msgSvc(), name() );
      char line[ 255 ];

      std::auto_ptr<std::istream> infileptr;
      if (m_fileAccess) infileptr = m_fileAccess->open(file);

      if ( infileptr.get() == 0 )
      {
        log << MSG::ERROR << "Unable to open properties file : " << file
            << endmsg;
        return StatusCode::FAILURE ;
      }

      std::istream &infile = *infileptr;
      sc = StatusCode::SUCCESS;
      log << MSG::INFO
          << "Opened particle properties file : " << file << endmsg;

      while( infile )
      {
        // parse each line of the file (comment lines begin with # in the cdf
        // file,
        infile.getline( line, 255 );

        if ( line[0] == '#' ) continue;

    #ifdef WIN32
    // Disable warning
    //   C4996: 'strtok': This function or variable may be unsafe.
    #pragma warning(disable:4996)
    #endif
        std::string par, gid, jid, chg, mas, lif, evt, pyt, mwi ;
        char* token = strtok( line, " " );
        if ( token ) { par = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { gid = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { jid = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { chg = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { mas = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { lif = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { evt = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { pyt = token; token = strtok( NULL, " " );} else continue;
        if ( token ) { mwi = token; token = strtok( NULL, " " );} else continue;
        if ( token != NULL ) continue;

        // In SICb cdf file mass and lifetime units are GeV and sec, specify it so
        // that they are converted to Gaudi units (MeV and ns)
        double mass = atof( mas.c_str() ) * Gaudi::Units::GeV;
        double tlife = atof( lif.c_str() ) * Gaudi::Units::s;
        long   ljid = atoi( jid.c_str() );
        long   lgid = atoi( gid.c_str() );
        long   lpyt = atoi( pyt.c_str() ) ;
        double mW = atof( mwi.c_str() ) * Gaudi::Units::GeV ;

        // Change the particles that do not correspond to a pdg number
        if ( ljid == 0 ) {
          ljid = 10000000*lgid;
        }

        // add a particle property
        sc = push_back( par, lgid, ljid,
                        atof( chg.c_str() ), mass, tlife, evt, lpyt, mW ) ;
        if ( sc.isFailure() )
        {
          log << MSG::ERROR
              << "Error from ParticlePropertySvc::push_back for particle='"
              << par << "'" << endmsg ;
        }

      }

      //infile.close();

      return StatusCode::SUCCESS ;
    }

StatusCode ParticlePropertySvc::push_back | ( | ParticleProperty * | pp ) | `[virtual]`

Add a new particle property.

Add a particle property.

Attention:
  ParticlePropertySvc is not the owner of this property!

Parameters:

  pp,a | particle property class.

Returns:
  StatusCode - SUCCESS if the particle property was added.

Implements IParticlePropertySvc.

Definition at line 208 of file ParticlePropertySvc.cpp.

    {
      if ( 0 == pp ) { return StatusCode::FAILURE ; }
      //
      { // try to add into Geant(3)ID map
        const int ID = pp->geantID() ;
        // is this already in the map?
        MapID::const_iterator ifind = m_idmap.find( ID ) ;
        if ( m_idmap.end() != ifind && 0 != m_idmap[ ID ])
        {
          diff ( ifind->second , pp ) ;
          m_replaced.insert( m_idmap[ ID ]->particle() ) ;
        }
        // put it into the map
        m_idmap[ ID ] = pp ;
      }
      //
      { // try to add into Name map
        const std::string& particle = pp->particle() ;
        // is this already in the map?
        MapName::const_iterator ifind = m_namemap.find( particle ) ;
        if ( m_namemap.end() != ifind && 0 != m_namemap[ particle ] )
        {
          diff ( ifind->second , pp ) ;
          m_replaced.insert( m_namemap[ particle ]->particle() ) ;
        }
        // put it into the map
        m_namemap[ particle ] = pp ;
      }
      //
      // add to StdHep map only if StdHep ID different from zero and if
      // not Cerenkov (StdHep ID = gamma)
      if ( 0 != pp->jetsetID() && "Tcherenkov" != pp->particle() )
      { // try to add into StdHepID map
        const int ID = pp->jetsetID() ;
        // is this already in the map?
        MapStdHepID::const_iterator ifind = m_stdhepidmap.find( ID ) ;
        if ( m_stdhepidmap.end() != ifind && 0 != m_stdhepidmap[ ID ])
        {
          diff ( ifind->second , pp ) ;
          m_replaced.insert( m_stdhepidmap[ ID ]->particle() ) ;
        }
        // put it into the map
        m_stdhepidmap[ ID ] = pp ;
      }
      //
      // add to Pythia map only if Pythia ID is different from
      // zero ( StdHep id is always different from zero in this case )
      if ( 0 != pp->pythiaID() &&
           0 != pp->jetsetID() &&
           "Tcherenkov" != pp->particle() )
      { // try to add into PythiaID map
        const int ID = pp->pythiaID() ;
        // is this already in the map?
        MapPythiaID::const_iterator ifind = m_pythiaidmap.find( ID ) ;
        if ( m_pythiaidmap.end() != ifind && 0 != m_pythiaidmap[ ID ])
        {
          diff ( ifind->second , pp ) ;
          m_replaced.insert( m_pythiaidmap[ ID ]->particle() ) ;
        }
        // put it into the map
        m_pythiaidmap[ ID ] = pp ;
      }
      //
      return rebuild() ;
    }

StatusCode ParticlePropertySvc::push_back | ( | const std::string & | particle,
|  | int | geantId,
|  | int | jetsetId,
|  | double | charge,
|  | double | mass,
|  | double | tlife,
|  | const std::string & | evtName,
|  | int | pythiaId,
|  | double | maxWidth
| ) |  | `[virtual]`

Create a new particle property.

Create a particle property and insert it in the maps.

Attention:
  ParticlePropertySvc *IS* the owner if this property! String name of the particle.

Parameters:

  geantId | Geant3 ID of the particle.
  jetsetId | Jetset ID of the particle.
  charge | Particle charge (/e).
  mass | Particle mass (GeV).
  tlife | Particle lifetime (s).
  evtName | String name of the particle in EvtGen.
  pythiaId | Pythia ID of the particle.

Returns:
  StatusCode - SUCCESS if the particle property was added.

Implements IParticlePropertySvc.

Definition at line 186 of file ParticlePropertySvc.cpp.

    {
      ParticleProperty* pp = new ParticleProperty
        ( particle , geantId  , jetsetId ,
          charge   , mass     , tlife    ,
          evtName  , pythiaId , maxWidth ) ;
      //
      m_owned.insert ( pp ) ;
      //
      return push_back( pp );
    }

StatusCode ParticlePropertySvc::rebuild | ( | ) | `[protected]`

rebuild "the linear container" from the map

Definition at line 464 of file ParticlePropertySvc.cpp.

    {
      Set local ;
      m_vectpp.clear() ;
      m_vectpp.reserve ( m_idmap.size() + 100 ) ;
      // load information from maps into the set
      _load_ ( m_idmap       , local ) ;
      _load_ ( m_namemap     , local ) ;
      _load_ ( m_stdhepidmap , local ) ;
      _load_ ( m_pythiaidmap , local ) ;
      // load information from set to the linear container vector
      for ( Set::iterator i = local.begin() ; local.end() != i ; ++i )
      { m_vectpp.push_back ( *i ) ; }
      return setAntiParticles() ;
    }

StatusCode ParticlePropertySvc::setAntiParticles | ( | ) | `[protected]`

helper (protected) function to set the valid particle<-->antiparticle relations

Returns:
  status code

Definition at line 438 of file ParticlePropertySvc.cpp.

    {
      // initialize particle<-->antiParticle relations
      for ( iterator ip = m_vectpp.begin() ; m_vectpp.end() != ip ; ++ip )
      {
        ParticleProperty* pp = *ip ;
        if ( 0 == pp                    ) { continue ; }   // CONTINUE
        const ParticleProperty* ap = anti ( pp ) ;
        if ( 0 != ap                    ) { pp->setAntiParticle( ap ) ; }
      }
      return StatusCode::SUCCESS ;
    }

virtual int ParticlePropertySvc::size | ( | void | ) | const`[inline, virtual]`

Get the container size.

Implements IParticlePropertySvc.

Definition at line 127 of file ParticlePropertySvc.h.

    { return m_vectpp.size() ; };

## Member Data Documentation

IFileAccess* ParticlePropertySvc::m_fileAccess`[private]`

Definition at line 204 of file ParticlePropertySvc.h.

std::string ParticlePropertySvc::m_filename`[private]`

Filename of the particle properties file.

Definition at line 189 of file ParticlePropertySvc.h.

MapID ParticlePropertySvc::m_idmap`[private]`

Map for geant IDs.

Definition at line 195 of file ParticlePropertySvc.h.

MapName ParticlePropertySvc::m_namemap`[private]`

Map for particle names.

Definition at line 196 of file ParticlePropertySvc.h.

Files ParticlePropertySvc::m_other`[private]`

additional file names

Definition at line 190 of file ParticlePropertySvc.h.

Set ParticlePropertySvc::m_owned`[private]`

Definition at line 201 of file ParticlePropertySvc.h.

Particles ParticlePropertySvc::m_particles`[private]`

Definition at line 192 of file ParticlePropertySvc.h.

MapPythiaID ParticlePropertySvc::m_pythiaidmap`[private]`

Map for Pythia Ids.

Definition at line 198 of file ParticlePropertySvc.h.

std::set<std::string> ParticlePropertySvc::m_replaced`[private]`

Definition at line 202 of file ParticlePropertySvc.h.

MapStdHepID ParticlePropertySvc::m_stdhepidmap`[private]`

Map for StdHep Ids.

Definition at line 197 of file ParticlePropertySvc.h.

VectPP ParticlePropertySvc::m_vectpp`[private]`

Vector of all particle properties.

Definition at line 194 of file ParticlePropertySvc.h.

The documentation for this class was generated from the following files:

- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r2/GaudiSvc/src/ParticlePropertySvc/ParticlePropertySvc.h
- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r2/GaudiSvc/src/ParticlePropertySvc/ParticlePropertySvc.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines