G4AdjointSimMessenger Class Reference

#include <G4AdjointSimMessenger.hh>

Inheritance diagram for G4AdjointSimMessenger:

G4UImessenger

Public Member Functions

 G4AdjointSimMessenger (G4AdjointSimManager *)
 ~G4AdjointSimMessenger ()
void SetNewValue (G4UIcommand *, G4String)

Detailed Description

Definition at line 123 of file G4AdjointSimMessenger.hh.


Constructor & Destructor Documentation

G4AdjointSimMessenger::G4AdjointSimMessenger ( G4AdjointSimManager  ) 

Definition at line 51 of file G4AdjointSimMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_Idle, G4State_PreInit, G4UIcmdWithAString::SetCandidates(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithADoubleAndUnit::SetParameterName(), G4UIcmdWithAString::SetParameterName(), G4UIparameter::SetParameterRange(), and G4UIcmdWithADoubleAndUnit::SetUnitCategory().

00052   : theAdjointRunManager(pAdjointRunManager)
00053 { 
00054   AdjointSimDir = new G4UIdirectory("/adjoint/");
00055   AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation");
00056 
00057   //Start and adjoint Run
00058   //---------------------
00059   
00060   beamOnCmd = new G4UIcommand("/adjoint/start_run",this);
00061   beamOnCmd->SetGuidance("Start an adjoint Run.");
00062   beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
00063   beamOnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00064   G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
00065   p1->SetDefaultValue(1);
00066   p1->SetParameterRange("numberOfEvent >= 0");
00067   beamOnCmd->SetParameter(p1);
00068 
00069   //Commands to define parameters relative to the external source
00070   //------------------------------------------------------------
00071   
00072   G4UIparameter* pos_x_par = new G4UIparameter("X",'d',true);
00073   
00074   G4UIparameter* pos_y_par = new G4UIparameter("Y",'d',true);
00075   
00076   G4UIparameter* pos_z_par = new G4UIparameter("Z",'d',true); 
00077   
00078   G4UIparameter* radius_par = new G4UIparameter("R",'d',true);
00079   
00080   radius_par->SetParameterRange("R >= 0");
00081   
00082   G4UIparameter* unit_par =  new G4UIparameter("unit",'s',true);
00083 
00084   DefineSpherExtSourceCmd = new G4UIcommand("/adjoint/DefineSphericalExtSource",this);
00085   DefineSpherExtSourceCmd->SetGuidance("Define a spherical external source.");
00086   DefineSpherExtSourceCmd->SetParameter(pos_x_par);
00087   DefineSpherExtSourceCmd->SetParameter(pos_y_par);
00088   DefineSpherExtSourceCmd->SetParameter(pos_z_par);
00089   DefineSpherExtSourceCmd->SetParameter(radius_par);
00090   DefineSpherExtSourceCmd->SetParameter(unit_par);
00091 
00092   G4UIparameter* phys_vol_name_par =  new G4UIparameter("phys_vol_name",'s',true);
00093 
00094   DefineSpherExtSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalExtSourceCenteredOnAVolume",this);
00095   DefineSpherExtSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical external source with the center located at the center of a physical volume");
00096   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
00097   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
00098   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
00099 
00100   DefineExtSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineExtSourceOnExtSurfaceOfAVolume",this);
00101   DefineExtSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the external source on the external surface of a physical volume");
00102   DefineExtSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
00103   
00104   setExtSourceEMaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetExtSourceEmax",this);
00105   setExtSourceEMaxCmd->SetGuidance("Set the maximum  energy of the external source");
00106   setExtSourceEMaxCmd->SetParameterName("Emax",false);
00107   setExtSourceEMaxCmd->SetUnitCategory("Energy");
00108   setExtSourceEMaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00109 
00110   //Commands to define the adjoint source
00111   //------------------------------------------------------------
00112 
00113   DefineSpherAdjSourceCmd = new G4UIcommand("/adjoint/DefineSphericalAdjSource",this);
00114   DefineSpherAdjSourceCmd->SetGuidance("Define a spherical adjoint source.");
00115   DefineSpherAdjSourceCmd->SetParameter(pos_x_par);
00116   DefineSpherAdjSourceCmd->SetParameter(pos_y_par);
00117   DefineSpherAdjSourceCmd->SetParameter(pos_z_par);
00118   DefineSpherAdjSourceCmd->SetParameter(radius_par);
00119   DefineSpherAdjSourceCmd->SetParameter(unit_par);
00120 
00121   DefineSpherAdjSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalAdjSourceCenteredOnAVolume",this);
00122   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical adjoint source with the center located at the center of a physical volume");
00123   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
00124   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
00125   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
00126   
00127   DefineAdjSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume",this);
00128   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the adjoint source on the external surface of physical volume");
00129   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false); 
00130   
00131   setAdjSourceEminCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmin",this);
00132   setAdjSourceEminCmd->SetGuidance("Set the minimum energy  of the adjoint source");
00133   setAdjSourceEminCmd->SetParameterName("Emin",false);
00134   setAdjSourceEminCmd->SetUnitCategory("Energy");
00135   setAdjSourceEminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00136   
00137   setAdjSourceEmaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmax",this);
00138   setAdjSourceEmaxCmd->SetGuidance("Set the maximum energy of the adjoint source");
00139   setAdjSourceEmaxCmd->SetParameterName("Emax",false);
00140   setAdjSourceEmaxCmd->SetUnitCategory("Energy");
00141   setAdjSourceEmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00142 
00143   ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary",this);
00144   ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary");
00145   ConsiderParticleAsPrimaryCmd->SetParameterName("particle",false);
00146   ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
00147 
00148   NeglectParticleAsPrimaryCmd= new G4UIcmdWithAString("/adjoint/NeglectAsPrimary",this);
00149   NeglectParticleAsPrimaryCmd->SetGuidance("Remove the selected particle from the lits of primaries");
00150   NeglectParticleAsPrimaryCmd->SetParameterName("particle",false);
00151   NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
00152 }

G4AdjointSimMessenger::~G4AdjointSimMessenger (  ) 

Definition at line 157 of file G4AdjointSimMessenger.cc.

00158 {
00159   delete beamOnCmd;
00160 }


Member Function Documentation

void G4AdjointSimMessenger::SetNewValue ( G4UIcommand ,
G4String   
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 165 of file G4AdjointSimMessenger.cc.

References G4AdjointSimManager::ConsiderParticleAsPrimary(), G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume(), G4AdjointSimManager::DefineExtSourceOnTheExtSurfaceOfAVolume(), G4AdjointSimManager::DefineSphericalAdjointSource(), G4AdjointSimManager::DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(), G4AdjointSimManager::DefineSphericalExtSource(), G4AdjointSimManager::DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UnitDefinition::GetValueOf(), G4AdjointSimManager::NeglectParticleAsPrimary(), G4AdjointSimManager::RunAdjointSimulation(), G4AdjointSimManager::SetAdjointSourceEmax(), G4AdjointSimManager::SetAdjointSourceEmin(), and G4AdjointSimManager::SetExtSourceEmax().

00166 {
00167   if( command==beamOnCmd )
00168   {
00169     G4int nev;
00170     const char* nv = (const char*)newValue;
00171     std::istringstream is(nv);
00172     is >> nev ;
00173     theAdjointRunManager->RunAdjointSimulation(nev); 
00174   }
00175   else if ( command==DefineSpherExtSourceCmd){
00176     
00177     G4double  x,y,z,r;
00178     G4String unit;
00179     const char* nv = (const char*)newValue;
00180     std::istringstream is(nv);
00181     is >> x>>y>>z>>r>>unit;
00182     
00183     x*=G4UnitDefinition::GetValueOf(unit);
00184     y*=G4UnitDefinition::GetValueOf(unit);
00185     z*=G4UnitDefinition::GetValueOf(unit);
00186     r*=G4UnitDefinition::GetValueOf(unit);
00187     theAdjointRunManager->DefineSphericalExtSource(r,G4ThreeVector(x,y,z));
00188   }
00189   else if ( command==DefineSpherExtSourceCenteredOnAVolumeCmd){
00190     
00191     G4double r;
00192     G4String vol_name, unit;
00193     const char* nv = (const char*)newValue;
00194     std::istringstream is(nv);
00195     is >>vol_name>>r>>unit;
00196     r*=G4UnitDefinition::GetValueOf(unit);
00197     theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
00198   } 
00199   else if ( command==DefineExtSourceOnAVolumeExtSurfaceCmd){
00200     theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue);
00201   }
00202   else if ( command== setExtSourceEMaxCmd){
00203 
00204     theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue));
00205   }
00206   else if ( command==DefineSpherAdjSourceCmd){
00207     
00208     G4double  x,y,z,r;
00209     G4String unit;
00210     const char* nv = (const char*)newValue;
00211     std::istringstream is(nv);
00212     is >> x>>y>>z>>r>>unit;
00213     
00214     x*=G4UnitDefinition::GetValueOf(unit);
00215     y*=G4UnitDefinition::GetValueOf(unit);
00216     z*=G4UnitDefinition::GetValueOf(unit);
00217     r*=G4UnitDefinition::GetValueOf(unit);
00218     theAdjointRunManager->DefineSphericalAdjointSource(r,G4ThreeVector(x,y,z));
00219   }
00220   else if ( command==DefineSpherAdjSourceCenteredOnAVolumeCmd){
00221     
00222     G4double r;
00223     G4String vol_name, unit;
00224     const char* nv = (const char*)newValue;
00225     std::istringstream is(nv);
00226     is >>vol_name>>r>>unit;
00227     r*=G4UnitDefinition::GetValueOf(unit);
00228     theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
00229   }
00230   else if ( command==DefineAdjSourceOnAVolumeExtSurfaceCmd){
00231 
00232     theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue);
00233   }
00234   else if ( command== setAdjSourceEminCmd){
00235     
00236     theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue));
00237   }
00238   else if ( command== setAdjSourceEmaxCmd){
00239     
00240     theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue));
00241   }
00242   else if ( command==ConsiderParticleAsPrimaryCmd){
00243 
00244      theAdjointRunManager->ConsiderParticleAsPrimary(newValue);
00245   }
00246   else if ( command==NeglectParticleAsPrimaryCmd){
00247 
00248      theAdjointRunManager->NeglectParticleAsPrimary(newValue);
00249   }
00250 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:25 2013 for Geant4 by  doxygen 1.4.7