Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm12/src/Detecto << 23 // $Id: DetectorMessenger.cc,v 1.1 2005/07/22 11:08:48 maire Exp $ 27 /// \brief Implementation of the DetectorMesse << 24 // GEANT4 tag $Name: geant4-08-00 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "DetectorMessenger.hh" 29 #include "DetectorMessenger.hh" 34 30 35 #include "DetectorConstruction.hh" 31 #include "DetectorConstruction.hh" 36 << 32 #include "G4UIdirectory.hh" 37 #include "G4UIcmdWithADoubleAndUnit.hh" << 38 #include "G4UIcmdWithAString.hh" 33 #include "G4UIcmdWithAString.hh" 39 #include "G4UIcmdWithAnInteger.hh" 34 #include "G4UIcmdWithAnInteger.hh" 40 #include "G4UIdirectory.hh" << 35 #include "G4UIcmdWithADoubleAndUnit.hh" >> 36 #include "G4UIcmdWithoutParameter.hh" 41 37 42 //....oooOO0OOooo........oooOO0OOooo........oo 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 39 44 DetectorMessenger::DetectorMessenger(DetectorC << 40 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) 45 { << 41 :Detector(Det) 46 fTestemDir = new G4UIdirectory("/testem/"); << 42 { 47 fTestemDir->SetGuidance(" detector control." << 43 testemDir = new G4UIdirectory("/testem/"); 48 << 44 testemDir->SetGuidance(" detector control."); 49 fDetDir = new G4UIdirectory("/testem/det/"); << 45 50 fDetDir->SetGuidance("detector construction << 46 detDir = new G4UIdirectory("/testem/det/"); 51 << 47 detDir->SetGuidance("detector construction commands"); 52 fMaterCmd = new G4UIcmdWithAString("/testem/ << 48 53 fMaterCmd->SetGuidance("Select material of t << 49 MaterCmd = new G4UIcmdWithAString("/testem/det/setMat",this); 54 fMaterCmd->SetParameterName("choice", false) << 50 MaterCmd->SetGuidance("Select material of the box."); 55 fMaterCmd->AvailableForStates(G4State_PreIni << 51 MaterCmd->SetParameterName("choice",false); 56 fMaterCmd->SetToBeBroadcasted(false); << 52 MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 57 << 53 58 fRadiusCmd = new G4UIcmdWithADoubleAndUnit(" << 54 RadiusCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setRadius",this); 59 fRadiusCmd->SetGuidance("Set radius of the a << 55 RadiusCmd->SetGuidance("Set radius of the absorber"); 60 fRadiusCmd->SetParameterName("Radius", false << 56 RadiusCmd->SetParameterName("Radius",false); 61 fRadiusCmd->SetRange("Radius>0."); << 57 RadiusCmd->SetRange("Radius>0."); 62 fRadiusCmd->SetUnitCategory("Length"); << 58 RadiusCmd->SetUnitCategory("Length"); 63 fRadiusCmd->AvailableForStates(G4State_PreIn << 59 RadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 64 fRadiusCmd->SetToBeBroadcasted(false); << 60 65 << 61 NbLayersCmd = new G4UIcmdWithAnInteger("/testem/det/setNbOfLayers",this); 66 fNbLayersCmd = new G4UIcmdWithAnInteger("/te << 62 NbLayersCmd->SetGuidance("Set number of layers"); 67 fNbLayersCmd->SetGuidance("Set number of lay << 63 NbLayersCmd->SetParameterName("NbLayers",false); 68 fNbLayersCmd->SetParameterName("NbLayers", f << 64 NbLayersCmd->SetRange("NbLayers>0"); 69 fNbLayersCmd->SetRange("NbLayers>0"); << 65 NbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 70 fNbLayersCmd->AvailableForStates(G4State_Pre << 66 71 fNbLayersCmd->SetToBeBroadcasted(false); << 67 MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setField",this); >> 68 MagFieldCmd->SetGuidance("Define magnetic field."); >> 69 MagFieldCmd->SetGuidance("Magnetic field will be in Z direction."); >> 70 MagFieldCmd->SetParameterName("Bz",false); >> 71 MagFieldCmd->SetUnitCategory("Magnetic flux density"); >> 72 MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle); >> 73 >> 74 UpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this); >> 75 UpdateCmd->SetGuidance("Update calorimeter geometry."); >> 76 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); >> 77 UpdateCmd->SetGuidance("if you changed geometrical value(s)."); >> 78 UpdateCmd->AvailableForStates(G4State_Idle); 72 } 79 } 73 80 74 //....oooOO0OOooo........oooOO0OOooo........oo 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 82 76 DetectorMessenger::~DetectorMessenger() 83 DetectorMessenger::~DetectorMessenger() 77 { 84 { 78 delete fMaterCmd; << 85 delete MaterCmd; 79 delete fRadiusCmd; << 86 delete RadiusCmd; 80 delete fNbLayersCmd; << 87 delete NbLayersCmd; 81 delete fDetDir; << 88 delete MagFieldCmd; 82 delete fTestemDir; << 89 delete UpdateCmd; >> 90 delete detDir; >> 91 delete testemDir; 83 } 92 } 84 93 85 //....oooOO0OOooo........oooOO0OOooo........oo 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 86 95 87 void DetectorMessenger::SetNewValue(G4UIcomman << 96 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 88 { << 97 { 89 if (command == fMaterCmd) { << 98 if( command == MaterCmd ) 90 fDetector->SetMaterial(newValue); << 99 { Detector->SetMaterial(newValue);} 91 } << 100 92 << 101 if( command == RadiusCmd ) 93 if (command == fRadiusCmd) { << 102 { Detector->SetRadius(RadiusCmd->GetNewDoubleValue(newValue));} 94 fDetector->SetRadius(fRadiusCmd->GetNewDou << 103 95 } << 104 if( command == NbLayersCmd ) 96 << 105 { Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));} 97 if (command == fNbLayersCmd) { << 106 98 fDetector->SetNbOfLayers(fNbLayersCmd->Get << 107 if( command == MagFieldCmd ) 99 } << 108 { Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));} >> 109 >> 110 if( command == UpdateCmd ) >> 111 { Detector->UpdateGeometry();} 100 } 112 } 101 113 102 //....oooOO0OOooo........oooOO0OOooo........oo 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 103 115