ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F03FieldMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file F03FieldMessenger.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 //
28 //
29 //
30 //
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "F03FieldMessenger.hh"
36 
37 #include "F03FieldSetup.hh"
38 #include "G4UIcmdWithAnInteger.hh"
42 
43 #include "G4SystemOfUnits.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48  : G4UImessenger(),
49  fEMfieldSetup(fieldSetup),
50  fFieldDir(0),
51  fStepperCmd(0),
52  fMagFieldZCmd(0),
53  fMagFieldCmd(0),
54  fLocalMagFieldCmd(0),
55  fMinStepCmd(0),
56  fUpdateCmd(0)
57 {
58  fFieldDir = new G4UIdirectory("/field/");
59  fFieldDir->SetGuidance("F03 field tracking control.");
60 
61  fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
62  fStepperCmd->SetGuidance("Select stepper type for magnetic field");
63  fStepperCmd->SetParameterName("choice",true);
66 
67  fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
68  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
69  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
70  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
72 
73  fMagFieldZCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
74  fMagFieldZCmd->SetGuidance("Define global magnetic field.");
75  fMagFieldZCmd->SetGuidance("Global magnetic field will be in Z direction.");
76  fMagFieldZCmd->SetParameterName("Bz",false,false);
77  fMagFieldZCmd->SetDefaultUnit("tesla");
79 
80  fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setField",this);
81  fMagFieldCmd->SetGuidance("Define global magnetic field.");
82  fMagFieldCmd->SetParameterName("Bx","By","Bz",false,false);
83  fMagFieldCmd->SetDefaultUnit("tesla");
85 
86  fLocalMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setLocalField",this);
87  fLocalMagFieldCmd->SetGuidance("Define local magnetic field.");
88  fLocalMagFieldCmd->SetParameterName("Blx","Bly","Blz",false,false);
91 
92  fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
93  fMinStepCmd->SetGuidance("Define minimal step");
94  fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
95  fMinStepCmd->SetParameterName("min step",false,false);
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
103 {
104  delete fStepperCmd;
105  delete fMagFieldZCmd;
106  delete fMagFieldCmd;
107  delete fLocalMagFieldCmd;
108  delete fMinStepCmd;
109  delete fFieldDir;
110  delete fUpdateCmd;
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
116 {
117  if( command == fStepperCmd )
119  if( command == fUpdateCmd )
121  if( command == fMagFieldZCmd )
122  {
124  // Check the value
125  G4cout << "Set global field value to " <<
126  fEMfieldSetup->GetGlobalFieldValue() / gauss << " Gauss " << G4endl;
127  }
128  if( command == fMagFieldCmd )
129  {
131  // Check the value
132  G4cout << "Set global field value to " <<
133  fEMfieldSetup->GetGlobalFieldValue() / gauss << " Gauss " << G4endl;
134  }
135  if( command == fLocalMagFieldCmd )
136  {
139  // Check the value
140  G4cout << "Set local field value to " <<
141  fEMfieldSetup->GetLocalFieldValue() / gauss << " Gauss " << G4endl;
142  }
143  if( command == fMinStepCmd )
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......