DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
DDG4
plugins
Geant4RunManagers.cpp
Go to the documentation of this file.
1
//==========================================================================
2
// AIDA Detector description implementation
3
//--------------------------------------------------------------------------
4
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5
// All rights reserved.
6
//
7
// For the licensing terms see $DD4hepINSTALL/LICENSE.
8
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9
//
10
// Author : M.Frank
11
//
12
//==========================================================================
13
#ifndef DDG4_GEANT4RUNMANAGER_H
14
#define DDG4_GEANT4RUNMANAGER_H 1
15
17
#include <
DDG4/Geant4Action.h
>
18
20
#include <G4RunManager.hh>
21
23
namespace
dd4hep
{
24
26
namespace
sim {
27
29
45
template
<
typename
RUNMANAGER>
46
class
Geant4RunManager
:
public
Geant4Action
,
public
RUNMANAGER {
47
public
:
48
Geant4RunManager
(
Geant4Context
* ctxt,
const
std::string& nam)
49
:
Geant4Action
(ctxt, nam), RUNMANAGER()
50
{
51
declareProperty
(
"NumberOfThreads"
,
m_numThreads
);
52
}
53
virtual
~Geant4RunManager
() { }
55
virtual
void
enableUI
();
56
private
:
58
int
m_numThreads
;
59
};
60
template
<>
void
Geant4RunManager<G4RunManager>::enableUI
() {
61
Geant4Action::enableUI
();
62
printout(WARNING,
"Geant4RunManager"
,
"+++ Configured run manager of type: %s."
,
63
typeName(
typeid
(G4RunManager)).c_str());
64
printout(WARNING,
"Geant4Kernel"
,
"+++ Multi-threaded mode requested, "
65
"but not supported by this compilation of Geant4."
);
66
printout(WARNING,
"Geant4Kernel"
,
"+++ Falling back to single threaded mode."
);
67
m_numThreads = 0;
68
}
69
typedef
Geant4RunManager<G4RunManager>
Geant4STRunManager
;
70
}
71
}
72
#endif // DDG4_GEANT4RUNMANAGER_H
73
74
#include <
DDG4/Factories.h
>
75
using namespace
dd4hep::sim
;
76
DD4HEP_PLUGINSVC_FACTORY
(
Geant4STRunManager
,G4RunManager,
dd4hep::sim::Geant4Action
*(
_ns::CT
*,std::string),__LINE__)
77
78
#ifdef G4MULTITHREADED
79
#include <G4MTRunManager.hh>
80
82
namespace
dd4hep
{
84
namespace
sim {
85
template
<>
void
Geant4RunManager<G4MTRunManager>::enableUI
() {
86
Geant4Action::enableUI
();
87
this->G4MTRunManager::SetNumberOfThreads(m_numThreads);
88
printout(WARNING,
"Geant4RunManager"
,
"+++ Configured run manager of type: %s with %d threads."
,
89
typeName(
typeid
(G4MTRunManager)).c_str(), m_numThreads);
90
}
91
typedef
Geant4RunManager<G4MTRunManager>
Geant4MTRunManager;
92
}
93
}
94
DD4HEP_PLUGINSVC_FACTORY
(Geant4MTRunManager,G4MTRunManager,
dd4hep::sim::Geant4Action
*(
_ns::CT
*,std::string),__LINE__)
95
#endif
96
97
DD4HEP_PLUGINSVC_FACTORY
#define DD4HEP_PLUGINSVC_FACTORY(type, name, signature, serial)
Definition:
Plugins.h:150
dd4hep::sim::Geant4RunManager::Geant4RunManager
Geant4RunManager(Geant4Context *ctxt, const std::string &nam)
Definition:
Geant4RunManagers.cpp:48
dd4hep::sim::Geant4Action::declareProperty
Geant4Action & declareProperty(const std::string &nam, T &val)
Declare property.
Definition:
Geant4Action.h:366
dd4hep::sim::Geant4Action
Default base class for all Geant 4 actions and derivates thereof.
Definition:
Geant4Action.h:113
dd4hep::sim::Geant4RunManager::m_numThreads
int m_numThreads
global range cut for secondary productions
Definition:
Geant4RunManagers.cpp:58
Factories.h
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition:
Geant4Output2EDM4hep.cpp:49
dd4hep::sim::Geant4RunManager::enableUI
virtual void enableUI()
Enable and install UI messenger.
dd4hep
Namespace for the AIDA detector description toolkit.
Definition:
AlignmentsCalib.h:28
dd4hep::sim::Geant4RunManager::~Geant4RunManager
virtual ~Geant4RunManager()
Definition:
Geant4RunManagers.cpp:53
dd4hep::sim::Geant4STRunManager
Geant4RunManager< G4RunManager > Geant4STRunManager
Definition:
Geant4RunManagers.cpp:69
dd4hep::sim::Geant4Action::enableUI
virtual void enableUI()
Enable and install UI messenger.
Definition:
Geant4Action.cpp:134
dd4hep::sim::Geant4RunManager
Geant4 run manager plugin class.
Definition:
Geant4RunManagers.cpp:46
Geant4Action.h
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition:
Geant4Context.h:201
Generated on Tue Dec 10 2024 18:30:09 for DD4hep by
1.8.18