Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FTFTuningsMessenger Class Reference

#include <G4FTFTuningsMessenger.hh>

+ Inheritance diagram for G4FTFTuningsMessenger:

Public Member Functions

 G4FTFTuningsMessenger ()
 
 ~G4FTFTuningsMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValues) override
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 44 of file G4FTFTuningsMessenger.hh.

Constructor & Destructor Documentation

◆ G4FTFTuningsMessenger()

G4FTFTuningsMessenger::G4FTFTuningsMessenger ( )
explicit

Definition at line 39 of file G4FTFTuningsMessenger.cc.

39 {
40 // These two commands select an alternative set of FTF parameters (called "tune"):
41 // either via its integer index
42 theFTFTuneIndexCmd = new G4UIcmdWithAnInteger( "/process/had/models/ftf/selectTuneByIndex", this );
43 theFTFTuneIndexCmd->SetGuidance( "Select one FTF set of parameters (tune) via its index: 0 (default), 1, 2, ..." );
44 theFTFTuneIndexCmd->SetParameterName( "indexFTFTune", true );
45 theFTFTuneIndexCmd->SetDefaultValue( 0 );
46 theFTFTuneIndexCmd->SetRange( "indexFTFTune>=0" );
47 theFTFTuneIndexCmd->AvailableForStates( G4State_PreInit );
48 // or via its string name
49 theFTFTuneNameCmd = new G4UIcmdWithAString( "/process/had/models/ftf/selectTuneByName", this );
50 theFTFTuneNameCmd->SetGuidance( "Select one FTF set of parametes (tune) via its name (string)." );
51 theFTFTuneNameCmd->SetGuidance( " (default) is the default." );
52 theFTFTuneNameCmd->SetParameterName( "nameFTFTune", true );
53 theFTFTuneNameCmd->SetDefaultValue( "default" );
54 theFTFTuneNameCmd->AvailableForStates( G4State_PreInit );
55}
@ G4State_PreInit
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
void SetRange(const char *rs)
Definition: G4UIcommand.hh:121
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:287

◆ ~G4FTFTuningsMessenger()

G4FTFTuningsMessenger::~G4FTFTuningsMessenger ( )

Definition at line 58 of file G4FTFTuningsMessenger.cc.

58 {
59 delete theFTFTuneIndexCmd;
60 delete theFTFTuneNameCmd;
61}

Member Function Documentation

◆ SetNewValue()

void G4FTFTuningsMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 64 of file G4FTFTuningsMessenger.cc.

64 {
65 if ( command == theFTFTuneIndexCmd || command == theFTFTuneNameCmd ) {
66 G4int index = -999;
67 if ( command == theFTFTuneIndexCmd ) {
68 G4int value = theFTFTuneIndexCmd->GetNewIntValue( newValues );
69 if ( value >= 0 && value < G4FTFTunings::sNumberOfTunes ) {
70 index = value;
71 } else {
73 ed << "The FTF tune index=" << value << " value is wrong!";
74 command->CommandFailed( ed );
75 }
76 } else {
77 for ( G4int i = 0; i < G4FTFTunings::sNumberOfTunes; ++i ) {
78 if ( newValues == G4FTFTunings::Instance()->GetTuneName(i) ) {
79 index = i;
80 break;
81 }
82 }
83 if ( index < 0 ) {
85 ed << "The FTF tune name=" << newValues << " is not found!";
86 command->CommandFailed( ed );
87 }
88 }
89 if ( index >= 0 ) {
90 // Tune applicability state: 0 means switched off; 1 means switched on.
92 }
93 }
94}
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
int G4int
Definition: G4Types.hh:85
static const G4int sNumberOfTunes
void SetTuneApplicabilityState(const G4int index, const G4int state)
static G4FTFTunings * Instance()
static G4int GetNewIntValue(const char *paramString)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
Definition: G4UIcommand.hh:179

The documentation for this class was generated from the following files: