Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MoleculeShootMessenger Class Reference

#include <G4MoleculeGunMessenger.hh>

+ Inheritance diagram for G4MoleculeShootMessenger:

Public Member Functions

 G4MoleculeShootMessenger (const G4String &name, G4MoleculeGunMessenger *, G4shared_ptr< G4MoleculeShoot >)
 
virtual ~G4MoleculeShootMessenger ()
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4shared_ptr< G4MoleculeShoot > & GetShoot ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Protected Attributes

G4UIcmdWithAStringfpGunSpecies
 
G4UIcmdWith3VectorAndUnitfpGunPosition
 
G4UIcmdWith3VectorAndUnitfpGunRdnmPosition
 
G4UIcmdWithADoubleAndUnitfpGunTime
 
G4UIcmdWithAnIntegerfpGunN
 
G4UIcmdWithAStringfpGunType
 
G4shared_ptr< G4MoleculeShootfpShoot
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 

Detailed Description

Definition at line 64 of file G4MoleculeGunMessenger.hh.

Constructor & Destructor Documentation

◆ G4MoleculeShootMessenger()

G4MoleculeShootMessenger::G4MoleculeShootMessenger ( const G4String name,
G4MoleculeGunMessenger ,
G4shared_ptr< G4MoleculeShoot shoot 
)

Definition at line 98 of file G4MoleculeGunMessenger.cc.

101 :
102 G4UImessenger(), fpShoot(shoot)
103{
104 G4String dir("/chem/gun/");
105 dir += name;
106 CreateDirectory(dir, "");
107
108 G4String tmp = dir;
109 tmp += "/species";
110 fpGunSpecies = new G4UIcmdWithAString(tmp, this);
111
112 tmp = dir;
113 tmp += "/position";
115
116 tmp = dir;
117 tmp += "/time";
118 fpGunTime = new G4UIcmdWithADoubleAndUnit(tmp, this);
119
120 tmp = dir;
121 tmp += "/number";
122 fpGunN = new G4UIcmdWithAnInteger(tmp, this);
123
124 tmp = dir;
125 tmp += "/rndmPosition";
127
128 tmp = dir;
129 tmp += "/type";
130 fpGunType = new G4UIcmdWithAString(tmp, this);
131
132// fpShoot.reset(new TG4MoleculeShoot<G4Track>());
133}
G4UIcmdWithAString * fpGunType
G4UIcmdWithADoubleAndUnit * fpGunTime
G4UIcmdWith3VectorAndUnit * fpGunRdnmPosition
G4UIcmdWith3VectorAndUnit * fpGunPosition
G4shared_ptr< G4MoleculeShoot > fpShoot
G4UIcmdWithAString * fpGunSpecies
G4UIcmdWithAnInteger * fpGunN
void CreateDirectory(const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
const char * name(G4int ptype)

◆ ~G4MoleculeShootMessenger()

G4MoleculeShootMessenger::~G4MoleculeShootMessenger ( )
virtual

Definition at line 137 of file G4MoleculeGunMessenger.cc.

138{
139 if (fpGunSpecies) delete fpGunSpecies;
140 if (fpGunPosition) delete fpGunPosition;
141 if (fpGunTime) delete fpGunTime;
142 if (fpGunN) delete fpGunN;
143}

Member Function Documentation

◆ GetCurrentValue()

G4String G4MoleculeShootMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 183 of file G4MoleculeGunMessenger.cc.

184{
185 if (command == fpGunSpecies)
186 {
187 return fpShoot->fMoleculeName;
188 }
189 else if (command == fpGunPosition)
190 {
192 }
193 else if (command == fpGunRdnmPosition)
194 {
195 if(fpShoot->fBoxSize)
196 {
198 }
200 }
201 else if (command == fpGunTime)
202 {
204 }
205 else if (command == fpGunN)
206 {
207 return fpGunN->ConvertToString(fpShoot->fNumber);
208 }
209 return "";
210}
CLHEP::Hep3Vector G4ThreeVector
G4String ConvertToStringWithBestUnit(G4ThreeVector vec)
G4String ConvertToStringWithBestUnit(G4double val)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:430

◆ GetShoot()

G4shared_ptr< G4MoleculeShoot > & G4MoleculeShootMessenger::GetShoot ( )
inline

Definition at line 74 of file G4MoleculeGunMessenger.hh.

74 {
75 return fpShoot;
76 }

◆ SetNewValue()

void G4MoleculeShootMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 147 of file G4MoleculeGunMessenger.cc.

148{
149 if (command == fpGunSpecies)
150 {
151 fpShoot->fMoleculeName = newValue;
152 }
153 else if (command == fpGunPosition)
154 {
155 fpShoot->fPosition = fpGunPosition->GetNew3VectorValue(newValue);
156 }
157 else if(command == fpGunRdnmPosition)
158 {
159 fpShoot->fBoxSize = new G4ThreeVector(fpGunRdnmPosition->GetNew3VectorValue(newValue));
160 }
161 else if (command == fpGunTime)
162 {
163 fpShoot->fTime = fpGunTime->GetNewDoubleValue(newValue);
164 }
165 else if (command == fpGunN)
166 {
167 fpShoot->fNumber = fpGunN->GetNewIntValue(newValue);
168 }
169 else if (command == fpGunType)
170 {
171 if(newValue == "CM")
172 {
173// G4cout << "**** Change type" << G4endl;
174// TG4MoleculeShoot<G4ContinuousMedium>* casted = reinterpret_cast<TG4MoleculeShoot<G4ContinuousMedium>*>(fpShoot.get());
175// fpShoot.reset(casted);
176 fpShoot = fpShoot.get()->ChangeType<G4ContinuousMedium>();
177 }
178 }
179}
int G4ContinuousMedium
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)

Member Data Documentation

◆ fpGunN

G4UIcmdWithAnInteger* G4MoleculeShootMessenger::fpGunN
protected

◆ fpGunPosition

G4UIcmdWith3VectorAndUnit* G4MoleculeShootMessenger::fpGunPosition
protected

◆ fpGunRdnmPosition

G4UIcmdWith3VectorAndUnit* G4MoleculeShootMessenger::fpGunRdnmPosition
protected

◆ fpGunSpecies

G4UIcmdWithAString* G4MoleculeShootMessenger::fpGunSpecies
protected

◆ fpGunTime

G4UIcmdWithADoubleAndUnit* G4MoleculeShootMessenger::fpGunTime
protected

◆ fpGunType

G4UIcmdWithAString* G4MoleculeShootMessenger::fpGunType
protected

Definition at line 84 of file G4MoleculeGunMessenger.hh.

Referenced by G4MoleculeShootMessenger(), and SetNewValue().

◆ fpShoot

G4shared_ptr<G4MoleculeShoot> G4MoleculeShootMessenger::fpShoot
protected

Definition at line 85 of file G4MoleculeGunMessenger.hh.

Referenced by GetCurrentValue(), GetShoot(), and SetNewValue().


The documentation for this class was generated from the following files: