Geant4_10
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 
113  G4Molecule(G4MoleculeDefinition * molecule, G4int, G4int);
114 
119  G4Molecule(G4MoleculeDefinition * molecule, G4int, G4bool);
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 
239  G4MolecularConfiguration* fpMolecularConfiguration;
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
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
Char_t n[5]
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
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
Definition: G4Molecule.cc:65
void PrintState() const
Definition: G4Molecule.cc:258
G4double GetDiffusionVelocity() const
Definition: G4Molecule.cc:308
void Print() const
Definition: G4Molecule.cc:77
double G4double
Definition: G4Types.hh:76
const G4ElectronOccupancy * GetElectronOccupancy() const
Definition: G4Molecule.cc:374
G4double GetVanDerVaalsRadius() const
Definition: G4Molecule.cc:354
#define ITDef(T)
Definition: G4ITType.hh:105
static void SetGlobalTemperature(G4double)
Definition: G4Molecule.cc:399
G4double GetDecayTime() const
Definition: G4Molecule.cc:344
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