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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 ]

  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 //
 27 /// \file UserChoosingDNASolvationModel.cc
 28 /// \brief Implementation of the UserChoosingDNASolvationModel class
 29 
 30 #include "UserChoosingDNASolvationModel.hh"
 31 #include "G4PhysicalConstants.hh"
 32 #include "G4SystemOfUnits.hh"
 33 #include "G4DNAWaterExcitationStructure.hh"
 34 #include "G4ParticleChangeForGamma.hh"
 35 #include "G4NistManager.hh"
 36 #include "G4DNAChemistryManager.hh"
 37 #include "G4DNAMolecularMaterial.hh"
 38 #include "G4TransportationManager.hh"
 39 #include "G4ITNavigator.hh"
 40 #include "G4Navigator.hh"
 41 #include "G4Electron.hh"
 42 #include "G4EmParameters.hh"
 43 
 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 45 
 46 template<typename MODEL>
 47 UserTDNAOneStepThermalizationModel<MODEL>::
 48 UserTDNAOneStepThermalizationModel(const G4ParticleDefinition*,const G4String& nam) :
 49 G4TDNAOneStepThermalizationModel<MODEL>(0,nam)
 50 {
 51     G4cout << "Calling SampleSecondaries() of UserTDNAOneStepThermalizationModel for Solvation process!!! \n";
 52 }
 53 
 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 55 
 56 template<typename MODEL>
 57 void UserTDNAOneStepThermalizationModel<MODEL>::
 58 SampleSecondaries(std::vector<G4DynamicParticle*>*,
 59                   const G4MaterialCutsCouple*,
 60                   const G4DynamicParticle* particle,
 61                   G4double tmin,
 62                   G4double maxEnergy)
 63 {
 64     G4TDNAOneStepThermalizationModel<MODEL>::SampleSecondaries(0,0,particle,tmin,maxEnergy);
 65     
 66     if (G4DNAChemistryManager::IsActivated()) return; // 
 67     G4double k = particle->GetKineticEnergy();
 68     G4double highE = G4TDNAOneStepThermalizationModel<MODEL>::HighEnergyLimit();
 69     if (k <= highE){
 70         G4ThreeVector displacement(0,0,0);
 71         G4TDNAOneStepThermalizationModel<MODEL>::GetPenetration(k, displacement);
 72 
 73         auto _ParticleChangeForGamma=G4TDNAOneStepThermalizationModel<MODEL>::GetParticleChangeForGamma();
 74         const G4Track * theIncomingTrack =_ParticleChangeForGamma->GetCurrentTrack();
 75 
 76         G4ThreeVector finalPosition(theIncomingTrack->GetPosition()+displacement);
 77         this->fpNavigator->SetWorldVolume(theIncomingTrack->GetTouchable()->GetVolume(theIncomingTrack->GetTouchable()->GetHistoryDepth()));
 78 
 79         G4double displacementMag = displacement.mag();
 80         G4double safety = DBL_MAX;
 81         G4ThreeVector direction = displacement/displacementMag;
 82 
 83         G4double mag_displacement = displacement.mag();
 84         G4ThreeVector displacement_direction = displacement/mag_displacement;
 85 
 86 
 87         this->fpNavigator->ResetHierarchyAndLocate(theIncomingTrack->GetPosition(),
 88                                             direction,
 89                                             *((G4TouchableHistory*)
 90                                             theIncomingTrack->GetTouchable()));
 91         this->fpNavigator->ComputeStep(theIncomingTrack->GetPosition(),
 92                                 displacement/displacementMag,
 93                                 displacementMag,
 94                                 safety);
 95 
 96         if(safety <= displacementMag){
 97             finalPosition = theIncomingTrack->GetPosition()+ (displacement/displacementMag)*safety*0.80;
 98         }
 99         G4DNAChemistryManager::Instance()->CreateSolvatedElectron(theIncomingTrack,&finalPosition);
100         _ParticleChangeForGamma->SetProposedKineticEnergy(25.e-3*eV);
101     }
102     
103 }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
107 G4VEmModel* UserChoosingDNASolvationModel::UserCreate(const G4String& penetrationModel)
108 {
109     G4String modelNamePrefix("DNAOneStepThermalizationModel_");
110     
111     if(penetrationModel == "Terrisol1990")
112     {
113         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Terrisol1990>
114         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
115     }
116     else if(penetrationModel == "Meesungnoen2002")
117     {
118         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Meesungnoen2002>
119         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
120     }
121     else if(penetrationModel == "Meesungnoen2002_amorphous")
122     {
123         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Meesungnoen2002_amorphous>
124         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
125     }
126     else if(penetrationModel == "Kreipl2009")
127     {
128         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Kreipl2009>
129         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
130     }
131     else if(penetrationModel == "Ritchie1994")
132     {
133         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Ritchie1994>
134         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
135     }
136     else
137     {
138         G4ExceptionDescription description;
139         description << penetrationModel + " is not a valid model name.";
140         G4Exception("UserChoosingDNASolvationModel::UserCreate",
141                     "INVALID_ARGUMENT",
142                     FatalErrorInArgument,
143                     description,
144                     "Options are: Terrisol1990, Meesungnoen2002, Ritchie1994.");
145     }
146     return nullptr;
147 }
148 
149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
150 
151 G4VEmModel* UserChoosingDNASolvationModel::UserGetMacroDefinedModel()
152 {
153     auto dnaSubType = G4EmParameters::Instance()->DNAeSolvationSubType();
154     
155     switch(dnaSubType)
156     {
157     case fRitchie1994eSolvation:
158         return UserCreate("Ritchie1994");
159     case fTerrisol1990eSolvation:
160         return UserCreate("Terrisol1990");
161     case fKreipl2009eSolvation:
162         return UserCreate("Kreipl2009");
163     case fMeesungnoensolid2002eSolvation:
164         return UserCreate("Meesungnoen2002_amorphous");
165     case fMeesungnoen2002eSolvation:
166     case fDNAUnknownModel:
167         return UserCreate("Meesungnoen2002");
168     default:
169         G4ExceptionDescription msg;
170         msg<<"The solvation parameter stored in G4EmParameters is unknown. "
171             <<"Supported types are: fRitchie1994eSolvation, fTerrisol1990eSolvation, "
172             <<"fMeesungnoen2002eSolvation.";
173         G4Exception("UserChoosingDNASolvationModel::UserGetMacroDefinedModel",
174                     "DnaSubType",
175                     FatalErrorInArgument,msg);
176     }
177 
178     return nullptr;
179 }
180 
181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......