Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4TBFieldMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4TBFieldMessenger.cc
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: G4TBFieldMessenger.cc,v 1.5 2012/07/10 16:48:20 pinkenbu Exp $
28 // GEANT4 tag $Name: $
29 //
30 //
31 
32 #include "G4TBFieldMessenger.hh"
33 
35 
36 #include <Geant4/G4ApplicationState.hh>
37 #include <Geant4/G4String.hh>
38 #include <Geant4/G4UIdirectory.hh>
39 #include <Geant4/G4UIcmdWithAString.hh>
40 #include <Geant4/G4UIcmdWithAnInteger.hh>
41 #include <Geant4/G4UIcmdWithADoubleAndUnit.hh>
42 #include <Geant4/G4UIcmdWithoutParameter.hh>
43 
44 class G4UIcommand;
45 
47 
49  :fEFieldSetup(pEMfield)
50 {
51  G4TBdetDir = new G4UIdirectory("/field/");
52  G4TBdetDir->SetGuidance("G4TB field tracking control.");
53 
54  StepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
55  StepperCmd->SetGuidance("Select stepper type for electric field");
56  StepperCmd->SetParameterName("choice",true);
57  StepperCmd->SetDefaultValue(4);
58  StepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
59 
60 
61  UpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
62  UpdateCmd->SetGuidance("Update calorimeter geometry.");
63  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
64  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
65  UpdateCmd->AvailableForStates(G4State_Idle);
66 
67  ElFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
68  ElFieldCmd->SetGuidance("Define uniform Electric field.");
69  ElFieldCmd->SetGuidance("Electric field will be in Z direction.");
70  ElFieldCmd->SetGuidance("Value of Electric field has to be given in volt/m");
71  ElFieldCmd->SetParameterName("Ez",false,false);
72  ElFieldCmd->SetDefaultUnit("volt/m");
73  ElFieldCmd->AvailableForStates(G4State_Idle);
74 
75  MinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
76  MinStepCmd->SetGuidance("Define minimal step");
77  MinStepCmd->SetParameterName("min step",false,false);
78  MinStepCmd->SetDefaultUnit("mm");
79  MinStepCmd->AvailableForStates(G4State_Idle);
80 
81  AbsMaterCmd = new G4UIcmdWithAString("/field/setAbsMat",this);
82  AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
83  AbsMaterCmd->SetParameterName("choice",true);
84  AbsMaterCmd->SetDefaultValue("Xe");
85  AbsMaterCmd->AvailableForStates(G4State_Idle);
86 
87 
88 }
89 
91 
93 {
94  delete StepperCmd;
95  delete ElFieldCmd;
96  delete MinStepCmd;
97  delete G4TBdetDir;
98  delete UpdateCmd;
99 
100  delete AbsMaterCmd;
101 }
102 
104 //
105 //
106 
107 void G4TBFieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
108 {
109  if( command == StepperCmd )
110  {
111  fEFieldSetup->SetStepperType(StepperCmd->GetNewIntValue(newValue));
112  }
113  if( command == UpdateCmd )
114  {
116  }
117  if( command == ElFieldCmd )
118  {
119  fEFieldSetup->SetFieldValue(ElFieldCmd->GetNewDoubleValue(newValue));
120  }
121  if( command == MinStepCmd )
122  {
123  fEFieldSetup->SetMinStep(MinStepCmd->GetNewDoubleValue(newValue));
124  }
125 }
126 
127 //
128 //