168 lines
7.9 KiB
C++
168 lines
7.9 KiB
C++
//
|
|
// ********************************************************************
|
|
// * 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: RMC01AnalysisManagerMessenger.cc,v 1.1 2009/11/19 22:41:18 ldesorgh Exp $
|
|
// GEANT4 tag $Name: geant4-09-03 $
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
// Class Name: RMC01AnalysisManagerMessenger
|
|
// Author: L. Desorgher
|
|
// Organisation: SpaceIT GmbH
|
|
// Contract: ESA contract 21435/08/NL/AT
|
|
// Customer: ESA/ESTEC
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
#include "RMC01AnalysisManagerMessenger.hh"
|
|
|
|
#include "RMC01AnalysisManager.hh"
|
|
#include "G4UIdirectory.hh"
|
|
#include "G4UIcmdWithADouble.hh"
|
|
#include "G4UnitsTable.hh"
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|
|
|
RMC01AnalysisManagerMessenger::RMC01AnalysisManagerMessenger(RMC01AnalysisManager* analysisManager)
|
|
:theAnalysisManager(analysisManager)
|
|
{
|
|
|
|
|
|
analysisDir = new G4UIdirectory("/RMC01/analysis/");
|
|
analysisDir->SetGuidance("Analysis commands");
|
|
|
|
|
|
|
|
|
|
G4UIparameter* fluence_par = new G4UIparameter("Fluence",'d',true);
|
|
fluence_par->SetParameterRange("Fluence > 0");
|
|
fluence_par->SetGuidance("Omnidirectional fluence for primary spectrum");
|
|
|
|
G4UIparameter* fluence_unit_par = new G4UIparameter("Fluence_unit",'s',true);
|
|
fluence_unit_par->SetParameterCandidates("1/cm2 1/m2 cm-2 m-2");
|
|
|
|
G4UIparameter* alpha_par = new G4UIparameter("alpha",'d',true);
|
|
|
|
G4UIparameter* E0_par = new G4UIparameter("E0",'d',true);
|
|
E0_par->SetParameterRange("E0 > 0");
|
|
|
|
G4UIparameter* E1_par = new G4UIparameter("E1",'d',true);
|
|
E1_par->SetParameterRange("E1 > 0");
|
|
|
|
G4UIparameter* E2_par = new G4UIparameter("E2",'d',true);
|
|
E2_par->SetParameterRange("E2 > 0");
|
|
|
|
G4UIparameter* E_unit_par = new G4UIparameter("E_unit",'s',true);
|
|
E_unit_par->SetParameterCandidates("eV keV MeV GeV TeV");
|
|
|
|
G4UIparameter* part_name_par = new G4UIparameter("particle_name",'s',true);
|
|
part_name_par->SetParameterCandidates("e- gamma proton ");
|
|
|
|
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd = new G4UIcommand("/RMC01/analysis/SetPowerLawPrimSpectrumForAdjointSim",this);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd
|
|
->SetGuidance("Set the primary spectrum to which adjoint simulation results will be normalised as a power law (Ekin^-alpha).");
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->SetParameter(part_name_par);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->SetParameter(fluence_par);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->SetParameter(fluence_unit_par);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->SetParameter(alpha_par);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->SetParameter(E1_par);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->SetParameter(E2_par);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->SetParameter(E_unit_par);
|
|
SetPowerLawSpectrumToNormaliseAdjointResultsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|
|
|
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd = new G4UIcommand("/RMC01/analysis/SetExponentialSpectrumForAdjointSim",this);
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd
|
|
->SetGuidance("Set the primary spectrum to which adjoint simulation results will be normalised as exponential (exp(-Ekin/E0)).");
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->SetParameter(new G4UIparameter(*part_name_par));
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->SetParameter(new G4UIparameter(*fluence_par));
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->SetParameter(new G4UIparameter(*fluence_unit_par));
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->SetParameter(new G4UIparameter(*E0_par));
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->SetParameter(new G4UIparameter(*E1_par));
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->SetParameter(new G4UIparameter(*E2_par));
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->SetParameter(new G4UIparameter(*E_unit_par));
|
|
SetExponentialSpectrumToNormaliseAdjointResultsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|
|
|
|
|
SetPrecisionForConvergenceTestCmd = new G4UIcmdWithADouble("/RMC01/analysis/SetExpectedPrecisionOfResults",this);
|
|
SetPrecisionForConvergenceTestCmd
|
|
->SetGuidance("Set the precision in % that the computed energy deposited in the sensitive volume should reached. If this precision is reached before the end of the run, the run is aborted and the results are registered.");
|
|
SetPrecisionForConvergenceTestCmd->SetParameterName("Precision",true);
|
|
SetPrecisionForConvergenceTestCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|
|
|
RMC01AnalysisManagerMessenger::~RMC01AnalysisManagerMessenger()
|
|
{
|
|
|
|
delete analysisDir;
|
|
|
|
|
|
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|
|
|
void RMC01AnalysisManagerMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
|
{ if( command == SetPowerLawSpectrumToNormaliseAdjointResultsCmd){
|
|
G4double alpha,E1,E2,fluence;
|
|
G4String f_unit,e_unit,part_name;
|
|
const char* nv = (const char*)newValue;
|
|
std::istringstream is(nv);
|
|
is >> part_name>>fluence>>f_unit>>alpha>>E1>>E2>>e_unit;
|
|
|
|
G4double factor_f_unit=1/cm2;
|
|
if (f_unit == "1/m2" || f_unit =="m-2") factor_f_unit=1/m2;
|
|
fluence*=factor_f_unit;
|
|
|
|
E1*= G4UnitDefinition::GetValueOf(e_unit);
|
|
E2*= G4UnitDefinition::GetValueOf(e_unit);
|
|
theAnalysisManager->SetPrimaryPowerLawSpectrumForAdjointSim(part_name, fluence, alpha, E1, E2);
|
|
}
|
|
else if( command == SetExponentialSpectrumToNormaliseAdjointResultsCmd){
|
|
G4double E0,E1,E2,fluence;
|
|
G4String f_unit,e_unit,part_name;
|
|
const char* nv = (const char*)newValue;
|
|
std::istringstream is(nv);
|
|
is >> part_name>>fluence>>f_unit>>E0>>E1>>E2>>e_unit;
|
|
|
|
G4double factor_f_unit=1/cm2;
|
|
if (f_unit == "1/m2" || f_unit =="m-2") factor_f_unit=1/m2;
|
|
fluence*=factor_f_unit;
|
|
|
|
E0*= G4UnitDefinition::GetValueOf(e_unit);
|
|
E1*= G4UnitDefinition::GetValueOf(e_unit);
|
|
E2*= G4UnitDefinition::GetValueOf(e_unit);
|
|
|
|
theAnalysisManager->SetPrimaryExponentialSpectrumForAdjointSim(part_name, fluence, E0, E1, E2);
|
|
|
|
}
|
|
else if( command == SetPrecisionForConvergenceTestCmd){
|
|
theAnalysisManager->SetPrecision(SetPrecisionForConvergenceTestCmd->GetNewDoubleValue(newValue));
|
|
}
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|