Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:03

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file UserChoosingDNASolvationModel.cc
0028 /// \brief Implementation of the UserChoosingDNASolvationModel class
0029 
0030 #include "UserChoosingDNASolvationModel.hh"
0031 #include "G4PhysicalConstants.hh"
0032 #include "G4SystemOfUnits.hh"
0033 #include "G4DNAWaterExcitationStructure.hh"
0034 #include "G4ParticleChangeForGamma.hh"
0035 #include "G4NistManager.hh"
0036 #include "G4DNAChemistryManager.hh"
0037 #include "G4DNAMolecularMaterial.hh"
0038 #include "G4TransportationManager.hh"
0039 #include "G4ITNavigator.hh"
0040 #include "G4Navigator.hh"
0041 #include "G4Electron.hh"
0042 #include "G4EmParameters.hh"
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 template<typename MODEL>
0047 UserTDNAOneStepThermalizationModel<MODEL>::
0048 UserTDNAOneStepThermalizationModel(const G4ParticleDefinition*,const G4String& nam) :
0049 G4TDNAOneStepThermalizationModel<MODEL>(0,nam)
0050 {
0051     G4cout << "Calling SampleSecondaries() of UserTDNAOneStepThermalizationModel for Solvation process!!! \n";
0052 }
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 template<typename MODEL>
0057 void UserTDNAOneStepThermalizationModel<MODEL>::
0058 SampleSecondaries(std::vector<G4DynamicParticle*>*,
0059                   const G4MaterialCutsCouple*,
0060                   const G4DynamicParticle* particle,
0061                   G4double tmin,
0062                   G4double maxEnergy)
0063 {
0064     G4TDNAOneStepThermalizationModel<MODEL>::SampleSecondaries(0,0,particle,tmin,maxEnergy);
0065     
0066     if (G4DNAChemistryManager::IsActivated()) return; // 
0067     G4double k = particle->GetKineticEnergy();
0068     G4double highE = G4TDNAOneStepThermalizationModel<MODEL>::HighEnergyLimit();
0069     if (k <= highE){
0070         G4ThreeVector displacement(0,0,0);
0071         G4TDNAOneStepThermalizationModel<MODEL>::GetPenetration(k, displacement);
0072 
0073         auto _ParticleChangeForGamma=G4TDNAOneStepThermalizationModel<MODEL>::GetParticleChangeForGamma();
0074         const G4Track * theIncomingTrack =_ParticleChangeForGamma->GetCurrentTrack();
0075 
0076         G4ThreeVector finalPosition(theIncomingTrack->GetPosition()+displacement);
0077         this->fpNavigator->SetWorldVolume(theIncomingTrack->GetTouchable()->GetVolume(theIncomingTrack->GetTouchable()->GetHistoryDepth()));
0078 
0079         G4double displacementMag = displacement.mag();
0080         G4double safety = DBL_MAX;
0081         G4ThreeVector direction = displacement/displacementMag;
0082 
0083         G4double mag_displacement = displacement.mag();
0084         G4ThreeVector displacement_direction = displacement/mag_displacement;
0085 
0086 
0087         this->fpNavigator->ResetHierarchyAndLocate(theIncomingTrack->GetPosition(),
0088                                             direction,
0089                                             *((G4TouchableHistory*)
0090                                             theIncomingTrack->GetTouchable()));
0091         this->fpNavigator->ComputeStep(theIncomingTrack->GetPosition(),
0092                                 displacement/displacementMag,
0093                                 displacementMag,
0094                                 safety);
0095 
0096         if(safety <= displacementMag){
0097             finalPosition = theIncomingTrack->GetPosition()+ (displacement/displacementMag)*safety*0.80;
0098         }
0099         G4DNAChemistryManager::Instance()->CreateSolvatedElectron(theIncomingTrack,&finalPosition);
0100         _ParticleChangeForGamma->SetProposedKineticEnergy(25.e-3*eV);
0101     }
0102     
0103 }
0104 
0105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0106 
0107 G4VEmModel* UserChoosingDNASolvationModel::UserCreate(const G4String& penetrationModel)
0108 {
0109     G4String modelNamePrefix("DNAOneStepThermalizationModel_");
0110     
0111     if(penetrationModel == "Terrisol1990")
0112     {
0113         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Terrisol1990>
0114         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
0115     }
0116     else if(penetrationModel == "Meesungnoen2002")
0117     {
0118         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Meesungnoen2002>
0119         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
0120     }
0121     else if(penetrationModel == "Meesungnoen2002_amorphous")
0122     {
0123         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Meesungnoen2002_amorphous>
0124         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
0125     }
0126     else if(penetrationModel == "Kreipl2009")
0127     {
0128         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Kreipl2009>
0129         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
0130     }
0131     else if(penetrationModel == "Ritchie1994")
0132     {
0133         return new UserTDNAOneStepThermalizationModel<DNA::Penetration::Ritchie1994>
0134         (G4Electron::Definition(), modelNamePrefix + penetrationModel);
0135     }
0136     else
0137     {
0138         G4ExceptionDescription description;
0139         description << penetrationModel + " is not a valid model name.";
0140         G4Exception("UserChoosingDNASolvationModel::UserCreate",
0141                     "INVALID_ARGUMENT",
0142                     FatalErrorInArgument,
0143                     description,
0144                     "Options are: Terrisol1990, Meesungnoen2002, Ritchie1994.");
0145     }
0146     return nullptr;
0147 }
0148 
0149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0150 
0151 G4VEmModel* UserChoosingDNASolvationModel::UserGetMacroDefinedModel()
0152 {
0153     auto dnaSubType = G4EmParameters::Instance()->DNAeSolvationSubType();
0154     
0155     switch(dnaSubType)
0156     {
0157     case fRitchie1994eSolvation:
0158         return UserCreate("Ritchie1994");
0159     case fTerrisol1990eSolvation:
0160         return UserCreate("Terrisol1990");
0161     case fKreipl2009eSolvation:
0162         return UserCreate("Kreipl2009");
0163     case fMeesungnoensolid2002eSolvation:
0164         return UserCreate("Meesungnoen2002_amorphous");
0165     case fMeesungnoen2002eSolvation:
0166     case fDNAUnknownModel:
0167         return UserCreate("Meesungnoen2002");
0168     default:
0169         G4ExceptionDescription msg;
0170         msg<<"The solvation parameter stored in G4EmParameters is unknown. "
0171             <<"Supported types are: fRitchie1994eSolvation, fTerrisol1990eSolvation, "
0172             <<"fMeesungnoen2002eSolvation.";
0173         G4Exception("UserChoosingDNASolvationModel::UserGetMacroDefinedModel",
0174                     "DnaSubType",
0175                     FatalErrorInArgument,msg);
0176     }
0177 
0178     return nullptr;
0179 }
0180 
0181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......