File indexing completed on 2025-01-31 09:21:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #include <G4UIcmdWithABool.hh>
0045 #include <G4UIcmdWith3Vector.hh>
0046 #include "CexmcProductionModel.hh"
0047 #include "CexmcProductionModelMessenger.hh"
0048 #include "CexmcMessenger.hh"
0049
0050
0051 CexmcProductionModelMessenger::CexmcProductionModelMessenger(
0052 CexmcProductionModel * productionModel_ ) :
0053 productionModel( productionModel_ ), applyFermiMotion( NULL ),
0054 setAngularRange( NULL ), addAngularRange( NULL )
0055 {
0056 applyFermiMotion = new G4UIcmdWithABool(
0057 ( CexmcMessenger::physicsDirName + "applyFermiMotionInTarget" ).c_str(),
0058 this );
0059 applyFermiMotion->SetGuidance( "Switch on/off fermi motion in target "
0060 "nuclei" );
0061 applyFermiMotion->SetParameterName( "ApplyFermiMotionInTarget", true );
0062 applyFermiMotion->SetDefaultValue( true );
0063 applyFermiMotion->AvailableForStates( G4State_PreInit, G4State_Idle );
0064
0065 setAngularRange = new G4UIcmdWith3Vector(
0066 ( CexmcMessenger::physicsDirName + "setAngularRange" ).c_str(), this );
0067 setAngularRange->SetGuidance(
0068 "\n Set angular range of interest given in values of cosinus;\n"
0069 " first two values give the range (descending or ascending),\n"
0070 " third value gives number of equal divisions within the\n"
0071 " range." );
0072 setAngularRange->SetParameterName( "ARangeTop", "ARangeBottom",
0073 "ARangeNmbOfDivisions", false );
0074 setAngularRange->SetRange(
0075 "ARangeTop >= -1.0 && ARangeTop <= 1.0 && "
0076 "ARangeBottom >= -1.0 && ARangeBottom <= 1.0 && "
0077 "ARangeNmbOfDivisions >= 1" );
0078 setAngularRange->AvailableForStates( G4State_PreInit, G4State_Idle );
0079
0080 addAngularRange = new G4UIcmdWith3Vector(
0081 ( CexmcMessenger::physicsDirName + "addAngularRange" ).c_str(), this );
0082 addAngularRange->SetGuidance(
0083 "\n Add angular range of interest given in values of cosinus;\n"
0084 " first two values give the range (descending or ascending),\n"
0085 " third value gives number of equal divisions within the\n"
0086 " range." );
0087 addAngularRange->SetParameterName( "ARangeTop", "ARangeBottom",
0088 "ARangeNmbOfDivisions", false );
0089 addAngularRange->SetRange(
0090 "ARangeTop >= -1.0 && ARangeTop <= 1.0 && "
0091 "ARangeBottom >= -1.0 && ARangeBottom <= 1.0 && "
0092 "ARangeNmbOfDivisions >= 1" );
0093 addAngularRange->AvailableForStates( G4State_PreInit, G4State_Idle );
0094 }
0095
0096
0097 CexmcProductionModelMessenger::~CexmcProductionModelMessenger()
0098 {
0099 delete applyFermiMotion;
0100 delete setAngularRange;
0101 delete addAngularRange;
0102 }
0103
0104
0105 void CexmcProductionModelMessenger::SetNewValue( G4UIcommand * cmd,
0106 G4String value )
0107 {
0108 do
0109 {
0110 if ( cmd == applyFermiMotion )
0111 {
0112 productionModel->ApplyFermiMotion(
0113 G4UIcmdWithABool::GetNewBoolValue( value ) );
0114 break;
0115 }
0116 if ( cmd == setAngularRange )
0117 {
0118 G4ThreeVector vec( G4UIcmdWith3Vector::GetNew3VectorValue(
0119 value ) );
0120 G4double top( std::max( vec.x(), vec.y() ) );
0121 G4double bottom( std::min( vec.x(), vec.y() ) );
0122 productionModel->SetAngularRange( top, bottom,
0123 static_cast< int >( vec.z() ) );
0124 break;
0125 }
0126 if ( cmd == addAngularRange )
0127 {
0128 G4ThreeVector vec( G4UIcmdWith3Vector::GetNew3VectorValue(
0129 value ) );
0130 G4double top( std::max( vec.x(), vec.y() ) );
0131 G4double bottom( std::min( vec.x(), vec.y() ) );
0132 productionModel->AddAngularRange( top, bottom,
0133 static_cast< int >( vec.z() ) );
0134 break;
0135 }
0136 } while ( false );
0137 }
0138