source: trunk/source/geometry/solids/test/OpticalEscape/src/AXPETDetectorMessenger.cc@ 1350

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

geant4 tag 9.4

File size: 5.2 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// $Id: AXPETDetectorMessenger.cc,v 1.2 2010/11/16 13:36:00 tnikitin Exp $
27// ------------------------------------------------------------
28// Geant4 class implementation file
29//
30// 03/09/2008, by T.Nikitina
31// ------------------------------------------------------------
32
33#include "AXPETDetectorMessenger.hh"
34
35#include "AXPETDetectorConstruction.hh"
36#include "G4UIdirectory.hh"
37#include "G4UIcmdWithAString.hh"
38#include "G4UIcmdWithADouble.hh"
39#include "G4UIcmdWithAnInteger.hh"
40#include "globals.hh"
41
42#include "G4ios.hh"
43
44AXPETDetectorMessenger::AXPETDetectorMessenger(AXPETDetectorConstruction * myDC)
45 : myDetector(myDC)
46{
47 G4String defParam;
48
49 mydetDir = new G4UIdirectory("/mydet/");
50 mydetDir->SetGuidance("Detector setup commands.");
51
52 selDetCmd = new G4UIcmdWithAString("/mydet/SelectDetector",this);
53 selDetCmd->SetGuidance("Select Detector Setup.");
54 selDetCmd->SetGuidance(" Choice : Detector type ");
55 selDetCmd->SetParameterName("choice",true);
56 selDetCmd->SetDefaultValue("Tubs");
57
58 selDetCmd->SetCandidates("Trap Trd Tet Sphere HalfSphere HollowSphere HalfHollowSphere Ring Shell Orb Box Cons manyCons Tubs Hype Torus Para Paraboloid Polycone PolyconeGen PolyconeGenComplex Polyhedra PolyhedraGen PolyhedraGenComplex BREPBox Trd b1Ib2 b1Ub2 b1Sb2 b1Ub1 b1Ib1 b1Sb1 Ellipsoid EllipticalCone EllipticalTube Tet GenericTrap TwistedBox TwistedTrd TwistedTrap TwistedTubs TessellatedSolid ExtrudedSolid");
59 selDetCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
60
61 rotXCmd = new G4UIcmdWithADouble("/mydet/RotateX",this);
62 rotXCmd->SetGuidance("Rotation in X direction ");
63 rotXCmd->SetGuidance(" Choice : deg");
64 rotXCmd->SetParameterName("choice",true);
65 rotXCmd->SetDefaultValue(0.0);
66 rotXCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
67
68 rotYCmd = new G4UIcmdWithADouble("/mydet/RotateY",this);
69 rotYCmd->SetGuidance("Rotation in Y direction ");
70 rotYCmd->SetGuidance(" Choice : deg");
71 rotYCmd->SetParameterName("choice",true);
72 rotYCmd->SetDefaultValue(0.0);
73 rotYCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
74
75 rotZCmd = new G4UIcmdWithADouble("/mydet/RotateZ",this);
76 rotZCmd->SetGuidance("Rotation in Z direction ");
77 rotZCmd->SetGuidance(" Choice : deg");
78 rotZCmd->SetParameterName("choice",true);
79 rotZCmd->SetDefaultValue(0.0);
80 rotZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
81
82 AbortCmd = new G4UIcmdWithAnInteger("/mydet/AbortRun",this);
83 AbortCmd->SetGuidance("Abortion of Run instead of Warnings ");
84 AbortCmd->SetGuidance(" Choice : 0/1");
85 AbortCmd->SetParameterName("choice",true);
86 AbortCmd->SetDefaultValue(0);
87 AbortCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
88
89 // myDetector->SelectDetector(defParam="Tubs");
90 myDetector->SetDetectorName(defParam="Tubs");
91 myDetector->Construct();
92
93
94
95
96}
97AXPETDetectorMessenger::~AXPETDetectorMessenger() {
98 delete rotXCmd;
99 delete rotYCmd;
100 delete rotZCmd;
101 delete AbortCmd;
102 delete selDetCmd;
103}
104void AXPETDetectorMessenger::SetNewValue(G4UIcommand * command,
105 G4String newValues)
106{
107 if( command == selDetCmd )
108 {
109 //myDetector->SelectDetector(newValues);
110 myDetector->SetDetectorName(newValues);
111 myDetector->Construct();
112 myDetector->SwitchDetector();
113 }
114 if( command == rotXCmd)
115 {
116 myDetector->SetRotationInX(rotXCmd->GetNewDoubleValue(newValues));
117 }
118 if( command == rotYCmd)
119 {
120 myDetector->SetRotationInY(rotYCmd->GetNewDoubleValue(newValues));
121 }
122 if( command == rotZCmd)
123 {
124 myDetector->SetRotationInZ(rotZCmd->GetNewDoubleValue(newValues));
125 }
126
127 if( command == AbortCmd)
128 {
129 myDetector->SetAbortAction(AbortCmd->GetNewIntValue(newValues));
130 }
131
132 return;
133}
Note: See TracBrowser for help on using the repository browser.