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4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/models/src/G4DNAMeltonAttachmentModel.cc (Version 11.3.0) and /processes/electromagnetic/dna/models/src/G4DNAMeltonAttachmentModel.cc (Version 10.4.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4DNAMeltonAttachmentModel.cc 98733 2016-08-09 10:51:58Z gcosmo $
 26 //                                                 27 //
 27                                                    28 
 28 // Created by Z. Francis                           29 // Created by Z. Francis
 29                                                    30 
 30 #include "G4DNAMeltonAttachmentModel.hh"           31 #include "G4DNAMeltonAttachmentModel.hh"
 31 #include "G4SystemOfUnits.hh"                      32 #include "G4SystemOfUnits.hh"
 32 #include "G4DNAChemistryManager.hh"                33 #include "G4DNAChemistryManager.hh"
 33 #include "G4DNAMolecularMaterial.hh"               34 #include "G4DNAMolecularMaterial.hh"
 34                                                    35 
 35 //....oooOO0OOooo........oooOO0OOooo........oo     36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 36                                                    37 
 37 using namespace std;                               38 using namespace std;
 38                                                    39 
 39 //#define MELTON_VERBOSE // prevent checking c     40 //#define MELTON_VERBOSE // prevent checking conditions at run time
 40                                                    41 
 41 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 42                                                    43 
 43 G4DNAMeltonAttachmentModel::G4DNAMeltonAttachm     44 G4DNAMeltonAttachmentModel::G4DNAMeltonAttachmentModel(const G4ParticleDefinition*,
 44                                                    45                                                        const G4String& nam) :
 45 G4VEmModel(nam)                                <<  46     G4VEmModel(nam), isInitialised(false)
 46 {                                                  47 {
 47   fpWaterDensity = nullptr;                    <<  48   fpWaterDensity = 0;
 48                                                    49 
 49   SetLowEnergyLimit(4.*eV);                        50   SetLowEnergyLimit(4.*eV);
 50   SetHighEnergyLimit(13.*eV);                      51   SetHighEnergyLimit(13.*eV);
 51                                                    52 
 52   verboseLevel = 0;                                53   verboseLevel = 0;
 53   // Verbosity scale:                              54   // Verbosity scale:
 54   // 0 = nothing                                   55   // 0 = nothing
 55   // 1 = warning for energy non-conservation       56   // 1 = warning for energy non-conservation
 56   // 2 = details of energy budget                  57   // 2 = details of energy budget
 57   // 3 = calculation of cross sections, file o     58   // 3 = calculation of cross sections, file openings, sampling of atoms
 58   // 4 = entering in methods                       59   // 4 = entering in methods
 59                                                    60 
 60 #ifdef MELTON_VERBOSE                              61 #ifdef MELTON_VERBOSE
 61   if (verboseLevel > 0)                            62   if (verboseLevel > 0)
 62   {                                                63   {
 63     G4cout << "Melton Attachment model is cons     64     G4cout << "Melton Attachment model is constructed "
 64            << G4endl                               65            << G4endl
 65            << "Energy range: "                     66            << "Energy range: "
 66            << LowEnergyLimit() / eV << " eV -      67            << LowEnergyLimit() / eV << " eV - "
 67            << HighEnergyLimit() / eV << " eV"      68            << HighEnergyLimit() / eV << " eV"
 68            << G4endl;                              69            << G4endl;
 69   }                                                70   }
 70 #endif                                             71 #endif
 71                                                    72   
 72   fParticleChangeForGamma = nullptr;           <<  73   fParticleChangeForGamma = 0;
 73   fDissociationFlag = true;                        74   fDissociationFlag = true;
 74   fData = nullptr;                             <<  75   fData = 0;
 75                                                    76 
 76   // Selection of stationary mode                  77   // Selection of stationary mode
 77                                                    78 
 78   statCode = false;                                79   statCode = false;
 79 }                                                  80 }
 80                                                    81 
 81 //....oooOO0OOooo........oooOO0OOooo........oo     82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 82                                                    83 
 83 G4DNAMeltonAttachmentModel::~G4DNAMeltonAttach     84 G4DNAMeltonAttachmentModel::~G4DNAMeltonAttachmentModel()
 84 {                                                  85 {
 85   delete fData;                                <<  86   if(fData) delete fData;
 86 }                                                  87 }
 87                                                    88 
 88 //....oooOO0OOooo........oooOO0OOooo........oo     89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 89                                                    90 
 90 void G4DNAMeltonAttachmentModel::Initialise(co     91 void G4DNAMeltonAttachmentModel::Initialise(const G4ParticleDefinition* particle,
 91                                             co     92                                             const G4DataVector& /*cuts*/)
 92 {                                                  93 {
 93 #ifdef MELTON_VERBOSE                              94 #ifdef MELTON_VERBOSE
 94   if (verboseLevel > 3)                            95   if (verboseLevel > 3)
 95     G4cout                                         96     G4cout
 96       << "Calling G4DNAMeltonAttachmentModel::     97       << "Calling G4DNAMeltonAttachmentModel::Initialise()" << G4endl;
 97 #endif                                             98 #endif
 98                                                    99 
 99   // Only electron                             << 100   // ONLY ELECTRON
100                                                   101   
101   if(particle->GetParticleName() != "e-")         102   if(particle->GetParticleName() != "e-")
102   {                                               103   {
103     G4Exception("G4DNAMeltonAttachmentModel::I    104     G4Exception("G4DNAMeltonAttachmentModel::Initialise",
104                 "em0002",                         105                 "em0002",
105                 FatalException,                   106                 FatalException,
106                 "Model not applicable to parti    107                 "Model not applicable to particle type.");
107   }                                               108   }
108                                                   109   
109   // Energy limits                                110   // Energy limits
110                                                   111 
111   if (LowEnergyLimit() < 4.*eV)                   112   if (LowEnergyLimit() < 4.*eV)
112   {                                               113   {
113     G4ExceptionDescription errMsg;                114     G4ExceptionDescription errMsg;
114     errMsg << "G4DNAMeltonAttachmentModel: low    115     errMsg << "G4DNAMeltonAttachmentModel: low energy limit increased from " <<
115     LowEnergyLimit()/eV << " eV to " << 4.  <<    116     LowEnergyLimit()/eV << " eV to " << 4.  << " eV" << G4endl;
116                                                   117     
117     G4Exception("G4DNAMeltonAttachmentModel::I    118     G4Exception("G4DNAMeltonAttachmentModel::Initialise",
118                 "Melton_LowerEBoundary",          119                 "Melton_LowerEBoundary",
119                 JustWarning,                      120                 JustWarning,
120                 errMsg);                          121                 errMsg);
121                                                   122     
122     SetLowEnergyLimit(4*eV);                      123     SetLowEnergyLimit(4*eV);
123   }                                               124   }
124                                                   125 
125   if (HighEnergyLimit() > 13.*eV)                 126   if (HighEnergyLimit() > 13.*eV)
126   {                                               127   {
127     G4ExceptionDescription errMsg;                128     G4ExceptionDescription errMsg;
128     errMsg << "G4DNAMeltonAttachmentModel: hig    129     errMsg << "G4DNAMeltonAttachmentModel: high energy limit decreased from " <<
129     HighEnergyLimit()/eV << " eV to " << 13. <    130     HighEnergyLimit()/eV << " eV to " << 13. << " eV" << G4endl;
130                                                   131     
131     G4Exception("G4DNAMeltonAttachmentModel::I    132     G4Exception("G4DNAMeltonAttachmentModel::Initialise",
132                 "Melton_HigherEBoundary",         133                 "Melton_HigherEBoundary",
133                 JustWarning,                      134                 JustWarning,
134                 errMsg);                          135                 errMsg);
135                                                   136     
136     SetHighEnergyLimit(13.*eV);                   137     SetHighEnergyLimit(13.*eV);
137   }                                               138   }
138                                                   139 
139   // Reading of data files                        140   // Reading of data files
140                                                   141 
141   G4double scaleFactor = 1e-18*cm2;               142   G4double scaleFactor = 1e-18*cm2;
142                                                   143 
143   // For total cross section                      144   // For total cross section
144   G4String fileElectron("dna/sigma_attachment_    145   G4String fileElectron("dna/sigma_attachment_e_melton");
145                                                   146 
146   fData = new G4DNACrossSectionDataSet(new G4L    147   fData = new G4DNACrossSectionDataSet(new G4LogLogInterpolation(),
147                                         eV, sc << 148                                      eV, scaleFactor);
148   fData->LoadData(fileElectron);                  149   fData->LoadData(fileElectron);
149                                                   150 
150                                                   151 
151 #ifdef MELTON_VERBOSE                             152 #ifdef MELTON_VERBOSE
152   if( verboseLevel >0)                            153   if( verboseLevel >0)
153   {                                               154   {
154     if (verboseLevel > 2)                         155     if (verboseLevel > 2)
155     {                                             156     {
156       G4cout << "Loaded cross section data for    157       G4cout << "Loaded cross section data for Melton Attachment model" << G4endl;
157     }                                             158     }
158                                                   159     
159     G4cout << "Melton Attachment model is init    160     G4cout << "Melton Attachment model is initialized " << G4endl
160     << "Energy range: "                           161     << "Energy range: "
161     << LowEnergyLimit() / eV << " eV - "          162     << LowEnergyLimit() / eV << " eV - "
162     << HighEnergyLimit() / eV << " eV"            163     << HighEnergyLimit() / eV << " eV"
163     << G4endl;                                    164     << G4endl;
164   }                                               165   }
165 #endif                                            166 #endif 
166                                                   167   
167   // Initialize water density pointer             168   // Initialize water density pointer
168   fpWaterDensity = G4DNAMolecularMaterial::Ins    169   fpWaterDensity = G4DNAMolecularMaterial::Instance()->
169       GetNumMolPerVolTableFor(G4Material::GetM    170       GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
170                                                   171 
171   if (isInitialised) return;                   << 172   if (isInitialised)
172                                                << 173   {
                                                   >> 174     return;
                                                   >> 175   }
173   fParticleChangeForGamma = GetParticleChangeF    176   fParticleChangeForGamma = GetParticleChangeForGamma();
174   isInitialised = true;                           177   isInitialised = true;
175 }                                                 178 }
176                                                   179 
177 //....oooOO0OOooo........oooOO0OOooo........oo    180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
178                                                   181 
179 G4double                                          182 G4double
180 G4DNAMeltonAttachmentModel::CrossSectionPerVol    183 G4DNAMeltonAttachmentModel::CrossSectionPerVolume(const G4Material* material,
181                                                   184                                                 const G4ParticleDefinition*,
182                                                   185                                                 G4double ekin,
183                                                   186                                                 G4double,
184                                                   187                                                 G4double)
185 {                                                 188 {
186 #ifdef MELTON_VERBOSE                             189 #ifdef MELTON_VERBOSE
187   if (verboseLevel > 3)                           190   if (verboseLevel > 3)
188     G4cout                                        191     G4cout
189       << "Calling CrossSectionPerVolume() of G    192       << "Calling CrossSectionPerVolume() of G4DNAMeltonAttachmentModel"
190       << G4endl;                                  193       << G4endl;
191 #endif                                            194 #endif
192                                                   195 
193   // Calculate total cross section for model      196   // Calculate total cross section for model
194                                                   197 
195   G4double sigma = 0.;                            198   G4double sigma = 0.;
196                                                   199 
197   G4double waterDensity = (*fpWaterDensity)[ma    200   G4double waterDensity = (*fpWaterDensity)[material->GetIndex()];
198                                                   201 
199   if (ekin >= LowEnergyLimit() && ekin <= High << 202   if(waterDensity != 0.0)
200     sigma = fData->FindValue(ekin);            << 
201                                                << 
202 #ifdef MELTON_VERBOSE                          << 
203   if (verboseLevel > 2)                        << 
204   {                                               203   {
205     G4cout << "_______________________________ << 204     if (ekin >= LowEnergyLimit() && ekin < HighEnergyLimit())
206     G4cout << "=== G4DNAMeltonAttachmentModel  << 205       // necessaire ?
207     G4cout << "--- Kinetic energy(eV)=" << eki << 206     {
208            << " particle : " << particleDefini << 207       sigma = fData->FindValue(ekin);
209            << G4endl;                          << 208     }
210     G4cout << "--- Cross section per water mol << 209 
211            << sigma/cm/cm << G4endl;           << 210 #ifdef MELTON_VERBOSE
212     G4cout << "--- Cross section per water mol << 211     if (verboseLevel > 2)
213            << sigma*waterDensity/(1./cm) << G4 << 212     {
214     G4cout << "--- G4DNAMeltonAttachmentModel  << 213       G4cout << "__________________________________" << G4endl;
215   }                                            << 214       G4cout << "=== G4DNAMeltonAttachmentModel - XS INFO START" << G4endl;
                                                   >> 215       G4cout << "--- Kinetic energy(eV)=" << ekin/eV
                                                   >> 216             << " particle : " << particleDefinition->GetParticleName()
                                                   >> 217             << G4endl;
                                                   >> 218       G4cout << "--- Cross section per water molecule (cm^2)="
                                                   >> 219              << sigma/cm/cm << G4endl;
                                                   >> 220       G4cout << "--- Cross section per water molecule (cm^-1)="
                                                   >> 221              << sigma*waterDensity/(1./cm) << G4endl;
                                                   >> 222       G4cout << "--- G4DNAMeltonAttachmentModel - XS INFO END" << G4endl;
                                                   >> 223     }
216 #endif                                            224 #endif
                                                   >> 225   } // if water
217                                                   226 
218   return sigma*waterDensity;                      227   return sigma*waterDensity;
219 }                                                 228 }
220                                                   229 
221 //....oooOO0OOooo........oooOO0OOooo........oo    230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
222                                                   231 
223 void                                              232 void
224 G4DNAMeltonAttachmentModel::                      233 G4DNAMeltonAttachmentModel::
225 SampleSecondaries(std::vector<G4DynamicParticl    234 SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
226                   const G4MaterialCutsCouple*     235                   const G4MaterialCutsCouple* /*couple*/,
227                   const G4DynamicParticle* aDy    236                   const G4DynamicParticle* aDynamicElectron,
228                   G4double,                       237                   G4double,
229                   G4double)                       238                   G4double)
230 {                                                 239 {
231                                                   240   
232 #ifdef MELTON_VERBOSE                             241 #ifdef MELTON_VERBOSE
233   if (verboseLevel > 3)                           242   if (verboseLevel > 3)
234     G4cout                                        243     G4cout
235     << "Calling SampleSecondaries() of G4DNAMe    244     << "Calling SampleSecondaries() of G4DNAMeltonAttachmentModel" << G4endl;
236 #endif                                            245 #endif
237                                                   246   
238   // Electron is killed                           247   // Electron is killed
239                                                   248   
240   G4double electronEnergy0 = aDynamicElectron-    249   G4double electronEnergy0 = aDynamicElectron->GetKineticEnergy();
241                                                   250 
242   if (!statCode)                                  251   if (!statCode)     
243   {                                               252   {     
244       fParticleChangeForGamma->SetProposedKine    253       fParticleChangeForGamma->SetProposedKineticEnergy(0.);
245       fParticleChangeForGamma->ProposeTrackSta    254       fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
246       fParticleChangeForGamma->ProposeLocalEne    255       fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0);
247   }                                               256   }
248                                                   257 
249   else                                            258   else 
250   {                                               259   {
251       fParticleChangeForGamma->SetProposedKine    260       fParticleChangeForGamma->SetProposedKineticEnergy(electronEnergy0);
252       fParticleChangeForGamma->ProposeLocalEne    261       fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0);
253   }                                               262   }
254                                                   263   
255   if(fDissociationFlag)                           264   if(fDissociationFlag)
256   {                                               265   {
257     G4DNAChemistryManager::Instance()->           266     G4DNAChemistryManager::Instance()->
258       CreateWaterMolecule(eDissociativeAttachm    267       CreateWaterMolecule(eDissociativeAttachment,
259                           -1,                     268                           -1,
260                           fParticleChangeForGa    269                           fParticleChangeForGamma->GetCurrentTrack());
261   }                                               270   }
262   return;                                         271   return;
263 }                                                 272 }
264                                                   273