source: trunk/examples/extended/electromagnetic/TestEm9/src/DetectorMessenger.cc@ 1337

Last change on this file since 1337 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 7.6 KB
RevLine 
[807]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: DetectorMessenger.cc,v 1.3 2006/06/29 17:03:01 gunter Exp $
[1337]28// GEANT4 tag $Name: geant4-09-04-beta-01 $
[807]29//
30//
31/////////////////////////////////////////////////////////////////////////
32//
33// TestEm9: Crystal calorimeter
34//
35// Created: 31.01.03 V.Ivanchenko
36//
37// Modified:
38//
39////////////////////////////////////////////////////////////////////////
40//
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
45#include "DetectorMessenger.hh"
46
47#include "DetectorConstruction.hh"
48#include "G4UIdirectory.hh"
49#include "G4UIcmdWithAString.hh"
50#include "G4UIcmdWith3Vector.hh"
51#include "G4UIcmdWithADoubleAndUnit.hh"
52#include "G4UIcmdWithoutParameter.hh"
53#include "HistoManager.hh"
54
55//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
58:Detector(Det)
59{
60 testemDir = new G4UIdirectory("/testem/");
61 testemDir->SetGuidance(" detector control.");
62
63 MaterCmd = new G4UIcmdWithAString("/testem/det/CalMat",this);
64 MaterCmd->SetGuidance("Select Material for calorimeter");
65 MaterCmd->SetParameterName("calMaterial",false);
66 MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
67
68 LBinCmd = new G4UIcmdWithAString("/testem/det/AbsMat",this);
69 LBinCmd->SetGuidance("Select Material for absorber");
70 LBinCmd->SetParameterName("absMarerial",false);
71 LBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
72
73 l1Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalLength",this);
74 l1Cmd->SetGuidance("Set length of Ecal");
75 l1Cmd->SetParameterName("lEcal",false);
76 l1Cmd->SetUnitCategory("Length");
77 l1Cmd->SetRange("lEcal>0");
78 l1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
79
80 l2Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalWidth",this);
81 l2Cmd->SetGuidance("Set width of Ecal crystal");
82 l2Cmd->SetParameterName("wEcal",false);
83 l2Cmd->SetUnitCategory("Length");
84 l2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
85
86 l3Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/AbsLength",this);
87 l3Cmd->SetGuidance("Set length of the absorber");
88 l3Cmd->SetParameterName("lAbs",false);
89 l3Cmd->SetUnitCategory("Length");
90 l3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
91
92 l4Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/VertexLength",this);
93 l4Cmd->SetGuidance("Set length of the vertex region");
94 l4Cmd->SetParameterName("lVert",false);
95 l4Cmd->SetUnitCategory("Length");
96 l4Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
97
98 l5Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadLength",this);
99 l5Cmd->SetGuidance("Set length of vertex detector");
100 l5Cmd->SetParameterName("lPad",false);
101 l5Cmd->SetUnitCategory("Length");
102 l5Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
103
104 l6Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadWidth",this);
105 l6Cmd->SetGuidance("Set width of a vertex pad");
106 l6Cmd->SetParameterName("wPad",false);
107 l6Cmd->SetUnitCategory("Length");
108 l6Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
109
110 UpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this);
111 UpdateCmd->SetGuidance("Update geometry.");
112 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
113 UpdateCmd->SetGuidance("if you changed geometrical value(s)");
114 UpdateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
115
116
117 accCmd1 = new G4UIcmdWith3Vector("/testem/det/acceptance1",this);
118 accCmd1->SetGuidance("set Edep and RMS");
119 accCmd1->SetGuidance("acceptance values for central cell");
120 accCmd1->SetParameterName("edep","rms","limit",true);
121 accCmd1->SetRange("edep>0 && edep<1 && rms>0");
122 accCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
123
124 accCmd2 = new G4UIcmdWith3Vector("/testem/det/acceptance9",this);
125 accCmd2->SetGuidance("set Edep and RMS");
126 accCmd2->SetGuidance("acceptance values for 3x3 matrix");
127 accCmd2->SetParameterName("edep","rms","limit",true);
128 accCmd2->SetRange("edep>0 && edep<1 && rms>0");
129 accCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
130
131 accCmd3 = new G4UIcmdWith3Vector("/testem/det/acceptance25",this);
132 accCmd3->SetGuidance("set Edep and RMS");
133 accCmd3->SetGuidance("acceptance values for 5x5 matrix");
134 accCmd3->SetParameterName("edep","rms","limit",true);
135 accCmd3->SetRange("edep>0 && edep<1 && rms>0");
136 accCmd3->AvailableForStates(G4State_PreInit,G4State_Idle);
137
138}
139
140//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141
142DetectorMessenger::~DetectorMessenger()
143{
144 delete MaterCmd;
145 delete LBinCmd;
146 delete l1Cmd;
147 delete l2Cmd;
148 delete l3Cmd;
149 delete l4Cmd;
150 delete l5Cmd;
151 delete l6Cmd;
152 delete UpdateCmd;
153 delete testemDir;
154 delete accCmd1;
155 delete accCmd2;
156 delete accCmd3;
157}
158
159//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160
161void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
162{
163 if( command == MaterCmd )
164 { Detector->SetEcalMaterial(newValue);}
165
166 if( command == LBinCmd )
167 { Detector->SetAbsMaterial(newValue);}
168
169 if( command == l1Cmd )
170 { Detector->SetEcalLength(l1Cmd->GetNewDoubleValue(newValue));}
171
172 if( command == l2Cmd )
173 { Detector->SetEcalWidth(l2Cmd->GetNewDoubleValue(newValue));}
174
175 if( command == l3Cmd )
176 { Detector->SetAbsLength(l3Cmd->GetNewDoubleValue(newValue));}
177
178 if( command == l4Cmd )
179 { Detector->SetVertexLength(l4Cmd->GetNewDoubleValue(newValue));}
180
181 if( command == l5Cmd )
182 { Detector->SetPadLength(l5Cmd->GetNewDoubleValue(newValue));}
183
184 if( command == l6Cmd )
185 { Detector->SetPadWidth(l6Cmd->GetNewDoubleValue(newValue));}
186
187 if( command == UpdateCmd )
188 { Detector->UpdateGeometry();}
189
190 HistoManager* histo = HistoManager::GetPointer();
191 if( command == accCmd1 )
192 { histo->SetEdepAndRMS(0,accCmd1->GetNew3VectorValue(newValue));}
193
194 if( command == accCmd2 )
195 { histo->SetEdepAndRMS(1,accCmd2->GetNew3VectorValue(newValue));}
196
197 if( command == accCmd3 )
198 { histo->SetEdepAndRMS(2,accCmd3->GetNew3VectorValue(newValue));}
199
200
201}
202
203//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
204
Note: See TracBrowser for help on using the repository browser.