Loading...
Searching...
No Matches
VG01DetectorMessenger.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//
27/// \file VG01DetectorMessenger.cc
28/// \brief Implementation of the VG01DetectorMessenger class
29
30// Authors: J. Apostolakis & S. Wenzel (CERN) 2018-2021
31//
32// Started from FullCMS code by Mihaly Novak (CERN) 2017
33
35
37#include "G4UIdirectory.hh"
38#include "G4UIcmdWithADoubleAndUnit.hh"
39#include "G4UIcmdWithAString.hh"
40#include "globals.hh"
41
42
45 : G4UImessenger(), fDetector( myDet )
46{
47
48 fDetectorDir = new G4UIdirectory( "/mydet/" );
49 fDetectorDir->SetGuidance( "Detector control." );
50
51 fFieldCommand = new G4UIcmdWithADoubleAndUnit( "/mydet/setField", this );
52 fFieldCommand->SetGuidance( "Define uniform magnetic field along Z." );
53 fFieldCommand->SetGuidance( " -> in unit of [Tesla]" );
54 fFieldCommand->SetParameterName( "By", false );
55 fFieldCommand->SetDefaultValue( 0.0 );
56 fFieldCommand->SetUnitCategory( "Magnetic flux density" );
57 fFieldCommand->AvailableForStates( G4State_PreInit, G4State_Idle );
58
59 fGDMLCommand = new G4UIcmdWithAString( "/mydet/setGdmlFile", this );
60 fGDMLCommand->SetGuidance( "Set the GDML file." );
61 fGDMLCommand->SetDefaultValue( "TestNTST.gdml" );
62 fGDMLCommand->AvailableForStates( G4State_PreInit, G4State_Idle );
63
64}
65
66//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
72
73//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74
76{
77 if ( command == fFieldCommand ) {
78 fDetector->SetMagFieldValue(fFieldCommand->GetNewDoubleValue(newValue));
79 }
80 else
81 {
82 if ( command == fGDMLCommand ) {
83 fDetector->SetGDMLFileName( newValue );
84 } else {
85 G4cerr << "VG01DetectorMessenger: ERROR> Unknown command " << G4endl;
86 }
87 }
88}
Definition of the VG01DetectorConstruction class.
Implementation of the VG01DetectorMessenger class.
void SetMagFieldValue(const G4double fieldValue)
void SetGDMLFileName(const G4String &gdmlfile)
VG01DetectorConstruction * fDetector
VG01DetectorMessenger(VG01DetectorConstruction *)
G4UIcmdWithADoubleAndUnit * fFieldCommand
void SetNewValue(G4UIcommand *, G4String) override
G4UIcmdWithAString * fGDMLCommand

Applications | User Support | Publications | Collaboration