| 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 | #include "TstDrawVox01DetectorMessenger.hh"
|
|---|
| 28 |
|
|---|
| 29 | #include "TstDrawVox01DetectorConstruction.hh"
|
|---|
| 30 | #include "G4UIdirectory.hh"
|
|---|
| 31 | #include "G4UIcmdWithAString.hh"
|
|---|
| 32 | #include "globals.hh"
|
|---|
| 33 |
|
|---|
| 34 | #include "G4ios.hh"
|
|---|
| 35 |
|
|---|
| 36 | TstDrawVox01DetectorMessenger::TstDrawVox01DetectorMessenger(TstDrawVox01DetectorConstruction * myDC)
|
|---|
| 37 | :myDetector(myDC)
|
|---|
| 38 | {
|
|---|
| 39 | G4String defParam;
|
|---|
| 40 |
|
|---|
| 41 | mydetDir = new G4UIdirectory("/mydet/");
|
|---|
| 42 | mydetDir->SetGuidance("Detector setup commands.");
|
|---|
| 43 |
|
|---|
| 44 | selDetCmd = new G4UIcmdWithAString("/mydet/SelectDetector",this);
|
|---|
| 45 | selDetCmd->SetGuidance("Select Detector Setup.");
|
|---|
| 46 | selDetCmd->SetGuidance(" Choice : SimpleBox / Honeycomb ");
|
|---|
| 47 | selDetCmd->SetParameterName("choice",true);
|
|---|
| 48 | selDetCmd->SetDefaultValue("SimpleBox");
|
|---|
| 49 | selDetCmd->SetCandidates("SimpleBox Honeycomb");
|
|---|
| 50 | selDetCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 51 |
|
|---|
| 52 | switchCmd = new G4UIcmdWithAString("/mydet/SwitchDetector",this);
|
|---|
| 53 | switchCmd->SetGuidance("Assign the selected geometry to G4RunManager.");
|
|---|
| 54 | switchCmd->SetGuidance("In cese detector name is associated to this command,");
|
|---|
| 55 | switchCmd->SetGuidance("\"/mydet/SelectDetector\" will be invoked and then switched.");
|
|---|
| 56 | switchCmd->SetParameterName("choice",true);
|
|---|
| 57 | switchCmd->SetDefaultValue(" ");
|
|---|
| 58 | switchCmd->SetCandidates("SimpleBox Honeycomb \" \"");
|
|---|
| 59 | switchCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 60 |
|
|---|
| 61 | selMatCmd = new G4UIcmdWithAString("/mydet/SelectMaterial",this);
|
|---|
| 62 | selMatCmd->SetGuidance("Select Material of the SimpleBox.");
|
|---|
| 63 | selMatCmd->SetGuidance(" Choice : Air, Al, Pb (default)");
|
|---|
| 64 | selMatCmd->SetParameterName("choice",true);
|
|---|
| 65 | selMatCmd->SetDefaultValue("Pb");
|
|---|
| 66 | selMatCmd->SetCandidates("Air Al Pb");
|
|---|
| 67 | selMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 68 |
|
|---|
| 69 | myDetector->SelectDetector(defParam="SimpleBox");
|
|---|
| 70 | myDetector->SelectMaterial(defParam="Pb");
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | void TstDrawVox01DetectorMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
|
|---|
| 74 | {
|
|---|
| 75 | if( command == selDetCmd )
|
|---|
| 76 | {
|
|---|
| 77 | myDetector->SelectDetector(newValues);
|
|---|
| 78 | }
|
|---|
| 79 | if( command == switchCmd )
|
|---|
| 80 | {
|
|---|
| 81 | if(newValues=="SimpleBox" || newValues=="Honeycomb")
|
|---|
| 82 | { myDetector->SelectDetector(newValues); }
|
|---|
| 83 | myDetector->SwitchDetector();
|
|---|
| 84 | }
|
|---|
| 85 | if( command == selMatCmd )
|
|---|
| 86 | {
|
|---|
| 87 | myDetector->SelectMaterial(newValues);
|
|---|
| 88 | }
|
|---|
| 89 | return;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|