Go to the documentation of this file.00001 #ifndef PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
00002 #define PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
00003
00004
00005
00006
00007
00008 #include <map>
00009 #include <set>
00010
00011
00012
00013 #include "GaudiKernel/Service.h"
00014 #include "GaudiKernel/SvcFactory.h"
00015 #include "GaudiKernel/IParticlePropertySvc.h"
00016
00017 class IFileAccess;
00018
00019 namespace Gaudi {
00020
00072 class ParticlePropertySvc: public extends1<Service,IParticlePropertySvc>
00073 {
00074 public:
00075
00076 typedef ParticleProperty* mapped_type;
00077 typedef std::map< int, mapped_type > MapID ;
00078 typedef std::map< std::string, mapped_type > MapName ;
00079 typedef std::map< int, mapped_type > MapStdHepID ;
00080 typedef std::map< int, mapped_type > MapPythiaID ;
00081 typedef IParticlePropertySvc::VectPP VectPP;
00082 typedef IParticlePropertySvc::const_iterator const_iterator;
00083 typedef IParticlePropertySvc::iterator iterator;
00084 typedef std::set<ParticleProperty*> Set ;
00085
00086
00088 virtual StatusCode initialize();
00090 virtual StatusCode finalize();
00103 virtual StatusCode push_back
00104 ( const std::string& particle ,
00105 int geantId ,
00106 int jetsetId ,
00107 double charge ,
00108 double mass ,
00109 double tlife ,
00110 const std::string& evtName ,
00111 int pythiaId ,
00112 double maxWidth ) ;
00118 virtual StatusCode push_back( ParticleProperty* pp );
00120 virtual const_iterator begin() const { return m_vectpp.begin() ; }
00122 virtual const_iterator end () const { return m_vectpp.end() ; }
00124 virtual int size() const { return m_vectpp.size() ; };
00126 virtual ParticleProperty* find( int geantId )
00127 { return m_idmap[ geantId ] ; }
00129 virtual ParticleProperty* find( const std::string& name )
00130 { return m_namemap[ name ] ; }
00132 virtual ParticleProperty* findByStdHepID( int stdHepId )
00133 { return m_stdhepidmap[ stdHepId ] ; }
00135 virtual ParticleProperty* findByPythiaID( int pythiaID )
00136 { return m_pythiaidmap[ pythiaID ]; }
00138 virtual StatusCode erase( int geantId )
00139 { return erase ( find ( geantId ) ) ; }
00141 virtual StatusCode erase( const std::string& name )
00142 { return erase ( find ( name ) ) ; }
00144 virtual StatusCode eraseByStdHepID( int stdHepId )
00145 { return erase( findByStdHepID ( stdHepId ) ) ; }
00150 ParticlePropertySvc
00151 ( const std::string& name , ISvcLocator* svc );
00153 virtual ~ParticlePropertySvc();
00154 protected:
00160 const ParticleProperty* anti
00161 ( const ParticleProperty* pp ) const ;
00166 StatusCode setAntiParticles() ;
00168 StatusCode rebuild() ;
00170 StatusCode erase ( const ParticleProperty* pp ) ;
00172 StatusCode parse ( const std::string& file ) ;
00173
00174 StatusCode parse();
00175
00176 StatusCode addParticles() ;
00177
00178 bool diff
00179 ( const ParticleProperty* o ,
00180 const ParticleProperty* n ,
00181 const MSG::Level l = MSG::DEBUG ) const ;
00182 private:
00183 typedef std::vector<std::string> Files ;
00184 typedef std::vector<std::string> Particles ;
00185
00186 std::string m_filename;
00187 Files m_other ;
00188
00189 Particles m_particles ;
00190
00191 VectPP m_vectpp;
00192 MapID m_idmap;
00193 MapName m_namemap;
00194 MapStdHepID m_stdhepidmap;
00195 MapPythiaID m_pythiaidmap;
00196
00197
00198 Set m_owned ;
00199 std::set<std::string> m_replaced ;
00200
00201 IFileAccess *m_fileAccess;
00202 };
00203 }
00204
00205
00206
00207 #endif
00208
00209
00210