Geant4  10.02
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 "G4RunManager.hh"
41 #include "G4UIdirectory.hh"
42 #include "G4UIcmdWithAString.hh"
45 #include "G4UIcmdWithABool.hh"
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48 
50 :Detector(Det)
51 {
52  detDir = new G4UIdirectory("/apparate/");
53  detDir->SetGuidance("detector control.");
54 
55  UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
56  UpdateCmd->SetGuidance("Update apparate geometry.");
57  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
58  UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
59 
61 
62  sampleCmd = new G4UIcmdWithAString("/apparate/sampleMaterial",this);
63  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");
64  sampleCmd->SetParameterName("material",true);
65  sampleCmd->SetDefaultValue("mars1");
67 
68  detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
69  detectorCmd->SetGuidance("select a diferent detectorType");
70  detectorCmd->SetParameterName("detector",true);
72  detectorCmd->SetCandidates("sili hpge");
74 
75  grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
76  grainDiaCmd->SetGuidance( "Set diameter of grains" );
77  grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
78  grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
79  grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
80  grainDiaCmd->SetDefaultUnit( "mm" );
81  grainDiaCmd->SetUnitCategory( "Length" );
83 
84  granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
85  granularityFlagCmd->SetGuidance("Set if sample granularity is present");
86  granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
87  granularityFlagCmd->SetParameterName("Granularity Flag",true);
90 
91  OhmicPosThicknessCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/ohmicPosThickness",this );
92  OhmicPosThicknessCmd->SetGuidance( "Changes thickness of the detector anode" );
93  OhmicPosThicknessCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
94  OhmicPosThicknessCmd->SetGuidance( "Default: 0.005 mm " );
95  OhmicPosThicknessCmd->SetParameterName( "OhmicPos Thickness", true, true );
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
102 
104 {
105  delete UpdateCmd;
106  delete detDir;
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
110 
112 {
113  if( command == UpdateCmd )
114  {
115  //This triggers a full re-build of the geometry. The method in the
116  //geometry will take care of that.
118  return;
119  }
120  else if ( command == sampleCmd )
121  {
122  Detector->SetSampleMaterial(newValue);
123  }
124 
125  else if ( command == detectorCmd )
126  {
127  Detector->SetDetectorType(newValue);
128  }
129  else if ( command == grainDiaCmd )
130  {
131  G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);
132  Detector->SetGrainDia(newSize);
133  }
134 
135  else if ( command == granularityFlagCmd )
136  {
138  G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
139  Detector->SetSampleGranularity(newGranFlag);
140  }
141  else if ( command == OhmicPosThicknessCmd )
142  {
143  G4double newSize = OhmicPosThicknessCmd->GetNewDoubleValue(newValue);
144  Detector->SetOhmicPosThickness(newSize);
145  }
146  //Notify the run manager that the geometry has been modified
148 }
149 
150 
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
153 
154 
155 
156 
157 
158 
159 
160 
161 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void GeometryHasBeenModified(G4bool prop=true)
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:239
G4UIcmdWithADoubleAndUnit * OhmicPosThicknessCmd
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
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)