Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
59 #include "G4MoleculeDefinition.hh"
60 
61 class G4Molecule;
65 class G4DynamicParticle;
66 
67 G4Molecule* GetMolecule(const G4Track& track) ;
68 G4Molecule* 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 
76 class G4Molecule : public G4IT
77 {
78 
79 public: // 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*);
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 
99 private :
100  bool CompareElectronOccupancy (const G4ElectronOccupancy* /*elecOccupancy2*/,
101  const G4int& /*totalOcc1*/, const G4int& /*totalOcc2*/) const;
102 
103 public:
104  //------ Constructors --------------------------
105  /** To build a molecule at ground state according to a given
106  * G4MoleculeDefinition that can be obtained from G4GenericMoleculeManager
107  */
108  G4Molecule(G4MoleculeDefinition * molecule);
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  */
113  G4Molecule(G4MoleculeDefinition * molecule, G4int, G4int);
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  */
119  G4Molecule(G4MoleculeDefinition * molecule, G4int, G4bool);
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 
170  G4double GetKineticEnergy() const;
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  */
200  void SetDecayTime(G4double);
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  static void SetGlobalTemperature(G4double);
233 
234 private:
235  /** Default molecule builder
236  */
237  G4Molecule();
238 
239  G4MolecularConfiguration* fpMolecularConfiguration;
240 
241  static /*G4ThreadLocal*/ double fgTemperature;
242 };
243 
244 
245 #if defined G4EM_ALLOC_EXPORT
247 #else
249 #endif
250 
251 
252 //////////////////////////
253 inline void * G4Molecule::operator new(size_t)
254 //////////////////////////
255 {
257  return (void *) aMoleculeAllocator->MallocSingle();
258 }
259 
260 //////////////////////////
261 inline void G4Molecule::operator delete(void * aMolecule)
262 //////////////////////////
263 {
264  aMoleculeAllocator->FreeSingle((G4Molecule *) aMolecule);
265 }
266 
267 #endif
ITDef(G4Molecule) void Print() const
Definition: G4IT.hh:82
void SetDiffusionCoefficient(G4double)
Definition: G4Molecule.cc:384
#define G4DLLEXPORT
Definition: G4Types.hh:62
G4bool operator!=(const G4Molecule &right) const
Definition: G4Molecule.cc:104
#define G4DLLIMPORT
Definition: G4Types.hh:63
G4bool operator<(const G4Molecule &right) const
Definition: G4Molecule.cc:114
const char * p
Definition: xmltok.h:285
G4double GetMass() const
Definition: G4Molecule.cc:369
void SetMass(G4double)
Definition: G4Molecule.cc:364
G4double GetDiffusionCoefficient() const
Definition: G4Molecule.cc:389
G4double GetNbElectrons() const
Definition: G4Molecule.cc:253
const std::vector< const G4MolecularDecayChannel * > * GetDecayChannel() const
Definition: G4Molecule.cc:329
G4MolecularConfiguration * GetMolecularConfiguration() const
Definition: G4Molecule.cc:394
#define G4ThreadLocal
Definition: tls.hh:52
virtual ~G4Molecule()
Definition: G4Molecule.cc:130
int G4int
Definition: G4Types.hh:78
static G4double GetGlobalTemperature()
Definition: G4Molecule.cc:404
const G4String & GetName() const
Definition: G4Molecule.cc:243
void MoveOneElectron(G4int, G4int)
Definition: G4Molecule.cc:238
void SetElectronOccupancy(const G4ElectronOccupancy *)
Definition: G4Molecule.cc:209
G4int GetAtomsNumber() const
Definition: G4Molecule.cc:248
bool G4bool
Definition: G4Types.hh:79
void SetVanDerVaalsRadius(G4double)
Definition: G4Molecule.cc:349
G4Molecule & operator=(const G4Molecule &right)
Definition: G4Molecule.cc:88
const G4int n
G4Molecule * GetMolecule(const G4Track &track)
Definition: G4Molecule.cc:67
void IonizeMolecule(G4int)
Definition: G4Molecule.cc:223
const G4MoleculeDefinition * GetDefinition() const
Definition: G4Molecule.cc:379
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:263
G4int GetCharge() const
Definition: G4Molecule.cc:359
G4double GetKineticEnergy() const
Definition: G4Molecule.cc:298
void RemoveElectron(G4int, G4int number=1)
Definition: G4Molecule.cc:233
G4DLLIMPORT G4ThreadLocal G4Allocator< G4Molecule > * aMoleculeAllocator
void PrintState() const
Definition: G4Molecule.cc:258
G4double GetDiffusionVelocity() const
Definition: G4Molecule.cc:308
double G4double
Definition: G4Types.hh:76
const G4ElectronOccupancy * GetElectronOccupancy() const
Definition: G4Molecule.cc:374
G4double GetVanDerVaalsRadius() const
Definition: G4Molecule.cc:354
static void SetGlobalTemperature(G4double)
Definition: G4Molecule.cc:399
G4double GetDecayTime() const
Definition: G4Molecule.cc:344
virtual void Print() const
Definition: G4IT.hh:92
void AddElectron(G4int orbit, G4int n=1)
Definition: G4Molecule.cc:228
G4bool operator==(const G4Molecule &right) const
Definition: G4Molecule.cc:95
void SetDecayTime(G4double)
Definition: G4Molecule.cc:339
void ExciteMolecule(G4int)
Definition: G4Molecule.cc:216
G4int GetMoleculeID() const
Definition: G4Molecule.cc:334