Geant4  10.00.p01
XrayFluoDetectorMessenger.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 //
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 
40 #include "G4UIdirectory.hh"
41 #include "G4UIcmdWithAString.hh"
44 #include "G4UIcmdWithABool.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47 
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 
60 
61  sampleCmd = new G4UIcmdWithAString("/apparate/sampleMaterial",this);
62  sampleCmd->SetGuidance("select a diferent material for the sample: materials can be: Dolorite, Anorthosite, Mars1, HawaiianWD, HawaiianRF, IceBasalt, IcelandicWD, IcelandicRF, Gabbro, GabbroWD, GabbroRF, HPGe OR choosen from Nist database (see /material/nist/listMaterials for details");
63  sampleCmd->SetParameterName("material",true);
64  sampleCmd->SetDefaultValue("mars1");
66 
67  detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
68  detectorCmd->SetGuidance("select a diferent detectorType");
69  detectorCmd->SetParameterName("detector",true);
71  detectorCmd->SetCandidates("sili hpge");
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" );
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);
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 );
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
101 
103 {
104  delete UpdateCmd;
105  delete detDir;
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
109 
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  {
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 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
XrayFluoDetectorMessenger(XrayFluoDetectorConstruction *)
G4UIcmdWithoutParameter * UpdateCmd
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetSampleMaterial(G4String newMaterial)
G4UIcmdWithADoubleAndUnit * grainDiaCmd
void SetNewValue(G4UIcommand *, G4String)
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
XrayFluoDetectorConstruction * Detector
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
G4UIcmdWithADoubleAndUnit * OhmicPosThicknessCmd
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetCandidates(const char *candidateList)
double G4double
Definition: G4Types.hh:76
void SetSampleGranularity(G4bool granularity)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)