G4ProcessManagerMessenger Class Reference

#include <G4ProcessManagerMessenger.hh>

Inheritance diagram for G4ProcessManagerMessenger:

G4UImessenger

Public Member Functions

 G4ProcessManagerMessenger (G4ParticleTable *pTable=0)
virtual ~G4ProcessManagerMessenger ()
virtual void SetNewValue (G4UIcommand *command, G4String newValues)
virtual G4String GetCurrentValue (G4UIcommand *command)

Detailed Description

Definition at line 69 of file G4ProcessManagerMessenger.hh.


Constructor & Destructor Documentation

G4ProcessManagerMessenger::G4ProcessManagerMessenger ( G4ParticleTable pTable = 0  ) 

Definition at line 62 of file G4ProcessManagerMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_EventProc, G4State_GeomClosed, G4State_Idle, G4State_Init, G4State_PreInit, G4ParticleTable::GetParticleTable(), G4UIparameter::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAnInteger::SetParameterName(), and G4UIcommand::SetRange().

00063                         :theParticleTable(pTable),
00064                          currentParticle(0),
00065                          currentProcess(0),
00066                          theManager(0),
00067                          theProcessList(0)
00068 {
00069   if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
00070 
00071   //Commnad   /particle/process
00072   thisDirectory = new G4UIdirectory("/particle/process/");
00073   thisDirectory->SetGuidance("Process Manager control commands.");
00074 
00075   //Commnad   /particle/process/dump
00076   dumpCmd = new G4UIcmdWithAnInteger("/particle/process/dump",this);
00077   dumpCmd->SetGuidance("dump process manager or process information");
00078   dumpCmd->SetGuidance("  dump [process index]");
00079   dumpCmd->SetGuidance("   process index: -1 for process manager");
00080   dumpCmd->SetParameterName("index", true);
00081   dumpCmd->SetDefaultValue(-1);
00082 
00083   //Commnad   /particle/process/Verbose
00084   verboseCmd = new G4UIcommand("/particle/process/verbose",this);
00085   verboseCmd->SetGuidance("Set Verbose Level for Process or Process Manager");
00086   verboseCmd->SetGuidance("  Verbose [Verbose] [process index]");
00087   verboseCmd->SetGuidance("   process index: -1 for process manager");
00088   G4UIparameter* param = new G4UIparameter("Verbose",'i',true);
00089   param->SetDefaultValue(1);
00090   verboseCmd->SetParameter(param);
00091   param = new G4UIparameter("index",'i',true);
00092   param->SetDefaultValue(-1);
00093   verboseCmd->SetParameter(param);
00094   verboseCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00095 
00096   //Commnad   /particle/process/Activate
00097   activateCmd = new G4UIcmdWithAnInteger("/particle/process/activate",this);
00098   activateCmd->SetGuidance("Activate process  ");
00099   activateCmd->SetGuidance(" Activate [process index]");
00100   activateCmd->SetParameterName("index", false);
00101   activateCmd->SetDefaultValue(0);
00102   activateCmd->SetRange("index >=0");
00103   activateCmd->AvailableForStates(G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00104 
00105   //Commnad   /particle/process/inactivate
00106   inactivateCmd = new G4UIcmdWithAnInteger("/particle/process/inactivate",this);
00107   inactivateCmd->SetGuidance("Inactivate process  ");
00108   inactivateCmd->SetGuidance(" inactivate [process index]");
00109   inactivateCmd->SetParameterName("index", false);
00110   inactivateCmd->SetDefaultValue(0);
00111   inactivateCmd->SetRange("index >=0");
00112   inactivateCmd->AvailableForStates(G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00113 
00114 }

G4ProcessManagerMessenger::~G4ProcessManagerMessenger (  )  [virtual]

Definition at line 116 of file G4ProcessManagerMessenger.cc.

00117 {
00118   delete activateCmd; 
00119   delete inactivateCmd; 
00120   delete verboseCmd;
00121   delete dumpCmd;
00122   delete thisDirectory;
00123 }


Member Function Documentation

G4String G4ProcessManagerMessenger::GetCurrentValue ( G4UIcommand command  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 203 of file G4ProcessManagerMessenger.cc.

References G4ProcessManager::GetVerboseLevel().

00204 {
00205   G4String returnValue('\0');
00206   if(SetCurrentParticle() == 0) {
00207     // no particle is selected. return null strings
00208     return returnValue;
00209   }
00210 
00211   std::ostringstream os;
00212   
00213   if( command==verboseCmd ){
00214     //Commnad   /particle/process/Verbose
00215     os << theManager->GetVerboseLevel();
00216     returnValue = os.str();
00217   } 
00218   return returnValue;
00219 }

void G4ProcessManagerMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 143 of file G4ProcessManagerMessenger.cc.

References G4UImanager::ApplyCommand(), G4VProcess::DumpInfo(), G4ProcessManager::DumpInfo(), G4cout, G4endl, G4UIcmdWithAnInteger::GetNewIntValue(), G4UImanager::GetUIpointer(), G4ProcessManager::SetProcessActivation(), G4VProcess::SetVerboseLevel(), and G4ProcessManager::SetVerboseLevel().

00144 {
00145   if (SetCurrentParticle()==0) {
00146       G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
00147       return;
00148   }
00149   if( command == dumpCmd ){
00150     //Commnad   /particle/process/dump
00151     G4int index = dumpCmd->GetNewIntValue(newValue);
00152     if (index <0) {
00153        theManager->DumpInfo();
00154     } else if ( index < theManager->GetProcessListLength()){
00155       currentProcess =  (*theProcessList)(index);
00156       if (currentProcess == 0) {
00157         G4cout << " no process at index of " << index;
00158         G4cout << "in the Process Vector" << G4endl;
00159       } else {
00160         currentProcess->DumpInfo();
00161       }
00162     } else {
00163       G4cout << " illegal index !!! " << G4endl;
00164       currentProcess = 0;
00165     } 
00166  
00167   } else if( command==activateCmd ) {
00168     //Commnad   /particle/process/activate
00169     theManager->SetProcessActivation(activateCmd->GetNewIntValue(newValue), true);
00170     G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
00171     
00172   } else if( command==inactivateCmd ) {
00173     //Commnad   /particle/process/inactivate
00174     theManager->SetProcessActivation(inactivateCmd->GetNewIntValue(newValue), false);
00175     G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
00176     
00177   } else if( command==verboseCmd ) {
00178     //Commnad   /particle/process/Verbose
00179     //  inputstream for newValues 
00180     const char* temp = (const char*)(newValue);
00181     std::istringstream is((char*)temp);
00182     G4int Verbose, index;
00183     is  >>Verbose >>index;
00184     if (index <0) {
00185       theManager->SetVerboseLevel(Verbose);
00186       
00187     } else if ( index < theManager->GetProcessListLength()){
00188       currentProcess =  (*theProcessList)(index);
00189       if (currentProcess == 0) {
00190         G4cout << " no process at index of " << index;
00191         G4cout << "in the Process Vector" << G4endl;
00192       } else {
00193         currentProcess->SetVerboseLevel(Verbose);
00194       }
00195     } else {
00196       G4cout << " illegal index !!! " << G4endl;
00197       currentProcess = 0;
00198     } 
00199   }
00200 }


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