DD4hep
1.32.1
Detector Description Toolkit for High Energy Physics
DDG4
plugins
Geant4SetKETolerance.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 : A. Sailer
11
//
12
//==========================================================================
13
24
#ifndef DDG4_Geant4SetKETolerance_h
25
#define DDG4_Geant4SetKETolerance_h 1
26
27
// Framework include files
28
#include <
DDG4/Geant4PhysicsList.h
>
29
30
// geant4
31
#include <G4Version.hh>
32
#if G4VERSION_NUMBER >= 1130
33
#include "G4ExceptionSeverity.hh"
34
#include "G4PrimaryTransformer.hh"
35
#endif
36
37
#include <CLHEP/Units/SystemOfUnits.h>
38
40
namespace
dd4hep
{
41
43
namespace
sim {
44
46
51
class
Geant4SetKETolerance
:
public
Geant4PhysicsList
{
52
public
:
53
Geant4SetKETolerance
(
Geant4Context
* ctxt,
const
std::string& nam)
54
:
Geant4PhysicsList
(ctxt, nam),
m_kETolerance
(1.0*
CLHEP
::MeV)
55
#if G4VERSION_NUMBER >= 1130
56
, m_kESeverity(G4ExceptionSeverity::JustWarning)
57
#endif
58
{
59
declareProperty
(
"Tolerance"
,
m_kETolerance
);
60
#if G4VERSION_NUMBER >= 1130
61
declareProperty
(
"Severity"
, m_kESeverity);
62
#endif
63
}
64
virtual
~Geant4SetKETolerance
() {
65
}
67
virtual
void
constructProcesses
(G4VUserPhysicsList*) {
68
#if G4VERSION_NUMBER >= 1130
69
G4PrimaryTransformer::SetKETolerance(
m_kETolerance
, G4ExceptionSeverity(m_kESeverity));
70
printout(INFO,
name
(),
"setting tolerance to %f MeV"
,
m_kETolerance
/ CLHEP::MeV);
71
printout(INFO,
name
(),
"setting severity to %s"
, m_sevMap[m_kESeverity].c_str());
72
#else
73
printout(DEBUG,
name
(),
"SetKETolerance not implemented for this version of Geant4"
);
74
#endif
75
}
76
77
private
:
78
double
m_kETolerance
;
79
#if G4VERSION_NUMBER >= 1130
80
int
m_kESeverity;
81
std::map<int, std::string> m_sevMap = {
82
{0,
"FatalException"
},
83
{1,
"FatalErrorInArgument"
},
84
{2,
"RunMustBeAborted"
},
85
{3,
"EventMustBeAborted"
},
86
{4,
"JustWarning"
},
87
{5,
"IgnoreTheIssue"
}};
88
#endif
89
};
90
}
91
}
92
#endif // DDG4_Geant4SetKETolerance_h
93
94
#include <
DDG4/Factories.h
>
95
using namespace
dd4hep::sim
;
96
DECLARE_GEANT4ACTION
(
Geant4SetKETolerance
)
dd4hep::sim::Geant4SetKETolerance::constructProcesses
virtual void constructProcesses(G4VUserPhysicsList *)
Callback to call the KETolerance setter.
Definition:
Geant4SetKETolerance.cpp:67
Geant4PhysicsList.h
DECLARE_GEANT4ACTION
#define DECLARE_GEANT4ACTION(name)
Plugin defintion to create Geant4Action objects.
Definition:
Factories.h:210
CLHEP
CLHEP namespace.
Definition:
Geant4Random.h:26
dd4hep::sim::Geant4Action::declareProperty
Geant4Action & declareProperty(const std::string &nam, T &val)
Declare property.
Definition:
Geant4Action.h:366
dd4hep::sim::Geant4SetKETolerance::~Geant4SetKETolerance
virtual ~Geant4SetKETolerance()
Definition:
Geant4SetKETolerance.cpp:64
dd4hep::sim::Geant4Action::name
const std::string & name() const
Access name of the action.
Definition:
Geant4Action.h:280
dd4hep::sim::Geant4PhysicsList
Concrete basic implementation of a Geant4 physics list action.
Definition:
Geant4PhysicsList.h:41
Factories.h
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition:
EDM4hepFileReader.cpp:41
dd4hep
Namespace for the AIDA detector description toolkit.
Definition:
AlignmentsCalib.h:28
dd4hep::sim::Geant4SetKETolerance::Geant4SetKETolerance
Geant4SetKETolerance(Geant4Context *ctxt, const std::string &nam)
Definition:
Geant4SetKETolerance.cpp:53
Geant4SetKETolerance
PhysicsConstructor to change the KETolerance and its warning severity for dynamic particles.
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition:
Geant4Context.h:201
dd4hep::sim::Geant4SetKETolerance::m_kETolerance
double m_kETolerance
Definition:
Geant4SetKETolerance.cpp:78
Generated on Fri Aug 15 2025 12:51:37 for DD4hep by
1.8.18