Geant4-11
G4ToolsAnalysisMessenger.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// Author: Ivana Hrivnacova, 29/10/2021 (ivana@ipno.in2p3.fr)
28
33
34#include "G4UIcommand.hh"
35#include "G4UIparameter.hh"
36
37using namespace G4Analysis;
38
39//_____________________________________________________________________________
41 : G4UImessenger(),
42 fManager(manager)
43{
44 // Create get commands
45 G4AnalysisMessengerHelper helper("h1");
46 fGetH1Cmd = helper.CreateGetCommand(this);
47
48 helper.SetHnType("h2");
49 fGetH2Cmd = helper.CreateGetCommand(this);
50
51 helper.SetHnType("h3");
52 fGetH3Cmd = helper.CreateGetCommand(this);
53
54 helper.SetHnType("p1");
55 fGetP1Cmd = helper.CreateGetCommand(this);
56
57 helper.SetHnType("p2");
58 fGetP2Cmd = helper.CreateGetCommand(this);
59}
60
61//_____________________________________________________________________________
63
65// public functions
66//
67
68//_____________________________________________________________________________
70{
71 if ( command == fGetH1Cmd.get() ) return fH1Value;
72 if ( command == fGetH2Cmd.get() ) return fH2Value;
73 if ( command == fGetH3Cmd.get() ) return fH3Value;
74 if ( command == fGetP1Cmd.get() ) return fP1Value;
75 if ( command == fGetP2Cmd.get() ) return fP2Value;
76 return "";
77}
78
79//_____________________________________________________________________________
81{
82 auto id = G4UIcommand::ConvertToInt(value);
83 if ( command == fGetH1Cmd.get() ) {
85 }
86 else if ( command == fGetH2Cmd.get() ) {
88 }
89 else if ( command == fGetH3Cmd.get() ) {
91 }
92 else if ( command == fGetP1Cmd.get() ) {
94 }
95 else if ( command == fGetP2Cmd.get() ) {
97 }
98}
void SetHnType(const G4String &hnType)
std::unique_ptr< G4UIcommand > CreateGetCommand(G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > fGetH1Cmd
G4String GetHnAddress(G4int id, G4THnManager< HT > *htManager) const
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4ToolsAnalysisMessenger()
std::unique_ptr< G4UIcommand > fGetP2Cmd
std::unique_ptr< G4UIcommand > fGetH2Cmd
std::unique_ptr< G4UIcommand > fGetP1Cmd
virtual void SetNewValue(G4UIcommand *command, G4String value) final
std::unique_ptr< G4UIcommand > fGetH3Cmd
G4ToolsAnalysisMessenger(G4ToolsAnalysisManager *manager)
G4ToolsAnalysisManager * fManager
Associated class.
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:557