Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FieldSetupMessenger.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// Implementation of the G4FieldSetupMessenger class
27//
28// Author: Ivana Hrivnacova (IJCLab, Orsay), 2024
29// --------------------------------------------------------------------
30
32#include "G4FieldSetup.hh"
33#include "G4LogicalVolume.hh"
34
37#include "G4UIdirectory.hh"
38
39//_____________________________________________________________________________
41 : fFieldSetup(fieldSetup)
42{
43 // Standard constructor
44
45 G4String directoryName = "/field/";
46 if (fFieldSetup->GetLogicalVolume() != nullptr)
47 {
48 directoryName.append(fFieldSetup->GetLogicalVolume()->GetName());
49 directoryName.append("/");
50 }
51
52 G4String commandName = std::move(directoryName);
53 commandName.append("update");
54 fUpdateCmd = new G4UIcmdWithoutParameter(commandName, this);
55 fUpdateCmd->SetGuidance("Update field setup.");
56 fUpdateCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
57}
58
59//_____________________________________________________________________________
61{
62 // Destructor
63
64 delete fUpdateCmd;
65}
66
67//
68// public methods
69//
70
71//_____________________________________________________________________________
73 G4UIcommand* command, G4String /*newValues*/)
74{
75 // Apply command to the associated object.
76
77 if (command == fUpdateCmd)
78 {
79 G4cout << "Execute update command" << G4endl;
80 fFieldSetup->Update();
81 return;
82 }
83}
@ G4State_Init
@ G4State_Idle
@ G4State_PreInit
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4FieldSetupMessenger()=delete
void SetNewValue(G4UIcommand *command, G4String newValues) override
G4FieldSetup is a class for constructing magnetic, electromagnetic and gravity fields which strength ...
void SetGuidance(const char *aGuidance)