Main Page
Class Categories
Classes
Namespaces
File List
File Members
exper-sw
cosmosw
AugerSW
Offline
source
main
Utilities
Particles
ParticlePropertiesFactory.cc
Go to the documentation of this file.
1
9
#include <utl/ParticlePropertiesFactory.h>
10
#include <utl/VParticleProperties.h>
11
#include <utl/ParticleProperties.h>
12
#include <utl/NucleusProperties.h>
13
#include <utl/Particle.h>
14
#include <utl/PhysicalConstants.h>
15
#include <utl/ErrorLogger.h>
16
#include <sstream>
17
18
19
namespace
utl {
20
21
namespace
{
22
24
void
25
RegisterOneParticle
(
const
int
type,
26
const
char
*
const
name,
27
const
double
mass)
28
{
29
ParticlePropertiesCreator
c
(
new
ParticleProperties(type, name, mass));
30
if
(!
ParticlePropertiesFactory::Register
(type,
c
)) {
31
std::ostringstream msg;
32
msg <<
"Registration of particle type "
<< type <<
" with name "
<< name <<
" failed."
;
33
FATAL
(msg);
34
throw
ParticleTypeException(msg.str());
35
}
36
}
37
38
39
void
40
RegisterAllParticleProperties()
41
{
42
#include "
Particles/ParticlePropertiesList.icc
"
43
}
44
45
}
46
47
48
ParticlePropertiesPtr
49
UnregisteredParticlePropertyPolicy::Unregistered
(
const
int
type)
50
{
51
if
(!
ParticlePropertiesFactory::GetNumberOfCreators
()) {
52
RegisterAllParticleProperties();
53
return
ParticlePropertiesFactory::Create
(type);
54
}
else
if
(
NucleusProperties::IsNucleus
(type)) {
55
return
ParticlePropertiesPtr
(
new
NucleusProperties
(type));
56
}
else
{
57
std::ostringstream msg;
58
msg <<
"Cannot create particle properties for particle id "
<< type <<
'.'
;
59
FATAL
(msg);
60
throw
ParticleTypeException
(msg.str());
61
}
62
}
63
64
}
utl::NucleusProperties
Class to hold properties of nuclei.
Definition:
NucleusProperties.h:33
FATAL
#define FATAL(message)
Macro for logging fatal messages.
Definition:
ErrorLogger.h:167
utl::ParticlePropertiesPtr
boost::shared_ptr< const VParticleProperties > ParticlePropertiesPtr
Definition:
VParticleProperties.h:40
RdGeoCeLDFFitter::c
const double c[]
Definition:
RdGeoCeLDFFitter/LikelihoodFunction.cc:540
utl::UnregisteredParticlePropertyPolicy::Unregistered
static ParticlePropertiesPtr Unregistered(const int type)
Definition:
ParticlePropertiesFactory.cc:49
utl::ObjectFactory::GetNumberOfCreators
static unsigned int GetNumberOfCreators()
Get number of object types know to this factory.
Definition:
ObjectFactory.h:98
utl::ParticleTypeException
Base class to report non-existing particle id's.
Definition:
Particle.h:180
utl::ObjectFactory::Register
static bool Register(const IdentifierType &id, const CreatorType &creator)
Register a factory function with an ID.
Definition:
ObjectFactory.h:89
RegisterOneParticle
RegisterOneParticle(Particle::eUndefined,"Undefined", 0)
ParticlePropertiesList.icc
utl::ObjectFactory::Create
static ObjectPtrType Create(const IdentifierType &id)
Create an object (0-argument constructor)
Definition:
ObjectFactory.h:104
utl::NucleusProperties::IsNucleus
static bool IsNucleus(const int type)
Check if type code is a valid nucleus.
Definition:
NucleusProperties.cc:98
, generated on Tue Sep 26 2023.