Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4Molecule.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Contact: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
27//
28// WARNING : This class is released as a prototype.
29// It might strongly evolve or even disapear in the next releases.
30//
31// ---------------------------------------------------------------------
32// GEANT 4 class header file
33//
34// History: first implementation, based on G4DynamicParticle
35// New dependency : G4VUserTrackInformation
36//
37// ---------------- G4Molecule ----------------
38// first design&implementation by Alfonso Mantero, 7 Apr 2009
39// New developments Alfonso Mantero & Mathieu Karamitros
40// Oct/Nov 2009 Class Name changed to G4Molecule
41// Removed dependency from G4DynamicParticle
42// New constructors :
43// copy constructor
44// direct ionized/excited molecule
45// New methods :
46// Get : name,atoms' number,nb electrons,decayChannel
47// PrintState //To get the electronic level and the
48// corresponding name of the excitation
49// Kinematic :
50// BuildTrack,GetKineticEnergy,GetDiffusionVelocity
51// Change the way dynCharge and eNb is calculated
52// ---------------------------------------------------------------------
53
54#ifndef G4Molecule_h
55#define G4Molecule_h 1
56
57#include "G4IT.hh"
58#include "G4Allocator.hh"
60
61class G4Molecule;
66
67G4Molecule* GetMolecule(const G4Track& track) ;
68G4Molecule* GetMolecule(const G4Track* track) ;
69
70/** Class Description
71 * The dynamic molecule holds all the data that change for a molecule
72 * It has a pointer to G4MoleculeDefinition object, which holds
73 * all the "ground level" information.
74 */
75
76class G4Molecule : public G4IT
77{
78
79public: // With Description
80
82
83 //From G4VUserTrackInformation
84 void Print() const;
85
86 // new/delete operators are overloded to use G4Allocator
87 inline void *operator new(size_t);
88#ifdef __IBMCPP__
89 inline void *operator new(size_t sz, void* p) { return p; }
90#endif
91 inline void operator delete(void *aVUserTrackInformation);
92
93 G4Molecule(const G4Molecule&);
94 G4Molecule & operator=(const G4Molecule &right);
95 G4bool operator==(const G4Molecule &right) const;
96 G4bool operator!=(const G4Molecule &right) const;
97 G4bool operator<(const G4Molecule &right) const;
98
99private :
100 bool CompareElectronOccupancy (const G4ElectronOccupancy* /*elecOccupancy2*/,
101 const G4int& /*totalOcc1*/, const G4int& /*totalOcc2*/) const;
102
103public:
104 //------ Constructors --------------------------
105 /** To build a molecule at ground state according to a given
106 * G4MoleculeDefinition that can be obtained from G4GenericMoleculeManager
107 */
109
110 /** To build a molecule at a specific excitation/ionisation state according
111 * to a ground state that can be obtained from G4GenericMoleculeManager
112 */
114
115 /** Specific builder for water molecules to be used in Geant4-DNA,
116 * the last option Excitation is true if the molecule is excited, is
117 * false is the molecule is ionized.
118 */
120
121 virtual ~G4Molecule();
122
123 //-------- Methods -------------------------------
124 //Get from static definition
125 /** Returns the name of the molecule
126 */
127 const G4String& GetName() const;
128
129 /** Returns the nomber of atoms compouning the molecule
130 */
131 G4int GetAtomsNumber() const;
132
133 /** Will set up the correct molecularConfiguration given
134 * an electron configuration
135 */
137
138 /** Method used in Geant4-DNA to excite water molecules
139 */
140 void ExciteMolecule(G4int);
141
142 /** Method used in Geant4-DNA to ionize water molecules
143 */
144 void IonizeMolecule(G4int);
145
146 /** Add n electrons to a given orbit.
147 * Note : You can add as many electrons to a given orbit, the result
148 * may be unrealist.
149 */
150 void AddElectron(G4int orbit, G4int n =1);
151
152 /** Remove n electrons to a given orbit.
153 */
154 void RemoveElectron(G4int,G4int number=1);
155
156 /** Move one electron from an orbit to another.
157 */
158 void MoveOneElectron(G4int /*orbit*/,G4int /*orbit*/);
159
160 /** Returns the number of electron.
161 */
162 G4double GetNbElectrons() const; //This method can be used to check if the electron s number is physical
163
164 /** Show the electronic state of the molecule.
165 */
166 void PrintState() const;
167
168 G4Track * BuildTrack(G4double globalTime, const G4ThreeVector& Position);
169
171
173
174 const std::vector <const G4MolecularDecayChannel*>* GetDecayChannel() const;
175
176 G4int GetMoleculeID() const;
177
178 //-------------Inline functions ---------------------
179 /** Get molecule definition. This G4MoleculeDefinition has the ground
180 * electronic state of the molecule.
181 */
182 const G4MoleculeDefinition* GetDefinition() const;
183
184 //methods to set/get changing parameters
185
186/////////////////////////////////////////////////////////////////////////////
187 /** Sets the diffusion coefficient D of the molecule used in diffusion
188 * processes to calculate the mean square jump distance between two
189 * changes of direction. In three dimension : <x^2> = 6 D t where t is
190 * the mean jump time between two changes of direction.
191 */
193
194 /** Returns the diffusion coefficient D.
195 */
197
198 /** Set the decay time of the molecule.
199 */
201
202 /** Returns the decay time of the molecule.
203 */
204 G4double GetDecayTime() const;
205
206 /** The Van Der Valls Radius of the molecule
207 */
210
211 /** Returns the object ElectronOccupancy describing the electronic
212 * configuration of the molecule.
213 */
215
216 /** Returns the charge of molecule.
217 */
218 G4int GetCharge() const;
219
220 /** Set the total mass of the molecule.
221 */
222 void SetMass(G4double);
223
224 /** Returns the total mass of the molecule.
225 */
226 G4double GetMass() const;
227////////////////////////////////////////////////////////////////////////
228
230
231 inline static void SetGlobalTemperature(double);
232 inline static double GetGlobalTemperature();
233
234private:
235 /** Default molecule builder
236 */
237 G4Molecule();
238
239 void Init();
240 G4DynamicParticle* fDynamicParticle;
241
242 G4MolecularConfiguration* fMolecularConfiguration;
243
244 static double fgTemperature;
245};
246
247
248#if defined G4EM_ALLOC_EXPORT
250#else
252#endif
253
254
255//////////////////////////
256inline void * G4Molecule::operator new(size_t)
257//////////////////////////
258{
259 void * aMolecule;
260 aMolecule = (void *) aMoleculeAllocator.MallocSingle();
261 return aMolecule;
262}
263
264//////////////////////////
265inline void G4Molecule::operator delete(void * aMolecule)
266//////////////////////////
267{
268 // DEBUG
269 // G4cout<<"G4Molecule::operator delete(void * aMolecule) called"<<G4endl;
270 aMoleculeAllocator.FreeSingle((G4Molecule *) aMolecule);
271}
272
274{
275 return fMolecularConfiguration ;
276}
277
278inline void G4Molecule::SetGlobalTemperature(double temperature)
279{
280 fgTemperature = temperature;
281}
282
284{
285 return fgTemperature;
286}
287
288#endif
G4Molecule * GetMolecule(const G4Track &track)
Definition: G4Molecule.cc:67
G4DLLIMPORT G4Allocator< G4Molecule > aMoleculeAllocator
double G4double
Definition: G4Types.hh:64
#define G4DLLIMPORT
Definition: G4Types.hh:56
#define G4DLLEXPORT
Definition: G4Types.hh:55
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
Definition: G4IT.hh:83
virtual void Print() const
Definition: G4IT.hh:92
void IonizeMolecule(G4int)
Definition: G4Molecule.cc:239
G4int GetCharge() const
Definition: G4Molecule.cc:375
void RemoveElectron(G4int, G4int number=1)
Definition: G4Molecule.cc:249
void AddElectron(G4int orbit, G4int n=1)
Definition: G4Molecule.cc:244
virtual ~G4Molecule()
Definition: G4Molecule.cc:138
G4bool operator<(const G4Molecule &right) const
Definition: G4Molecule.cc:116
G4double GetVanDerVaalsRadius() const
Definition: G4Molecule.cc:370
void SetElectronOccupancy(const G4ElectronOccupancy *)
Definition: G4Molecule.cc:225
void MoveOneElectron(G4int, G4int)
Definition: G4Molecule.cc:254
G4double GetMass() const
Definition: G4Molecule.cc:385
G4MolecularConfiguration * GetMolecularConfiguration()
Definition: G4Molecule.hh:273
static double GetGlobalTemperature()
Definition: G4Molecule.hh:283
ITDef(G4Molecule) void Print() const
G4int GetMoleculeID() const
Definition: G4Molecule.cc:350
G4double GetKineticEnergy() const
Definition: G4Molecule.cc:314
G4int GetAtomsNumber() const
Definition: G4Molecule.cc:264
G4bool operator==(const G4Molecule &right) const
Definition: G4Molecule.cc:97
void SetMass(G4double)
Definition: G4Molecule.cc:380
static void SetGlobalTemperature(double)
Definition: G4Molecule.hh:278
void SetVanDerVaalsRadius(G4double)
Definition: G4Molecule.cc:365
G4double GetDiffusionVelocity() const
Definition: G4Molecule.cc:324
void PrintState() const
Definition: G4Molecule.cc:274
void SetDecayTime(G4double)
Definition: G4Molecule.cc:355
const G4String & GetName() const
Definition: G4Molecule.cc:259
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:279
void ExciteMolecule(G4int)
Definition: G4Molecule.cc:232
G4bool operator!=(const G4Molecule &right) const
Definition: G4Molecule.cc:106
void SetDiffusionCoefficient(G4double)
Definition: G4Molecule.cc:400
const G4ElectronOccupancy * GetElectronOccupancy() const
Definition: G4Molecule.cc:390
G4Molecule & operator=(const G4Molecule &right)
Definition: G4Molecule.cc:89
const G4MoleculeDefinition * GetDefinition() const
Definition: G4Molecule.cc:395
G4double GetDiffusionCoefficient() const
Definition: G4Molecule.cc:405
G4double GetDecayTime() const
Definition: G4Molecule.cc:360
const std::vector< const G4MolecularDecayChannel * > * GetDecayChannel() const
Definition: G4Molecule.cc:345
G4double GetNbElectrons() const
Definition: G4Molecule.cc:269