Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/advanced/amsEcal/src/DetectorMessenger.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: DetectorMessenger.cc 68740 2013-04-05 09:56:39Z gcosmo $
27 //
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 
31 #include "DetectorMessenger.hh"
32 
33 #include "DetectorConstruction.hh"
34 #include "G4UIdirectory.hh"
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
39 
41 :Detector(Det)
42 {
43  amsDir = new G4UIdirectory("/ams/");
44  amsDir->SetGuidance("UI commands specific to this example");
45 
46  detDir = new G4UIdirectory("/ams/det/");
47  detDir->SetGuidance("detector construction commands");
48 
49  MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/ams/det/setField",this);
50  MagFieldCmd->SetGuidance("Define magnetic field.");
51  MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
52  MagFieldCmd->SetParameterName("Bz",false);
53  MagFieldCmd->SetUnitCategory("Magnetic flux density");
55 
56  UpdateCmd = new G4UIcmdWithoutParameter("/ams/det/update",this);
57  UpdateCmd->SetGuidance("Update calorimeter geometry.");
58  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
59  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
60  UpdateCmd->AvailableForStates(G4State_Idle);
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {
67  delete MagFieldCmd;
68  delete UpdateCmd;
69  delete detDir;
70  delete amsDir;
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76 {
77  if( command == MagFieldCmd )
78  { Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
79 
80  if( command == UpdateCmd )
81  { Detector->UpdateGeometry();}
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)