source: trunk/examples/advanced/xray_fluorescence/src/XrayFluoMercuryDetectorMessenger.cc@ 1210

Last change on this file since 1210 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: XrayFluoMercuryDetectorMessenger.cc
28// GEANT4 tag $Name:
29//
30// Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
31//
32// History:
33// -----------
34//
35// 18 Sep 2003 Alfonso Mantero created
36//
37// -------------------------------------------------------------------
38
39
40#include "XrayFluoMercuryDetectorMessenger.hh"
41#include "XrayFluoMercuryDetectorConstruction.hh"
42#include "G4UIdirectory.hh"
43#include "G4UIcmdWithAString.hh"
44#include "G4UIcmdWithADoubleAndUnit.hh"
45#include "G4UIcmdWithoutParameter.hh"
46#include "G4UIcmdWithABool.hh"
47
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49
50XrayFluoMercuryDetectorMessenger::XrayFluoMercuryDetectorMessenger(XrayFluoMercuryDetectorConstruction * Det)
51:Detector(Det)
52{
53 detDir = new G4UIdirectory("/apparate/");
54 detDir->SetGuidance("detector control.");
55
56 UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
57 UpdateCmd->SetGuidance("Update apparate geometry.");
58 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
59 UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
60
61 UpdateCmd->AvailableForStates(G4State_Idle);
62
63 sampleCmd = new G4UIcmdWithAString("/apparate/mercuryMaterial",this);
64 sampleCmd->SetGuidance("select a diferent material for the mercury");
65 sampleCmd->SetParameterName("material",true);
66 sampleCmd->SetDefaultValue("mars1");
67 sampleCmd->SetCandidates("Dolorite Anorthosite Mars1 IceBasalt");
68 sampleCmd->AvailableForStates(G4State_Idle);
69
70 detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
71 detectorCmd->SetGuidance("select a diferent detectorType");
72 detectorCmd->SetParameterName("detector",true);
73 detectorCmd->SetDefaultValue("sili");
74 detectorCmd->SetCandidates("sili hpge");
75 detectorCmd->AvailableForStates(G4State_Idle);
76
77 latitudeAngleCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/latitude",this );
78 latitudeAngleCmd->SetGuidance( "Set latitude angle of the spacecraft" );
79 latitudeAngleCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
80 latitudeAngleCmd->SetGuidance( "Default: 45 deg " );
81 latitudeAngleCmd->SetParameterName( "Latitude Angle", true, true );
82 latitudeAngleCmd->SetDefaultUnit( "deg" );
83 latitudeAngleCmd->SetUnitCategory( "Angle" );
84 latitudeAngleCmd->AvailableForStates(G4State_Idle);
85
86 orbitHeightCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/orbitHeight",this );
87 orbitHeightCmd->SetGuidance( "Set height of the spacecraft above Mercuey Surface" );
88 orbitHeightCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
89 orbitHeightCmd->SetGuidance( "Default: 400 km " );
90 orbitHeightCmd->SetParameterName( "Spacecraft Altitude", true, true );
91 orbitHeightCmd->SetDefaultUnit( "km" );
92 orbitHeightCmd->SetUnitCategory( "Length" );
93 orbitHeightCmd->AvailableForStates(G4State_Idle);
94
95
96
97// granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
98// granularityFlagCmd->SetGuidance("Set if sample granularity is present");
99// granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
100// granularityFlagCmd->SetParameterName("Granularity Flag",true);
101// granularityFlagCmd->SetDefaultValue(false);
102// granularityFlagCmd->AvailableForStates(G4State_Idle);
103
104}
105
106//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
107
108 XrayFluoMercuryDetectorMessenger::~XrayFluoMercuryDetectorMessenger()
109{
110 delete UpdateCmd;
111 delete detDir;
112}
113
114//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
115
116void XrayFluoMercuryDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
117{
118 if( command == UpdateCmd )
119 { Detector->UpdateGeometry(); }
120
121 else if ( command == sampleCmd )
122 { Detector->SetMercuryMaterial(newValue);}
123
124 else if ( command == detectorCmd )
125 { Detector->SetDetectorType(newValue);}
126
127 else if ( command == latitudeAngleCmd )
128 {
129 G4double newAngle = latitudeAngleCmd->GetNewDoubleValue(newValue);
130 Detector->SetLatitude(newAngle);
131 }
132
133 else if ( command == orbitHeightCmd )
134 {
135 G4double newAngle = orbitHeightCmd->GetNewDoubleValue(newValue);
136 Detector->SetOribitHeight(newAngle);
137 }
138
139
140// else if ( command == granularityFlagCmd )
141// {
142// Detector->DeleteGrainObjects();
143// G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
144// Detector->SetMercuryGranularity(newGranFlag);
145// }
146
147}
148
149
150//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
151
152
153
154
155
156
157
158
159
Note: See TracBrowser for help on using the repository browser.