Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
garsoft
GArG4
CustomPhysicsFactory.hh
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
/// \file CustomPhysicsFactory.h
3
//
4
////////////////////////////////////////////////////////////////////////
5
#ifndef CUSTOMPHYSICSFACTORY_hh
6
#define CUSTOMPHYSICSFACTORY_hh
7
8
#include "Geant4/G4VPhysicsConstructor.hh"
9
10
#ifndef CUSTOMPHYSICSTABLE_hh
11
namespace
gar
{
12
namespace
garg4 {
class
CustomPhysicsTable; }
13
}
14
#endif
15
16
namespace
gar
{
17
namespace
garg4 {
18
class
CustomPhysicsFactoryBase
19
{
20
public
:
21
CustomPhysicsFactoryBase
() {}
22
virtual
~CustomPhysicsFactoryBase
() {}
23
24
virtual
bool
Registered() = 0;
25
virtual
std::string
GetName() = 0;
26
virtual
G4VPhysicsConstructor * Build() = 0;
27
};
28
29
template
<
class
T>
30
class
CustomPhysicsFactory
:
public
CustomPhysicsFactoryBase
31
{
32
public
:
33
CustomPhysicsFactory
();
34
CustomPhysicsFactory
(
std::string
);
35
virtual
~CustomPhysicsFactory
() {};
36
bool
Registered
()
37
{
return
registered;}
38
std::string
GetName
()
39
{
return
myName;}
40
virtual
G4VPhysicsConstructor * Build();
41
42
43
private
:
44
std::string
myName
;
45
bool
registered
;
46
bool
verbose
;
47
};
48
}
49
}
50
51
#include "
GArG4/CustomPhysicsTable.hh
"
52
53
namespace
gar
{
54
namespace
garg4 {
55
56
template
<
class
T> G4VPhysicsConstructor *
CustomPhysicsFactory<T>::Build
()
57
{
58
return
new
T
();
59
}
60
61
template
<
class
T>
CustomPhysicsFactory<T>::CustomPhysicsFactory
(
std::string
Name
)
62
{
63
64
// For debugging.
65
verbose
=
true
;
66
67
if
(Name!=
""
)
68
myName=
Name
;
69
else
70
std::cerr<<
"CustomPhysicsFactory Error : Physics registered with no name!"
<<
std::endl
;
71
72
// register self in physics table - note, factory is actually registered
73
// in static TheCustomPhysicsTable, not the instance created below
74
// which just acts to pass information along
75
new
CustomPhysicsTable
(
this
);
76
registered=
true
;
77
}
78
79
80
81
template
<
class
T>
CustomPhysicsFactory<T>::CustomPhysicsFactory
()
82
{
83
registered=
false
;
84
}
85
86
}
87
}
// gar
88
89
#endif
90
91
92
// Sept 2009 - Ben Jones, MIT
string
std::string string
Definition:
nybbler.cc:12
Name
ChannelGroupService::Name Name
Definition:
FixedChannelGroupService_service.cc:19
CustomPhysicsTable.hh
gar::garg4::CustomPhysicsFactory::Build
virtual G4VPhysicsConstructor * Build()
Definition:
CustomPhysicsFactory.hh:56
ValidateOpDetSimulation.T
T
Definition:
ValidateOpDetSimulation.py:52
gar::garg4::CustomPhysicsFactoryBase::CustomPhysicsFactoryBase
CustomPhysicsFactoryBase()
Definition:
CustomPhysicsFactory.hh:21
gar::garg4::CustomPhysicsFactoryBase
Definition:
CustomPhysicsFactory.hh:18
gar::garg4::CustomPhysicsFactoryBase::~CustomPhysicsFactoryBase
virtual ~CustomPhysicsFactoryBase()
Definition:
CustomPhysicsFactory.hh:22
gar::garg4::CustomPhysicsFactory::verbose
bool verbose
Definition:
CustomPhysicsFactory.hh:46
gar::garg4::CustomPhysicsFactory::GetName
std::string GetName()
Definition:
CustomPhysicsFactory.hh:38
gar::garg4::CustomPhysicsFactory
Definition:
CustomPhysicsFactory.hh:30
train.verbose
verbose
Definition:
train.py:477
gar
General GArSoft Utilities.
Definition:
anatest_module.cc:57
gar::garg4::CustomPhysicsFactory::myName
std::string myName
Definition:
CustomPhysicsFactory.hh:44
gar::garg4::CustomPhysicsFactory::registered
bool registered
Definition:
CustomPhysicsFactory.hh:45
gar::garg4::CustomPhysicsTable
Definition:
CustomPhysicsTable.hh:38
gar::garg4::CustomPhysicsFactory::~CustomPhysicsFactory
virtual ~CustomPhysicsFactory()
Definition:
CustomPhysicsFactory.hh:35
gar::garg4::CustomPhysicsFactory::Registered
bool Registered()
Definition:
CustomPhysicsFactory.hh:36
gar::garg4::CustomPhysicsFactory::CustomPhysicsFactory
CustomPhysicsFactory()
Definition:
CustomPhysicsFactory.hh:81
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11