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 // G4NeutronBetaDecayChannel class implementat << 27 // 26 // 28 // Author: H.Kurashige, 18 September 2001 << 27 // $Id: G4NeutronBetaDecayChannel.cc,v 1.7 2006/06/29 19:25:38 gunter Exp $ 29 // ------------------------------------------- << 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 30 << 29 // 31 #include "G4NeutronBetaDecayChannel.hh" << 30 // >> 31 // ------------------------------------------------------------ >> 32 // GEANT 4 class header file >> 33 // >> 34 // History: first implementation, based on object model of >> 35 // 18 Sep 2001 H.Kurashige >> 36 //--- >> 37 // Fix energy of proton and neutrino May 2011 H.Kurashige >> 38 // ------------------------------------------------------------ 32 39 33 #include "G4DecayProducts.hh" << 34 #include "G4LorentzRotation.hh" << 35 #include "G4LorentzVector.hh" << 36 #include "G4ParticleDefinition.hh" 40 #include "G4ParticleDefinition.hh" 37 #include "G4PhysicalConstants.hh" << 41 #include "G4DecayProducts.hh" 38 #include "G4RotationMatrix.hh" << 39 #include "G4SystemOfUnits.hh" << 40 #include "G4VDecayChannel.hh" 42 #include "G4VDecayChannel.hh" >> 43 #include "G4NeutronBetaDecayChannel.hh" 41 #include "Randomize.hh" 44 #include "Randomize.hh" >> 45 #include "G4RotationMatrix.hh" >> 46 #include "G4LorentzVector.hh" >> 47 #include "G4LorentzRotation.hh" 42 48 43 G4NeutronBetaDecayChannel::G4NeutronBetaDecayC << 49 G4NeutronBetaDecayChannel::G4NeutronBetaDecayChannel() 44 : G4VDecayChannel("Neutron Decay") << 50 :G4VDecayChannel(), >> 51 aENuCorr(-0.102) >> 52 { >> 53 } >> 54 >> 55 G4NeutronBetaDecayChannel::G4NeutronBetaDecayChannel( >> 56 const G4String& theParentName, >> 57 G4double theBR) >> 58 :G4VDecayChannel("Neutron Decay"), >> 59 aENuCorr(-0.102) 45 { 60 { 46 // set names for daughter particles 61 // set names for daughter particles 47 if (theParentName == "neutron") { 62 if (theParentName == "neutron") { 48 SetBR(theBR); 63 SetBR(theBR); 49 SetParent("neutron"); 64 SetParent("neutron"); 50 SetNumberOfDaughters(3); 65 SetNumberOfDaughters(3); 51 SetDaughter(0, "e-"); 66 SetDaughter(0, "e-"); 52 SetDaughter(1, "anti_nu_e"); 67 SetDaughter(1, "anti_nu_e"); 53 SetDaughter(2, "proton"); 68 SetDaughter(2, "proton"); 54 } << 69 } else if (theParentName == "anti_neutron") { 55 else if (theParentName == "anti_neutron") { << 56 SetBR(theBR); 70 SetBR(theBR); 57 SetParent("anti_neutron"); 71 SetParent("anti_neutron"); 58 SetNumberOfDaughters(3); 72 SetNumberOfDaughters(3); 59 SetDaughter(0, "e+"); 73 SetDaughter(0, "e+"); 60 SetDaughter(1, "nu_e"); 74 SetDaughter(1, "nu_e"); 61 SetDaughter(2, "anti_proton"); 75 SetDaughter(2, "anti_proton"); 62 } << 76 } else { 63 else { << 64 #ifdef G4VERBOSE 77 #ifdef G4VERBOSE 65 if (GetVerboseLevel() > 0) { << 78 if (GetVerboseLevel()>0) { 66 G4cout << "G4NeutronBetaDecayChannel:: c 79 G4cout << "G4NeutronBetaDecayChannel:: constructor :"; 67 G4cout << " parent particle is not neutr 80 G4cout << " parent particle is not neutron but "; 68 G4cout << theParentName << G4endl; 81 G4cout << theParentName << G4endl; 69 } 82 } 70 #endif 83 #endif 71 } 84 } 72 } 85 } 73 86 74 G4NeutronBetaDecayChannel::G4NeutronBetaDecayC << 87 G4NeutronBetaDecayChannel::~G4NeutronBetaDecayChannel() 75 : G4VDecayChannel(right) << 88 { 76 {} << 89 } >> 90 >> 91 G4NeutronBetaDecayChannel::G4NeutronBetaDecayChannel(const G4NeutronBetaDecayChannel &right) >> 92 : G4VDecayChannel(right), >> 93 aENuCorr(-0.102) >> 94 { >> 95 } 77 96 78 G4NeutronBetaDecayChannel& << 97 79 G4NeutronBetaDecayChannel::operator=(const G4N << 98 G4NeutronBetaDecayChannel & G4NeutronBetaDecayChannel::operator=(const G4NeutronBetaDecayChannel & right) 80 { 99 { 81 if (this != &right) { << 100 if (this != &right) { 82 kinematics_name = right.kinematics_name; 101 kinematics_name = right.kinematics_name; 83 verboseLevel = right.verboseLevel; 102 verboseLevel = right.verboseLevel; 84 rbranch = right.rbranch; 103 rbranch = right.rbranch; 85 104 86 // copy parent name 105 // copy parent name 87 delete parent_name; << 88 parent_name = new G4String(*right.parent_n 106 parent_name = new G4String(*right.parent_name); 89 107 90 // clear daughters_name array 108 // clear daughters_name array 91 ClearDaughtersName(); 109 ClearDaughtersName(); 92 110 93 // recreate array 111 // recreate array 94 numberOfDaughters = right.numberOfDaughter 112 numberOfDaughters = right.numberOfDaughters; 95 if (numberOfDaughters > 0) { << 113 if ( numberOfDaughters >0 ) { >> 114 if (daughters_name !=0) ClearDaughtersName(); 96 daughters_name = new G4String*[numberOfD 115 daughters_name = new G4String*[numberOfDaughters]; 97 // copy daughters name << 116 //copy daughters name 98 for (G4int index = 0; index < numberOfDa << 117 for (G4int index=0; index < numberOfDaughters; index++) { 99 daughters_name[index] = new G4String(* << 118 daughters_name[index] = new G4String(*right.daughters_name[index]); 100 } 119 } 101 } 120 } 102 } 121 } 103 return *this; 122 return *this; 104 } 123 } 105 124 106 G4DecayProducts* G4NeutronBetaDecayChannel::De << 125 G4DecayProducts *G4NeutronBetaDecayChannel::DecayIt(G4double) 107 { 126 { 108 // This class describes free neutron beta d << 127 // This class describes free neutron beta decay kinemtics. 109 // This version neglects neutron/electron p << 128 // This version neglects neutron/electron polarization 110 // without Coulomb effect 129 // without Coulomb effect 111 130 112 #ifdef G4VERBOSE 131 #ifdef G4VERBOSE 113 if (GetVerboseLevel() > 1) G4cout << "G4Neut << 132 if (GetVerboseLevel()>1) G4cout << "G4NeutronBetaDecayChannel::DecayIt "; 114 #endif 133 #endif 115 134 116 CheckAndFillParent(); << 135 if (parent == 0) FillParent(); 117 CheckAndFillDaughters(); << 136 if (daughters == 0) FillDaughters(); 118 << 137 119 // parent mass 138 // parent mass 120 G4double parentmass = G4MT_parent->GetPDGMas << 139 G4double parentmass = parent->GetPDGMass(); 121 140 122 // daughters'mass << 141 //daughters'mass 123 G4double daughtermass[3]; << 142 G4double daughtermass[3]; 124 G4double sumofdaughtermass = 0.0; 143 G4double sumofdaughtermass = 0.0; 125 for (G4int index = 0; index < 3; ++index) { << 144 for (G4int index=0; index<3; index++){ 126 daughtermass[index] = G4MT_daughters[index << 145 daughtermass[index] = daughters[index]->GetPDGMass(); 127 sumofdaughtermass += daughtermass[index]; 146 sumofdaughtermass += daughtermass[index]; 128 } 147 } 129 G4double xmax = parentmass - sumofdaughterma << 148 G4double xmax = parentmass-sumofdaughtermass; 130 149 131 // create parent G4DynamicParticle at rest << 150 //create parent G4DynamicParticle at rest 132 G4ThreeVector dummy; 151 G4ThreeVector dummy; 133 auto parentparticle = new G4DynamicParticle( << 152 G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0); 134 153 135 // create G4Decayproducts << 154 //create G4Decayproducts 136 auto products = new G4DecayProducts(*parentp << 155 G4DecayProducts *products = new G4DecayProducts(*parentparticle); 137 delete parentparticle; 156 delete parentparticle; 138 157 139 // calculate daughter momentum 158 // calculate daughter momentum 140 G4double daughtermomentum[3]; 159 G4double daughtermomentum[3]; 141 160 142 // calcurate electron energy 161 // calcurate electron energy 143 G4double x; // Ee << 162 G4double x; // Ee 144 G4double p; // Pe << 163 G4double p; // Pe 145 G4double dm = daughtermass[0]; // Me << 164 G4double m = daughtermass[0]; //Me 146 G4double w; // cosine of e-nu angle << 165 G4double w; // cosine of e-nu angle 147 G4double r; << 166 G4double r; 148 G4double r0; 167 G4double r0; 149 const std::size_t MAX_LOOP = 10000; << 168 do { 150 for (std::size_t loop_counter = 0; loop_coun << 169 x = xmax*G4UniformRand(); 151 x = xmax * G4UniformRand(); << 170 p = std::sqrt(x*(x+2.0*m)); 152 p = std::sqrt(x * (x + 2.0 * dm)); << 171 w = 1.0-2.0*G4UniformRand(); 153 w = 1.0 - 2.0 * G4UniformRand(); << 172 r = p*(x+m)*(xmax-x)*(xmax-x)*(1.0+aENuCorr*p/(x+m)*w); 154 r = p * (x + dm) * (xmax - x) * (xmax - x) << 173 r0 = G4UniformRand()*(xmax+m)*(xmax+m)*xmax*xmax*(1.0+aENuCorr); 155 r0 = G4UniformRand() * (xmax + dm) * (xmax << 174 } while (r < r0); 156 if (r > r0) break; << 175 157 } << 158 176 159 // create daughter G4DynamicParticle << 177 //create daughter G4DynamicParticle 160 // rotation materix to lab frame 178 // rotation materix to lab frame 161 // << 179 G4double costheta = 2.*G4UniformRand()-1.0; 162 G4double costheta = 2. * G4UniformRand() - 1 << 180 G4double theta = std::acos(costheta)*rad; 163 G4double theta = std::acos(costheta) * rad; << 181 G4double phi = twopi*G4UniformRand()*rad; 164 G4double phi = twopi * G4UniformRand() * rad << 165 G4RotationMatrix rm; 182 G4RotationMatrix rm; 166 rm.rotateY(theta); 183 rm.rotateY(theta); 167 rm.rotateZ(phi); 184 rm.rotateZ(phi); 168 185 169 // daughter 0 (electron) in Z direction 186 // daughter 0 (electron) in Z direction 170 daughtermomentum[0] = p; 187 daughtermomentum[0] = p; 171 G4ThreeVector direction0(0.0, 0.0, 1.0); 188 G4ThreeVector direction0(0.0, 0.0, 1.0); 172 direction0 = rm * direction0; 189 direction0 = rm * direction0; 173 auto daughterparticle0 = << 190 G4DynamicParticle * daughterparticle0 174 new G4DynamicParticle(G4MT_daughters[0], d << 191 = new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]); 175 products->PushProducts(daughterparticle0); 192 products->PushProducts(daughterparticle0); 176 193 177 // daughter 1 (nutrino) in XZ plane 194 // daughter 1 (nutrino) in XZ plane 178 G4double eNu; // Enu << 195 G4double eNu; // Enu 179 eNu = (parentmass - daughtermass[2]) * (pare << 196 eNu = (parentmass-daughtermass[2])*(parentmass+daughtermass[2])+(m*m)-2.*parentmass*(x+m); 180 - 2. * parentmass * (x + dm); << 197 eNu /= 2.*(parentmass+p*w-(x+m)); 181 eNu /= 2. * (parentmass + p * w - (x + dm)); << 182 G4double cosn = w; 198 G4double cosn = w; 183 G4double phin = twopi * G4UniformRand() * ra << 199 G4double sinn = std::sqrt((1.0-cosn)*(1.0+cosn)); 184 G4double sinn = std::sqrt((1.0 - cosn) * (1. << 185 200 186 G4ThreeVector direction1(sinn * std::cos(phi << 201 G4ThreeVector direction1(sinn, 0.0, cosn); 187 direction1 = rm * direction1; 202 direction1 = rm * direction1; 188 auto daughterparticle1 = new G4DynamicPartic << 203 G4DynamicParticle * daughterparticle1 >> 204 = new G4DynamicParticle( daughters[1], direction1*eNu); 189 products->PushProducts(daughterparticle1); 205 products->PushProducts(daughterparticle1); 190 206 191 // daughter 2 (proton) at REST 207 // daughter 2 (proton) at REST 192 G4double eP; // Eproton << 208 G4double eP; // Eproton 193 eP = parentmass - eNu - (x + dm) - daughterm << 209 eP = parentmass-eNu-(x+m)-daughtermass[2]; 194 G4double pPx = -eNu * sinn; << 210 G4double pPx = -eNu*sinn; 195 G4double pPz = -p - eNu * cosn; << 211 G4double pPz = -p-eNu*cosn; 196 G4double pP = std::sqrt(eP * (eP + 2. * daug << 212 G4double pP = std::sqrt(eP*(eP+2.*daughtermass[2])); 197 G4ThreeVector direction2(pPx / pP * std::cos << 213 G4ThreeVector direction2(pPx/pP, 0.0, pPz/pP); 198 direction2 = rm * direction2; << 214 G4DynamicParticle * daughterparticle2 199 auto daughterparticle2 = new G4DynamicPartic << 215 = new G4DynamicParticle( daughters[2], direction2); 200 products->PushProducts(daughterparticle2); 216 products->PushProducts(daughterparticle2); >> 217 201 218 202 // output message << 219 // output message 203 #ifdef G4VERBOSE 220 #ifdef G4VERBOSE 204 if (GetVerboseLevel() > 1) { << 221 if (GetVerboseLevel()>1) { 205 G4cout << "G4NeutronBetaDecayChannel::Deca 222 G4cout << "G4NeutronBetaDecayChannel::DecayIt "; 206 G4cout << " create decay products in rest << 223 G4cout << " create decay products in rest frame " <<G4endl; 207 products->DumpInfo(); 224 products->DumpInfo(); 208 } 225 } 209 #endif 226 #endif 210 return products; 227 return products; 211 } 228 } >> 229 >> 230 >> 231 >> 232 >> 233 >> 234 212 235