source: trunk/examples/extended/analysis/AnaEx01/src/AnaEx01DetectorMessenger.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 6.1 KB
Line 
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: AnaEx01DetectorMessenger.cc,v 1.5 2006/06/29 16:33:51 gunter Exp $
28// GEANT4 tag $Name: $
29//
30//
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34
35#include "AnaEx01DetectorMessenger.hh"
36
37#include "AnaEx01DetectorConstruction.hh"
38#include "G4UIdirectory.hh"
39#include "G4UIcmdWithAString.hh"
40#include "G4UIcmdWithAnInteger.hh"
41#include "G4UIcmdWithADoubleAndUnit.hh"
42#include "G4UIcmdWithoutParameter.hh"
43
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45
46AnaEx01DetectorMessenger::AnaEx01DetectorMessenger(AnaEx01DetectorConstruction * AnaEx01Det)
47:AnaEx01Detector(AnaEx01Det)
48{
49 AnaEx01detDir = new G4UIdirectory("/calor/");
50 AnaEx01detDir->SetGuidance("AnaEx01 detector control.");
51
52 AbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
53 AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
54 AbsMaterCmd->SetParameterName("choice",false);
55 AbsMaterCmd->AvailableForStates(G4State_Idle);
56
57 GapMaterCmd = new G4UIcmdWithAString("/calor/setGapMat",this);
58 GapMaterCmd->SetGuidance("Select Material of the Gap.");
59 GapMaterCmd->SetParameterName("choice",false);
60 GapMaterCmd->AvailableForStates(G4State_Idle);
61
62 AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
63 AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
64 AbsThickCmd->SetParameterName("Size",false);
65 AbsThickCmd->SetRange("Size>=0.");
66 AbsThickCmd->SetUnitCategory("Length");
67 AbsThickCmd->AvailableForStates(G4State_Idle);
68
69 GapThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setGapThick",this);
70 GapThickCmd->SetGuidance("Set Thickness of the Gap");
71 GapThickCmd->SetParameterName("Size",false);
72 GapThickCmd->SetRange("Size>=0.");
73 GapThickCmd->SetUnitCategory("Length");
74 GapThickCmd->AvailableForStates(G4State_Idle);
75
76 SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setSizeYZ",this);
77 SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
78 SizeYZCmd->SetParameterName("Size",false);
79 SizeYZCmd->SetRange("Size>0.");
80 SizeYZCmd->SetUnitCategory("Length");
81 SizeYZCmd->AvailableForStates(G4State_Idle);
82
83 NbLayersCmd = new G4UIcmdWithAnInteger("/calor/setNbOfLayers",this);
84 NbLayersCmd->SetGuidance("Set number of layers.");
85 NbLayersCmd->SetParameterName("NbLayers",false);
86 NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
87 NbLayersCmd->AvailableForStates(G4State_Idle);
88
89 UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
90 UpdateCmd->SetGuidance("Update calorimeter geometry.");
91 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
92 UpdateCmd->SetGuidance("if you changed geometrical value(s).");
93 UpdateCmd->AvailableForStates(G4State_Idle);
94
95 MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
96 MagFieldCmd->SetGuidance("Define magnetic field.");
97 MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
98 MagFieldCmd->SetParameterName("Bz",false);
99 MagFieldCmd->SetUnitCategory("Magnetic flux density");
100 MagFieldCmd->AvailableForStates(G4State_Idle);
101}
102
103//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
104
105AnaEx01DetectorMessenger::~AnaEx01DetectorMessenger()
106{
107 delete NbLayersCmd;
108 delete AbsMaterCmd; delete GapMaterCmd;
109 delete AbsThickCmd; delete GapThickCmd;
110 delete SizeYZCmd; delete UpdateCmd;
111 delete MagFieldCmd;
112 delete AnaEx01detDir;
113}
114
115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
116
117void AnaEx01DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
118{
119 if( command == AbsMaterCmd )
120 { AnaEx01Detector->SetAbsorberMaterial(newValue);}
121
122 if( command == GapMaterCmd )
123 { AnaEx01Detector->SetGapMaterial(newValue);}
124
125 if( command == AbsThickCmd )
126 { AnaEx01Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));}
127
128 if( command == GapThickCmd )
129 { AnaEx01Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
130
131 if( command == SizeYZCmd )
132 { AnaEx01Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
133
134 if( command == NbLayersCmd )
135 { AnaEx01Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
136
137 if( command == UpdateCmd )
138 { AnaEx01Detector->UpdateGeometry(); }
139
140 if( command == MagFieldCmd )
141 { AnaEx01Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
142}
143
144//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.