Import Geant4 8.1.0 source tree
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: DetectorMessenger.cc,v 1.3 2006/06/29 17:24:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DetectorMessenger
|
||||
//
|
||||
// Created: 31.01.03 V.Ivanchenko
|
||||
//
|
||||
// Modified:
|
||||
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWith3Vector.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
:Detector(Det)
|
||||
{
|
||||
testDir = new G4UIdirectory("/testhadr/");
|
||||
testDir->SetGuidance(" Hadronic Extended Example.");
|
||||
|
||||
matCmd = new G4UIcmdWithAString("/testhadr/TargetMat",this);
|
||||
matCmd->SetGuidance("Select Material for the target");
|
||||
matCmd->SetParameterName("tMaterial",false);
|
||||
matCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
mat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat",this);
|
||||
mat1Cmd->SetGuidance("Select Material for world");
|
||||
mat1Cmd->SetParameterName("wMaterial",false);
|
||||
mat1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
rCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius",this);
|
||||
rCmd->SetGuidance("Set radius of the target");
|
||||
rCmd->SetParameterName("radius",false);
|
||||
rCmd->SetUnitCategory("Length");
|
||||
rCmd->SetRange("radius>0");
|
||||
rCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
lCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength",this);
|
||||
lCmd->SetGuidance("Set length of the target");
|
||||
lCmd->SetParameterName("length",false);
|
||||
lCmd->SetUnitCategory("Length");
|
||||
lCmd->SetRange("length>0");
|
||||
lCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
binCmd = new G4UIcmdWithAnInteger("/testhadr/NumberOfBinsE",this);
|
||||
binCmd->SetGuidance("Set number of bins for Energy");
|
||||
binCmd->SetParameterName("NEbins",false);
|
||||
binCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
nOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/NumberDivZ",this);
|
||||
nOfAbsCmd->SetGuidance("Set number of slices");
|
||||
nOfAbsCmd->SetParameterName("NZ",false);
|
||||
nOfAbsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
updateCmd = new G4UIcmdWithoutParameter("/testhadr/Update",this);
|
||||
updateCmd->SetGuidance("Update geometry.");
|
||||
updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
updateCmd->SetGuidance("if you changed geometrical value(s)");
|
||||
updateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
verbCmd = new G4UIcmdWithAnInteger("/testhadr/Verbose",this);
|
||||
verbCmd->SetGuidance("Set verbose for ");
|
||||
verbCmd->SetParameterName("verb",false);
|
||||
verbCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete matCmd;
|
||||
delete mat1Cmd;
|
||||
delete rCmd;
|
||||
delete lCmd;
|
||||
delete nOfAbsCmd;
|
||||
delete updateCmd;
|
||||
delete testDir;
|
||||
delete verbCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
|
||||
if( command == matCmd )
|
||||
Detector->SetTargetMaterial(newValue);
|
||||
|
||||
if( command == mat1Cmd )
|
||||
Detector->SetWorldMaterial(newValue);
|
||||
|
||||
if( command == rCmd )
|
||||
Detector->SetTargetRadius(rCmd->GetNewDoubleValue(newValue));
|
||||
|
||||
if( command == lCmd )
|
||||
HistoManager::GetPointer()->SetTargetLength(lCmd->GetNewDoubleValue(newValue));
|
||||
|
||||
if( command == nOfAbsCmd )
|
||||
HistoManager::GetPointer()->SetNumberOfSlices(nOfAbsCmd->GetNewIntValue(newValue));
|
||||
|
||||
if( command == binCmd )
|
||||
HistoManager::GetPointer()->SetNumberOfBinsE(binCmd->GetNewIntValue(newValue));
|
||||
|
||||
if( command == verbCmd )
|
||||
HistoManager::GetPointer()->SetVerbose(verbCmd->GetNewIntValue(newValue));
|
||||
|
||||
if( command == updateCmd )
|
||||
Detector->UpdateGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user