Geant4 11.2.2
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 >)
 
 ~G4MoleculeShootMessenger () override
 
void SetNewValue (G4UIcommand *command, G4String newValue) override
 
G4String GetCurrentValue (G4UIcommand *command) override
 
G4shared_ptr< G4MoleculeShoot > & GetShoot ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
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 LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 95 of file G4MoleculeGunMessenger.cc.

98 :
99 fpShoot(shoot)
100{
101 G4String dir("/chem/gun/");
102 dir += name;
103 CreateDirectory(dir, "");
104
105 G4String tmp = dir;
106 tmp += "/species";
107 fpGunSpecies = new G4UIcmdWithAString(tmp, this);
108
109 tmp = dir;
110 tmp += "/position";
112
113 tmp = dir;
114 tmp += "/time";
115 fpGunTime = new G4UIcmdWithADoubleAndUnit(tmp, this);
116
117 tmp = dir;
118 tmp += "/number";
119 fpGunN = new G4UIcmdWithAnInteger(tmp, this);
120
121 tmp = dir;
122 tmp += "/rndmPosition";
124
125 tmp = dir;
126 tmp += "/type";
127 fpGunType = new G4UIcmdWithAString(tmp, this);
128
129// fpShoot.reset(new TG4MoleculeShoot<G4Track>());
130}
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 ( )
override

Definition at line 134 of file G4MoleculeGunMessenger.cc.

135{
136 delete fpGunSpecies;
137 delete fpGunPosition;
138 delete fpGunTime;
139 delete fpGunN;
140}

Member Function Documentation

◆ GetCurrentValue()

G4String G4MoleculeShootMessenger::GetCurrentValue ( G4UIcommand * command)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 180 of file G4MoleculeGunMessenger.cc.

181{
182 if (command == fpGunSpecies)
183 {
184 return fpShoot->fMoleculeName;
185 }
186 if (command == fpGunPosition)
187 {
189 }
190 if (command == fpGunRdnmPosition)
191 {
192 if(fpShoot->fBoxSize != nullptr)
193 {
195 }
197 }
198 if (command == fpGunTime)
199 {
201 }
202 if (command == fpGunN)
203 {
204 return fpGunN->ConvertToString(fpShoot->fNumber);
205 }
206 return "";
207}
CLHEP::Hep3Vector G4ThreeVector
G4String ConvertToStringWithBestUnit(const G4ThreeVector &vec)
G4String ConvertToStringWithBestUnit(G4double val)
static G4String ConvertToString(G4bool boolVal)

◆ 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 )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 144 of file G4MoleculeGunMessenger.cc.

145{
146 if (command == fpGunSpecies)
147 {
148 fpShoot->fMoleculeName = newValue;
149 }
150 else if (command == fpGunPosition)
151 {
152 fpShoot->fPosition = fpGunPosition->GetNew3VectorValue(newValue);
153 }
154 else if(command == fpGunRdnmPosition)
155 {
156 fpShoot->fBoxSize = new G4ThreeVector(fpGunRdnmPosition->GetNew3VectorValue(newValue));
157 }
158 else if (command == fpGunTime)
159 {
160 fpShoot->fTime = fpGunTime->GetNewDoubleValue(newValue);
161 }
162 else if (command == fpGunN)
163 {
164 fpShoot->fNumber = fpGunN->GetNewIntValue(newValue);
165 }
166 else if (command == fpGunType)
167 {
168 if(newValue == "CM")
169 {
170// G4cout << "**** Change type" << G4endl;
171// TG4MoleculeShoot<G4ContinuousMedium>* casted = static_cast<TG4MoleculeShoot<G4ContinuousMedium>*>(fpShoot.get());
172// fpShoot.reset(casted);
173 fpShoot = fpShoot.get()->ChangeType<G4ContinuousMedium>();
174 }
175 }
176}
G4int 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: