Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorMessenger.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 //
28 //
29 //
30 // $Id$
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
36 
37 #include "DetectorMessenger.hh"
38 
39 #include "DetectorConstruction.hh"
40 #include "G4UIdirectory.hh"
41 #include "G4UIcmdWithAString.hh"
42 #include "G4UIcmdWithAnInteger.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 :Detector(Det)
50 {
51  fN03Dir = new G4UIdirectory("/N03/");
52  fN03Dir->SetGuidance("UI commands of this example");
53 
54  fDetDir = new G4UIdirectory("/N03/det/");
55  fDetDir->SetGuidance("detector control");
56 
57  fAbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
58  fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
59  fAbsMaterCmd->SetParameterName("choice",false);
61 
62  fGapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
63  fGapMaterCmd->SetGuidance("Select Material of the Gap.");
64  fGapMaterCmd->SetParameterName("choice",false);
66 
67  fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
68  fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
69  fAbsThickCmd->SetParameterName("Size",false);
70  fAbsThickCmd->SetRange("Size>=0.");
71  fAbsThickCmd->SetUnitCategory("Length");
73 
74  fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
75  fGapThickCmd->SetGuidance("Set Thickness of the Gap");
76  fGapThickCmd->SetParameterName("Size",false);
77  fGapThickCmd->SetRange("Size>=0.");
78  fGapThickCmd->SetUnitCategory("Length");
80 
81  fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
82  fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
83  fSizeYZCmd->SetParameterName("Size",false);
84  fSizeYZCmd->SetRange("Size>0.");
85  fSizeYZCmd->SetUnitCategory("Length");
87 
88  fNbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
89  fNbLayersCmd->SetGuidance("Set number of layers.");
90  fNbLayersCmd->SetParameterName("NbLayers",false);
91  fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
93 
94  fUpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
95  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
96  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
97  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
98  fUpdateCmd->AvailableForStates(G4State_Idle);
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
104 {
105  delete fNbLayersCmd;
106  delete fAbsMaterCmd; delete fGapMaterCmd;
107  delete fAbsThickCmd; delete fGapThickCmd;
108  delete fSizeYZCmd; delete fUpdateCmd;
109  delete fDetDir;
110  delete fN03Dir;
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
116 {
117  if( command == fAbsMaterCmd )
118  { Detector->SetAbsorberMaterial(newValue);}
119 
120  if( command == fGapMaterCmd )
121  { Detector->SetGapMaterial(newValue);}
122 
123  if( command == fAbsThickCmd )
124  { Detector->SetAbsorberThickness(fAbsThickCmd
125  ->GetNewDoubleValue(newValue));}
126 
127  if( command == fGapThickCmd )
128  { Detector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));}
129 
130  if( command == fSizeYZCmd )
131  { Detector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));}
132 
133  if( command == fNbLayersCmd )
134  { Detector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));}
135 
136  if( command == fUpdateCmd )
137  { Detector->UpdateGeometry(); }
138 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......