Geant4_10
XrayFluoPlaneDetectorMessenger.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: XrayFluoPlaneDetectorMessenger.cc
28 // GEANT4 tag $Name:
29 //
30 // Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
31 //
32 // History:
33 // -----------
34 //
35 // 29 Aug 2003 Alfonso Mantero created
36 //
37 // -------------------------------------------------------------------
38 
39 
42 #include "G4UIdirectory.hh"
43 #include "G4UIcmdWithAString.hh"
46 #include "G4UIcmdWithABool.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
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/planeMaterial",this);
64  sampleCmd->SetGuidance("select a diferent material for the plane");
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  grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
78  grainDiaCmd->SetGuidance( "Set diameter of grains" );
79  grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
80  grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
81  grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
82  grainDiaCmd->SetDefaultUnit( "mm" );
83  grainDiaCmd->SetUnitCategory( "Length" );
84  grainDiaCmd->AvailableForStates(G4State_Idle);
85 
86  granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
87  granularityFlagCmd->SetGuidance("Set if sample granularity is present");
88  granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
89  granularityFlagCmd->SetParameterName("Granularity Flag",true);
90  granularityFlagCmd->SetDefaultValue(false);
91  granularityFlagCmd->AvailableForStates(G4State_Idle);
92 
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
96 
98 {
99  delete UpdateCmd;
100  delete detDir;
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
104 
106 {
107  if( command == UpdateCmd )
108  { Detector->UpdateGeometry(); }
109 
110  else if ( command == sampleCmd )
111  { Detector->SetPlaneMaterial(newValue);}
112 
113  else if ( command == detectorCmd )
114  { Detector->SetDetectorType(newValue);}
115 
116  else if ( command == grainDiaCmd )
117  {
118  G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);
119  Detector->SetGrainDia(newSize);
120  }
121 
122  else if ( command == granularityFlagCmd )
123  {
124  Detector->DeleteGrainObjects();
125  G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
126  Detector->SetPlaneGranularity(newGranFlag);
127  }
128 
129 }
130 
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
133 
134 
135 
136 
137 
138 
139 
140 
141 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
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)
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
XrayFluoPlaneDetectorMessenger(XrayFluoPlaneDetectorConstruction *)
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetCandidates(const char *candidateList)
double G4double
Definition: G4Types.hh:76
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)