source: trunk/examples/advanced/xray_fluorescence/src/XrayFluoDetectorMessenger.cc@ 1229

Last change on this file since 1229 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: XrayFluoDetectorMessenger.cc
28// GEANT4 tag $Name: xray_fluo-V03-02-00
29//
30// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
31//
32// History:
33// -----------
34// 28 Nov 2001 Elena Guardincerri Created
35//
36// -------------------------------------------------------------------
37
38#include "XrayFluoDetectorMessenger.hh"
39#include "XrayFluoDetectorConstruction.hh"
40#include "G4UIdirectory.hh"
41#include "G4UIcmdWithAString.hh"
42#include "G4UIcmdWithADoubleAndUnit.hh"
43#include "G4UIcmdWithoutParameter.hh"
44#include "G4UIcmdWithABool.hh"
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47
48XrayFluoDetectorMessenger::XrayFluoDetectorMessenger(XrayFluoDetectorConstruction * Det)
49:Detector(Det)
50{
51 detDir = new G4UIdirectory("/apparate/");
52 detDir->SetGuidance("detector control.");
53
54 UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
55 UpdateCmd->SetGuidance("Update apparate geometry.");
56 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
57 UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
58
59 UpdateCmd->AvailableForStates(G4State_Idle);
60
61 sampleCmd = new G4UIcmdWithAString("/apparate/sampleMaterial",this);
62 sampleCmd->SetGuidance("select a diferent material for the sample: materials can be: Dolorite, Anorthosite, Mars1, IceBasalt, HPGe OR choosen from Nist database (see /material/nist/listMaterials for details");
63 sampleCmd->SetParameterName("material",true);
64 sampleCmd->SetDefaultValue("mars1");
65 sampleCmd->AvailableForStates(G4State_Idle);
66
67 detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
68 detectorCmd->SetGuidance("select a diferent detectorType");
69 detectorCmd->SetParameterName("detector",true);
70 detectorCmd->SetDefaultValue("sili");
71 detectorCmd->SetCandidates("sili hpge");
72 detectorCmd->AvailableForStates(G4State_Idle);
73
74 grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
75 grainDiaCmd->SetGuidance( "Set diameter of grains" );
76 grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
77 grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
78 grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
79 grainDiaCmd->SetDefaultUnit( "mm" );
80 grainDiaCmd->SetUnitCategory( "Length" );
81 grainDiaCmd->AvailableForStates(G4State_Idle);
82
83 granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
84 granularityFlagCmd->SetGuidance("Set if sample granularity is present");
85 granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
86 granularityFlagCmd->SetParameterName("Granularity Flag",true);
87 granularityFlagCmd->SetDefaultValue(false);
88 granularityFlagCmd->AvailableForStates(G4State_Idle);
89
90 OhmicPosThicknessCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/ohmicPosThickness",this );
91 OhmicPosThicknessCmd->SetGuidance( "Changes thickness of the detector anode" );
92 OhmicPosThicknessCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
93 OhmicPosThicknessCmd->SetGuidance( "Default: 0.005 mm " );
94 OhmicPosThicknessCmd->SetParameterName( "OhmicPos Thickness", true, true );
95 OhmicPosThicknessCmd->SetDefaultUnit( "mm" );
96 OhmicPosThicknessCmd->SetUnitCategory( "Length" );
97 OhmicPosThicknessCmd->AvailableForStates(G4State_Idle);
98}
99
100//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
101
102 XrayFluoDetectorMessenger::~XrayFluoDetectorMessenger()
103{
104 delete UpdateCmd;
105 delete detDir;
106}
107
108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
109
110void XrayFluoDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
111{
112 if( command == UpdateCmd )
113 { Detector->UpdateGeometry(); }
114
115 else if ( command == sampleCmd )
116 { Detector->SetSampleMaterial(newValue);}
117
118 else if ( command == detectorCmd )
119 { Detector->SetDetectorType(newValue);}
120
121 else if ( command == grainDiaCmd )
122 {
123 G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);
124 Detector->SetGrainDia(newSize);
125 }
126
127 else if ( command == granularityFlagCmd )
128 {
129 Detector->DeleteGrainObjects();
130 G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
131 Detector->SetSampleGranularity(newGranFlag);
132 }
133 else if ( command == OhmicPosThicknessCmd )
134 {
135 G4double newSize = OhmicPosThicknessCmd->GetNewDoubleValue(newValue);
136 Detector->SetOhmicPosThickness(newSize);
137 }
138}
139
140
141//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
142
143
144
145
146
147
148
149
150
Note: See TracBrowser for help on using the repository browser.