G4ParticlePropertyMessenger Class Reference

#include <G4ParticlePropertyMessenger.hh>

Inheritance diagram for G4ParticlePropertyMessenger:

G4UImessenger

Public Member Functions

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

Detailed Description

Definition at line 69 of file G4ParticlePropertyMessenger.hh.


Constructor & Destructor Documentation

G4ParticlePropertyMessenger::G4ParticlePropertyMessenger ( G4ParticleTable pTable = 0  ) 

Definition at line 59 of file G4ParticlePropertyMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_GeomClosed, G4State_Idle, G4State_PreInit, G4ParticleTable::GetParticleTable(), G4UIcmdWithADoubleAndUnit::SetDefaultUnit(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcmdWithADoubleAndUnit::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcmdWithADoubleAndUnit::SetParameterName(), G4UIcmdWithABool::SetParameterName(), and G4UIcommand::SetRange().

00060                         :theParticleTable(pTable),
00061                          currentParticle(0),
00062                          fDecayTableMessenger(0)
00063 {
00064   if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
00065   //Commnad   /particle/property/
00066   thisDirectory = new G4UIdirectory("/particle/property/");
00067   thisDirectory->SetGuidance("Paricle Table control commands.");
00068 
00069   //Commnad   /particle/property/dump
00070   dumpCmd = new G4UIcmdWithoutParameter("/particle/property/dump",this);
00071   dumpCmd->SetGuidance("dump particle properties.");
00072 
00073   //Command   /particle/property/stable
00074   stableCmd = new G4UIcmdWithABool("/particle/property/stable",this);
00075   stableCmd->SetGuidance("Set stable flag.");
00076   stableCmd->SetGuidance("  false: Unstable   true: Stable");
00077   stableCmd->SetParameterName("stable",false);
00078   stableCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
00079 
00080   //particle/property/lifetime
00081   lifetimeCmd = new G4UIcmdWithADoubleAndUnit("/particle/property/lifetime",this);
00082   lifetimeCmd->SetGuidance("Set life time.");
00083   lifetimeCmd->SetGuidance("Unit of the time can be :");
00084   lifetimeCmd->SetGuidance(" s, ms, ns (default)");
00085   lifetimeCmd->SetParameterName("life",false);
00086   lifetimeCmd->SetDefaultValue(0.0);
00087   lifetimeCmd->SetRange("life >0.0");
00088   //lifetimeCmd->SetUnitCategory("Time");
00089   //lifetimeCmd->SetUnitCandidates("s ms ns");
00090   lifetimeCmd->SetDefaultUnit("ns");
00091   lifetimeCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
00092 
00093   // -- particle/property/Verbose ---
00094   verboseCmd = new G4UIcmdWithAnInteger("/particle/property/verbose",this);
00095   verboseCmd->SetGuidance("Set Verbose level of particle property.");
00096   verboseCmd->SetGuidance(" 0 : Silent (default)");
00097   verboseCmd->SetGuidance(" 1 : Display warning messages");
00098   verboseCmd->SetGuidance(" 2 : Display more");
00099   verboseCmd->SetParameterName("verbose_level",true);
00100   verboseCmd->SetDefaultValue(0);
00101   verboseCmd->SetRange("verbose_level >=0");
00102 
00103   //UI messenger for Decay Table
00104   fDecayTableMessenger = new G4DecayTableMessenger(theParticleTable);
00105   
00106 }

G4ParticlePropertyMessenger::~G4ParticlePropertyMessenger (  )  [virtual]

Definition at line 108 of file G4ParticlePropertyMessenger.cc.

00109 {
00110   if (fDecayTableMessenger !=0) delete  fDecayTableMessenger;
00111   fDecayTableMessenger = 0;
00112 
00113   delete stableCmd; 
00114   delete verboseCmd;
00115   delete lifetimeCmd;
00116   delete dumpCmd;
00117   delete thisDirectory;
00118 } 


Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 170 of file G4ParticlePropertyMessenger.cc.

References G4UIcommand::ConvertToString(), G4ParticleDefinition::GetPDGLifeTime(), G4ParticleDefinition::GetPDGStable(), and G4ParticlePropertyTable::GetVerboseLevel().

00171 {
00172   G4String returnValue('\0');
00173 
00174   if (SetCurrentParticle()==0) {
00175     // no particle is selected. return null 
00176     return returnValue;
00177   }
00178 
00179   if( command == stableCmd ){
00180     //Commnad   /particle/property/stable
00181     returnValue = stableCmd->ConvertToString( currentParticle->GetPDGStable());
00182 
00183   } else if( command == lifetimeCmd ){
00184     //Commnad   /particle/property/lifetime
00185     returnValue = lifetimeCmd->ConvertToString(  currentParticle->GetPDGLifeTime() , "ns" );
00186     
00187   } else if( command==verboseCmd ){
00188    //Commnad   /particle/property/Verbose
00189      returnValue= verboseCmd->ConvertToString(currentParticle ->GetVerboseLevel());
00190 
00191   } 
00192   
00193   return returnValue;
00194 }

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

Reimplemented from G4UImessenger.

Definition at line 120 of file G4ParticlePropertyMessenger.cc.

References G4ParticleDefinition::DumpTable(), G4cout, G4endl, G4UIcmdWithABool::GetNewBoolValue(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), G4ParticleDefinition::GetPDGLifeTime(), G4ParticleDefinition::GetPDGMass(), G4ParticleDefinition::SetPDGLifeTime(), G4ParticleDefinition::SetPDGStable(), and G4ParticleDefinition::SetVerboseLevel().

00121 {
00122   if (SetCurrentParticle()==0) {
00123       G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
00124       return;
00125   }
00126 
00127   if( command == dumpCmd ){
00128     //Commnad   /particle/property/dump
00129     currentParticle->DumpTable();
00130 
00131   } else if (command == lifetimeCmd ) {
00132     //Commnad   /particle/property/lifetime
00133     currentParticle->SetPDGLifeTime(lifetimeCmd->GetNewDoubleValue(newValue)); 
00134 
00135   } else if (command == stableCmd ) {
00136     //Commnad   /particle/property/stable
00137     if (currentParticle->GetPDGLifeTime()<0.0) {
00138       G4cout << "Life time is negative! Command ignored." << G4endl; 
00139     } else if (currentParticle->GetPDGMass()<=0.0) {
00140       G4cout << "Zero Mass! Command ignored." << G4endl; 
00141     } else {
00142       currentParticle->SetPDGStable(stableCmd->GetNewBoolValue(newValue));
00143     }
00144   
00145   } else if( command==verboseCmd ) {
00146     //Commnad   /particle/property/Verbose
00147     currentParticle->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue)); 
00148   }
00149 }


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