| The Gaudi Framework v28r2-patches (bc4ad17a)

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

- File List
- File Members

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 // ============================================================================
13 #include "GaudiKernel/IParticlePropertySvc.h"
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
76 typedef ParticleProperty* mapped_type;
77 typedef std::map<int, mapped_type> MapID;
78 typedef std::map<std::string, mapped_type> MapName;
79 typedef std::map<int, mapped_type> MapStdHepID;
80 typedef std::map<int, mapped_type> MapPythiaID;
81 using IParticlePropertySvc::VectPP;
82 using IParticlePropertySvc::const_iterator;
83 using IParticlePropertySvc::iterator;
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;
109 StatusCode push_back( ParticleProperty* pp ) 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 ) ); }
134 ParticlePropertySvc( const std::string& name, ISvcLocator* svc );
136 ~ParticlePropertySvc() override = default;
137
138 protected:
144 const ParticleProperty* anti( const ParticleProperty* pp ) const;
149 StatusCode setAntiParticles();
151 StatusCode rebuild();
153 StatusCode erase( const ParticleProperty* pp );
155 StatusCode parse( const std::string& file );
156 // Text file parsing routine.
157 StatusCode parse();
158 // treat additional particles
159 StatusCode addParticles();
160 // compare 2 entries
161 bool diff( const ParticleProperty* o, const ParticleProperty* n, const MSG::Level l = MSG::DEBUG ) const;
162
163 private:
164 Gaudi::Property<std::string> m_filename{this, "ParticlePropertiesFile", "ParticleTable.txt",
165 "Filename of the particle properties file"};
166 Gaudi::Property<std::vector<std::string>> m_other{this, "OtherFiles", {}, "additional file names"};
167 Gaudi::Property<std::vector<std::string>> m_particles{
168 this, "Particles", {}, "properties to be redefined explicitly"};
169
170 VectPP m_vectpp;
171 MapID m_idmap;
172 MapName m_namemap;
173 MapStdHepID m_stdhepidmap;
174 MapPythiaID m_pythiaidmap;
175
176 // local storage of ALL properties
177 std::set<std::unique_ptr<ParticleProperty>> m_owned;
178 std::set<std::string> m_replaced;
179
180 SmartIF<IFileAccess> m_fileAccess;
181 };
182 } // namespace Gaudi
183 // =============================================================================
184 // The END
185 // =============================================================================
186 #endif
187 // =============================================================================
Gaudi::ParticlePropertySvc::rebuild
StatusCode rebuild()
rebuild "the linear container" from the map
Definition: ParticlePropertySvc.cpp:401
IParticlePropertySvc::iterator
VectPP::iterator iterator
Definition: IParticlePropertySvc.h:27
SmartIF< IFileAccess >
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
Gaudi::ParticlePropertySvc::end
const_iterator end() const override
Get a const reference to the end of the container.
Definition: ParticlePropertySvc.h:113
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
Gaudi::ParticlePropertySvc
This service provides access to particle properties.
Definition: ParticlePropertySvc.h:72
Gaudi::ParticlePropertySvc::eraseByStdHepID
StatusCode eraseByStdHepID(int stdHepId) override
Erase a property by StdHep id ???
Definition: ParticlePropertySvc.h:129
IParticlePropertySvc.h
Gaudi::ParticlePropertySvc::const_iterator
VectPP::const_iterator const_iterator
Definition: IParticlePropertySvc.h:26
ParticleProperty
A trivial class to hold information about a single particle properties.
Definition: ParticleProperty.h:18
Gaudi::ParticlePropertySvc::erase
StatusCode erase(int geantId) override
Erase a property by geant3 id.
Definition: ParticlePropertySvc.h:125
MSG::DEBUG
Definition: IMessageSvc.h:18
Gaudi::ParticlePropertySvc::findByPythiaID
ParticleProperty * findByPythiaID(int pythiaID) override
Retrieve a property by Pythia id.
Definition: ParticlePropertySvc.h:123
Gaudi::ParticlePropertySvc::finalize
StatusCode finalize() override
Finalise the service.
Definition: ParticlePropertySvc.cpp:132
IParticlePropertySvc::VectPP
std::vector< ParticleProperty * > VectPP
Definition: IParticlePropertySvc.h:25
Gaudi::ParticlePropertySvc::initialize
StatusCode initialize() override
Initialise the service.
Definition: ParticlePropertySvc.cpp:68
Gaudi::ParticlePropertySvc::m_namemap
MapName m_namemap
Map for particle names.
Definition: ParticlePropertySvc.h:172
Gaudi::ParticlePropertySvc::parse
StatusCode parse()
Parses the file and fill all the maps.
Definition: ParticlePropertySvc.cpp:274
std::vector::end
T end(T...args)
Gaudi::ParticlePropertySvc::find
ParticleProperty * find(const std::string &name) override
Retrieve a property by particle name.
Definition: ParticlePropertySvc.h:119
Gaudi::ParticlePropertySvc::~ParticlePropertySvc
~ParticlePropertySvc() override=default
Destructor.
Gaudi::ParticlePropertySvc::m_fileAccess
SmartIF< IFileAccess > m_fileAccess
Definition: ParticlePropertySvc.h:180
std::map< int, mapped_type >
Gaudi::ParticlePropertySvc::push_back
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.
Definition: ParticlePropertySvc.cpp:158
std::string
STL class.
Service.h
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:217
MSG::Level
Level
Definition: IMessageSvc.h:15
Gaudi::ParticlePropertySvc::MapStdHepID
std::map< int, mapped_type > MapStdHepID
Definition: ParticlePropertySvc.h:79
Gaudi::ParticlePropertySvc::m_replaced
std::set< std::string > m_replaced
Definition: ParticlePropertySvc.h:178
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::ParticlePropertySvc::find
ParticleProperty * find(int geantId) override
Retrieve a property by geant3 id.
Definition: ParticlePropertySvc.h:117
Gaudi::ParticlePropertySvc::erase
StatusCode erase(const std::string &name) override
Erase a property by particle name.
Definition: ParticlePropertySvc.h:127
Gaudi::ParticlePropertySvc::m_stdhepidmap
MapStdHepID m_stdhepidmap
Map for StdHep Ids.
Definition: ParticlePropertySvc.h:173
gaudirun.l
dictionary l
Definition: gaudirun.py:421
Gaudi::ParticlePropertySvc::anti
const ParticleProperty * anti(const ParticleProperty *pp) const
helper (protected) function to find an antiparticle for the given particle ID (StdHepID) ...
Definition: ParticlePropertySvc.cpp:358
std::vector::size
T size(T...args)
std::set
STL class.
std::vector
STL class.
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
std::vector::begin
T begin(T...args)
Gaudi::ParticlePropertySvc::findByStdHepID
ParticleProperty * findByStdHepID(int stdHepId) override
Retrieve a property by StdHep id.
Definition: ParticlePropertySvc.h:121
Gaudi::ParticlePropertySvc::diff
bool diff(const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const
Definition: ParticlePropertySvc.cpp:487
Gaudi::ParticlePropertySvc::size
int size() const override
Get the container size.
Definition: ParticlePropertySvc.h:115
Gaudi::ParticlePropertySvc::begin
const_iterator begin() const override
Get a const reference to the beginning of the container.
Definition: ParticlePropertySvc.h:111
Gaudi::ParticlePropertySvc::m_other
Gaudi::Property< std::vector< std::string > > m_other
Definition: ParticlePropertySvc.h:166
Gaudi::ParticlePropertySvc::MapID
std::map< int, mapped_type > MapID
Definition: ParticlePropertySvc.h:77
IFileAccess
Abstract interface for a service or tool implementing a read access to files.
Definition: IFileAccess.h:18
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:417
Gaudi::ParticlePropertySvc::addParticles
StatusCode addParticles()
Definition: ParticlePropertySvc.cpp:418
Gaudi::ParticlePropertySvc::m_owned
std::set< std::unique_ptr< ParticleProperty > > m_owned
Definition: ParticlePropertySvc.h:177
Gaudi::ParticlePropertySvc::m_idmap
MapID m_idmap
Map for geant IDs.
Definition: ParticlePropertySvc.h:171
Gaudi::ParticlePropertySvc::m_filename
Gaudi::Property< std::string > m_filename
Definition: ParticlePropertySvc.h:164
Gaudi::ParticlePropertySvc::MapName
std::map< std::string, mapped_type > MapName
Definition: ParticlePropertySvc.h:78
Gaudi::ParticlePropertySvc::m_particles
Gaudi::Property< std::vector< std::string > > m_particles
Definition: ParticlePropertySvc.h:167
Gaudi::ParticlePropertySvc::ParticlePropertySvc
ParticlePropertySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: ParticlePropertySvc.cpp:54
Gaudi::ParticlePropertySvc::MapPythiaID
std::map< int, mapped_type > MapPythiaID
Definition: ParticlePropertySvc.h:80
Gaudi::ParticlePropertySvc::setAntiParticles
StatusCode setAntiParticles()
helper (protected) function to set the valid particle<–>antiparticle relations
Definition: ParticlePropertySvc.cpp:376
Gaudi::ParticlePropertySvc::mapped_type
ParticleProperty * mapped_type
Definition: ParticlePropertySvc.h:76
Gaudi::ParticlePropertySvc::m_vectpp
VectPP m_vectpp
Vector of all particle properties.
Definition: ParticlePropertySvc.h:170
IParticlePropertySvc::const_iterator
VectPP::const_iterator const_iterator
Definition: IParticlePropertySvc.h:26
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
Gaudi::ParticlePropertySvc::m_pythiaidmap
MapPythiaID m_pythiaidmap
Map for Pythia Ids.
Definition: ParticlePropertySvc.h:174