Geant4 Cross Reference |
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 #include "G4LEPTSElasticModel.hh" 26 #include "G4LEPTSElasticModel.hh" 27 27 28 //....oooOO0OOooo........oooOO0OOooo........oo 28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 29 G4LEPTSElasticModel::G4LEPTSElasticModel(const 29 G4LEPTSElasticModel::G4LEPTSElasticModel(const G4String& modelName) 30 : G4VLEPTSModel( modelName ) 30 : G4VLEPTSModel( modelName ) 31 { 31 { 32 theXSType = XSElastic; 32 theXSType = XSElastic; 33 fParticleChangeForGamma = nullptr; << 34 } // constructor 33 } // constructor 35 34 36 35 37 //....oooOO0OOooo........oooOO0OOooo........oo 36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 G4LEPTSElasticModel::~G4LEPTSElasticModel() = << 37 G4LEPTSElasticModel::~G4LEPTSElasticModel() { >> 38 } 39 39 40 40 41 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 42 void G4LEPTSElasticModel::Initialise(const G4P 42 void G4LEPTSElasticModel::Initialise(const G4ParticleDefinition* aParticle, 43 const G4DataVector&) 43 const G4DataVector&) 44 { 44 { 45 Init(); 45 Init(); 46 BuildPhysicsTable( *aParticle ); 46 BuildPhysicsTable( *aParticle ); 47 47 48 fParticleChangeForGamma = GetParticleChangeF 48 fParticleChangeForGamma = GetParticleChangeForGamma(); 49 49 50 // static const G4double proton_mass_c2 = 50 // static const G4double proton_mass_c2 = 938.272013 * MeV; 51 // static const G4double neutron_mass_c2 = 51 // static const G4double neutron_mass_c2 = 939.56536 * MeV; 52 // static const G4double h2o_mass_c2 = 8*neu 52 // static const G4double h2o_mass_c2 = 8*neutron_mass_c2 + 10*(proton_mass_c2 + electron_mass_c2); 53 // G4cout << "mme " << h2o_mass_c2/MeV << " 53 // G4cout << "mme " << h2o_mass_c2/MeV << " " << H2o_mass_c2/MeV << G4endl; 54 54 55 const G4MaterialTable * materialTable = G4Ma 55 const G4MaterialTable * materialTable = G4Material::GetMaterialTable() ; 56 std::vector<G4Material*>::const_iterator mat 56 std::vector<G4Material*>::const_iterator matite; 57 for( matite = materialTable->begin(); matite 57 for( matite = materialTable->begin(); matite != materialTable->end(); matite++ ) { 58 const G4Material * aMaterial = (*matite); 58 const G4Material * aMaterial = (*matite); 59 theMassTarget[aMaterial] = theMolecularMa 59 theMassTarget[aMaterial] = theMolecularMass[aMaterial] / (6.02214179e+23/CLHEP::mole) *CLHEP::c_light * CLHEP::c_light; 60 theMassProjectile[aMaterial] = CLHEP::elec 60 theMassProjectile[aMaterial] = CLHEP::electron_mass_c2; 61 61 62 if( verboseLevel >= 1) G4cout << "Material 62 if( verboseLevel >= 1) G4cout << "Material: " << aMaterial->GetName() << " MolecularMass: " << theMolecularMass[aMaterial]/(CLHEP::g/CLHEP::mole) << " g/mole " 63 << " MTarget: " << theMassTarget[aMater 63 << " MTarget: " << theMassTarget[aMaterial]/CLHEP::MeV << " MeV" << G4endl; 64 } 64 } 65 65 66 66 67 } 67 } 68 68 69 //....oooOO0OOooo........oooOO0OOooo........oo 69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 70 G4double G4LEPTSElasticModel::CrossSectionPerV 70 G4double G4LEPTSElasticModel::CrossSectionPerVolume(const G4Material* mate, 71 const 71 const G4ParticleDefinition* aParticle, 72 G4dou 72 G4double kineticEnergy, 73 G4dou 73 G4double, 74 G4dou 74 G4double) 75 { 75 { 76 if( kineticEnergy < theLowestEnergyLimit ) r 76 if( kineticEnergy < theLowestEnergyLimit ) return DBL_MAX; 77 return 1./GetMeanFreePath( mate, aParticle, 77 return 1./GetMeanFreePath( mate, aParticle, kineticEnergy ); 78 78 79 } 79 } 80 80 81 81 82 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 83 void G4LEPTSElasticModel::SampleSecondaries(st 83 void G4LEPTSElasticModel::SampleSecondaries(std::vector<G4DynamicParticle*>*, 84 const G4Mater 84 const G4MaterialCutsCouple* mateCuts, 85 const G4Dynam 85 const G4DynamicParticle* aDynamicParticle, 86 G4double, 86 G4double, 87 G4double) 87 G4double) 88 { 88 { 89 G4double P0KinEn = aDynamicParticle->GetKine 89 G4double P0KinEn = aDynamicParticle->GetKineticEnergy(); 90 G4ThreeVector P0Dir = aDynamicParticle->GetM 90 G4ThreeVector P0Dir = aDynamicParticle->GetMomentumDirection(); 91 91 92 if( P0KinEn < theLowestEnergyLimit ) { 92 if( P0KinEn < theLowestEnergyLimit ) { 93 fParticleChangeForGamma->ProposeMomentumDi 93 fParticleChangeForGamma->ProposeMomentumDirection( P0Dir ); 94 fParticleChangeForGamma->SetProposedKineti 94 fParticleChangeForGamma->SetProposedKineticEnergy( 0.); 95 fParticleChangeForGamma->ProposeLocalEnerg 95 fParticleChangeForGamma->ProposeLocalEnergyDeposit( P0KinEn); 96 fParticleChangeForGamma->ProposeTrackStatu 96 fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill); 97 if( verboseLevel > 2 ) G4cout << " ENERGY 97 if( verboseLevel > 2 ) G4cout << " ENERGY LOW " << P0KinEn - theLowestEnergyLimit << G4endl; 98 return; 98 return; 99 } 99 } 100 100 101 //- G4ParticleDefinition * particleDefDef = 101 //- G4ParticleDefinition * particleDefDef = aTrack.GetDefinition(); 102 //- G4String partName = particleDefDef->Get 102 //- G4String partName = particleDefDef->GetParticleName(); 103 103 104 // G4ThreeVector pos, pos0, dpos; 104 // G4ThreeVector pos, pos0, dpos; 105 105 106 //- G4StepPoG4int * PostPoG4int = aStep.Get 106 //- G4StepPoG4int * PostPoG4int = aStep.GetPostStepPoG4int(); 107 //- G4ThreeVector r = PostPoG4int->GetPosit 107 //- G4ThreeVector r = PostPoG4int->GetPosition(); 108 108 109 //TypeOfInteraction=-10; 109 //TypeOfInteraction=-10; 110 110 111 const G4Material* aMaterial = mateCuts->GetM 111 const G4Material* aMaterial = mateCuts->GetMaterial(); 112 G4double ang = SampleAngle(aMaterial, P0KinE 112 G4double ang = SampleAngle(aMaterial, P0KinEn/CLHEP::eV, 0.0); 113 G4ThreeVector P1Dir = SampleNewDirection(P0D 113 G4ThreeVector P1Dir = SampleNewDirection(P0Dir, ang); 114 #ifdef DEBUG_LEPTS 114 #ifdef DEBUG_LEPTS 115 if( verboseLevel >= 2 ) G4cout << " G4LEPTSE 115 if( verboseLevel >= 2 ) G4cout << " G4LEPTSElasticModel::SampleSecondaries( P1Dir " << P1Dir << " P0Dir " << P0Dir << " ang " << ang << G4endl; 116 #endif 116 #endif 117 117 118 //G4ThreeVector P1Dir = SampleNewDirection(P 118 //G4ThreeVector P1Dir = SampleNewDirection(P0Dir, P0KinEn/eV, 0.0); 119 //G4double Energylost1= ElasticEnergyTransf 119 //G4double Energylost1= ElasticEnergyTransferWater2(P0KinEn, ang); 120 G4double Energylost = EnergyTransfer(P0KinE 120 G4double Energylost = EnergyTransfer(P0KinEn, ang, theMassTarget[aMaterial], theMassProjectile[aMaterial]); 121 if( verboseLevel >= 3 ) G4cout << " ELASTIC 121 if( verboseLevel >= 3 ) G4cout << " ELASTIC Energylost "<< Energylost << " = " << P0KinEn << " " <<ang << " " << theMassTarget[aMaterial] << " " << theMassProjectile[aMaterial] << G4endl; 122 122 123 G4double P1KinEn = P0KinEn - Energylost; 123 G4double P1KinEn = P0KinEn - Energylost; 124 if( verboseLevel >= 3 ) G4cout << " ELASTIC 124 if( verboseLevel >= 3 ) G4cout << " ELASTIC " << P1KinEn << " = " << P0KinEn << " - " << Energylost << G4endl; 125 #ifdef DEBUG_LEPTS 125 #ifdef DEBUG_LEPTS 126 if( verboseLevel >= 2 ) G4cout << " G4LEPTS 126 if( verboseLevel >= 2 ) G4cout << " G4LEPTSElasticModel::SampleSecondaries( SetProposedKineticEnergy " << P1KinEn << " " << P0KinEn << " - " << Energylost << G4endl; 127 #endif 127 #endif 128 fParticleChangeForGamma->ProposeMomentumDire 128 fParticleChangeForGamma->ProposeMomentumDirection( P1Dir ); 129 fParticleChangeForGamma->SetProposedKineticE 129 fParticleChangeForGamma->SetProposedKineticEnergy( P1KinEn); 130 fParticleChangeForGamma->ProposeLocalEnergyD 130 fParticleChangeForGamma->ProposeLocalEnergyDeposit( Energylost); 131 //G4cout << "elasticEnergyLost: " << Energyl 131 //G4cout << "elasticEnergyLost: " << Energylost << G4endl; 132 132 133 #ifdef DEBUG_LEPTS 133 #ifdef DEBUG_LEPTS 134 if( verboseLevel >= 2 ) G4cout << " G4LEPTS 134 if( verboseLevel >= 2 ) G4cout << " G4LEPTSElasticModel::SampleSecondaries( ProposeMomentumDirection " << fParticleChangeForGamma->GetProposedMomentumDirection() << G4endl; 135 #endif 135 #endif 136 } 136 } 137 137 138 //....oooOO0OOooo........oooOO0OOooo........oo 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 139 G4double G4LEPTSElasticModel::EnergyTransfer(G 139 G4double G4LEPTSElasticModel::EnergyTransfer(G4double E, G4double ang, G4double MT, G4double MP) 140 { 140 { 141 G4double co = std::cos(ang); 141 G4double co = std::cos(ang); 142 G4double si = std::sin(ang); 142 G4double si = std::sin(ang); 143 143 144 G4double W = ( (E+MP)*si*si + MT - co*std::s 144 G4double W = ( (E+MP)*si*si + MT - co*std::sqrt(MT*MT-MP*MP*si*si) ) * E*(E+2*MP) 145 / ( std::pow((E+MP+MT),2) - E*co*co*(E+2*M 145 / ( std::pow((E+MP+MT),2) - E*co*co*(E+2*MP) ); 146 146 147 //G4double W2 = 2*MP/MT*(1-co)*E; 147 //G4double W2 = 2*MP/MT*(1-co)*E; 148 //G4cout << "WWWWWWWWW: " << W/E << " " << E 148 //G4cout << "WWWWWWWWW: " << W/E << " " << E/W << " " << W2/W << G4endl; 149 //G4cout << "Mm " << MT/MeV << " " << MP/MeV 149 //G4cout << "Mm " << MT/MeV << " " << MP/MeV << G4endl; 150 150 151 return W; 151 return W; 152 } 152 } 153 153 154 154