| The Gaudi Framework v32r1 (f65d50dc)

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 // ============================================================================
71 class ParticlePropertySvc : public extends<Service, IParticlePropertySvc> {
72 public:
73 // typedefs for container type
74 typedef ParticleProperty* mapped_type;
75 typedef std::map<int, mapped_type> MapID;
76 typedef std::map<std::string, mapped_type> MapName;
77 typedef std::map<int, mapped_type> MapStdHepID;
78 typedef std::map<int, mapped_type> MapPythiaID;
79 using IParticlePropertySvc::const_iterator;
80 using IParticlePropertySvc::iterator;
81 using IParticlePropertySvc::VectPP;
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;
107 StatusCode push_back( ParticleProperty* pp ) 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 ) ); }
132 ParticlePropertySvc( const std::string& name, ISvcLocator* svc );
133
134 protected:
140 const ParticleProperty* anti( const ParticleProperty* pp ) const;
145 StatusCode setAntiParticles();
147 StatusCode rebuild();
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
155 StatusCode addParticles();
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"};
163 Gaudi::Property<std::vector<std::string>> m_particles{
164 this, "Particles", {}, "properties to be redefined explicitly"};
165
166 VectPP m_vectpp;
167 MapID m_idmap;
168 MapName m_namemap;
169 MapStdHepID m_stdhepidmap;
170 MapPythiaID m_pythiaidmap;
171
172 // local storage of ALL properties
173 std::set<std::unique_ptr<ParticleProperty>> m_owned;
174 std::set<std::string> m_replaced;
175
176 SmartIF<IFileAccess> m_fileAccess;
177 };
178 } // namespace Gaudi
179 // =============================================================================
180 // The END
181 // =============================================================================
182 #endif
Gaudi::ParticlePropertySvc::diff
bool diff(const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const
Definition: ParticlePropertySvc.cpp:378
Gaudi::ParticlePropertySvc::rebuild
StatusCode rebuild()
rebuild "the linear container" from the map
Definition: ParticlePropertySvc.cpp:322
IParticlePropertySvc::iterator
VectPP::iterator iterator
Definition: IParticlePropertySvc.h:27
SmartIF< IFileAccess >
Gaudi::ParticlePropertySvc::size
int size() const override
Get the container size.
Definition: ParticlePropertySvc.h:113
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
Gaudi::ParticlePropertySvc
This service provides access to particle properties.
Definition: ParticlePropertySvc.h:71
Gaudi::ParticlePropertySvc::eraseByStdHepID
StatusCode eraseByStdHepID(int stdHepId) override
Erase a property by StdHep id ???
Definition: ParticlePropertySvc.h:127
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:123
MSG::DEBUG
Definition: IMessageSvc.h:15
Gaudi::ParticlePropertySvc::findByPythiaID
ParticleProperty * findByPythiaID(int pythiaID) override
Retrieve a property by Pythia id.
Definition: ParticlePropertySvc.h:121
Gaudi::ParticlePropertySvc::finalize
StatusCode finalize() override
Finalise the service.
Definition: ParticlePropertySvc.cpp:105
IParticlePropertySvc::VectPP
std::vector< ParticleProperty * > VectPP
Definition: IParticlePropertySvc.h:25
Gaudi::ParticlePropertySvc::initialize
StatusCode initialize() override
Initialise the service.
Definition: ParticlePropertySvc.cpp:54
Gaudi::ParticlePropertySvc::m_namemap
MapName m_namemap
Map for particle names.
Definition: ParticlePropertySvc.h:168
Gaudi::ParticlePropertySvc::parse
StatusCode parse()
Parses the file and fill all the maps.
Definition: ParticlePropertySvc.cpp:217
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:117
Gaudi::ParticlePropertySvc::m_fileAccess
SmartIF< IFileAccess > m_fileAccess
Definition: ParticlePropertySvc.h:176
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:123
std::string
STL class.
Service.h
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
MSG::Level
Level
Definition: IMessageSvc.h:15
Gaudi::ParticlePropertySvc::MapStdHepID
std::map< int, mapped_type > MapStdHepID
Definition: ParticlePropertySvc.h:77
Gaudi::ParticlePropertySvc::m_replaced
std::set< std::string > m_replaced
Definition: ParticlePropertySvc.h:174
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:286
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::ParticlePropertySvc::find
ParticleProperty * find(int geantId) override
Retrieve a property by geant3 id.
Definition: ParticlePropertySvc.h:115
Gaudi::ParticlePropertySvc::erase
StatusCode erase(const std::string &name) override
Erase a property by particle name.
Definition: ParticlePropertySvc.h:125
Gaudi::ParticlePropertySvc::end
const_iterator end() const override
Get a const reference to the end of the container.
Definition: ParticlePropertySvc.h:111
Gaudi::ParticlePropertySvc::m_stdhepidmap
MapStdHepID m_stdhepidmap
Map for StdHep Ids.
Definition: ParticlePropertySvc.h:169
gaudirun.l
dictionary l
Definition: gaudirun.py:521
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:119
Gaudi::ParticlePropertySvc::m_other
Gaudi::Property< std::vector< std::string > > m_other
Definition: ParticlePropertySvc.h:162
Gaudi::ParticlePropertySvc::MapID
std::map< int, mapped_type > MapID
Definition: ParticlePropertySvc.h:75
IFileAccess
Abstract interface for a service or tool implementing a read access to files.
Definition: IFileAccess.h:18
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:495
Gaudi::ParticlePropertySvc::addParticles
StatusCode addParticles()
Definition: ParticlePropertySvc.cpp:338
Gaudi::ParticlePropertySvc::m_owned
std::set< std::unique_ptr< ParticleProperty > > m_owned
Definition: ParticlePropertySvc.h:173
Gaudi::ParticlePropertySvc::m_idmap
MapID m_idmap
Map for geant IDs.
Definition: ParticlePropertySvc.h:167
Gaudi::ParticlePropertySvc::m_filename
Gaudi::Property< std::string > m_filename
Definition: ParticlePropertySvc.h:160
Gaudi::ParticlePropertySvc::MapName
std::map< std::string, mapped_type > MapName
Definition: ParticlePropertySvc.h:76
Gaudi::ParticlePropertySvc::m_particles
Gaudi::Property< std::vector< std::string > > m_particles
Definition: ParticlePropertySvc.h:163
Gaudi::ParticlePropertySvc::ParticlePropertySvc
ParticlePropertySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: ParticlePropertySvc.cpp:46
Gaudi::ParticlePropertySvc::MapPythiaID
std::map< int, mapped_type > MapPythiaID
Definition: ParticlePropertySvc.h:78
Gaudi::ParticlePropertySvc::setAntiParticles
StatusCode setAntiParticles()
helper (protected) function to set the valid particle<-->antiparticle relations
Definition: ParticlePropertySvc.cpp:302
Gaudi::ParticlePropertySvc::mapped_type
ParticleProperty * mapped_type
Definition: ParticlePropertySvc.h:74
Gaudi::ParticlePropertySvc::begin
const_iterator begin() const override
Get a const reference to the beginning of the container.
Definition: ParticlePropertySvc.h:109
Gaudi::ParticlePropertySvc::m_vectpp
VectPP m_vectpp
Vector of all particle properties.
Definition: ParticlePropertySvc.h:166
IParticlePropertySvc::const_iterator
VectPP::const_iterator const_iterator
Definition: IParticlePropertySvc.h:26
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
Gaudi::ParticlePropertySvc::m_pythiaidmap
MapPythiaID m_pythiaidmap
Map for Pythia Ids.
Definition: ParticlePropertySvc.h:170