G4DecayTableMessenger Class Reference

#include <G4DecayTableMessenger.hh>

Inheritance diagram for G4DecayTableMessenger:

G4UImessenger

Public Member Functions

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

Detailed Description

Definition at line 67 of file G4DecayTableMessenger.hh.


Constructor & Destructor Documentation

G4DecayTableMessenger::G4DecayTableMessenger ( G4ParticleTable pTable = 0  ) 

Definition at line 58 of file G4DecayTableMessenger.cc.

References G4ParticleTable::GetParticleTable(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcmdWithADouble::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), and G4UIcommand::SetRange().

00059                      :theParticleTable(pTable)
00060 {
00061   if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
00062 
00063   currentParticle = 0;
00064 
00065   //Commnad   /particle/property/decay/
00066   thisDirectory = new G4UIdirectory("/particle/property/decay/");
00067   thisDirectory->SetGuidance("Decay Table control commands.");
00068 
00069   //Commnad   /particle/property/decay/select
00070   selectCmd = new G4UIcmdWithAnInteger("/particle/property/decay/select",this);
00071   selectCmd->SetGuidance("Enter index of decay mode.");
00072   selectCmd->SetParameterName("mode", true);
00073   selectCmd->SetDefaultValue(0);
00074   selectCmd->SetRange("mode >=0");
00075   currentChannel = 0;
00076 
00077   //Commnad   /particle/property/decay/dump
00078   dumpCmd = new G4UIcmdWithoutParameter("/particle/property/decay/dump",this);
00079   dumpCmd->SetGuidance("Dump decay mode information.");
00080 
00081   //Command   /particle/property/decay/br
00082   brCmd = new G4UIcmdWithADouble("/particle/property/decay/br",this);
00083   brCmd->SetGuidance("Set branching ratio. [0< BR <1.0]");
00084   brCmd->SetParameterName("br",false);
00085   brCmd->SetRange("(br >=0.0) && (br <=1.0)");
00086 
00087 }

G4DecayTableMessenger::~G4DecayTableMessenger (  )  [virtual]

Definition at line 89 of file G4DecayTableMessenger.cc.

00090 {
00091   delete dumpCmd;
00092   delete selectCmd;
00093   delete brCmd;
00094   delete thisDirectory;
00095 }


Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 176 of file G4DecayTableMessenger.cc.

References G4UIcommand::ConvertToString(), and G4VDecayChannel::GetBR().

00177 {
00178   G4String returnValue('\0');
00179 
00180   if (SetCurrentParticle()==0) {
00181     // no particle is selected. return null 
00182     return returnValue;
00183   }
00184 
00185   if( command == selectCmd ){
00186     //Commnad   /particle/property/decay/select
00187     returnValue = selectCmd->ConvertToString(idxCurrentChannel);
00188 
00189   } else if( command == brCmd ){
00190     if ( currentChannel != 0) {
00191       returnValue = brCmd->ConvertToString(currentChannel->GetBR());
00192     } 
00193   }
00194   return returnValue;
00195 }

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

Reimplemented from G4UImessenger.

Definition at line 97 of file G4DecayTableMessenger.cc.

References G4DecayTable::DumpInfo(), G4cout, G4endl, G4DecayTable::GetDecayChannel(), G4UIcmdWithADouble::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), and G4VDecayChannel::SetBR().

00098 {
00099   if (SetCurrentParticle()==0) {
00100     G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
00101     return;
00102   }
00103   if (currentDecayTable==0) {
00104     G4cout << "The particle has no decay table !! Command ignored." << G4endl;
00105     return;
00106   }
00107 
00108   if( command == dumpCmd ){
00109     //Commnad   /particle/property/decay/dump
00110     currentDecayTable->DumpInfo();
00111 
00112   } else if ( command == selectCmd ){
00113     //Commnad   /particle/property/decay/select
00114     G4int index = selectCmd->GetNewIntValue(newValue) ;
00115     currentChannel = currentDecayTable->GetDecayChannel(index);
00116     if ( currentChannel == 0 ) {
00117       G4cout << "Invalid index. Command ignored." << G4endl;
00118     } else {
00119       idxCurrentChannel = index;
00120     }
00121 
00122   } else {
00123     if ( currentChannel == 0 ) {
00124       G4cout << "Select a decay channel. Command ignored." << G4endl;
00125       return;
00126     }
00127     if (command == brCmd) {
00128       //Commnad   /particle/property/decay/br
00129       G4double  br = brCmd->GetNewDoubleValue(newValue);
00130       if( (br<0.0) || (br>1.0) ) { 
00131         G4cout << "Invalid brancing ratio. Command ignored." << G4endl;
00132       } else {
00133         currentChannel->SetBR(br);
00134       }
00135     }
00136   }
00137 }


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