Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ParticlePropertySvc.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GaudiSvc/src/ParticlePropertySvc/ParticlePropertySvc.h,v 1.1.1.2 2001/04/18 18:32:50 tlindner Exp $
00002 #ifndef PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
00003 #define PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
00004 
00005 // Include Files
00006 #include "GaudiKernel/Service.h"
00007 #include "GaudiKernel/IParticlePropertySvc.h"
00008 
00009 // Forward declarations
00010 template <class TYPE> class SvcFactory;
00011 
00012 //------------------------------------------------------------------
00013 //
00014 // ClassName:   ParticlePropertySvc
00015 //  
00016 // Description: This service provides access to particle properties.
00017 //              The settable property of this service is the 
00018 //              ParticlePropertiesFile, an ASCII file containing the 
00019 //              list of properties for the particles.
00020 //              The default file is: 
00021 //                $LHCBDBASE/cdf/particle.cdf
00022 //              or if $LHCBDBASE is not defined
00023 //                particle.cdf
00024 //
00025 // Author:      Iain Last
00026 // Changes:     G.Corti 8/11/1999 : change default file from
00027 //              $CDF/particle.cdf to $LHCBDBASE/cdf/particle.cdf on Unix 
00028 //              and use environment variable also on WinNT
00029 //              Also introduce finding of particle by StdHepID
00030 //
00031 //------------------------------------------------------------------
00032 
00033 class ParticlePropertySvc : public Service, virtual public IParticlePropertySvc {
00034 
00035 public:  
00036   // typedefs for container type
00037   typedef ParticleProperty* mapped_type;
00038   typedef std::map< int, mapped_type, std::less<int> > MapID;
00039   typedef std::map< std::string, mapped_type, std::less<std::string> > MapName;
00040   typedef std::map< int, mapped_type, std::less<int> > MapStdHepID;
00041   typedef IParticlePropertySvc::VectPP VectPP;
00042   typedef IParticlePropertySvc::const_iterator const_iterator;
00043   typedef IParticlePropertySvc::iterator iterator;
00044 
00045   // Inherited Service overrides:
00046   // Initialise the service.
00047   virtual StatusCode initialize();
00048   
00049   // Finalise the service.
00050   virtual StatusCode finalize();
00051   
00052   // Query the interfaces.
00053   //   Input: riid, Requested interface ID
00054   //          ppvInterface, Pointer to requested interface
00055   //   Return: StatusCode indicating SUCCESS or FAILURE.
00056   // N.B. Don't forget to release the interface after use!!!
00057   virtual StatusCode queryInterface( const IID& riid, void** ppvInterface );
00058   
00059   // Service type.
00060   virtual const IID& type() const;
00061   
00062   // IParticlePropertySvc interface overrides:
00063   // Create a new particle property.
00064   //   Input: particle, String name of the particle.
00065   //          geantId, Geant3 ID of the particle.
00066   //          jetsetId, Jetset ID of the particle.
00067   //          type, Geant3 particle tracking type.
00068   //          charge, Particle charge (/e).
00069   //          mass, Particle mass (GeV).
00070   //          tlife, Particle lifetime (s).   
00071   //   Return: StatusCode - SUCCESS if the particle property was added.
00072   virtual StatusCode push_back( const std::string& particle,
00073                                 int geantId, int jetsetId, int type, 
00074                                 double charge, double mass, double tlife );
00075   
00076   // Create a new particle property.
00077   //   Input: pp, a particle property class.
00078   //   Return: StatusCode - SUCCESS if the particle property was added.
00079   virtual StatusCode push_back( ParticleProperty* pp );
00080   
00081   // Get a const reference to the begining of the container.
00082   virtual const_iterator begin() const;
00083 
00084   // Get a const reference to the end of the container.
00085   virtual const_iterator end() const;  
00086 
00087   // Get the container size.
00088   virtual int size() const;
00089 
00090   // Retrieve a property by geant3 id.
00091   virtual ParticleProperty* find( int geantId );
00092 
00093   // Retrieve a property by particle name.
00094   virtual ParticleProperty* find( const std::string& name );
00095 
00096   // Retrieve a property by StdHep id
00097   virtual ParticleProperty* findByStdHepID( int stdHepId );
00098 
00099   // Erase a property by geant3 id.
00100   virtual StatusCode erase( int geantId );
00101 
00102   // Erase a property by particle name.
00103   virtual StatusCode erase( const std::string& name );
00104 
00105   // Erase a property by StdHep id ???
00106   virtual StatusCode eraseByStdHepID( int stdHepId );
00107 
00108 protected:
00109   
00110   // Standard Constructor.
00111   //   Input:  name   String with service name
00112   //   Input:  svc    Pointer to service locator interface
00113   ParticlePropertySvc( const std::string& name, ISvcLocator* svc );
00114   
00115   // Destructor.
00116   virtual ~ParticlePropertySvc();
00117 
00118 private:
00119   // Allow SvcFactory to instantiate the service.
00120   friend class SvcFactory<ParticlePropertySvc>;
00121   
00122   // Text file parsing routine. 
00123   StatusCode parseFile();       
00124   
00125   std::string m_filename;        // Filename of the particle properties file  
00126   VectPP      m_vectpp;          // Vector of all particle properties
00127   MapID       m_idmap;           // Map for geant IDs
00128   MapName     m_namemap;         // Map for particle names
00129   MapStdHepID m_stdhepidmap;     // Map for StdHep Ids
00130 };
00131 
00132 #endif
00133 
00134 

Generated at Wed Nov 21 12:22:30 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000