Geant4  9.6.p02
 All Classes 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 
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 *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 
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  inline static void SetGlobalTemperature(double);
232  inline static double GetGlobalTemperature();
233 
234 private:
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 
256 inline void * G4Molecule::operator new(size_t)
258 {
259  void * aMolecule;
260  aMolecule = (void *) aMoleculeAllocator.MallocSingle();
261  return aMolecule;
262 }
263 
265 inline void G4Molecule::operator delete(void * aMolecule)
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 
278 inline void G4Molecule::SetGlobalTemperature(double temperature)
279 {
280  fgTemperature = temperature;
281 }
282 
284 {
285  return fgTemperature;
286 }
287 
288 #endif