Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ParticlePropertySvc.h
Go to the documentation of this file.
1 #ifndef PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
2 #define PARTICLEPROPERTYSVC_PARTICLEPROPERTYSVC_H
3 // ============================================================================
4 // Include Files
5 // ============================================================================
6 // STD&STL
7 // ============================================================================
8 #include <map>
9 #include <set>
10 // ============================================================================
11 // GaudiKernel
12 // ============================================================================
14 #include "GaudiKernel/Service.h"
15 
16 class IFileAccess;
17 
18 namespace Gaudi {
19  // ============================================================================
71  class ParticlePropertySvc : public extends<Service, IParticlePropertySvc> {
72  public:
73  // typedefs for container type
82  // Inherited Service overrides:
83 
85  StatusCode initialize() override;
87  StatusCode finalize() override;
100  StatusCode push_back( const std::string& particle, int geantId, int jetsetId, double charge, double mass,
101  double tlife, const std::string& evtName, int pythiaId, double maxWidth ) override;
109  const_iterator begin() const override { return m_vectpp.begin(); }
111  const_iterator end() const override { return m_vectpp.end(); }
113  int size() const override { return m_vectpp.size(); };
115  ParticleProperty* find( int geantId ) override { return m_idmap[geantId]; }
117  ParticleProperty* find( const std::string& name ) override { return m_namemap[name]; }
119  ParticleProperty* findByStdHepID( int stdHepId ) override { return m_stdhepidmap[stdHepId]; }
121  ParticleProperty* findByPythiaID( int pythiaID ) override { return m_pythiaidmap[pythiaID]; }
123  StatusCode erase( int geantId ) override { return erase( find( geantId ) ); }
125  StatusCode erase( const std::string& name ) override { return erase( find( name ) ); }
127  StatusCode eraseByStdHepID( int stdHepId ) override { return erase( findByStdHepID( stdHepId ) ); }
133 
134  protected:
140  const ParticleProperty* anti( const ParticleProperty* pp ) const;
149  StatusCode erase( const ParticleProperty* pp );
151  StatusCode parse( const std::string& file );
152  // Text file parsing routine.
153  StatusCode parse();
154  // treat additional particles
156  // compare 2 entries
157  bool diff( const ParticleProperty* o, const ParticleProperty* n, const MSG::Level l = MSG::DEBUG ) const;
158 
159  private:
160  Gaudi::Property<std::string> m_filename{this, "ParticlePropertiesFile", "ParticleTable.txt",
161  "Filename of the particle properties file"};
162  Gaudi::Property<std::vector<std::string>> m_other{this, "OtherFiles", {}, "additional file names"};
164  this, "Particles", {}, "properties to be redefined explicitly"};
165 
167  MapID m_idmap;
168  MapName m_namemap;
169  MapStdHepID m_stdhepidmap;
170  MapPythiaID m_pythiaidmap;
171 
172  // local storage of ALL properties
175 
177  };
178 } // namespace Gaudi
179 // =============================================================================
180 // The END
181 // =============================================================================
182 #endif
StatusCode rebuild()
rebuild "the linear container" from the map
VectPP::iterator iterator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
const_iterator end() const override
Get a const reference to the end of the container.
Implementation of property with value of concrete type.
Definition: Property.h:352
This service provides access to particle properties.
StatusCode eraseByStdHepID(int stdHepId) override
Erase a property by StdHep id ???
VectPP::const_iterator const_iterator
A trivial class to hold information about a single particle properties.
StatusCode erase(int geantId) override
Erase a property by geant3 id.
ParticleProperty * findByPythiaID(int pythiaID) override
Retrieve a property by Pythia id.
StatusCode finalize() override
Finalise the service.
std::vector< ParticleProperty * > VectPP
StatusCode initialize() override
Initialise the service.
MapName m_namemap
Map for particle names.
StatusCode parse()
Parses the file and fill all the maps.
T end(T...args)
ParticleProperty * find(const std::string &name) override
Retrieve a property by particle name.
SmartIF< IFileAccess > m_fileAccess
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) override
Create a new particle property.
STL class.
std::map< int, mapped_type > MapStdHepID
std::set< std::string > m_replaced
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
ParticleProperty * find(int geantId) override
Retrieve a property by geant3 id.
StatusCode erase(const std::string &name) override
Erase a property by particle name.
MapStdHepID m_stdhepidmap
Map for StdHep Ids.
dictionary l
Definition: gaudirun.py:517
const ParticleProperty * anti(const ParticleProperty *pp) const
helper (protected) function to find an antiparticle for the given particle ID (StdHepID) ...
T size(T...args)
STL class.
STL class.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
T begin(T...args)
ParticleProperty * findByStdHepID(int stdHepId) override
Retrieve a property by StdHep id.
bool diff(const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const
int size() const override
Get the container size.
const_iterator begin() const override
Get a const reference to the beginning of the container.
Gaudi::Property< std::vector< std::string > > m_other
std::map< int, mapped_type > MapID
Abstract interface for a service or tool implementing a read access to files.
Definition: IFileAccess.h:18
std::set< std::unique_ptr< ParticleProperty > > m_owned
MapID m_idmap
Map for geant IDs.
Gaudi::Property< std::string > m_filename
std::map< std::string, mapped_type > MapName
Gaudi::Property< std::vector< std::string > > m_particles
ParticlePropertySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
std::map< int, mapped_type > MapPythiaID
StatusCode setAntiParticles()
helper (protected) function to set the valid particle<–>antiparticle relations
ParticleProperty * mapped_type
VectPP m_vectpp
Vector of all particle properties.
VectPP::const_iterator const_iterator
Helper functions to set/get the application return code.
Definition: __init__.py:1
MapPythiaID m_pythiaidmap
Map for Pythia Ids.