Geant4  10.00.p01
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 
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 --------------------------
108  G4Molecule(G4MoleculeDefinition * molecule);
109 
114 
120 
121  virtual ~G4Molecule();
122 
123  //-------- Methods -------------------------------
124  //Get from static definition
127  const G4String& GetName() const;
128 
131  G4int GetAtomsNumber() const;
132 
137 
140  void ExciteMolecule(G4int);
141 
144  void IonizeMolecule(G4int);
145 
150  void AddElectron(G4int orbit, G4int n =1);
151 
154  void RemoveElectron(G4int,G4int number=1);
155 
158  void MoveOneElectron(G4int /*orbit*/,G4int /*orbit*/);
159 
162  G4double GetNbElectrons() const; //This method can be used to check if the electron s number is physical
163 
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 ---------------------
182  const G4MoleculeDefinition* GetDefinition() const;
183 
184  //methods to set/get changing parameters
185 
187 
193 
197 
200  void SetDecayTime(G4double);
201 
204  G4double GetDecayTime() const;
205 
210 
215 
218  G4int GetCharge() const;
219 
222  void SetMass(G4double);
223 
226  G4double GetMass() const;
228 
230 
231  static void SetGlobalTemperature(G4double);
233 
234 private:
237  G4Molecule();
238 
240 
241  static /*G4ThreadLocal*/ double fgTemperature;
242 };
243 
244 
245 #if defined G4EM_ALLOC_EXPORT
247 #else
249 #endif
250 
251 
253 inline void * G4Molecule::operator new(size_t)
255 {
257  return (void *) aMoleculeAllocator->MallocSingle();
258 }
259 
261 inline void G4Molecule::operator delete(void * aMolecule)
263 {
264  aMoleculeAllocator->FreeSingle((G4Molecule *) aMolecule);
265 }
266 
267 #endif
The pointer G4MolecularConfiguration will be shared by all the molecules having the same molecule def...
ITDef(G4Molecule) void Print() const
G4IT is a interface which allows the inheriting object :
Definition: G4IT.hh:82
void SetDiffusionCoefficient(G4double)
Sets the diffusion coefficient D of the molecule used in diffusion processes to calculate the mean sq...
Definition: G4Molecule.cc:384
#define G4DLLEXPORT
Definition: G4Types.hh:62
G4bool operator!=(const G4Molecule &right) const
Definition: G4Molecule.cc:104
CLHEP::Hep3Vector G4ThreeVector
G4Molecule()
Default molecule builder.
Definition: G4Molecule.cc:123
#define G4DLLIMPORT
Definition: G4Types.hh:63
G4bool operator<(const G4Molecule &right) const
The two methods below are the most called of the simulation : compare molecules in the MoleculeStackM...
Definition: G4Molecule.cc:114
G4double GetMass() const
Returns the total mass of the molecule.
Definition: G4Molecule.cc:369
void SetMass(G4double)
Set the total mass of the molecule.
Definition: G4Molecule.cc:364
G4MolecularConfiguration * fpMolecularConfiguration
Definition: G4Molecule.hh:239
G4double GetDiffusionCoefficient() const
Returns the diffusion coefficient D.
Definition: G4Molecule.cc:389
G4double GetNbElectrons() const
Returns the number of electron.
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
Returns the name of the molecule.
Definition: G4Molecule.cc:243
void MoveOneElectron(G4int, G4int)
Move one electron from an orbit to another.
Definition: G4Molecule.cc:238
void SetElectronOccupancy(const G4ElectronOccupancy *)
Will set up the correct molecularConfiguration given an electron configuration.
Definition: G4Molecule.cc:209
G4int GetAtomsNumber() const
Returns the nomber of atoms compouning the molecule.
Definition: G4Molecule.cc:248
bool G4bool
Definition: G4Types.hh:79
void SetVanDerVaalsRadius(G4double)
The Van Der Valls Radius of the molecule.
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)
Method used in Geant4-DNA to ionize water molecules.
Definition: G4Molecule.cc:223
const G4MoleculeDefinition * GetDefinition() const
Get molecule definition.
Definition: G4Molecule.cc:379
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:263
G4int GetCharge() const
Returns the charge of molecule.
Definition: G4Molecule.cc:359
bool CompareElectronOccupancy(const G4ElectronOccupancy *, const G4int &, const G4int &) const
G4double GetKineticEnergy() const
Definition: G4Molecule.cc:298
void RemoveElectron(G4int, G4int number=1)
Remove n electrons to a given orbit.
Definition: G4Molecule.cc:233
G4DLLIMPORT G4ThreadLocal G4Allocator< G4Molecule > * aMoleculeAllocator
void PrintState() const
Show the electronic state of the molecule.
Definition: G4Molecule.cc:258
G4double GetDiffusionVelocity() const
Definition: G4Molecule.cc:308
Class Description The dynamic molecule holds all the data that change for a molecule It has a pointer...
Definition: G4Molecule.hh:76
double G4double
Definition: G4Types.hh:76
const G4ElectronOccupancy * GetElectronOccupancy() const
Returns the object ElectronOccupancy describing the electronic configuration of the molecule...
Definition: G4Molecule.cc:374
G4double GetVanDerVaalsRadius() const
Definition: G4Molecule.cc:354
static void SetGlobalTemperature(G4double)
Definition: G4Molecule.cc:399
G4double GetDecayTime() const
Returns the decay time of the molecule.
Definition: G4Molecule.cc:344
virtual void Print() const
Definition: G4IT.hh:92
void AddElectron(G4int orbit, G4int n=1)
Add n electrons to a given orbit.
Definition: G4Molecule.cc:228
G4bool operator==(const G4Molecule &right) const
Definition: G4Molecule.cc:95
void SetDecayTime(G4double)
Set the decay time of the molecule.
Definition: G4Molecule.cc:339
static double fgTemperature
Definition: G4Molecule.hh:241
void ExciteMolecule(G4int)
Method used in Geant4-DNA to excite water molecules.
Definition: G4Molecule.cc:216
G4int GetMoleculeID() const
Definition: G4Molecule.cc:334