Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HadronicEPTestMessenger.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//
28#include "G4UIdirectory.hh"
30#include "G4UIcmdWithADouble.hh"
33
34
36 :theProcessStore(theStore)
37{
38 // Main directory for control of the e/p test
39 old_heptstDirectory = new G4UIdirectory("/heptst/"); // To be removed in G4 11.0
40 old_heptstDirectory->SetGuidance("Controls for the hadronic energy/momentum test");
41
42 heptstDirectory = new G4UIdirectory("/process/had/heptst/");
43 heptstDirectory->SetGuidance("Controls for the hadronic energy/momentum test");
44
45 // Command to set level of detail reported upon e/p non-conservation
46 old_reportLvlCmd = new G4UIcmdWithAnInteger("/heptst/reportLevel",this); // To be removed in G4 11.0
47 old_reportLvlCmd->SetGuidance("Set level of detail reported upon E/p non-conservation");
48 old_reportLvlCmd->SetGuidance(" 0 - (default) no reporting ");
49 old_reportLvlCmd->SetGuidance(" 1 - report only when E/p not conserved ");
50 old_reportLvlCmd->SetGuidance(" 2 - report regardless of E/p conservation ");
51 old_reportLvlCmd->SetGuidance(" 3 - report only when E/p not conserved, with names, limits ");
52 old_reportLvlCmd->SetGuidance(" 4 - report regardless of E/p conservation, with names, limits ");
53 old_reportLvlCmd->SetParameterName("OldReportLevel",true);
54 old_reportLvlCmd->SetDefaultValue(0);
55 old_reportLvlCmd->SetRange("OldReportLevel >= 0 && OldReportLevel < 5");
56
57 reportLvlCmd = new G4UIcmdWithAnInteger("/process/had/heptst/reportLevel",this);
58 reportLvlCmd->SetGuidance("Set level of detail reported upon E/p non-conservation");
59 reportLvlCmd->SetGuidance(" 0 - (default) no reporting ");
60 reportLvlCmd->SetGuidance(" 1 - report only when E/p not conserved ");
61 reportLvlCmd->SetGuidance(" 2 - report regardless of E/p conservation ");
62 reportLvlCmd->SetGuidance(" 3 - report only when E/p not conserved, with names, limits ");
63 reportLvlCmd->SetGuidance(" 4 - report regardless of E/p conservation, with names, limits ");
64 reportLvlCmd->SetParameterName("ReportLevel",true);
65 reportLvlCmd->SetDefaultValue(0);
66 reportLvlCmd->SetRange("ReportLevel >= 0 && ReportLevel < 5");
67
68 // Set the relative energy non-conservation level for the process
69 old_procRelLvlCmd = new G4UIcmdWithADouble("/heptst/processRelLevel",this); // To be removed in G4 11.0
70 old_procRelLvlCmd->SetGuidance("Set relative level of allowed energy non-conservation");
71 old_procRelLvlCmd->SetParameterName("OlProcessRelLevel",true);
72 old_procRelLvlCmd->SetDefaultValue(-1.0);
73
74 procRelLvlCmd = new G4UIcmdWithADouble("/process/had/heptst/processRelLevel",this);
75 procRelLvlCmd->SetGuidance("Set relative level of allowed energy non-conservation");
76 procRelLvlCmd->SetParameterName("ProcessRelLevel",true);
77 procRelLvlCmd->SetDefaultValue(-1.0);
78
79 // Set the absolute energy non-conservation level for the process
80 old_procAbsLvlCmd = new G4UIcmdWithADoubleAndUnit("/heptst/processAbsLevel",this); // To be removed in G4 11.0
81 old_procAbsLvlCmd->SetGuidance("Set absolute energy level (with unit) of allowed energy non-conservation");
82 old_procAbsLvlCmd->SetParameterName("OldProcessAbsLevel",true);
83 old_procAbsLvlCmd->SetDefaultValue(-1.0);
84 old_procAbsLvlCmd->SetUnitCategory("Energy");
85
86 procAbsLvlCmd = new G4UIcmdWithADoubleAndUnit("/process/had/heptst/processAbsLevel",this);
87 procAbsLvlCmd->SetGuidance("Set absolute energy level (with unit) of allowed energy non-conservation");
88 procAbsLvlCmd->SetParameterName("ProcessAbsLevel",true);
89 procAbsLvlCmd->SetDefaultValue(-1.0);
90 procAbsLvlCmd->SetUnitCategory("Energy");
91}
92
93
95{
96 delete old_heptstDirectory; // To be removed in G4 11.0
97 delete heptstDirectory;
98 delete old_reportLvlCmd; // To be removed in G4 11.0
99 delete reportLvlCmd;
100 delete old_procRelLvlCmd; // To be removed in G4 11.0
101 delete procRelLvlCmd;
102 delete old_procAbsLvlCmd; // To be removed in G4 11.0
103 delete procAbsLvlCmd;
104}
105
106
108{
109 // Old commands to be removed in G4 11.0
110 if ( command == old_reportLvlCmd ) {
111 theProcessStore->SetEpReportLevel( old_reportLvlCmd->GetNewIntValue( newValue ) );
113 ed << "This command is valid but deprecated and will be replaced with the command:\n"
114 << "/process/had/heptst/reportLevel in the next major release, Geant4 version 11.0";
115 G4Exception( "G4HadronicEPTestMessenger", "hadEPTestMessenger001", JustWarning, ed );
116 } else if ( command == old_procRelLvlCmd ) {
117 theProcessStore->SetProcessRelLevel( old_procRelLvlCmd->GetNewDoubleValue( newValue ) );
119 ed << "This command is valid but deprecated and will be replaced with the command:\n"
120 << "/process/had/heptst/processRelLevel in the next major release, Geant4 version 11.0";
121 G4Exception( "G4HadronicEPTestMessenger", "hadEPTestMessenger002", JustWarning, ed );
122 } else if ( command == old_procAbsLvlCmd ) {
123 theProcessStore->SetProcessAbsLevel( old_procAbsLvlCmd->GetNewDoubleValue( newValue ) );
125 ed << "This command is valid but deprecated and will be replaced with the command:\n"
126 << "/process/had/heptst/processAbsLevel in the next major release, Geant4 version 11.0";
127 G4Exception( "G4HadronicEPTestMessenger", "hadEPTestMessenger003", JustWarning, ed );
128 }
129
130 // New commands
131 if ( command == reportLvlCmd ) {
132 theProcessStore->SetEpReportLevel( reportLvlCmd->GetNewIntValue( newValue ) );
133 } else if ( command == procRelLvlCmd ) {
134 theProcessStore->SetProcessRelLevel( procRelLvlCmd->GetNewDoubleValue( newValue ) );
135 } else if ( command == procAbsLvlCmd ) {
136 theProcessStore->SetProcessAbsLevel( procAbsLvlCmd->GetNewDoubleValue( newValue ) );
137 }
138}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4HadronicEPTestMessenger(G4HadronicProcessStore *theProcessStore)
void SetNewValue(G4UIcommand *command, G4String newValues)
void SetProcessAbsLevel(G4double absoluteLevel)
void SetProcessRelLevel(G4double relativeLevel)
void SetEpReportLevel(G4int level)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4double GetNewDoubleValue(const char *paramString)
void SetDefaultValue(G4double defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120