Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larsim
larsim
LegacyLArG4
CustomPhysicsFactory.hh
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
/// \file CustomPhysicsFactory.h
3
//
4
/// \author seligman@nevis.columbia.edu
5
////////////////////////////////////////////////////////////////////////
6
#ifndef CUSTOMPHYSICSFACTORY_hh
7
#define CUSTOMPHYSICSFACTORY_hh
8
9
#include "Geant4/G4VPhysicsConstructor.hh"
10
#include "
larsim/LegacyLArG4/CustomPhysicsTable.hh
"
11
12
namespace
larg4
{
13
class
CustomPhysicsTable;
14
15
class
CustomPhysicsFactoryBase
{
16
public
:
17
explicit
CustomPhysicsFactoryBase
(
std::string
const
&
name
) :
fName
{name}
18
{
19
if
(
empty
(
name
))
20
std::cerr <<
"CustomPhysicsFactory Error : Physics registered with no name!"
<<
std::endl
;
21
}
22
virtual
~CustomPhysicsFactoryBase
() =
default
;
23
24
std::string
const
&
25
GetName
()
const
noexcept
26
{
27
return
fName
;
28
}
29
30
virtual
G4VPhysicsConstructor*
Build
()
const
= 0;
31
32
private
:
33
std::string
fName
;
34
};
35
36
template
<
class
T>
37
class
CustomPhysicsFactory
:
public
CustomPhysicsFactoryBase
{
38
public
:
39
explicit
CustomPhysicsFactory
(
std::string
const
&
name
);
40
41
G4VPhysicsConstructor*
42
Build
()
const
43
{
44
return
new
T
{};
45
}
46
};
47
48
template
<
class
T>
49
CustomPhysicsFactory<T>::CustomPhysicsFactory
(
std::string
const
&
name
)
50
:
CustomPhysicsFactoryBase
{name}
51
{
52
// register self in physics table - note, factory is actually registered
53
// in static TheCustomPhysicsTable, not the instance created below
54
// which just acts to pass information along
55
new
CustomPhysicsTable
(
this
);
56
}
57
}
58
59
#endif
name
static QCString name
Definition:
declinfo.cpp:673
freeze_graph.const
const
Definition:
freeze_graph.py:179
string
std::string string
Definition:
nybbler.cc:12
larg4::CustomPhysicsFactory::CustomPhysicsFactory
CustomPhysicsFactory(std::string const &name)
Definition:
CustomPhysicsFactory.hh:49
larg4
Geant4 interface.
Definition:
CheckAuxDetHit_module.cc:25
ValidateOpDetSimulation.T
T
Definition:
ValidateOpDetSimulation.py:52
larg4::CustomPhysicsFactoryBase::CustomPhysicsFactoryBase
CustomPhysicsFactoryBase(std::string const &name)
Definition:
CustomPhysicsFactory.hh:17
larg4::CustomPhysicsTable
Definition:
CustomPhysicsTable.hh:35
CustomPhysicsTable.hh
larg4::CustomPhysicsFactory
Definition:
CustomPhysicsFactory.hh:37
larg4::CustomPhysicsFactoryBase::fName
std::string fName
Definition:
CustomPhysicsFactory.hh:33
larg4::CustomPhysicsFactoryBase::Build
virtual G4VPhysicsConstructor * Build() const =0
larg4::CustomPhysicsFactoryBase::~CustomPhysicsFactoryBase
virtual ~CustomPhysicsFactoryBase()=default
larg4::CustomPhysicsFactory::Build
G4VPhysicsConstructor * Build() const
Definition:
CustomPhysicsFactory.hh:42
larg4::CustomPhysicsFactoryBase
Definition:
CustomPhysicsFactory.hh:15
util::empty
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition:
StdUtils.h:97
larg4::CustomPhysicsFactoryBase::GetName
std::string const & GetName() const noexcept
Definition:
CustomPhysicsFactory.hh:25
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11