Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GFlashShowerModelMessenger.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 // $Id: GFlashShowerModelMessenger.cc 69796 2013-05-15 13:26:12Z gcosmo $
27 //
28 //
29 // ------------------------------------------------------------
30 // GEANT 4 class implementation
31 //
32 // ------------- GFlashShowerModelMessenger -------------
33 //
34 // Author: Joanna Weng - 9.11.2004
35 // ------------------------------------------------------------
36 
37 #include <iomanip>
38 #include <sstream>
39 
41 #include "GFlashShowerModel.hh"
42 #include "GFlashParticleBounds.hh"
43 #include "globals.hh"
44 #include "G4SystemOfUnits.hh"
45 #include "G4UIdirectory.hh"
46 #include "G4UIcmdWithAString.hh"
48 #include "G4UIcmdWithADouble.hh"
49 #include "G4UIcmdWithAnInteger.hh"
50 #include "G4Electron.hh"
51 #include "G4Positron.hh"
52 
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");
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");
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");
92 }
93 
94 
96 {
97  delete ContCmd;
98  delete FlagCmd;
99  delete StepInX0Cmd;
100  delete EminCmd;
101  delete EmaxCmd;
102  delete EkillCmd;
103 }
104 
105 
107 SetNewValue(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 ) {
125  EminCmd->GetNewDoubleValue(newValues));
126  this->GetCurrentValue(command);
127  }
128 
129  else if( command == EmaxCmd ) {
131  EmaxCmd->GetNewDoubleValue(newValues));
132  this->GetCurrentValue(command);
133  }
134 
135  else if( command == EkillCmd ) {
137  EkillCmd->GetNewDoubleValue(newValues));
138  this->GetCurrentValue(command);
139  }
140 
141 }
142 
143 
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 "
157  << " GeV" << '\0';
158  returnValue = G4String(os.str());
159  }
160 
161  else if( command == EminCmd ) {
162  os << "/GFlash/Emin "
164  << " GeV" << '\0';
165  returnValue = G4String(os.str());
166  }
167 
168  else if( command == EmaxCmd ) {
169  os << "/GFlash/Emax "
171  << " GeV" << '\0';
172  returnValue = G4String(os.str());
173  }
174 
175  return returnValue;
176 }