source: trunk/examples/extended/electromagnetic/TestEm8/src/Em8DetectorMessenger.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

File size: 7.4 KB
Line 
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: Em8DetectorMessenger.cc,v 1.8 2007/10/02 10:12:47 vnivanch Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31
32#include "Em8DetectorMessenger.hh"
33
34#include "Em8DetectorConstruction.hh"
35#include "G4UIdirectory.hh"
36#include "G4UIcmdWithAString.hh"
37#include "G4UIcmdWithAnInteger.hh"
38#include "G4UIcmdWithADoubleAndUnit.hh"
39#include "G4UIcmdWithoutParameter.hh"
40
41///////////////////////////////////////////////////////////////////////////////////
42
43Em8DetectorMessenger::Em8DetectorMessenger(Em8DetectorConstruction * Em8Det)
44:Em8Detector(Em8Det)
45{ 
46  Em8detDir = new G4UIdirectory("/calor/");
47  Em8detDir->SetGuidance("Em8 detector control.");
48     
49  AbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
50  AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
51  AbsMaterCmd->SetParameterName("choice",true);
52  AbsMaterCmd->SetDefaultValue("Lead");
53  AbsMaterCmd->AvailableForStates(G4State_Idle);
54 
55  WorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
56  WorldMaterCmd->SetGuidance("Select Material of the World.");
57  WorldMaterCmd->SetParameterName("wchoice",true);
58  WorldMaterCmd->SetDefaultValue("Air");
59  WorldMaterCmd->AvailableForStates(G4State_Idle);
60 
61  AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
62  AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
63  AbsThickCmd->SetParameterName("SizeZ",false,false);
64  AbsThickCmd->SetDefaultUnit("mm");
65  AbsThickCmd->SetRange("SizeZ>0.");
66  AbsThickCmd->AvailableForStates(G4State_Idle);
67 
68  AbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad",this);
69  AbsRadCmd->SetGuidance("Set radius of the Absorber");
70  AbsRadCmd->SetParameterName("SizeR",false,false);
71  AbsRadCmd->SetDefaultUnit("mm");
72  AbsRadCmd->SetRange("SizeR>0.");
73  AbsRadCmd->AvailableForStates(G4State_Idle);
74 
75  AbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos",this);
76  AbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
77  AbsZposCmd->SetParameterName("Zpos",false,false);
78  AbsZposCmd->SetDefaultUnit("mm");
79  AbsZposCmd->AvailableForStates(G4State_Idle);
80 
81  WorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ",this);
82  WorldZCmd->SetGuidance("Set Z size of the World");
83  WorldZCmd->SetParameterName("WSizeZ",false,false);
84  WorldZCmd->SetDefaultUnit("mm");
85  WorldZCmd->SetRange("WSizeZ>0.");
86  WorldZCmd->AvailableForStates(G4State_Idle);
87 
88  WorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR",this);
89  WorldRCmd->SetGuidance("Set R size of the World");
90  WorldRCmd->SetParameterName("WSizeR",false,false);
91  WorldRCmd->SetDefaultUnit("mm");
92  WorldRCmd->SetRange("WSizeR>0.");
93  WorldRCmd->AvailableForStates(G4State_Idle);
94
95  ElectronCutCmd = new G4UIcmdWithADoubleAndUnit("/calor/setElectronCut",this);
96  ElectronCutCmd->SetGuidance("Set electron cut in mm for vertex region");
97  ElectronCutCmd->SetParameterName("ElectronCut",false,false);
98  ElectronCutCmd->SetDefaultUnit("mm");
99  ElectronCutCmd->SetRange("ElectronCut>0.");
100  ElectronCutCmd->AvailableForStates(G4State_Idle);
101
102  PositronCutCmd = new G4UIcmdWithADoubleAndUnit("/calor/setPositronCut",this);
103  PositronCutCmd->SetGuidance("Set positron cut in mm for vertex region");
104  PositronCutCmd->SetParameterName("PositronCut",false,false);
105  PositronCutCmd->SetDefaultUnit("mm");
106  PositronCutCmd->SetRange("PositronCut>0.");
107  PositronCutCmd->AvailableForStates(G4State_Idle);
108
109  GammaCutCmd = new G4UIcmdWithADoubleAndUnit("/calor/setGammaCut",this);
110  GammaCutCmd->SetGuidance("Set gamma cut in mm for vertex region");
111  GammaCutCmd->SetParameterName("GammaCut",false,false);
112  GammaCutCmd->SetDefaultUnit("mm");
113  GammaCutCmd->SetRange("GammaCut>0.");
114  GammaCutCmd->AvailableForStates(G4State_Idle);
115 
116  UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
117  UpdateCmd->SetGuidance("Update calorimeter geometry.");
118  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
119  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
120  UpdateCmd->AvailableForStates(G4State_Idle);
121     
122}
123
124//////////////////////////////////////////////////////////////////////////////
125
126Em8DetectorMessenger::~Em8DetectorMessenger()
127{
128  delete AbsMaterCmd; 
129  delete AbsThickCmd; 
130  delete AbsRadCmd; 
131  delete AbsZposCmd; 
132  delete WorldMaterCmd;
133  delete WorldZCmd;
134  delete WorldRCmd;
135  delete UpdateCmd;
136  delete GammaCutCmd;
137  delete PositronCutCmd;
138  delete ElectronCutCmd; 
139  delete Em8detDir;
140}
141
142//////////////////////////////////////////////////////////////////////////////////
143
144void Em8DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
145{ 
146  if( command == AbsMaterCmd )
147  { 
148    Em8Detector->SetAbsorberMaterial(newValue);
149  } 
150  if( command == WorldMaterCmd )
151  { 
152    Em8Detector->SetWorldMaterial(newValue);
153  } 
154  if( command == AbsThickCmd )
155  { 
156    Em8Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));
157  } 
158  if( command == AbsRadCmd )
159  { 
160    Em8Detector->SetAbsorberRadius(AbsRadCmd->GetNewDoubleValue(newValue));
161  } 
162  if( command == AbsZposCmd )
163  { 
164    Em8Detector->SetAbsorberZpos(AbsZposCmd->GetNewDoubleValue(newValue));
165  }
166  if( command == WorldZCmd )
167  { 
168    Em8Detector->SetWorldSizeZ(WorldZCmd->GetNewDoubleValue(newValue));
169  } 
170  if( command == WorldRCmd )
171  { 
172    Em8Detector->SetWorldSizeR(WorldRCmd->GetNewDoubleValue(newValue));
173  }
174  if( command == ElectronCutCmd )
175  { 
176    Em8Detector->SetElectronCut(WorldRCmd->GetNewDoubleValue(newValue));
177  }
178  if( command == PositronCutCmd )
179  { 
180    Em8Detector->SetPositronCut(WorldRCmd->GetNewDoubleValue(newValue));
181  }
182  if( command == GammaCutCmd )
183  { 
184    Em8Detector->SetGammaCut(WorldRCmd->GetNewDoubleValue(newValue));
185  }
186  if( command == UpdateCmd )
187  { 
188    Em8Detector->UpdateGeometry(); 
189  }
190
191
192}
193
194/////////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.