Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExN02DetectorMessenger.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 // $Id: ExN02DetectorMessenger.cc 69899 2013-05-17 10:05:33Z gcosmo $
28 //
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 
32 #include "ExN02DetectorMessenger.hh"
33 
34 #include "ExN02DetectorConstruction.hh"
35 #include "G4UIdirectory.hh"
36 #include "G4UIcmdWithAString.hh"
38 #include "globals.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
43 :myDetector(myDet)
44 {
45  N02Dir = new G4UIdirectory("/N02/");
46  N02Dir->SetGuidance("UI commands specific to this example.");
47 
48  detDir = new G4UIdirectory("/N02/det/");
49  detDir->SetGuidance("detector control.");
50 
51  TargMatCmd = new G4UIcmdWithAString("/N02/det/setTargetMate",this);
52  TargMatCmd->SetGuidance("Select Material of the Target.");
53  TargMatCmd->SetParameterName("choice",false);
55 
56  ChamMatCmd = new G4UIcmdWithAString("/N02/det/setChamberMate",this);
57  ChamMatCmd->SetGuidance("Select Material of the Target.");
58  ChamMatCmd->SetParameterName("choice",false);
60 
61  FieldCmd = new G4UIcmdWithADoubleAndUnit("/N02/det/setField",this);
62  FieldCmd->SetGuidance("Define magnetic field.");
63  FieldCmd->SetGuidance("Magnetic field will be in X direction.");
64  FieldCmd->SetParameterName("Bx",false);
65  FieldCmd->SetUnitCategory("Magnetic flux density");
67 
68  StepMaxCmd = new G4UIcmdWithADoubleAndUnit("/N02/det/stepMax",this);
69  StepMaxCmd->SetGuidance("Define a step max");
70  StepMaxCmd->SetParameterName("stepMax",false);
71  StepMaxCmd->SetUnitCategory("Length");
72  StepMaxCmd->AvailableForStates(G4State_Idle);
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79  delete TargMatCmd;
80  delete ChamMatCmd;
81  delete FieldCmd;
82  delete StepMaxCmd;
83  delete detDir;
84  delete N02Dir;
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
90 {
91  if( command == TargMatCmd )
92  { myDetector->setTargetMaterial(newValue);}
93 
94  if( command == ChamMatCmd )
95  { myDetector->setChamberMaterial(newValue);}
96 
97  if( command == FieldCmd )
98  { myDetector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));}
99 
100  if( command == StepMaxCmd )
101  { myDetector->SetMaxStep(StepMaxCmd->GetNewDoubleValue(newValue));}
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......