Geant4  10.02.p01
G4MolecularDissociationChannel.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: G4MolecularDissociationChannel.cc 91584 2015-07-27 13:01:48Z gcosmo $
27 //
28 // ----------------------------------------------------------------------
29 // GEANT 4 class implementation file
30 //
31 // History: first implementation by Alfonso Mantero 4 Mar 2009
32 //
33 // **********************************************************************
34 
36 #include "G4Molecule.hh"
38 #include "G4MoleculeTable.hh"
39 
40 using namespace std;
41 
42 // -----------------------------------------------------------------------------
43 // ### MolecularDecayChannel ###
44 // -----------------------------------------------------------------------------
45 
46 //struct CompMoleculePointer
47 //{
48 // bool operator()(const G4Molecule* mol1, const G4Molecule* mol2) const
49 // {
50 // return (*mol1) < (*mol2);
51 // }
52 //};
53 
54 //______________________________________________________________________________
55 
57  fName(aName)
58 {
59  //pointer
60  fProductsVector = 0;
61  //double
62  fDecayTime = 0;
63  fProbability = 0;
64  fReleasedEnergy = 0;
66  fDisplacementType = 0; // meaning no displacement cf G4VMolecularDisplacer
67 }
68 
69 //______________________________________________________________________________
70 
72 {
73  // pointer
74  fProductsVector = 0;
75  // double
76  fReleasedEnergy = 0;
77  fDecayTime = 0;
78  fProbability = 0;
80  fDisplacementType = 0; // meaning no displacement cf G4VMolecularDisplacer
81 }
82 
83 //______________________________________________________________________________
84 
86 {
87  if(fProductsVector)
88  {
89  fProductsVector->clear();
90  delete fProductsVector;
91  }
92 }
93 
94 //______________________________________________________________________________
95 
98 {
99  *this = right;
100 }
101 
102 //______________________________________________________________________________
103 
106 {
107  if(&right == this) return *this;
108 
109  // string
110  fName = right.fName;
111  //displacement type
113  // pointer
114  if(right.fProductsVector)
115  {
116 // fProductsVector = new vector<const G4Molecule*>(*(right.fProductsVector));
117  fProductsVector = new vector<G4MolecularConfiguration*>(*(right.fProductsVector));
118  }
119  else fProductsVector = 0;
120 
121  // double
123  fDecayTime = right.fDecayTime;
124  fProbability = right.fProbability;
125  // vector
128  return *this;
129 }
130 
131 //______________________________________________________________________________
132 
134  G4double displacement)
135 {
136  if(!fProductsVector) fProductsVector = new vector<G4MolecularConfiguration*>;
137 
138  fProductsVector->push_back(molecule->GetMolecularConfiguration());
139  fRMSProductsDisplacementVector.push_back(displacement);
140 }
141 
142 //______________________________________________________________________________
143 
144 void
146  G4double displacement)
147 {
148  if(!fProductsVector) fProductsVector = new vector<G4MolecularConfiguration*>;
149 
150  fProductsVector->push_back(molecule);
151  fRMSProductsDisplacementVector.push_back(displacement);
152 }
153 
154 //______________________________________________________________________________
155 
157  G4double displacement)
158 {
159 // if(!fProductsVector) fProductsVector = new vector<const G4Molecule*>;
160  if(!fProductsVector) fProductsVector = new vector<G4MolecularConfiguration*>;
161 
162  fProductsVector->push_back(
163  G4MoleculeTable::Instance()->GetConfiguration(molecule));
164  fRMSProductsDisplacementVector.push_back(displacement);
165 }
166 
167 //______________________________________________________________________________
168 
170 {
171  if(fProductsVector) return fProductsVector->size();
172  return 0;
173 }
174 
175 //______________________________________________________________________________
176 
178 {
179  if(fProductsVector)
180  return ((*fProductsVector)[index]);
181 
182  return 0;
183 }
184 
185 //______________________________________________________________________________
186 
187 G4double
190 {
191  if(!fProductsVector) return -1.;
192 
193  G4int sz = fProductsVector->size();
194  G4double value = DBL_MAX;
195  for(G4int i = 0; i < sz; i++)
196  {
197  if(product->GetMolecularConfiguration() != ((*fProductsVector)[i]))
198  {
200  }
201  }
202  return value;
203 }
204 
The pointer G4MolecularConfiguration will be shared by all the molecules having the same molecule def...
G4double GetRMSRadialDisplacementOfProduct(const G4Molecule *)
G4String fName
Definition: G4AttUtils.hh:55
G4MolecularConfiguration * GetMolecularConfiguration() const
Definition: G4Molecule.cc:565
int G4int
Definition: G4Types.hh:78
void AddProduct(const G4Molecule *, G4double=0)
G4MolecularConfiguration * GetProduct(int) const
std::vector< G4double > fRMSProductsDisplacementVector
static G4MoleculeTable * Instance()
std::vector< G4MolecularConfiguration * > * fProductsVector
Class Description The dynamic molecule holds all the data that change for a molecule It has a pointer...
Definition: G4Molecule.hh:94
double G4double
Definition: G4Types.hh:76
G4MolecularDissociationChannel & operator=(const G4MolecularDissociationChannel &right)
#define DBL_MAX
Definition: templates.hh:83