Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StepMaxMessenger.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 //
28 //
29 // $Id: fStepMaxMessenger.cc,v 1.3 2006-06-29 16:53:21 gunter Exp $
30 // GEANT4 tag $Name: not supported by cvs2svn $
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "StepMaxMessenger.hh"
36 
37 #include "StepMax.hh"
38 #include "G4UIdirectory.hh"
39 #include "G4UIcommand.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44 :fStepMax(stepM)
45 {
46  fStepMaxDir = new G4UIdirectory("/testem/stepMax/");
47  fStepMaxDir->SetGuidance("histograms control");
48 
49  fStepMaxCmd = new G4UIcommand("/testem/stepMax/absorber",this);
50  fStepMaxCmd->SetGuidance("Set max allowed step length in absorber k");
51  //
52  G4UIparameter* k = new G4UIparameter("k",'i',false);
53  k->SetGuidance("absorber number : from 1 to MaxHisto-1");
54  k->SetParameterRange("k>0");
55  fStepMaxCmd->SetParameter(k);
56  //
57  G4UIparameter* sMax = new G4UIparameter("sMax",'d',false);
58  sMax->SetGuidance("stepMax, expressed in choosen unit");
59  sMax->SetParameterRange("sMax>0.");
60  fStepMaxCmd->SetParameter(sMax);
61  //
62  G4UIparameter* unit = new G4UIparameter("unit",'s',false);
63  fStepMaxCmd->SetParameter(unit);
64 }
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67 
69 {
70  delete fStepMaxCmd;
71  delete fStepMaxDir;
72 }
73 
74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75 
76 void StepMaxMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
77 {
78  if (command == fStepMaxCmd)
79  { G4int k; G4double sMax;
80  G4String unts;
81  std::istringstream is(newValues);
82  is >> k >> sMax >> unts;
83  G4String unit = unts;
84  G4double vUnit = G4UIcommand::ValueOf(unit);
85  fStepMax->SetStepMax(k,sMax*vUnit);
86  }
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......