| 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: test19DetectorMessenger.cc,v 1.8 2006/06/29 21:34:42 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-02-ref-03 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // Detector Construction Messenger for visualization testing.
|
|---|
| 32 | // John Allison 25th April 1997
|
|---|
| 33 |
|
|---|
| 34 | #include "test19DetectorMessenger.hh"
|
|---|
| 35 |
|
|---|
| 36 | #include "test19DetectorConstruction.hh"
|
|---|
| 37 | #include "MyDetectorConstruction.hh"
|
|---|
| 38 |
|
|---|
| 39 | #include "G4StateManager.hh"
|
|---|
| 40 | #include "G4UImanager.hh"
|
|---|
| 41 | #include "G4UIcommand.hh"
|
|---|
| 42 | #include "G4UIparameter.hh"
|
|---|
| 43 | #include "G4VPhysicalVolume.hh"
|
|---|
| 44 |
|
|---|
| 45 | #include "BuildCalorimeter.hh"
|
|---|
| 46 | #include "BuildGeom_Example1.hh"
|
|---|
| 47 | #include "BuildGeom_Example2.hh"
|
|---|
| 48 | #include "BuildParametrised.hh"
|
|---|
| 49 | #include "BuildHouse.hh"
|
|---|
| 50 |
|
|---|
| 51 | #include <sstream>
|
|---|
| 52 |
|
|---|
| 53 | #ifdef ATLAS
|
|---|
| 54 | #include "ATLASdetector.hh"
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | test19DetectorMessenger::test19DetectorMessenger
|
|---|
| 58 | (test19DetectorConstruction * test19Det)
|
|---|
| 59 | :test19Detector (test19Det)
|
|---|
| 60 | {
|
|---|
| 61 | G4UIcommand * command;
|
|---|
| 62 | G4UIparameter * param;
|
|---|
| 63 |
|
|---|
| 64 | command = new G4UIcommand ("/test19det/", this);
|
|---|
| 65 | command -> SetGuidance ("test19 detector choice.");
|
|---|
| 66 | fpTest19DetCommandDirectory = command;
|
|---|
| 67 |
|
|---|
| 68 | command = new G4UIcommand ("/test19det/detector",this);
|
|---|
| 69 | command -> SetGuidance ("test19 detector choice. Give integer.");
|
|---|
| 70 | command -> SetGuidance
|
|---|
| 71 | (
|
|---|
| 72 | "0) Part of original test calorimeter"
|
|---|
| 73 | "\n1) Example1 (LBNO, no rotation)"
|
|---|
| 74 | "\n2) Example2 (embryo LBNO, rotated volumes)"
|
|---|
| 75 | "\n3) A parametrised volume"
|
|---|
| 76 | "\n4) MyDetector"
|
|---|
| 77 | "\n5) House"
|
|---|
| 78 | #ifdef ATLAS
|
|---|
| 79 | "\n6) ATLAS (selected part)"
|
|---|
| 80 | #endif
|
|---|
| 81 | );
|
|---|
| 82 | param = new G4UIparameter ("detector id", 'i', true);
|
|---|
| 83 | param -> SetDefaultValue (-1);
|
|---|
| 84 | command -> SetParameter (param);
|
|---|
| 85 | fpDetectorCommand = command;
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | test19DetectorMessenger::~test19DetectorMessenger () {
|
|---|
| 89 | delete fpDetectorCommand;
|
|---|
| 90 | delete fpTest19DetCommandDirectory;
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | void test19DetectorMessenger::SetNewValue
|
|---|
| 94 | (G4UIcommand * command, G4String newValues)
|
|---|
| 95 | {
|
|---|
| 96 | if (command == fpDetectorCommand) {
|
|---|
| 97 | G4int id;
|
|---|
| 98 | std::istringstream is(newValues) ; is >> id;
|
|---|
| 99 | #ifdef ATLAS
|
|---|
| 100 | const G4int idMax = 6;
|
|---|
| 101 | #else
|
|---|
| 102 | const G4int idMax = 5;
|
|---|
| 103 | #endif
|
|---|
| 104 | if (id < 0 || id > idMax) {
|
|---|
| 105 | G4cout << "Available detectors:"
|
|---|
| 106 | << "\n0) Part of original test calorimeter"
|
|---|
| 107 | << "\n1) Example1 (LBNO, no rotation)"
|
|---|
| 108 | << "\n2) Example2 (embryo LBNO, rotated volumes)"
|
|---|
| 109 | << "\n3) A parametrised volume"
|
|---|
| 110 | << "\n4) MyDetector"
|
|---|
| 111 | #ifdef ATLAS
|
|---|
| 112 | << "\n5) ATLAS (selected part)"
|
|---|
| 113 | #endif
|
|---|
| 114 | << "\nChoose by specifying integer parameter."
|
|---|
| 115 | << G4endl;
|
|---|
| 116 | }
|
|---|
| 117 | else {
|
|---|
| 118 | G4VPhysicalVolume* pGeom;
|
|---|
| 119 | G4VUserDetectorConstruction* detector;
|
|---|
| 120 | #ifdef ATLAS
|
|---|
| 121 | ATLASdetector* atlas;
|
|---|
| 122 | #endif
|
|---|
| 123 | switch (id) {
|
|---|
| 124 | default:
|
|---|
| 125 | case 0: pGeom = BuildCalorimeter (); break;
|
|---|
| 126 | case 1: pGeom = BuildGeom_Example1(); break;
|
|---|
| 127 | case 2: pGeom = BuildGeom_Example2(); break;
|
|---|
| 128 | case 3: pGeom = BuildParametrised(); break;
|
|---|
| 129 | case 4:
|
|---|
| 130 | detector = new MyDetectorConstruction;
|
|---|
| 131 | //G4cout <<
|
|---|
| 132 | // "Now further commands before constructing MyDetector."
|
|---|
| 133 | // "\nType continue to Construct MyDetector..."
|
|---|
| 134 | // << G4endl;
|
|---|
| 135 | //G4StateManager::GetStateManager () -> Pause ();
|
|---|
| 136 | pGeom = detector -> Construct ();
|
|---|
| 137 | break;
|
|---|
| 138 | case 5: pGeom = BuildHouse(); break;
|
|---|
| 139 | #ifdef ATLAS
|
|---|
| 140 | case 6:
|
|---|
| 141 | atlas = new ATLASdetector();
|
|---|
| 142 | // G4UImanager* UI = G4UImanager::GetUIpointer ();
|
|---|
| 143 | // UI -> ApplyCommand ("/atlas/innerDetector/barrelSilicon 1");
|
|---|
| 144 | // UI -> ApplyCommand ("/atlas/innerDetector/pixel 1");
|
|---|
| 145 | // Build ATLAS detector geometry
|
|---|
| 146 | G4cout <<
|
|---|
| 147 | "Now further ATLAS commands before constructing."
|
|---|
| 148 | "\nType continue to Construct ATLAS..."
|
|---|
| 149 | << G4endl;
|
|---|
| 150 | G4StateManager::GetStateManager () -> Pause ();
|
|---|
| 151 | pGeom = atlas -> buildATLAS ();
|
|---|
| 152 | G4cout << "ATLAS geometrical definition Done." << G4endl;
|
|---|
| 153 | break;
|
|---|
| 154 | #endif
|
|---|
| 155 | }
|
|---|
| 156 | test19Detector -> SetDetector (pGeom);
|
|---|
| 157 | }
|
|---|
| 158 | }
|
|---|
| 159 | }
|
|---|