Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4NeutronBetaDecayChannel class implementat << 27 // 23 // 28 // Author: H.Kurashige, 18 September 2001 << 24 // $Id: G4NeutronBetaDecayChannel.cc,v 1.6 2004/12/10 18:02:04 gcosmo Exp $ 29 // ------------------------------------------- << 25 // GEANT4 tag $Name: geant4-07-00-cand-05 $ 30 << 26 // 31 #include "G4NeutronBetaDecayChannel.hh" << 27 // >> 28 // ------------------------------------------------------------ >> 29 // GEANT 4 class header file >> 30 // >> 31 // History: first implementation, based on object model of >> 32 // 18 Sep 2001 H.Kurashige >> 33 // >> 34 // ------------------------------------------------------------ 32 35 33 #include "G4DecayProducts.hh" << 34 #include "G4LorentzRotation.hh" << 35 #include "G4LorentzVector.hh" << 36 #include "G4ParticleDefinition.hh" 36 #include "G4ParticleDefinition.hh" 37 #include "G4PhysicalConstants.hh" << 37 #include "G4DecayProducts.hh" 38 #include "G4RotationMatrix.hh" << 39 #include "G4SystemOfUnits.hh" << 40 #include "G4VDecayChannel.hh" 38 #include "G4VDecayChannel.hh" >> 39 #include "G4NeutronBetaDecayChannel.hh" 41 #include "Randomize.hh" 40 #include "Randomize.hh" >> 41 #include "G4RotationMatrix.hh" >> 42 #include "G4LorentzVector.hh" >> 43 #include "G4LorentzRotation.hh" >> 44 42 45 43 G4NeutronBetaDecayChannel::G4NeutronBetaDecayC << 46 G4NeutronBetaDecayChannel::G4NeutronBetaDecayChannel( 44 : G4VDecayChannel("Neutron Decay") << 47 const G4String& theParentName, >> 48 G4double theBR) >> 49 :G4VDecayChannel("Neutron Decay"), >> 50 aENuCorr(-0.102) 45 { 51 { 46 // set names for daughter particles 52 // set names for daughter particles 47 if (theParentName == "neutron") { 53 if (theParentName == "neutron") { 48 SetBR(theBR); 54 SetBR(theBR); 49 SetParent("neutron"); 55 SetParent("neutron"); 50 SetNumberOfDaughters(3); 56 SetNumberOfDaughters(3); 51 SetDaughter(0, "e-"); 57 SetDaughter(0, "e-"); 52 SetDaughter(1, "anti_nu_e"); 58 SetDaughter(1, "anti_nu_e"); 53 SetDaughter(2, "proton"); 59 SetDaughter(2, "proton"); 54 } << 60 } else { 55 else if (theParentName == "anti_neutron") { << 56 SetBR(theBR); << 57 SetParent("anti_neutron"); << 58 SetNumberOfDaughters(3); << 59 SetDaughter(0, "e+"); << 60 SetDaughter(1, "nu_e"); << 61 SetDaughter(2, "anti_proton"); << 62 } << 63 else { << 64 #ifdef G4VERBOSE 61 #ifdef G4VERBOSE 65 if (GetVerboseLevel() > 0) { << 62 if (GetVerboseLevel()>0) { 66 G4cout << "G4NeutronBetaDecayChannel:: c 63 G4cout << "G4NeutronBetaDecayChannel:: constructor :"; 67 G4cout << " parent particle is not neutr << 64 G4cout << " parent particle is not muon but "; 68 G4cout << theParentName << G4endl; 65 G4cout << theParentName << G4endl; 69 } 66 } 70 #endif 67 #endif 71 } 68 } 72 } 69 } 73 70 74 G4NeutronBetaDecayChannel::G4NeutronBetaDecayC << 71 G4NeutronBetaDecayChannel::~G4NeutronBetaDecayChannel() 75 : G4VDecayChannel(right) << 76 {} << 77 << 78 G4NeutronBetaDecayChannel& << 79 G4NeutronBetaDecayChannel::operator=(const G4N << 80 { 72 { 81 if (this != &right) { << 82 kinematics_name = right.kinematics_name; << 83 verboseLevel = right.verboseLevel; << 84 rbranch = right.rbranch; << 85 << 86 // copy parent name << 87 delete parent_name; << 88 parent_name = new G4String(*right.parent_n << 89 << 90 // clear daughters_name array << 91 ClearDaughtersName(); << 92 << 93 // recreate array << 94 numberOfDaughters = right.numberOfDaughter << 95 if (numberOfDaughters > 0) { << 96 daughters_name = new G4String*[numberOfD << 97 // copy daughters name << 98 for (G4int index = 0; index < numberOfDa << 99 daughters_name[index] = new G4String(* << 100 } << 101 } << 102 } << 103 return *this; << 104 } 73 } 105 74 106 G4DecayProducts* G4NeutronBetaDecayChannel::De << 75 G4DecayProducts *G4NeutronBetaDecayChannel::DecayIt(G4double) 107 { 76 { 108 // This class describes free neutron beta d << 77 // This class describes free neutron beta decay kinemtics. 109 // This version neglects neutron/electron p << 78 // This version neglects neutron/electron polarization 110 // without Coulomb effect 79 // without Coulomb effect 111 80 112 #ifdef G4VERBOSE 81 #ifdef G4VERBOSE 113 if (GetVerboseLevel() > 1) G4cout << "G4Neut << 82 if (GetVerboseLevel()>1) G4cout << "G4NeutronBetaDecayChannel::DecayIt "; 114 #endif 83 #endif 115 84 116 CheckAndFillParent(); << 85 if (parent == 0) FillParent(); 117 CheckAndFillDaughters(); << 86 if (daughters == 0) FillDaughters(); 118 << 87 119 // parent mass 88 // parent mass 120 G4double parentmass = G4MT_parent->GetPDGMas << 89 G4double parentmass = parent->GetPDGMass(); 121 90 122 // daughters'mass << 91 //daughters'mass 123 G4double daughtermass[3]; << 92 G4double daughtermass[3]; 124 G4double sumofdaughtermass = 0.0; 93 G4double sumofdaughtermass = 0.0; 125 for (G4int index = 0; index < 3; ++index) { << 94 for (G4int index=0; index<3; index++){ 126 daughtermass[index] = G4MT_daughters[index << 95 daughtermass[index] = daughters[index]->GetPDGMass(); 127 sumofdaughtermass += daughtermass[index]; 96 sumofdaughtermass += daughtermass[index]; 128 } 97 } 129 G4double xmax = parentmass - sumofdaughterma << 98 G4double xmax = parentmass-sumofdaughtermass; 130 99 131 // create parent G4DynamicParticle at rest << 100 //create parent G4DynamicParticle at rest 132 G4ThreeVector dummy; 101 G4ThreeVector dummy; 133 auto parentparticle = new G4DynamicParticle( << 102 G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0); 134 103 135 // create G4Decayproducts << 104 //create G4Decayproducts 136 auto products = new G4DecayProducts(*parentp << 105 G4DecayProducts *products = new G4DecayProducts(*parentparticle); 137 delete parentparticle; 106 delete parentparticle; 138 107 139 // calculate daughter momentum 108 // calculate daughter momentum 140 G4double daughtermomentum[3]; 109 G4double daughtermomentum[3]; 141 110 142 // calcurate electron energy 111 // calcurate electron energy 143 G4double x; // Ee << 112 G4double x; // Ee 144 G4double p; // Pe << 113 G4double p; // Pe 145 G4double dm = daughtermass[0]; // Me << 114 G4double m = daughtermass[0]; //Me 146 G4double w; // cosine of e-nu angle << 115 G4double w; // cosine of e-nu angle 147 G4double r; << 116 G4double r; 148 G4double r0; 117 G4double r0; 149 const std::size_t MAX_LOOP = 10000; << 118 do { 150 for (std::size_t loop_counter = 0; loop_coun << 119 x = xmax*G4UniformRand(); 151 x = xmax * G4UniformRand(); << 120 p = std::sqrt(x*(x+2.0*m)); 152 p = std::sqrt(x * (x + 2.0 * dm)); << 121 w = 1.0-2.0*G4UniformRand(); 153 w = 1.0 - 2.0 * G4UniformRand(); << 122 r = p*(x+m)*(xmax-x)*(xmax-x)*(1.0+aENuCorr*p/(x+m)*w); 154 r = p * (x + dm) * (xmax - x) * (xmax - x) << 123 r0 = G4UniformRand()*(xmax+m)*(xmax+m)*xmax*xmax*(1.0+aENuCorr); 155 r0 = G4UniformRand() * (xmax + dm) * (xmax << 124 } while (r < r0); 156 if (r > r0) break; << 157 } << 158 125 159 // create daughter G4DynamicParticle << 126 //create daughter G4DynamicParticle 160 // rotation materix to lab frame 127 // rotation materix to lab frame 161 // << 128 G4double costheta = 2.*G4UniformRand()-1.0; 162 G4double costheta = 2. * G4UniformRand() - 1 << 129 G4double theta = std::acos(costheta)*rad; 163 G4double theta = std::acos(costheta) * rad; << 130 G4double phi = twopi*G4UniformRand()*rad; 164 G4double phi = twopi * G4UniformRand() * rad << 165 G4RotationMatrix rm; 131 G4RotationMatrix rm; 166 rm.rotateY(theta); 132 rm.rotateY(theta); 167 rm.rotateZ(phi); 133 rm.rotateZ(phi); 168 134 169 // daughter 0 (electron) in Z direction 135 // daughter 0 (electron) in Z direction 170 daughtermomentum[0] = p; 136 daughtermomentum[0] = p; 171 G4ThreeVector direction0(0.0, 0.0, 1.0); 137 G4ThreeVector direction0(0.0, 0.0, 1.0); 172 direction0 = rm * direction0; 138 direction0 = rm * direction0; 173 auto daughterparticle0 = << 139 G4DynamicParticle * daughterparticle0 174 new G4DynamicParticle(G4MT_daughters[0], d << 140 = new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]); 175 products->PushProducts(daughterparticle0); 141 products->PushProducts(daughterparticle0); 176 142 177 // daughter 1 (nutrino) in XZ plane 143 // daughter 1 (nutrino) in XZ plane 178 G4double eNu; // Enu << 144 G4double eNu = xmax-x; 179 eNu = (parentmass - daughtermass[2]) * (pare << 180 - 2. * parentmass * (x + dm); << 181 eNu /= 2. * (parentmass + p * w - (x + dm)); << 182 G4double cosn = w; 145 G4double cosn = w; 183 G4double phin = twopi * G4UniformRand() * ra << 146 G4double sinn = std::sqrt((1.0-cosn)*(1.0+cosn)); 184 G4double sinn = std::sqrt((1.0 - cosn) * (1. << 185 147 186 G4ThreeVector direction1(sinn * std::cos(phi << 148 G4ThreeVector direction1(sinn, 0.0, cosn); 187 direction1 = rm * direction1; 149 direction1 = rm * direction1; 188 auto daughterparticle1 = new G4DynamicPartic << 150 G4DynamicParticle * daughterparticle1 >> 151 = new G4DynamicParticle( daughters[1], direction1*eNu); 189 products->PushProducts(daughterparticle1); 152 products->PushProducts(daughterparticle1); 190 153 191 // daughter 2 (proton) at REST 154 // daughter 2 (proton) at REST 192 G4double eP; // Eproton << 155 G4ThreeVector direction2(0.0, 0.0, 0.0); 193 eP = parentmass - eNu - (x + dm) - daughterm << 156 G4DynamicParticle * daughterparticle2 194 G4double pPx = -eNu * sinn; << 157 = new G4DynamicParticle( daughters[2], direction2); 195 G4double pPz = -p - eNu * cosn; << 196 G4double pP = std::sqrt(eP * (eP + 2. * daug << 197 G4ThreeVector direction2(pPx / pP * std::cos << 198 direction2 = rm * direction2; << 199 auto daughterparticle2 = new G4DynamicPartic << 200 products->PushProducts(daughterparticle2); 158 products->PushProducts(daughterparticle2); >> 159 201 160 202 // output message << 161 // output message 203 #ifdef G4VERBOSE 162 #ifdef G4VERBOSE 204 if (GetVerboseLevel() > 1) { << 163 if (GetVerboseLevel()>1) { 205 G4cout << "G4NeutronBetaDecayChannel::Deca 164 G4cout << "G4NeutronBetaDecayChannel::DecayIt "; 206 G4cout << " create decay products in rest << 165 G4cout << " create decay products in rest frame " <<G4endl; 207 products->DumpInfo(); 166 products->DumpInfo(); 208 } 167 } 209 #endif 168 #endif 210 return products; 169 return products; 211 } 170 } >> 171 >> 172 >> 173 >> 174 >> 175 >> 176 212 177