Geant4  10.01.p03
G4MoleculeDefinition.cc
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 // $Id: G4MoleculeDefinition.cc 84858 2014-10-21 16:08:22Z gcosmo $
27 //
28 // ----------------------------------------------------------------------
29 // GEANT 4 class implementation file
30 //
31 // 21 Oct 2009 first implementation by A. Mantero and M.Karamitros
32 // Based on prototype of A.Mantero
33 // **********************************************************************
34 
35 #include "G4MoleculeDefinition.hh"
37 #include "G4MoleculeTable.hh"
38 
39 using namespace std;
40 
41 // ######################################################################
42 // ### MoleculeDefinition ###
43 // ######################################################################
44 
46  G4double mass,
47  G4double diffCoeff,
48  G4int charge,
49  G4int electronicLevels,
50  G4double radius,
51  G4int atomsNumber,
52  G4double lifetime,
53  G4String aType,
54  G4FakeParticleID ID) :
55  G4ParticleDefinition(name, mass, 0., charge, 0, 0, 0, 0, 0, 0, "Molecule",
56  0, 0, ID, false, lifetime, NULL, false, aType, 0, 0.0),
57  fDiffusionCoefficient(diffCoeff),
58  fAtomsNb(atomsNumber),
59  fVanDerVaalsRadius(radius)
60 
61 {
62  fCharge = charge;
63  if (electronicLevels)
64  {
65  fElectronOccupancy = new G4ElectronOccupancy(electronicLevels);
66  }
67  else
68  {
70  }
71  fDecayTable = NULL;
73 }
74 
75 //___________________________________________________________________________
77 {
79  {
80  delete fElectronOccupancy;
82  }
83  if (fDecayTable)
84  {
85  delete fDecayTable;
86  fDecayTable = 0;
87  }
88 }
89 //___________________________________________________________________________
91  const G4ElectronOccupancy& conf,
92  double decayTime)
93 {
94  if (!fDecayTable)
95  {
97  }
98  fDecayTable->AddeConfToExcitedState(exStId, conf);
100  decayTime);
101 }
102 //___________________________________________________________________________
104 {
105  if (fElectronOccupancy)
106  {
107  G4int levelOccupancy = fElectronOccupancy->GetOccupancy(shell);
108 
109  if (levelOccupancy)
110  {
111 
112  fElectronOccupancy->RemoveElectron(shell, levelOccupancy);
113  }
114 
115  fElectronOccupancy->AddElectron(shell, eNb);
116  }
117 }
118 //___________________________________________________________________________
120 {
121  if (!fDecayTable)
122  {
124  }
125 
127 }
128 //___________________________________________________________________________
130 {
131  if (fDecayTable)
132  {
133  return fDecayTable->GetExcitedState(occ);
134  }
135  else
136  {
137  G4String const errMsg = ": no Excited States and Decays for" + GetName()
138  + " are defined.";
139  G4Exception("G4MoleculeDefinition::GetExcitedState", "",
140  FatalErrorInArgument, errMsg);
141  }
142  return *(new G4String(""));
143 }
144 //___________________________________________________________________________
146  const G4MolecularDissociationChannel* chan)
147 {
148  if (!fDecayTable)
149  {
151  }
152  fDecayTable->AddDecayChannel(chanId, chan);
153 }
154 //___________________________________________________________________________
155 const vector<const G4MolecularDissociationChannel*>*
157 {
158  if (fDecayTable)
159  {
160  const vector<const G4MolecularDissociationChannel*>* output = fDecayTable
161  ->GetDecayChannels(ExState);
162  return output;
163  }
164  else
165  {
166  G4String const errMsg = ": no Excited States and Decays for" + GetName()
167  + " are defined.";
168  G4Exception("G4MoleculeDefinition::GetDecayChannels", "",
169  FatalErrorInArgument, errMsg);
170  }
171  return 0;
172 }
173 //___________________________________________________________________________
174 const vector<const G4MolecularDissociationChannel*>*
176 {
177  if (fDecayTable)
178  {
179  const vector<const G4MolecularDissociationChannel*>* output = fDecayTable
180  ->GetDecayChannels(occ);
181  return output;
182  }
183  else
184  {
185  G4String const errMsg = ": no Excited States and Decays for" + GetName()
186  + " are defined.";
187  G4Exception("G4MoleculeDefinition::GetDecayChannels", "",
188  FatalErrorInArgument, errMsg);
189  }
190  return 0;
191 }
192 
194 // Protected
196 
199  fDiffusionCoefficient(right.fDiffusionCoefficient),
200  fAtomsNb(right.fAtomsNb),
201  fVanDerVaalsRadius(right.fVanDerVaalsRadius)
202 {
203  if (right.fElectronOccupancy != 0)
204  {
206  }
207  else fElectronOccupancy = 0;
208 
209  if (right.fDecayTable != 0)
210  {
212  }
213  else fDecayTable = 0;
214 
215  fCharge = right.fCharge;
216 }
217 
218 //___________________________________________________________________________
219 
221 {
222  if (this != &right)
223  {
224  }
225  return *this;
226 }
void Insert(G4MoleculeDefinition *)
const G4String & GetExcitedState(const G4ElectronOccupancy *) const
G4ElectronOccupancy * fElectronOccupancy
G4MolecularDissociationTable * fDecayTable
G4String name
Definition: TRTMaterials.hh:40
void AddeConfToExcitedState(const G4String &, const G4ElectronOccupancy &, double decayTime=0.)
Class Description G4MolecularDecayTable operates as a container of deexcitation modes for excited or ...
int G4int
Definition: G4Types.hh:78
const std::vector< const G4MolecularDissociationChannel * > * GetDecayChannels(const G4ElectronOccupancy *) const
G4int GetOccupancy(G4int orbit) const
G4int AddElectron(G4int orbit, G4int number=1)
void AddExcitedState(const G4String &)
static G4MoleculeTable * Instance()
static G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *)
void AddDecayChannel(const G4String &, const G4MolecularDissociationChannel *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void AddDecayChannel(const G4String &, const G4MolecularDissociationChannel *)
const std::vector< const G4MolecularDissociationChannel * > * GetDecayChannels(const G4ElectronOccupancy *) const
void AddeConfToExcitedState(const G4String &, const G4ElectronOccupancy &)
void SetDecayTime(G4double)
Set the decay time of the molecule.
const G4String & GetName() const
const G4MoleculeDefinition & operator=(const G4MoleculeDefinition &right)
void SetLevelOccupation(G4int, G4int eNb=2)
double G4double
Definition: G4Types.hh:76
const G4String & GetExcitedState(const G4ElectronOccupancy *) const
G4int RemoveElectron(G4int orbit, G4int number=1)