Import Geant4 9.2.0 source tree
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ProductionCutsTableMessenger.cc,v 1.1 2008/03/02 10:52:55 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ProductionCutsTableMessenger.cc
|
||||
// ------------------------------------------------------------
|
||||
// History
|
||||
// first version 02 Mar. 2008 by H.Kurashige
|
||||
//
|
||||
|
||||
#include "G4ProductionCutsTableMessenger.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Tokenizer.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
G4ProductionCutsTableMessenger::G4ProductionCutsTableMessenger( G4ProductionCutsTable* pTable)
|
||||
:theCutsTable(pTable)
|
||||
{
|
||||
// /cuts/ directory
|
||||
theDirectory = new G4UIdirectory("/cuts/");
|
||||
theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
|
||||
|
||||
// /cuts/verbose command
|
||||
verboseCmd = new G4UIcmdWithAnInteger("/cuts/verbose",this);
|
||||
verboseCmd->SetGuidance("Set the Verbose level of G4ProductionCutsTable.");
|
||||
verboseCmd->SetGuidance(" 0 : Silent (default)");
|
||||
verboseCmd->SetGuidance(" 1 : Display warning messages");
|
||||
verboseCmd->SetGuidance(" 2 : Display more info");
|
||||
verboseCmd->SetGuidance(" 2 : Display debug info");
|
||||
verboseCmd->SetParameterName("level",true);
|
||||
verboseCmd->SetDefaultValue(0);
|
||||
verboseCmd->SetRange("level >=0 && level <=3");
|
||||
|
||||
// /cuts/setLowEdge command
|
||||
setLowEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setLowEdge",this);
|
||||
setLowEdgeCmd->SetGuidance("Set low edge energy value ");
|
||||
setLowEdgeCmd->SetParameterName("edge",false);
|
||||
setLowEdgeCmd->SetDefaultValue(0.99);
|
||||
setLowEdgeCmd->SetRange("edge >0.0");
|
||||
setLowEdgeCmd->SetDefaultUnit("keV");
|
||||
setLowEdgeCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
// /cuts/setHighEdge command
|
||||
setHighEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setHighEdge",this);
|
||||
setHighEdgeCmd->SetGuidance("Set high edge energy value ");
|
||||
setHighEdgeCmd->SetParameterName("edge",false);
|
||||
setHighEdgeCmd->SetDefaultValue(100.0);
|
||||
setHighEdgeCmd->SetRange("edge >0.0");
|
||||
setHighEdgeCmd->SetDefaultUnit("TeV");
|
||||
setHighEdgeCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
// /cuts/dump command
|
||||
dumpCmd = new G4UIcmdWithoutParameter("/cuts/dump",this);
|
||||
dumpCmd->SetGuidance("Dump cuplues in ProductuinCutsTable. ");
|
||||
|
||||
}
|
||||
|
||||
G4ProductionCutsTableMessenger::~G4ProductionCutsTableMessenger()
|
||||
{
|
||||
delete dumpCmd;
|
||||
delete setHighEdgeCmd;
|
||||
delete setLowEdgeCmd;
|
||||
delete verboseCmd;
|
||||
delete theDirectory;
|
||||
}
|
||||
|
||||
void G4ProductionCutsTableMessenger::SetNewValue(G4UIcommand * command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command==verboseCmd ) {
|
||||
theCutsTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
|
||||
|
||||
} else if( command==dumpCmd ){
|
||||
theCutsTable-> DumpCouples();
|
||||
|
||||
} else if( command==setLowEdgeCmd ){
|
||||
G4double lowEdge = setLowEdgeCmd->GetNewDoubleValue(newValue);
|
||||
G4double highEdge = theCutsTable->GetHighEdgeEnergy();
|
||||
theCutsTable->SetEnergyRange(lowEdge, highEdge);
|
||||
|
||||
} else if( command==setHighEdgeCmd ){
|
||||
G4double highEdge = setHighEdgeCmd->GetNewDoubleValue(newValue);
|
||||
G4double lowEdge = theCutsTable->GetLowEdgeEnergy();
|
||||
theCutsTable->SetEnergyRange(lowEdge, highEdge);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
G4String G4ProductionCutsTableMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
{
|
||||
G4String cv;
|
||||
|
||||
if( command==verboseCmd ){
|
||||
cv = verboseCmd->ConvertToString(theCutsTable->GetVerboseLevel());
|
||||
|
||||
} else if( command==setLowEdgeCmd ){
|
||||
G4double lowEdge = theCutsTable->GetLowEdgeEnergy();
|
||||
cv = setLowEdgeCmd->ConvertToString( lowEdge, "keV" );
|
||||
|
||||
} else if( command==setHighEdgeCmd ){
|
||||
G4double highEdge = theCutsTable->GetHighEdgeEnergy();
|
||||
cv = setHighEdgeCmd->ConvertToString( highEdge, "TeV" );
|
||||
}
|
||||
|
||||
return cv;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user