Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ExceptionHandlerMessenger.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// G4ExceptionHandlerMessenger implementation
27//
28// Original author: M.Asai, 1997
29// --------------------------------------------------------------------
30
32
33#include "G4ExceptionHandler.hh"
34#include "G4Tokenizer.hh"
36#include "G4UIcommand.hh"
37#include "G4UIdirectory.hh"
38#include "G4UImanager.hh"
39#include "G4UIparameter.hh"
40
42: expHandler(expH)
43{
44 EHDirectory = new G4UIdirectory("/control/exception/");
45 EHDirectory->SetGuidance("Managing number of G4Exception warning messages");
46
47 nwCmd = new G4UIcommand("/control/exception/maxExceptionWarning",this);
48 nwCmd->SetGuidance("Set maximum number of G4Exception warning messages to be displayed");
49 nwCmd->SetGuidance("for the specified error code.");
50 nwCmd->SetGuidance("Number of warnings is counted for each thread individually.");
51 nwCmd->SetGuidance("Once the number reaches to the maximum, the warning message of specified");
52 nwCmd->SetGuidance("error code won't be printed out any more.");
53 nwCmd->SetGuidance("Number is counted through the program execution if more than one run");
54 nwCmd->SetGuidance("are executed. Count can be reset with the same command.");
55 nwCmd->SetGuidance("If number is set to zero, warning message of the specified error code");
56 nwCmd->SetGuidance("won't be displayed at all.");
57 nwCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
58 auto p1 = new G4UIparameter("errorCode",'s',false);
59 nwCmd->SetParameter(p1);
60 auto p2 = new G4UIparameter("maxNumber",'i',false);
61 p2->SetParameterRange("maxNumber >= 0");
62 nwCmd->SetParameter(p2);
63
64 tnwCmd = new G4UIcmdWithAnInteger("/control/exception/maxTotalExceptionWarning",this);
65 tnwCmd->SetGuidance("Set total maximum number of G4Exception warning messages to be displayed.");
66 tnwCmd->SetGuidance("Number of warnings is counted for each thread individually.");
67 tnwCmd->SetGuidance("Once the number reaches to the maximum, warning messages won't be");
68 tnwCmd->SetGuidance("printed out any more.");
69 tnwCmd->SetGuidance("Number is counted through the program execution if more than one run");
70 tnwCmd->SetGuidance("are executed. Count can be reset with the same command.");
71 tnwCmd->SetGuidance("If number is set to zero, warning message won't be displayed at all.");
72 tnwCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
73 tnwCmd->SetParameterName("maxNumber",false);
74 tnwCmd->SetRange("maxNumber >= 0");
75
76}
77
78// --------------------------------------------------------------------
80{
81 delete nwCmd;
82 delete tnwCmd;
83 delete EHDirectory;
84}
85
86// --------------------------------------------------------------------
88{
89 if (command == nwCmd) {
90 G4Tokenizer next(newValue);
91 G4String ec = next();
92 G4int mc = StoI(next());
93 expHandler->SetMaxWarning(ec,mc);
94 }
95 else if (command == tnwCmd) {
96 expHandler->SetMaxTotalWarning(tnwCmd->GetNewIntValue(newValue));
97 }
98}
99
100// --------------------------------------------------------------------
102{
103 G4String cv;
104 return cv;
105}
106
@ G4State_Idle
@ G4State_PreInit
int G4int
Definition G4Types.hh:85
G4String GetCurrentValue(G4UIcommand *command) override
void SetNewValue(G4UIcommand *command, G4String newValues) override
G4ExceptionHandlerMessenger(G4ExceptionHandler *expH)
G4int StoI(const G4String &s)