// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // $Id: ExN03DetectorMessenger.cc,v 1.1 2007/05/26 00:18:28 tkoi Exp $ // GEANT4 tag $Name: geant4-09-04-beta-01 $ // // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "ExN03DetectorMessenger.hh" #include "ExN03DetectorConstruction.hh" #include "G4UIdirectory.hh" #include "G4UIcmdWithAString.hh" #include "G4UIcmdWithAnInteger.hh" #include "G4UIcmdWithADoubleAndUnit.hh" #include "G4UIcmdWithoutParameter.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... ExN03DetectorMessenger::ExN03DetectorMessenger( ExN03DetectorConstruction* ExN03Det) :ExN03Detector(ExN03Det) { N03Dir = new G4UIdirectory("/N03/"); N03Dir->SetGuidance("UI commands of this example"); detDir = new G4UIdirectory("/N03/det/"); detDir->SetGuidance("detector control"); AbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this); AbsMaterCmd->SetGuidance("Select Material of the Absorber."); AbsMaterCmd->SetParameterName("choice",false); AbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this); GapMaterCmd->SetGuidance("Select Material of the Gap."); GapMaterCmd->SetParameterName("choice",false); GapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this); AbsThickCmd->SetGuidance("Set Thickness of the Absorber"); AbsThickCmd->SetParameterName("Size",false); AbsThickCmd->SetRange("Size>=0."); AbsThickCmd->SetUnitCategory("Length"); AbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle); GapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this); GapThickCmd->SetGuidance("Set Thickness of the Gap"); GapThickCmd->SetParameterName("Size",false); GapThickCmd->SetRange("Size>=0."); GapThickCmd->SetUnitCategory("Length"); GapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle); SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this); SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter"); SizeYZCmd->SetParameterName("Size",false); SizeYZCmd->SetRange("Size>0."); SizeYZCmd->SetUnitCategory("Length"); SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle); NbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this); NbLayersCmd->SetGuidance("Set number of layers."); NbLayersCmd->SetParameterName("NbLayers",false); NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500"); NbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle); UpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this); UpdateCmd->SetGuidance("Update calorimeter geometry."); UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); UpdateCmd->SetGuidance("if you changed geometrical value(s)."); UpdateCmd->AvailableForStates(G4State_Idle); MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setField",this); MagFieldCmd->SetGuidance("Define magnetic field."); MagFieldCmd->SetGuidance("Magnetic field will be in Z direction."); MagFieldCmd->SetParameterName("Bz",false); MagFieldCmd->SetUnitCategory("Magnetic flux density"); MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... ExN03DetectorMessenger::~ExN03DetectorMessenger() { delete NbLayersCmd; delete AbsMaterCmd; delete GapMaterCmd; delete AbsThickCmd; delete GapThickCmd; delete SizeYZCmd; delete UpdateCmd; delete MagFieldCmd; delete detDir; delete N03Dir; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void ExN03DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) { if( command == AbsMaterCmd ) { ExN03Detector->SetAbsorberMaterial(newValue);} if( command == GapMaterCmd ) { ExN03Detector->SetGapMaterial(newValue);} if( command == AbsThickCmd ) { ExN03Detector->SetAbsorberThickness(AbsThickCmd ->GetNewDoubleValue(newValue));} if( command == GapThickCmd ) { ExN03Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));} if( command == SizeYZCmd ) { ExN03Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));} if( command == NbLayersCmd ) { ExN03Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));} if( command == UpdateCmd ) { ExN03Detector->UpdateGeometry(); } if( command == MagFieldCmd ) { ExN03Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));} } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......