All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 // ============================================================================
13 #include "GaudiKernel/Service.h"
15 
16 class IFileAccess;
17 
18 namespace Gaudi {
19 // ============================================================================
71 class ParticlePropertySvc: public extends1<Service,IParticlePropertySvc>
72 {
73 public:
74  // typedefs for container type
76  typedef std::map< int, mapped_type > MapID ;
77  typedef std::map< std::string, mapped_type > MapName ;
78  typedef std::map< int, mapped_type > MapStdHepID ;
79  typedef std::map< int, mapped_type > MapPythiaID ;
83  typedef std::set<ParticleProperty*> Set ;
84  // Inherited Service overrides:
85 
87  virtual StatusCode initialize();
89  virtual StatusCode finalize();
102  virtual 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 ) ;
119  virtual const_iterator begin() const { return m_vectpp.begin() ; }
121  virtual const_iterator end () const { return m_vectpp.end() ; }
123  virtual int size() const { return m_vectpp.size() ; };
125  virtual ParticleProperty* find( int geantId )
126  { return m_idmap[ geantId ] ; }
128  virtual ParticleProperty* find( const std::string& name )
129  { return m_namemap[ name ] ; }
131  virtual ParticleProperty* findByStdHepID( int stdHepId )
132  { return m_stdhepidmap[ stdHepId ] ; }
134  virtual ParticleProperty* findByPythiaID( int pythiaID )
135  { return m_pythiaidmap[ pythiaID ]; }
137  virtual StatusCode erase( int geantId )
138  { return erase ( find ( geantId ) ) ; }
140  virtual StatusCode erase( const std::string& name )
141  { return erase ( find ( name ) ) ; }
143  virtual StatusCode eraseByStdHepID( int stdHepId )
144  { return erase( findByStdHepID ( stdHepId ) ) ; }
150  ( const std::string& name , ISvcLocator* svc );
152  virtual ~ParticlePropertySvc();
153 protected:
159  const ParticleProperty* anti
160  ( const ParticleProperty* pp ) const ;
167  StatusCode rebuild() ;
169  StatusCode erase ( const ParticleProperty* pp ) ;
171  StatusCode parse ( const std::string& file ) ;
172  // Text file parsing routine.
173  StatusCode parse();
174  // treat additional particles
176  // compare 2 entries
177  bool diff
178  ( const ParticleProperty* o ,
179  const ParticleProperty* n ,
180  const MSG::Level l = MSG::DEBUG ) const ;
181 private:
182  typedef std::vector<std::string> Files ;
183  typedef std::vector<std::string> Particles ;
184 
185  std::string m_filename;
187  // properties to be redefined explicitly
189 
195 
196  // local storage of ALL properties
198  std::set<std::string> m_replaced ;
199 
201 };
202 } // namespace Gaudi
203 // =============================================================================
204 // The END
205 // =============================================================================
206 #endif
207 // =============================================================================
208 
209 
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:26
virtual ParticleProperty * find(int geantId)
Retrieve a property by geant3 id.
std::map< int, mapped_type > MapStdHepID
virtual StatusCode eraseByStdHepID(int stdHepId)
Erase a property by StdHep id ???
This service provides access to particle properties.
A trivial class to hold information about a single particle properties.
virtual StatusCode erase(int geantId)
Erase a property by geant3 id.
std::map< std::string, mapped_type > MapName
std::vector< ParticleProperty * > VectPP
virtual StatusCode erase(const std::string &name)
Erase a property by particle name.
virtual ParticleProperty * find(const std::string &name)
Retrieve a property by particle name.
MapName m_namemap
Map for particle names.
StatusCode parse()
Parses the file and fill all the maps.
Files m_other
additional file names
virtual ParticleProperty * findByPythiaID(int pythiaID)
Retrieve a property by Pythia id.
virtual 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)
Create a new particle property.
std::set< std::string > m_replaced
std::vector< std::string > Files
virtual StatusCode initialize()
Initialise the service.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
std::vector< std::string > Particles
std::string m_filename
Filename of the particle properties file.
list file
Definition: ana.py:160
IParticlePropertySvc::VectPP VectPP
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MapStdHepID m_stdhepidmap
Map for StdHep Ids.
dictionary l
Definition: gaudirun.py:365
virtual const_iterator begin() const
Get a const reference to the beginning of the container.
std::set< ParticleProperty * > Set
const ParticleProperty * anti(const ParticleProperty *pp) const
helper (protected) function to find an antiparticle for the given particle ID (StdHepID) ...
std::map< int, mapped_type > MapPythiaID
virtual ParticleProperty * findByStdHepID(int stdHepId)
Retrieve a property by StdHep id.
bool diff(const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const
virtual StatusCode finalize()
Finalise the service.
std::map< int, mapped_type > MapID
Abstract interface for a service or tool implementing a read access to files.
Definition: IFileAccess.h:19
MapID m_idmap
Map for geant IDs.
ParticlePropertySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
virtual int size() const
Get the container size.
virtual const_iterator end() const
Get a const reference to the end of the container.
This is a number of static methods for bootstrapping the Gaudi framework.
Definition: Bootstrap.h:14
StatusCode setAntiParticles()
helper (protected) function to set the valid particle<–>antiparticle relations
ParticleProperty * mapped_type
VectPP m_vectpp
Vector of all particle properties.
virtual ~ParticlePropertySvc()
Destructor.
VectPP::const_iterator const_iterator
MapPythiaID m_pythiaidmap
Map for Pythia Ids.
IParticlePropertySvc::iterator iterator
IParticlePropertySvc::const_iterator const_iterator