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: TstVADetectorMessenger.cc,v 1.6 2006/06/29 18:34:35 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | // -------------------------------------------------------------- |
---|
31 | |
---|
32 | #include "globals.hh" |
---|
33 | #include "G4ios.hh" |
---|
34 | |
---|
35 | #include "TstVADetectorMessenger.hh" |
---|
36 | |
---|
37 | #include "TstVADetectorConstruction.hh" |
---|
38 | #include "G4UIdirectory.hh" |
---|
39 | #include "G4UIcmdWithAString.hh" |
---|
40 | |
---|
41 | TstVADetectorMessenger::TstVADetectorMessenger(TstVADetectorConstruction * myDC) |
---|
42 | :myDetector(myDC) |
---|
43 | { |
---|
44 | G4String defParam; |
---|
45 | |
---|
46 | mydetDir = new G4UIdirectory("/geom/"); |
---|
47 | mydetDir->SetGuidance("Geometry setup commands."); |
---|
48 | |
---|
49 | selDetCmd = new G4UIcmdWithAString("/geom/select",this); |
---|
50 | selDetCmd->SetGuidance("Select the way detector geometry is built."); |
---|
51 | selDetCmd->SetGuidance(" classic: use simple placements "); |
---|
52 | selDetCmd->SetGuidance(" assembly: use assembly volume " ); |
---|
53 | selDetCmd->SetParameterName("choice",true); |
---|
54 | selDetCmd->SetDefaultValue("classic"); |
---|
55 | selDetCmd->SetCandidates("classic assembly"); |
---|
56 | selDetCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
57 | |
---|
58 | switchCmd = new G4UIcmdWithAString("/geom/switch",this); |
---|
59 | switchCmd->SetGuidance("Assign the selected geometry to G4RunManager."); |
---|
60 | switchCmd->SetGuidance("In case the choice is present to this command,"); |
---|
61 | switchCmd->SetGuidance("\"/geom/select\" will be invoked and then switched."); |
---|
62 | switchCmd->SetParameterName("choice",true); |
---|
63 | switchCmd->SetDefaultValue(" "); |
---|
64 | switchCmd->SetCandidates("classic assembly \" \""); |
---|
65 | switchCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
66 | |
---|
67 | selMatCmd = new G4UIcmdWithAString("/geom/material",this); |
---|
68 | selMatCmd->SetGuidance("UNUSED IN THIS VERSION...\n\n"); |
---|
69 | selMatCmd->SetGuidance("Select Material of the SimpleBox."); |
---|
70 | selMatCmd->SetGuidance(" Choice : Air, Al, Pb (default)"); |
---|
71 | selMatCmd->SetParameterName("choice",true); |
---|
72 | selMatCmd->SetDefaultValue("Pb"); |
---|
73 | selMatCmd->SetCandidates("Air Al Pb"); |
---|
74 | selMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
75 | |
---|
76 | myDetector->SelectDetector(defParam="classic"); |
---|
77 | myDetector->SelectMaterial(defParam="Pb"); |
---|
78 | } |
---|
79 | |
---|
80 | void TstVADetectorMessenger::SetNewValue(G4UIcommand * command,G4String newValues) |
---|
81 | { |
---|
82 | if( command == selDetCmd ) |
---|
83 | { |
---|
84 | myDetector->SelectDetector(newValues); |
---|
85 | } |
---|
86 | if( command == switchCmd ) |
---|
87 | { |
---|
88 | if(newValues=="classic" || newValues=="assembly") |
---|
89 | { myDetector->SelectDetector(newValues); } |
---|
90 | myDetector->SwitchDetector(); |
---|
91 | } |
---|
92 | if( command == selMatCmd ) |
---|
93 | { |
---|
94 | myDetector->SelectMaterial(newValues); |
---|
95 | //G4cout << "UNUSED IN THIS VERSION...\a" << G4endl; |
---|
96 | } |
---|
97 | return; |
---|
98 | } |
---|
99 | |
---|