| The Gaudi Framework v27r1

- 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/Service.h"
14 #include "GaudiKernel/IParticlePropertySvc.h"
15
16 class IFileAccess;
17
18 namespace Gaudi {
19 // ============================================================================
71 class ParticlePropertySvc: public extends<Service,
72 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
103 ( const std::string& particle ,
104 int geantId ,
105 int jetsetId ,
106 double charge ,
107 double mass ,
108 double tlife ,
109 const std::string& evtName ,
110 int pythiaId ,
111 double maxWidth ) override ;
117 StatusCode push_back( ParticleProperty* pp ) override;
119 const_iterator begin() const override { return m_vectpp.begin() ; }
121 const_iterator end () const override { return m_vectpp.end() ; }
123 int size() const override { return m_vectpp.size() ; };
125 ParticleProperty* find( int geantId ) override
126 { return m_idmap[ geantId ] ; }
128 ParticleProperty* find( const std::string& name ) override
129 { return m_namemap[ name ] ; }
131 ParticleProperty* findByStdHepID( int stdHepId ) override
132 { return m_stdhepidmap[ stdHepId ] ; }
134 ParticleProperty* findByPythiaID( int pythiaID ) override
135 { return m_pythiaidmap[ pythiaID ]; }
137 StatusCode erase( int geantId ) override
138 { return erase ( find ( geantId ) ) ; }
140 StatusCode erase( const std::string& name ) override
141 { return erase ( find ( name ) ) ; }
143 StatusCode eraseByStdHepID( int stdHepId ) override
144 { return erase( findByStdHepID ( stdHepId ) ) ; }
149 ParticlePropertySvc ( const std::string& name , ISvcLocator* svc );
151 ~ParticlePropertySvc() override = default;
152 protected:
158 const ParticleProperty* anti
159 ( const ParticleProperty* pp ) const ;
164 StatusCode setAntiParticles() ;
166 StatusCode rebuild() ;
168 StatusCode erase ( const ParticleProperty* pp ) ;
170 StatusCode parse ( const std::string& file ) ;
171 // Text file parsing routine.
172 StatusCode parse();
173 // treat additional particles
174 StatusCode addParticles() ;
175 // compare 2 entries
176 bool diff
177 ( const ParticleProperty* o ,
178 const ParticleProperty* n ,
179 const MSG::Level l = MSG::DEBUG ) const ;
180 private:
181 typedef std::vector<std::string> Files ;
182 typedef std::vector<std::string> Particles ;
183
184 std::string m_filename = "ParticleTable.txt" ;
185 Files m_other ;
186 // properties to be redefined explicitly
187 Particles m_particles ;
188
189 VectPP m_vectpp;
190 MapID m_idmap;
191 MapName m_namemap;
192 MapStdHepID m_stdhepidmap;
193 MapPythiaID m_pythiaidmap;
194
195 // local storage of ALL properties
196 std::set<std::unique_ptr<ParticleProperty>> m_owned ;
197 std::set<std::string> m_replaced ;
198
199 SmartIF<IFileAccess> m_fileAccess;
200 };
201 } // namespace Gaudi
202 // =============================================================================
203 // The END
204 // =============================================================================
205 #endif
206 // =============================================================================
207
208
Gaudi::ParticlePropertySvc::rebuild
StatusCode rebuild()
rebuild "the linear container" from the map
Definition: ParticlePropertySvc.cpp:405
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:123
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Gaudi::ParticlePropertySvc::MapStdHepID
std::map< int, mapped_type > MapStdHepID
Definition: ParticlePropertySvc.h:79
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:143
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::MapName
std::map< std::string, mapped_type > MapName
Definition: ParticlePropertySvc.h:78
Gaudi::ParticlePropertySvc::erase
StatusCode erase(int geantId) override
Erase a property by geant3 id.
Definition: ParticlePropertySvc.h:137
MSG::DEBUG
Definition: IMessageSvc.h:18
Gaudi::ParticlePropertySvc::findByPythiaID
ParticleProperty * findByPythiaID(int pythiaID) override
Retrieve a property by Pythia id.
Definition: ParticlePropertySvc.h:134
Gaudi::ParticlePropertySvc::finalize
StatusCode finalize() override
Finalise the service.
Definition: ParticlePropertySvc.cpp:136
IParticlePropertySvc::VectPP
std::vector< ParticleProperty * > VectPP
Definition: IParticlePropertySvc.h:25
Gaudi::ParticlePropertySvc::initialize
StatusCode initialize() override
Initialise the service.
Definition: ParticlePropertySvc.cpp:72
Gaudi::ParticlePropertySvc::m_namemap
MapName m_namemap
Map for particle names.
Definition: ParticlePropertySvc.h:191
Gaudi::ParticlePropertySvc::parse
StatusCode parse()
Parses the file and fill all the maps.
Definition: ParticlePropertySvc.cpp:278
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:128
Gaudi::ParticlePropertySvc::~ParticlePropertySvc
~ParticlePropertySvc() override=default
Destructor.
Gaudi::ParticlePropertySvc::m_other
Files m_other
additional file names
Definition: ParticlePropertySvc.h:185
Gaudi::ParticlePropertySvc::m_fileAccess
SmartIF< IFileAccess > m_fileAccess
Definition: ParticlePropertySvc.h:199
std::map
STL class.
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
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:162
std::string
STL class.
Service.h
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
MSG::Level
Level
Definition: IMessageSvc.h:15
Gaudi::ParticlePropertySvc::m_replaced
std::set< std::string > m_replaced
Definition: ParticlePropertySvc.h:197
Gaudi::ParticlePropertySvc::Files
std::vector< std::string > Files
Definition: ParticlePropertySvc.h:181
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:125
Gaudi::ParticlePropertySvc::Particles
std::vector< std::string > Particles
Definition: ParticlePropertySvc.h:182
Gaudi::ParticlePropertySvc::m_filename
std::string m_filename
Filename of the particle properties file.
Definition: ParticlePropertySvc.h:184
Gaudi::ParticlePropertySvc::erase
StatusCode erase(const std::string &name) override
Erase a property by particle name.
Definition: ParticlePropertySvc.h:140
ana.file
list file
Definition: ana.py:160
Gaudi::ParticlePropertySvc::end
const_iterator end() const override
Get a const reference to the end of the container.
Definition: ParticlePropertySvc.h:121
Gaudi::ParticlePropertySvc::m_stdhepidmap
MapStdHepID m_stdhepidmap
Map for StdHep Ids.
Definition: ParticlePropertySvc.h:192
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:362
std::vector::size
T size(T...args)
std::set
STL class.
std::vector< std::string >
compareOutputFiles.pp
tuple pp
Definition: compareOutputFiles.py:417
Gaudi::ParticlePropertySvc::MapPythiaID
std::map< int, mapped_type > MapPythiaID
Definition: ParticlePropertySvc.h:80
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:131
Gaudi::ParticlePropertySvc::diff
bool diff(const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const
Definition: ParticlePropertySvc.cpp:491
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
Gaudi::ParticlePropertySvc::addParticles
StatusCode addParticles()
Definition: ParticlePropertySvc.cpp:422
Gaudi::ParticlePropertySvc::m_owned
std::set< std::unique_ptr< ParticleProperty > > m_owned
Definition: ParticlePropertySvc.h:196
Gaudi::ParticlePropertySvc::m_idmap
MapID m_idmap
Map for geant IDs.
Definition: ParticlePropertySvc.h:190
Gaudi::ParticlePropertySvc::ParticlePropertySvc
ParticlePropertySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: ParticlePropertySvc.cpp:54
Gaudi::ParticlePropertySvc::setAntiParticles
StatusCode setAntiParticles()
helper (protected) function to set the valid particle<–>antiparticle relations
Definition: ParticlePropertySvc.cpp:380
Gaudi::ParticlePropertySvc::mapped_type
ParticleProperty * mapped_type
Definition: ParticlePropertySvc.h:76
Gaudi::ParticlePropertySvc::begin
const_iterator begin() const override
Get a const reference to the beginning of the container.
Definition: ParticlePropertySvc.h:119
Gaudi::ParticlePropertySvc::m_vectpp
VectPP m_vectpp
Vector of all particle properties.
Definition: ParticlePropertySvc.h:189
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:193
Gaudi::ParticlePropertySvc::m_particles
Particles m_particles
Definition: ParticlePropertySvc.h:187