source: trunk/source/parameterisations/gflash/src/GFlashShowerModelMessenger.cc@ 1355

Last change on this file since 1355 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 6.4 KB
RevLine 
[823]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// $Id: GFlashShowerModelMessenger.cc,v 1.6 2006/06/29 19:14:24 gunter Exp $
[1337]27// GEANT4 tag $Name: geant4-09-04-beta-01 $
[823]28//
29//
30// ------------------------------------------------------------
31// GEANT 4 class implementation
32//
33// ------------- GFlashShowerModelMessenger -------------
34//
35// Author: Joanna Weng - 9.11.2004
36// ------------------------------------------------------------
37
38#include "GFlashShowerModelMessenger.hh"
39#include "GFlashShowerModel.hh"
40#include "GFlashParticleBounds.hh"
41#include "G4UIdirectory.hh"
42#include "G4UIcmdWithAString.hh"
43#include "G4UIcmdWithADoubleAndUnit.hh"
44#include "G4UIcmdWithADouble.hh"
45#include "G4UIcmdWithAnInteger.hh"
46#include "G4Electron.hh"
47#include "G4Positron.hh"
48#include "globals.hh"
49
50#include <iomanip>
51#include <sstream>
52
53GFlashShowerModelMessenger::
54GFlashShowerModelMessenger(GFlashShowerModel * aModel)
55{
56 myParaDir = new G4UIdirectory("/GFlash/");
57 myParaDir->SetGuidance("Parametrisation control.");
58 myModel= aModel;
59
60 FlagCmd = new G4UIcmdWithAnInteger("/GFlash/flag",this);
61 FlagCmd->SetGuidance("Defines if GFlash is activated");
62 FlagCmd->SetParameterName("flag",false,false);
63
64 ContCmd = new G4UIcmdWithAnInteger("/GFlash/containment ",this);
65 ContCmd->SetGuidance("Defines if Containment is checked");
66 ContCmd->SetParameterName("flag",false,false);
67
68 StepInX0Cmd = new G4UIcmdWithADouble("/GFlash/stepXo",this);
69 StepInX0Cmd->SetGuidance("Defines step lenghts");
70 StepInX0Cmd->SetParameterName("flag",false,false);
71
72 EminCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emin",this);
73 EminCmd->SetGuidance("Set minimum kinetic energy to trigger parametrisation");
74 EminCmd->SetParameterName("Emin",false,false);
75 EminCmd->SetDefaultUnit("GeV");
76 EminCmd->SetUnitCategory("Energy");
77 EminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
78
79 EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emax",this);
80 EmaxCmd->SetGuidance("Set maximum kinetic energy to trigger parametrisation");
81 EmaxCmd->SetParameterName("Emax",false,false);
82 EmaxCmd->SetDefaultUnit("GeV");
83 EmaxCmd->SetUnitCategory("Energy");
84 EmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
85
86 EkillCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Ekill",this);
87 EkillCmd->SetGuidance("Set maximum kinetic energy for electrons to be killed");
88 EkillCmd->SetParameterName("Ekill",false,false);
89 EkillCmd->SetDefaultUnit("GeV");
90 EkillCmd->SetUnitCategory("Energy");
91 EkillCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
92}
93
94
95GFlashShowerModelMessenger::~GFlashShowerModelMessenger()
96{
97 delete ContCmd;
98 delete FlagCmd;
99 delete StepInX0Cmd;
100 delete EminCmd;
101 delete EmaxCmd;
102 delete EkillCmd;
103}
104
105
106void GFlashShowerModelMessenger::
107SetNewValue(G4UIcommand * command,G4String newValues)
108{
109
110 if( command == FlagCmd ) {
111 myModel->SetFlagParamType(FlagCmd->GetNewIntValue(newValues));
112 this->GetCurrentValue(command);
113 }
114 if( command == ContCmd ) {
115 myModel->SetFlagParticleContainment(ContCmd->GetNewIntValue(newValues));
116 this->GetCurrentValue(command);
117 }
118 if( command == StepInX0Cmd ) {
119 myModel->SetStepInX0(StepInX0Cmd->GetNewDoubleValue(newValues));
120 this->GetCurrentValue(command);
121 }
122
123 else if( command == EminCmd ) {
124 myModel->PBound->SetMinEneToParametrise(*G4Electron::ElectronDefinition(),
125 EminCmd->GetNewDoubleValue(newValues));
126 this->GetCurrentValue(command);
127 }
128
129 else if( command == EmaxCmd ) {
130 myModel->PBound->SetMaxEneToParametrise(*G4Electron::ElectronDefinition(),
131 EmaxCmd->GetNewDoubleValue(newValues));
132 this->GetCurrentValue(command);
133 }
134
135 else if( command == EkillCmd ) {
136 myModel->PBound->SetEneToKill(*G4Electron::ElectronDefinition(),
137 EkillCmd->GetNewDoubleValue(newValues));
138 this->GetCurrentValue(command);
139 }
140
141}
142
143
144G4String GFlashShowerModelMessenger::GetCurrentValue(G4UIcommand * command)
145{
146 G4String returnValue('\0');
147 std::ostringstream os;
148
149 if( command == FlagCmd ) {
150 os << "/GFlash/flag " << myModel->GetFlagParamType() << '\0';
151 returnValue = G4String(os.str());
152 }
153
154 else if( command == EkillCmd ) {
155 os << "/GFlash/Ekill "
156 << myModel->PBound->GetEneToKill(*G4Electron::ElectronDefinition())/GeV
157 << " GeV" << '\0';
158 returnValue = G4String(os.str());
159 }
160
161 else if( command == EminCmd ) {
162 os << "/GFlash/Emin "
163 << myModel->PBound->GetMinEneToParametrise(*G4Electron::ElectronDefinition())/GeV
164 << " GeV" << '\0';
165 returnValue = G4String(os.str());
166 }
167
168 else if( command == EmaxCmd ) {
169 os << "/GFlash/Emax "
170 << myModel->PBound->GetMaxEneToParametrise(*G4Electron::ElectronDefinition())/GeV
171 << " GeV" << '\0';
172 returnValue = G4String(os.str());
173 }
174
175 return returnValue;
176}
Note: See TracBrowser for help on using the repository browser.