Geant4  10.01
G4DNAWaterDissociationDisplacer.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: G4DNAWaterDissociationDisplacer.cc 84858 2014-10-21 16:08:22Z gcosmo $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // WARNING : This class is released as a prototype.
31 // It might strongly evolve or even disapear in the next releases.
32 //
33 // History:
34 // -----------
35 // 10 Oct 2011 M.Karamitros created
36 //
37 // -------------------------------------------------------------------
38 
40 #include "G4PhysicalConstants.hh"
41 #include "G4SystemOfUnits.hh"
42 #include "G4H2O.hh"
43 #include "G4H2.hh"
44 #include "G4Hydrogen.hh"
45 #include "G4OH.hh"
46 #include "G4H3O.hh"
47 #include "G4Electron_aq.hh"
48 #include "G4H2O2.hh"
49 #include "Randomize.hh"
50 #include "G4Molecule.hh"
51 
52 using namespace std;
53 
64 
67 {
68  ;
69 }
70 
72 {
73  ;
74 }
75 
77 {
78  G4int decayType = theDecayChannel->GetDisplacementType();
79 
80  G4double RMSMotherMoleculeDisplacement = 0;
81 
82  if (decayType == Ionisation_DissociationDecay)
83  {
84  RMSMotherMoleculeDisplacement = 2.0 * nanometer;
85  }
86  else if (decayType == A1B1_DissociationDecay)
87  {
88  RMSMotherMoleculeDisplacement = 0. * nanometer;
89  }
90  else if (decayType == B1A1_DissociationDecay)
91  {
92  RMSMotherMoleculeDisplacement = 0. * nanometer;
93  }
94  else if (decayType == AutoIonisation)
95  {
96  RMSMotherMoleculeDisplacement = 2.0 * nanometer;
97  }
98  else if (decayType == DissociativeAttachment)
99  {
100  RMSMotherMoleculeDisplacement = 0. * nanometer;
101  }
102 
103  if (RMSMotherMoleculeDisplacement == 0)
104  {
105  return G4ThreeVector(0, 0, 0);
106  }
108  RMSMotherMoleculeDisplacement);
109 
110  return RandDirection;
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
114 
116 {
117  G4int nbProducts = theDecayChannel->GetNbProducts();
118  vector<G4ThreeVector> theProductDisplacementVector(nbProducts);
119 
120  typedef map<const G4MoleculeDefinition*, G4double> RMSmap;
121  RMSmap theRMSmap;
122 
123  G4int decayType = theDecayChannel->GetDisplacementType();
124 
125  if (decayType == Ionisation_DissociationDecay)
126  {
127  if (fVerbose) G4cout << "Ionisation_DissociationDecay" << G4endl;
128  G4double RdmValue = G4UniformRand();
129 
130  if(RdmValue< 0.5)
131  {
132  // H3O
133  theRMSmap[G4H3O::Definition()] = 0.* nanometer;
134  // OH
135  theRMSmap[G4OH::Definition()] = 0.8* nanometer;
136  }
137  else
138  {
139  // H3O
140  theRMSmap[G4H3O::Definition()] = 0.8* nanometer;
141  // OH
142  theRMSmap[G4OH::Definition()] = 0.* nanometer;
143  }
144 
145  for(int i = 0; i < nbProducts; i++)
146  {
147  G4double theRMSDisplacement;
148  const G4Molecule* product = theDecayChannel->GetProduct(i);
149  theRMSDisplacement = theRMSmap[product->GetDefinition()];
150 
151  if(theRMSDisplacement==0)
152  {
153  theProductDisplacementVector[i] = G4ThreeVector();
154  }
155  else
156  {
157  G4ThreeVector RandDirection = radialDistributionOfProducts(theRMSDisplacement);
158  theProductDisplacementVector[i] = RandDirection;
159  }
160  }
161  }
162  else if(decayType == A1B1_DissociationDecay)
163  {
164  if(fVerbose)
165  G4cout<<"A1B1_DissociationDecay"<<G4endl;
166  G4double theRMSDisplacement = 2.4 * nanometer;
167  G4ThreeVector RandDirection = radialDistributionOfProducts(theRMSDisplacement);
168 
169  for(G4int i =0; i < nbProducts; i++)
170  {
171  const G4Molecule* product = theDecayChannel->GetProduct(i);
172  if(product->GetDefinition()== G4OH::Definition())
173  {
174  theProductDisplacementVector[i] = -1./18.*RandDirection;
175  }
176  else if(product->GetDefinition() == G4Hydrogen::Definition())
177  {
178  theProductDisplacementVector[i] = +17./18.*RandDirection;
179  }
180  }
181  }
182  else if(decayType == B1A1_DissociationDecay)
183  {
184  if(fVerbose)
185  G4cout<<"B1A1_DissociationDecay"<<G4endl;
186  G4double theRMSDisplacement = 0.8 * nanometer;
187  G4ThreeVector RandDirection = radialDistributionOfProducts(theRMSDisplacement);
188 
189  G4int NbOfOH = 0;
190  for(G4int i =0; i < nbProducts; i++)
191  {
192  const G4Molecule* product = theDecayChannel->GetProduct(i);
193  if(product->GetDefinition() == G4H2::Definition())
194  {
195  theProductDisplacementVector[i] = -2./18.*RandDirection;
196  }
197  else if(product->GetDefinition() == G4OH::Definition())
198  {
199  G4ThreeVector OxygenDisplacement = +16./18.*RandDirection;
200  G4double OHRMSDisplacement = 1.1 * nanometer;
201 
202  G4ThreeVector OHDisplacement = radialDistributionOfProducts(OHRMSDisplacement);
203 
204  if(NbOfOH==0)
205  {
206  OHDisplacement = 1./2.*OHDisplacement;
207  }
208  else
209  {
210  OHDisplacement = -1./2.*OHDisplacement;
211  }
212 
213  theProductDisplacementVector[i] = OHDisplacement + OxygenDisplacement;
214 
215  NbOfOH ++;
216  }
217  }
218  }
219  else if(decayType == AutoIonisation)
220  {
221  if(fVerbose)
222  G4cout<<"AutoIonisation"<<G4endl;
223  G4double RdmValue = G4UniformRand();
224 
225  if(RdmValue< 0.5)
226  {
227  // H3O
228  theRMSmap[G4H3O::Definition()] = 0.* nanometer;
229  // OH
230  theRMSmap[G4OH::Definition()] = 0.8* nanometer;
231  }
232  else
233  {
234  // H3O
235  theRMSmap[G4H3O::Definition()] = 0.8* nanometer;
236  // OH
237  theRMSmap[G4OH::Definition()] = 0.* nanometer;
238  }
239 
240  for(G4int i =0; i < nbProducts; i++)
241  {
242  G4double theRMSDisplacement;
243  const G4Molecule* product = theDecayChannel->GetProduct(i);
244  theRMSDisplacement = theRMSmap[product->GetDefinition()];
245 
246  if(theRMSDisplacement==0)
247  {
248  theProductDisplacementVector[i] = G4ThreeVector();
249  }
250  else
251  {
252  G4ThreeVector RandDirection = radialDistributionOfProducts(theRMSDisplacement);
253  theProductDisplacementVector[i] = RandDirection;
254  }
255  if(product->GetDefinition() == G4Electron_aq::Definition())
256  {
257  theProductDisplacementVector[i]=radialDistributionOfElectron();
258  }
259  }
260  }
261  else if(decayType == DissociativeAttachment)
262  {
263  if(fVerbose)
264  G4cout<<"DissociativeAttachment"<<G4endl;
265  G4double theRMSDisplacement = 0.8 * nanometer;
266  G4ThreeVector RandDirection = radialDistributionOfProducts(theRMSDisplacement);
267 
268  G4int NbOfOH = 0;
269  for(G4int i =0; i < nbProducts; i++)
270  {
271  const G4Molecule* product = theDecayChannel->GetProduct(i);
272  if(product->GetDefinition() == G4H2::Definition())
273  {
274  theProductDisplacementVector[i] = -2./18.*RandDirection;
275  }
276  else if(product->GetDefinition() == G4OH::Definition())
277  {
278  G4ThreeVector OxygenDisplacement = +16./18.*RandDirection;
279  G4double OHRMSDisplacement = 1.1 * nanometer;
280 
281  G4ThreeVector OHDisplacement = radialDistributionOfProducts(OHRMSDisplacement);
282 
283  if(NbOfOH==0)
284  {
285  OHDisplacement = 1./2.*OHDisplacement;
286  }
287  else
288  {
289  OHDisplacement = -1./2.*OHDisplacement;
290  }
291 
292  theProductDisplacementVector[i] = OHDisplacement + OxygenDisplacement;
293 
294  NbOfOH ++;
295  }
296  }
297  }
298 
299  return theProductDisplacementVector;
300 }
301 
302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
303 
305 {
306  G4double sigma = Rrms / sqrt(3.);
307  G4double expectationValue = 2. * sqrt(2. / 3.14) * sigma;
308 
309  G4double XValueForfMax = sqrt(2. * sigma * sigma);
310  G4double fMaxValue = sqrt(2. / 3.14) * 1. / (sigma * sigma * sigma)
311  * (XValueForfMax * XValueForfMax)
312  * exp(-1. / 2. * (XValueForfMax * XValueForfMax) / (sigma * sigma));
313 
314  G4double R(-1.);
315 
316  do
317  {
318  G4double aRandomfValue = fMaxValue * G4UniformRand();
319 
320  G4double sign;
321  if(G4UniformRand() > 0.5)
322  {
323  sign = +1.;
324  }
325  else
326  {
327  sign = -1;
328  }
329 
330  R = expectationValue + sign*3.*sigma* G4UniformRand();
331  G4double f = sqrt(2./3.14) * 1/pow(sigma, 3) * R*R * exp(-1./2. * R*R/(sigma*sigma));
332 
333  if(aRandomfValue < f)
334  {
335  break;
336  }
337  }
338  while(1);
339 
340  G4double costheta = (2. * G4UniformRand()-1.);
341  G4double theta = acos(costheta);
342  G4double phi = 2. * pi * G4UniformRand();
343 
344  G4double xDirection = R * cos(phi) * sin(theta);
345  G4double yDirection = R * sin(theta) * sin(phi);
346  G4double zDirection = R * costheta;
347  G4ThreeVector RandDirection(xDirection, yDirection, zDirection);
348 
349  return RandDirection;
350 }
351 
352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
353 
355 {
356 
357  G4double sigma = 1. / 2.;
358  G4double expectationValue = 1.;
359 
360  G4double XValueForfMax = 1. / 2.;
361  G4double fMaxValue = 4. * XValueForfMax * exp(-2. * XValueForfMax);
362 
363  G4double R(-1.);
364 
365  do
366  {
367  G4double aRandomfValue = fMaxValue * G4UniformRand();
368 
369  G4double sign;
370  if(G4UniformRand() > 0.5)
371  {
372  sign = +1;
373  }
374  else
375  {
376  sign = -1;
377  }
378 
379  R = (expectationValue * G4UniformRand() )+ sign*3*sigma* G4UniformRand();
380  G4double f = 4* R * exp(- 2. * R);
381 
382  if(aRandomfValue < f)
383  {
384  break;
385  }
386  }
387  while(1);
388 
389  G4double Rnano = R * 10 * nanometer;
390 
391  G4double costheta = (2 * G4UniformRand()-1);
392  G4double theta = acos(costheta);
393  G4double phi = 2 * pi * G4UniformRand();
394 
395  G4double xDirection = Rnano * cos(phi) * sin(theta);
396  G4double yDirection = Rnano * sin(theta) * sin(phi);
397  G4double zDirection = Rnano * costheta;
398  G4ThreeVector RandDirection(xDirection, yDirection, zDirection);
399 
400  return RandDirection;
401 }
static G4DLLIMPORT const DisplacementType AutoIonisation
static G4DLLIMPORT const DisplacementType B1A1_DissociationDecay
static G4Electron_aq * Definition()
static G4DLLIMPORT const DisplacementType A1B1_DissociationDecay
CLHEP::Hep3Vector G4ThreeVector
static G4DLLIMPORT const DisplacementType Ionisation_DissociationDecay
static const double nanometer
Definition: G4SIunits.hh:91
const G4double pi
int G4int
Definition: G4Types.hh:78
G4ThreeVector radialDistributionOfProducts(G4double) const
static G4DLLIMPORT const DisplacementType DissociativeAttachment
#define G4UniformRand()
Definition: Randomize.hh:95
G4GLOB_DLL std::ostream G4cout
static G4H3O * Definition()
Definition: G4H3O.cc:47
const G4MoleculeDefinition * GetDefinition() const
Get molecule definition.
Definition: G4Molecule.cc:455
#define G4endl
Definition: G4ios.hh:61
const G4Molecule * GetProduct(int) const
static G4OH * Definition()
Definition: G4OH.cc:46
Class Description The dynamic molecule holds all the data that change for a molecule It has a pointer...
Definition: G4Molecule.hh:93
double G4double
Definition: G4Types.hh:76
static G4H2 * Definition()
Definition: G4H2.cc:46
virtual G4ThreeVector GetMotherMoleculeDisplacement(const G4MolecularDissociationChannel *) const
G4int sign(const T t)
A simple sign function that allows us to port fortran code to c++ more easily.
virtual std::vector< G4ThreeVector > GetProductsDisplacement(const G4MolecularDissociationChannel *) const
static G4Hydrogen * Definition()
Definition: G4Hydrogen.cc:46