Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "G4RunManager.hh"
43 #include "G4UIdirectory.hh"
44 #include "G4UIcmdWithAString.hh"
47 #include "G4UIcmdWithABool.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
52 :Detector(Det)
53 {
54  detDir = new G4UIdirectory("/apparate/");
55  detDir->SetGuidance("detector control.");
56 
57  UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
58  UpdateCmd->SetGuidance("Update apparate geometry.");
59  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
60  UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
61 
62  UpdateCmd->AvailableForStates(G4State_Idle);
63 
64  sampleCmd = new G4UIcmdWithAString("/apparate/planeMaterial",this);
65  sampleCmd->SetGuidance("select a diferent material for the plane");
66  sampleCmd->SetParameterName("material",true);
67  sampleCmd->SetDefaultValue("mars1");
68  sampleCmd->SetCandidates("Dolorite Anorthosite Mars1 IceBasalt");
69  sampleCmd->AvailableForStates(G4State_Idle);
70 
71  detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
72  detectorCmd->SetGuidance("select a diferent detectorType");
73  detectorCmd->SetParameterName("detector",true);
74  detectorCmd->SetDefaultValue("sili");
75  detectorCmd->SetCandidates("sili hpge");
76  detectorCmd->AvailableForStates(G4State_Idle);
77 
78  grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
79  grainDiaCmd->SetGuidance( "Set diameter of grains" );
80  grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
81  grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
82  grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
83  grainDiaCmd->SetDefaultUnit( "mm" );
84  grainDiaCmd->SetUnitCategory( "Length" );
85  grainDiaCmd->AvailableForStates(G4State_Idle);
86 
87  granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
88  granularityFlagCmd->SetGuidance("Set if sample granularity is present");
89  granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
90  granularityFlagCmd->SetParameterName("Granularity Flag",true);
91  granularityFlagCmd->SetDefaultValue(false);
92  granularityFlagCmd->AvailableForStates(G4State_Idle);
93 
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
97 
99 {
100  delete UpdateCmd;
101  delete detDir;
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
105 
107 {
108  if( command == UpdateCmd )
109  {
110  //This triggers a full re-build of the geometry. The method in the
111  //geometry will take care of that.
112  Detector->UpdateGeometry();
113  return;
114  }
115  else if ( command == sampleCmd )
116  {
117  Detector->SetPlaneMaterial(newValue);
118  }
119  else if ( command == detectorCmd )
120  {
121  Detector->SetDetectorType(newValue);
122  }
123  else if ( command == grainDiaCmd )
124  {
125  G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);
126  Detector->SetGrainDia(newSize);
127  }
128  else if ( command == granularityFlagCmd )
129  {
130  Detector->DeleteGrainObjects();
131  G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
132  Detector->SetPlaneGranularity(newGranFlag);
133  }
134  //Notify the run manager that the geometry has been modified
136 
137 }
138 
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
141 
142 
143 
144 
145 
146 
147 
148 
149 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void GeometryHasBeenModified(G4bool prop=true)
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:240
XrayFluoPlaneDetectorMessenger(XrayFluoPlaneDetectorConstruction *)
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 SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)