Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 64057 2012-10-30 15:04:49Z 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 
36 #include "G4MoleculeDefinition.hh"
38 
39 using namespace std;
40 
41 // ######################################################################
42 // ### MoleculeDefinition ###
43 // ######################################################################
44 
46  G4double mass,
47  G4int electronsNumber,
48  G4int electronicLevels,
49  G4double diffCoeff,
50  G4int atomsNumber,
51  G4double radius,
52  G4double lifetime,
53  G4String aType ,
54  G4MoleculeID ID
55  ):
56  G4ParticleDefinition(name, mass, 0., 0., 0, 0, 0, 0, 0, 0, "Molecule",
57  0, 0, ID, false, lifetime, NULL, false, aType, 0, 0.0),
58  fMass(mass),
59  fNbOfElectrons(electronsNumber), fNbOfMolecularShells(electronicLevels), fDiffusionCoefficient(diffCoeff),
60  fAtomsNb(atomsNumber), fVanDerVaalsRadius(radius)
61 
62 {
63  fElectronOccupancy = new G4ElectronOccupancy(fNbOfMolecularShells);
64  fDecayTable = NULL;
65 }
66 //___________________________________________________________________________
68 {
69  if (fElectronOccupancy)
70  {
71  delete fElectronOccupancy;
72  fElectronOccupancy = 0;
73  }
74  if (fDecayTable)
75  {
76  delete fDecayTable;
77  fDecayTable = 0;
78  }
79  // fMolecularConfiguration = 0;
80 }
81 //___________________________________________________________________________
83  const G4ElectronOccupancy& conf,
84  double decayTime)
85 {
86  if (!fDecayTable)
87  {
88  fDecayTable = new G4MolecularDecayTable();
89  }
90  fDecayTable->AddeConfToExcitedState(exStId, conf);
92 }
93 //___________________________________________________________________________
95 {
96  G4int levelOccupancy = fElectronOccupancy->GetOccupancy(shell);
97 
98  if (levelOccupancy)
99  {
100 
101  fElectronOccupancy->RemoveElectron(shell, levelOccupancy);
102  }
103 
104  fElectronOccupancy->AddElectron(shell,eNb);
105 
106 }
107 //___________________________________________________________________________
109 {
110  if (!fDecayTable)
111  {
112  fDecayTable = new G4MolecularDecayTable();
113  }
114 
115  fDecayTable->AddExcitedState(val);
116 
117 }
118 //___________________________________________________________________________
120 {
121  if (fDecayTable)
122  {
123  return fDecayTable->GetExcitedState(occ);
124  }
125  else
126  {
127  G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
128  G4Exception("G4MoleculeDefinition::GetExcitedState","",FatalErrorInArgument,errMsg);
129  }
130  return *(new G4String(""));
131 }
132 //___________________________________________________________________________
134  const G4MolecularDecayChannel* chan)
135 {
136  if (!fDecayTable)
137  {
138  fDecayTable = new G4MolecularDecayTable();
139  }
140  fDecayTable->AddDecayChannel(chanId, chan);
141 }
142 //___________________________________________________________________________
143 const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4String& ExState) const
144 {
145  if (fDecayTable)
146  {
147  const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(ExState);
148  return output;
149  }
150  else
151  {
152  G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
153  G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
154  }
155  return 0;
156 }
157 //___________________________________________________________________________
158 const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4ElectronOccupancy* occ) const
159 {
160  if (fDecayTable)
161  {
162  const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(occ);
163  return output;
164  }
165  else
166  {
167  G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
168  G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
169  }
170  return 0;
171 }
172 
174 // Protected
176 
179  fMass(right.fMass),
180  fNbOfElectrons (right.fNbOfElectrons),
181  fNbOfMolecularShells(right.fNbOfMolecularShells),
182  fDiffusionCoefficient( right.fDiffusionCoefficient),
183  fAtomsNb( right.fAtomsNb),
184  fVanDerVaalsRadius (right.fVanDerVaalsRadius)
185 {
186  if(right.fElectronOccupancy!=0)
187  {
188  fElectronOccupancy= new G4ElectronOccupancy(*(right.fElectronOccupancy));
189  }
190  else fElectronOccupancy = 0;
191 
192  if(right.fDecayTable!=0)
193  {
194  fDecayTable = new G4MolecularDecayTable(*(right.fDecayTable));
195  }
196  else fDecayTable =0;
197 }
198 
199 //___________________________________________________________________________
200 
201 const G4MoleculeDefinition & G4MoleculeDefinition::operator=(const G4MoleculeDefinition &right)
202 {
203  if (this != &right) {
204  }
205  return *this;
206 }