The Gaudi Framework  v30r3 (a5ef0a68)
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 {
20  // ============================================================================
72  class ParticlePropertySvc : public extends<Service, IParticlePropertySvc>
73  {
74  public:
75  // typedefs for container type
84  // Inherited Service overrides:
85 
87  StatusCode initialize() override;
89  StatusCode finalize() override;
102  StatusCode push_back( const std::string& particle, int geantId, int jetsetId, double charge, double mass,
103  double tlife, const std::string& evtName, int pythiaId, double maxWidth ) override;
111  const_iterator begin() const override { return m_vectpp.begin(); }
113  const_iterator end() const override { return m_vectpp.end(); }
115  int size() const override { return m_vectpp.size(); };
117  ParticleProperty* find( int geantId ) override { return m_idmap[geantId]; }
119  ParticleProperty* find( const std::string& name ) override { return m_namemap[name]; }
121  ParticleProperty* findByStdHepID( int stdHepId ) override { return m_stdhepidmap[stdHepId]; }
123  ParticleProperty* findByPythiaID( int pythiaID ) override { return m_pythiaidmap[pythiaID]; }
125  StatusCode erase( int geantId ) override { return erase( find( geantId ) ); }
127  StatusCode erase( const std::string& name ) override { return erase( find( name ) ); }
129  StatusCode eraseByStdHepID( int stdHepId ) override { return erase( findByStdHepID( stdHepId ) ); }
135 
136  protected:
142  const ParticleProperty* anti( const ParticleProperty* pp ) const;
151  StatusCode erase( const ParticleProperty* pp );
153  StatusCode parse( const std::string& file );
154  // Text file parsing routine.
155  StatusCode parse();
156  // treat additional particles
158  // compare 2 entries
159  bool diff( const ParticleProperty* o, const ParticleProperty* n, const MSG::Level l = MSG::DEBUG ) const;
160 
161  private:
162  Gaudi::Property<std::string> m_filename{this, "ParticlePropertiesFile", "ParticleTable.txt",
163  "Filename of the particle properties file"};
164  Gaudi::Property<std::vector<std::string>> m_other{this, "OtherFiles", {}, "additional file names"};
166  this, "Particles", {}, "properties to be redefined explicitly"};
167 
169  MapID m_idmap;
170  MapName m_namemap;
171  MapStdHepID m_stdhepidmap;
172  MapPythiaID m_pythiaidmap;
173 
174  // local storage of ALL properties
177 
179  };
180 } // namespace Gaudi
181 // =============================================================================
182 // The END
183 // =============================================================================
184 #endif
185 // =============================================================================
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:288
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:381
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:51
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:440
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.