| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# ParticlePropertySvc.h

Go to the documentation of this file.

    00001 // $Id: ParticlePropertySvc.h,v 1.9 2008/05/09 12:43:29 marcocle Exp $
    00002 // ============================================================================
    00003 // CVS tag $Name: v17r1 $, version $Revision: 1.9 $
    00004 // ============================================================================
    00005 #ifndef PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
    00006 #define PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
    00007 // ============================================================================
    00008 // Include Files
    00009 // ============================================================================
    00010 // STD&STL
    00011 // ============================================================================
    00012 #include <map>
    00013 #include <set>
    00014 // ============================================================================
    00015 // GaudiKernel
    00016 // ============================================================================
    00017 #include "GaudiKernel/Service.h"
    00018 #include "GaudiKernel/SvcFactory.h"
    00019 #include "GaudiKernel/IParticlePropertySvc.h"
    00020
    00021 class IFileAccess;
    00022
    00023 // ============================================================================
    00075 class ParticlePropertySvc
    00076   :         public Service
    00077   , virtual public IParticlePropertySvc
    00078 {
    00079 public:
    00080   // typedefs for container type
    00081   typedef ParticleProperty* mapped_type;
    00082   typedef std::map< int,         mapped_type > MapID       ;
    00083   typedef std::map< std::string, mapped_type > MapName     ;
    00084   typedef std::map< int,         mapped_type > MapStdHepID ;
    00085   typedef std::map< int,         mapped_type > MapPythiaID ;
    00086   typedef IParticlePropertySvc::VectPP VectPP;
    00087   typedef IParticlePropertySvc::const_iterator const_iterator;
    00088   typedef IParticlePropertySvc::iterator iterator;
    00089   typedef std::set<ParticleProperty*>    Set ;
    00090   // Inherited Service overrides:
    00091
    00093   virtual StatusCode initialize();
    00095   virtual StatusCode finalize();
    00097   virtual StatusCode queryInterface
    00098   ( const InterfaceID& riid, void** ppvInterface );
    00100   virtual const InterfaceID& type() const;
    00113   virtual StatusCode push_back
    00114   ( const std::string& particle ,
    00115     int                geantId  ,
    00116     int                jetsetId ,
    00117     double             charge   ,
    00118     double             mass     ,
    00119     double             tlife    ,
    00120     const std::string& evtName  ,
    00121     int                pythiaId ,
    00122     double             maxWidth ) ;
    00128   virtual StatusCode push_back( ParticleProperty* pp );
    00130   virtual const_iterator begin() const { return m_vectpp.begin() ; }
    00132   virtual const_iterator end  () const { return m_vectpp.end() ; }
    00134   virtual int size() const { return m_vectpp.size() ; };
    00136   virtual ParticleProperty* find( int geantId )
    00137   { return m_idmap[ geantId ] ; }
    00139   virtual ParticleProperty* find( const std::string& name )
    00140   { return m_namemap[ name ] ; }
    00142   virtual ParticleProperty* findByStdHepID( int stdHepId )
    00143   { return m_stdhepidmap[ stdHepId ] ; }
    00145   virtual ParticleProperty* findByPythiaID( int pythiaID )
    00146   { return m_pythiaidmap[ pythiaID ]; }
    00148   virtual StatusCode erase( int geantId )
    00149   { return erase ( find ( geantId ) ) ; }
    00151   virtual StatusCode erase( const std::string& name )
    00152   { return erase ( find ( name ) ) ; }
    00154   virtual StatusCode eraseByStdHepID( int stdHepId )
    00155   { return erase( findByStdHepID ( stdHepId ) ) ; }
    00160   ParticlePropertySvc
    00161   ( const std::string& name , ISvcLocator* svc );
    00163   virtual ~ParticlePropertySvc();
    00164 protected:
    00170   const ParticleProperty* anti
    00171   ( const ParticleProperty* pp ) const ;
    00176   StatusCode setAntiParticles() ;
    00178   StatusCode rebuild() ;
    00180   StatusCode erase ( const ParticleProperty* pp ) ;
    00182   StatusCode parse ( const std::string& file ) ;
    00183   // Text file parsing routine.
    00184   StatusCode parse();
    00185   // treat additional particles
    00186   StatusCode addParticles() ;
    00187   // compare 2 entries
    00188   bool diff
    00189   ( const ParticleProperty* o              ,
    00190     const ParticleProperty* n              ,
    00191     const MSG::Level        l = MSG::DEBUG ) const ;
    00192 private:
    00193   typedef std::vector<std::string> Files ;
    00194   typedef std::vector<std::string> Particles ;
    00195
    00196   std::string m_filename;
    00197   Files m_other ;
    00198   // properties to be redefined  explicitely
    00199   Particles m_particles ;
    00200
    00201   VectPP      m_vectpp;
    00202   MapID       m_idmap;
    00203   MapName     m_namemap;
    00204   MapStdHepID m_stdhepidmap;
    00205   MapPythiaID m_pythiaidmap;
    00206
    00207   // local storage of ALL properties
    00208   Set                           m_owned    ;
    00209   std::set<std::string>         m_replaced ;
    00210
    00211   IFileAccess *m_fileAccess;
    00212 };
    00213
    00214 // =============================================================================
    00215 // The END
    00216 // =============================================================================
    00217 #endif
    00218 // =============================================================================
    00219
    00220