Geant4  10.00.p01
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 74551 2013-10-14 12:59:14Z 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 {
64  fDecayTable = NULL;
65 }
66 //___________________________________________________________________________
68 {
70  {
71  delete fElectronOccupancy;
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  {
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  {
113  }
114 
116 }
117 //___________________________________________________________________________
119 {
120  if (fDecayTable)
121  {
122  return fDecayTable->GetExcitedState(occ);
123  }
124  else
125  {
126  G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
127  G4Exception("G4MoleculeDefinition::GetExcitedState","",FatalErrorInArgument,errMsg);
128  }
129  return *(new G4String(""));
130 }
131 //___________________________________________________________________________
133  const G4MolecularDecayChannel* chan)
134 {
135  if (!fDecayTable)
136  {
138  }
139  fDecayTable->AddDecayChannel(chanId, chan);
140 }
141 //___________________________________________________________________________
142 const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4String& ExState) const
143 {
144  if (fDecayTable)
145  {
146  const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(ExState);
147  return output;
148  }
149  else
150  {
151  G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
152  G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
153  }
154  return 0;
155 }
156 //___________________________________________________________________________
157 const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4ElectronOccupancy* occ) const
158 {
159  if (fDecayTable)
160  {
161  const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(occ);
162  return output;
163  }
164  else
165  {
166  G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
167  G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
168  }
169  return 0;
170 }
171 
173 // Protected
175 
178  fMass(right.fMass),
179  fNbOfElectrons (right.fNbOfElectrons),
180  fNbOfMolecularShells(right.fNbOfMolecularShells),
181  fDiffusionCoefficient( right.fDiffusionCoefficient),
182  fAtomsNb( right.fAtomsNb),
183  fVanDerVaalsRadius (right.fVanDerVaalsRadius)
184 {
185  if(right.fElectronOccupancy!=0)
186  {
188  }
189  else fElectronOccupancy = 0;
190 
191  if(right.fDecayTable!=0)
192  {
194  }
195  else fDecayTable = 0;
196 }
197 
198 //___________________________________________________________________________
199 
201 {
202  if (this != &right) {
203  }
204  return *this;
205 }
const G4String & GetExcitedState(const G4ElectronOccupancy *) const
G4ElectronOccupancy * fElectronOccupancy
void AddDecayChannel(const G4String &, const G4MolecularDecayChannel *)
static G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *, const G4ElectronOccupancy &electronOccupancy)
G4String name
Definition: TRTMaterials.hh:40
void AddeConfToExcitedState(const G4String &, const G4ElectronOccupancy &, double decayTime=0.)
int G4int
Definition: G4Types.hh:78
const std::vector< const G4MolecularDecayChannel * > * GetDecayChannels(const G4ElectronOccupancy *) const
G4int GetOccupancy(G4int orbit) const
G4int AddElectron(G4int orbit, G4int number=1)
void AddExcitedState(const G4String &)
const G4String & GetExcitedState(const G4ElectronOccupancy *) const
void AddDecayChannel(const G4String &, const G4MolecularDecayChannel *)
void AddExcitedState(const G4String &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void AddeConfToExcitedState(const G4String &, const G4ElectronOccupancy &)
G4MolecularDecayTable * fDecayTable
void SetDecayTime(G4double)
Set the decay time of the molecule.
const G4String & GetName() const
const G4MoleculeDefinition & operator=(const G4MoleculeDefinition &right)
const std::vector< const G4MolecularDecayChannel * > * GetDecayChannels(const G4ElectronOccupancy *) const
void SetLevelOccupation(G4int, G4int eNb=2)
double G4double
Definition: G4Types.hh:76
Class Description G4MolecularDecayTable operates as a container of deexcitation modes for excited or ...
G4int RemoveElectron(G4int orbit, G4int number=1)