Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4QSSParameters.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4QSSParameters
27//
28// Hold parameters for QSS Integrator driver
29//
30// Author: John Apostolakis (CERN), 19.08.2025
31// --------------------------------------------------------------------
32
33#include "G4QSSParameters.hh"
34#include "G4Exception.hh"
35
36const G4double dQMin_smallest = 1.0e-20; // Minimum limit for deviation
37const G4double dQMin_biggest = 1.0e+20; // Maximum limit for deviation
38// These can be problem dependent - wide values
39
40const G4double dQRel_smallest = 1.0e-08; // Minimum limit for relative deviation
41const G4double dQRel_biggest = 0.01; // Maximum limit for relative deviation
42// Achievable relative accuracy needs tight bounds
43
44G4QSSParameters* G4QSSParameters::Instance()
45{
46 static G4QSSParameters theQSSParametersSingleton;
47 return &theQSSParametersSingleton;
48}
49
50// --------------------------------------------------------------------------------
51
53{
54 G4bool good_value= dQMin_smallest < value && value < dQMin_biggest;
55 if( good_value )
56 {
57 fdQMin = value;
58 //-------------
59 }
60 else
61 {
63 errmsg << " OUT of RANGE: Proposed value of dQMin is not within expected limits: "
64 << " Smallest = " << dQMin_smallest
65 << " Biggest = " << dQMin_biggest
66 << " Proposed value = " << value;
67 G4Exception("G4QSSParameters::Set_dQMin", "QSS-Parameters-0002",
68 FatalException, errmsg );
69 }
70 return good_value;
71}
72
73// --------------------------------------------------------------------------------
74
76{
77 G4bool good_value= dQRel_smallest < value && value < dQRel_biggest ;
78 if( good_value )
79 {
80 fdQRel = value;
81 //-------------
82 }
83 else
84 {
86 errmsg << " OUT of RANGE: Proposed value of dQRel is not within expected limits: "
87 << " Smallest = " << dQRel_smallest
88 << " Biggest = " << dQRel_biggest
89 << " Proposed value = " << value;
90 G4Exception("G4QSSParameters::Set_dQRel", "QSS-Parameters-0003",
91 FatalException, errmsg );
92 }
93 return good_value;
94}
95
96// --------------------------------------------------------------------------------
97
99{
100 G4bool good_value= false;
101 if( 2 <= order_val && order_val <= 3 )
102 {
103 good_value= true;
104 fQssOrder = order_val;
105 }
106 else
107 {
108 G4ExceptionDescription err_msg;
109 err_msg << "Requested order for G4QSStepper= "
110 << order_val << " is neither 2 nor 3.";
111 G4Exception("G4QSSParameters::SetQssOrder", "QSS-Parameters-0001",
112 onlyWarn ? JustWarning : FatalException, err_msg );
113 }
114 return good_value;
115}
116
117// --------------------------------------------------------------------------------
118
120{
121 const G4int maxSubstep_smallest= 2; // Min acceptable value
122 const G4int maxSubstep_biggest = 10000; // Maxacceptable value
123
124 G4bool good_value= false;
125 if( maxSubstep_smallest <= maxSubSteps && maxSubSteps <= maxSubstep_biggest )
126 {
127 good_value= true;
128 fMaxSubsteps = maxSubSteps;
129 }
130 else
131 {
132 G4ExceptionDescription err_msg;
133 err_msg << "Requested max-substeps for G4QSStepper= " << maxSubSteps
134 << " is not between "
135 << maxSubstep_smallest << " and " << maxSubstep_biggest;
136 G4Exception("G4QSSParameters::SetMaxSubsteps", "QSS-Parameters-0001",
137 JustWarning, err_msg );
138 }
139 return good_value;
140}
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4double dQRel_smallest
const G4double dQMin_biggest
const G4double dQRel_biggest
const G4double dQMin_smallest
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
static G4QSSParameters * Instance()
G4bool Set_dQMin(G4double dQMin)
G4bool SetQssOrder(G4int value, G4bool onlyWarn=false)
G4bool Set_dQRel(G4double dQRel)
G4bool SetMaxSubsteps(G4int maxSubsteps)