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 // G4PionRadiativeDecayChannel class implement << 26 // ------------------------------------------------------------ 27 // GEANT 4 class header file 27 // GEANT 4 class header file 28 // 28 // 29 // Author: P.Gumplinger, 30 July 2007 << 29 // History: 30 // Reference: M. Blecher, TRIUMF/PIENU Technot << 30 // 01 August 2007 P.Gumplinger 31 // "Inclusion of pi->enug in the Mo << 31 // Reference: TRIUMF PIENU Technote: 32 // ------------------------------------------- << 32 // M. Blecher - "Inclusion of pi->enug in MC " >> 33 // Rate is for gammas > 100keV >> 34 // >> 35 // ------------------------------------------------------------ >> 36 // >> 37 // >> 38 // 33 39 34 #include "G4PionRadiativeDecayChannel.hh" 40 #include "G4PionRadiativeDecayChannel.hh" 35 41 36 #include "G4DecayProducts.hh" << 37 #include "G4LorentzVector.hh" << 38 #include "G4PhysicalConstants.hh" 42 #include "G4PhysicalConstants.hh" 39 #include "G4SystemOfUnits.hh" 43 #include "G4SystemOfUnits.hh" 40 #include "Randomize.hh" 44 #include "Randomize.hh" >> 45 #include "G4DecayProducts.hh" >> 46 #include "G4LorentzVector.hh" 41 47 42 namespace << 48 namespace { 43 { << 49 const G4double beta = 3.6612e-03; 44 const G4double beta = 3.6612e-03; << 50 const G4double cib = 1.16141e-03; 45 const G4double cib = 1.16141e-03; << 51 const G4double csdp = 3.45055e-02; 46 const G4double csdp = 3.45055e-02; << 52 const G4double csdm = 5.14122e-03; 47 const G4double csdm = 5.14122e-03; << 53 const G4double cif = 4.63543e-05; 48 const G4double cif = 4.63543e-05; << 54 const G4double cig = 1.78928e-05; 49 const G4double cig = 1.78928e-05; << 55 const G4double xl = 2.*0.1*MeV/139.57*MeV; 50 const G4double xl = 2. * 0.1 * MeV / 139.57 * << 56 const G4double yl = ((1.-xl) + std::sqrt((1-xl)*(1-xl)+4*beta*beta))/2.; 51 const G4double yl = ((1. - xl) + std::sqrt((1 << 57 >> 58 const G4double xu = 1. - (yl - std::sqrt(yl*yl-4.*beta*beta))/2.; >> 59 const G4double yu = 1. + beta*beta; >> 60 >> 61 inline G4double D2W(const G4double x,const G4double y) { >> 62 return cib*(1.-y)*(1.+((1.-x)*(1.-x)))/((x*x)*(x+y-1.)) + >> 63 csdp*(1.-x)*((x+y-1.)*(x+y-1.)) + >> 64 csdm*(1.-x)*((1.-y)*(1.-y)) + >> 65 cif*(x-1.)*(1.-y)/x + >> 66 cig*(1.-y)*(1.-x+(x*x)/(x+y-1.))/x; >> 67 } 52 68 53 const G4double xu = 1. - (yl - std::sqrt(yl * << 69 const G4double d2wmax = D2W(xl,yl); 54 const G4double yu = 1. + beta * beta; << 55 70 56 inline G4double D2W(const G4double x, const G4 << 71 >> 72 } >> 73 G4PionRadiativeDecayChannel::G4PionRadiativeDecayChannel() >> 74 : G4VDecayChannel() 57 { 75 { 58 return cib * (1. - y) * (1. + ((1. - x) * (1 << 59 + csdp * (1. - x) * ((x + y - 1.) * ( << 60 + cif * (x - 1.) * (1. - y) / x + cig << 61 } 76 } 62 77 63 const G4double d2wmax = D2W(xl, yl); << 78 G4PionRadiativeDecayChannel:: 64 } // namespace << 79 G4PionRadiativeDecayChannel(const G4String& theParentName, 65 << 80 G4double theBR) 66 G4PionRadiativeDecayChannel::G4PionRadiativeDe << 81 : G4VDecayChannel("Radiative Pion Decay",1) 67 << 68 : G4VDecayChannel("Radiative Pion Decay", 1) << 69 { 82 { 70 // set names for daughter particles 83 // set names for daughter particles 71 if (theParentName == "pi+") { 84 if (theParentName == "pi+") { 72 SetBR(theBR); 85 SetBR(theBR); 73 SetParent("pi+"); 86 SetParent("pi+"); 74 SetNumberOfDaughters(3); 87 SetNumberOfDaughters(3); 75 SetDaughter(0, "e+"); 88 SetDaughter(0, "e+"); 76 SetDaughter(1, "gamma"); 89 SetDaughter(1, "gamma"); 77 SetDaughter(2, "nu_e"); 90 SetDaughter(2, "nu_e"); 78 } << 91 } else if (theParentName == "pi-") { 79 else if (theParentName == "pi-") { << 80 SetBR(theBR); 92 SetBR(theBR); 81 SetParent("pi-"); 93 SetParent("pi-"); 82 SetNumberOfDaughters(3); 94 SetNumberOfDaughters(3); 83 SetDaughter(0, "e-"); 95 SetDaughter(0, "e-"); 84 SetDaughter(1, "gamma"); 96 SetDaughter(1, "gamma"); 85 SetDaughter(2, "anti_nu_e"); 97 SetDaughter(2, "anti_nu_e"); 86 } << 98 } else { 87 else { << 88 #ifdef G4VERBOSE 99 #ifdef G4VERBOSE 89 if (GetVerboseLevel() > 0) { << 100 if (GetVerboseLevel()>0) { 90 G4cout << "G4RadiativePionDecayChannel:: << 101 G4cout << "G4RadiativePionDecayChannel:: constructor :"; 91 G4cout << "Parent particle is not charge << 102 G4cout << " parent particle is not charged pion but "; 92 G4cout << theParentName << G4endl; 103 G4cout << theParentName << G4endl; 93 } 104 } 94 #endif 105 #endif 95 } 106 } 96 } 107 } 97 108 98 G4PionRadiativeDecayChannel& << 109 G4PionRadiativeDecayChannel::~G4PionRadiativeDecayChannel() 99 G4PionRadiativeDecayChannel::operator=(const G << 100 { 110 { 101 if (this != &right) { << 111 } >> 112 G4PionRadiativeDecayChannel::G4PionRadiativeDecayChannel(const G4PionRadiativeDecayChannel &right) >> 113 :G4VDecayChannel(right) >> 114 { >> 115 } >> 116 >> 117 G4PionRadiativeDecayChannel & G4PionRadiativeDecayChannel::operator=(const G4PionRadiativeDecayChannel & right) >> 118 { >> 119 if (this != &right) { 102 kinematics_name = right.kinematics_name; 120 kinematics_name = right.kinematics_name; 103 verboseLevel = right.verboseLevel; 121 verboseLevel = right.verboseLevel; 104 rbranch = right.rbranch; 122 rbranch = right.rbranch; 105 123 106 // copy parent name 124 // copy parent name 107 parent_name = new G4String(*right.parent_n 125 parent_name = new G4String(*right.parent_name); 108 126 109 // clear daughters_name array 127 // clear daughters_name array 110 ClearDaughtersName(); 128 ClearDaughtersName(); 111 129 112 // recreate array 130 // recreate array 113 numberOfDaughters = right.numberOfDaughter 131 numberOfDaughters = right.numberOfDaughters; 114 if (numberOfDaughters > 0) { << 132 if ( numberOfDaughters >0 ) { 115 if (daughters_name != nullptr) ClearDaug << 133 if (daughters_name !=0) ClearDaughtersName(); 116 daughters_name = new G4String*[numberOfD 134 daughters_name = new G4String*[numberOfDaughters]; 117 // copy daughters name << 135 //copy daughters name 118 for (G4int index = 0; index < numberOfDa << 136 for (G4int index=0; index < numberOfDaughters; index++) { 119 daughters_name[index] = new G4String(* << 137 daughters_name[index] = new G4String(*right.daughters_name[index]); 120 } 138 } 121 } 139 } 122 } 140 } 123 return *this; 141 return *this; 124 } 142 } 125 143 126 G4DecayProducts* G4PionRadiativeDecayChannel:: << 144 G4DecayProducts *G4PionRadiativeDecayChannel::DecayIt(G4double) 127 { 145 { >> 146 128 #ifdef G4VERBOSE 147 #ifdef G4VERBOSE 129 if (GetVerboseLevel() > 1) G4cout << "G4Pion << 148 if (GetVerboseLevel()>1) >> 149 G4cout << "G4PionRadiativeDecayChannel::DecayIt "; 130 #endif 150 #endif 131 151 132 CheckAndFillParent(); 152 CheckAndFillParent(); 133 CheckAndFillDaughters(); 153 CheckAndFillDaughters(); 134 154 135 // parent mass 155 // parent mass 136 G4double parentmass = G4MT_parent->GetPDGMas 156 G4double parentmass = G4MT_parent->GetPDGMass(); 137 157 138 G4double EMPI = parentmass; 158 G4double EMPI = parentmass; 139 159 140 // daughters'mass << 160 //daughters'mass 141 const G4int N_DAUGHTER = 3; << 161 const G4int N_DAUGHTER=3; 142 G4double daughtermass[N_DAUGHTER]; << 162 G4double daughtermass[N_DAUGHTER]; 143 // G4double sumofdaughtermass = 0.0; << 163 G4double sumofdaughtermass = 0.0; 144 for (G4int index = 0; index < N_DAUGHTER; ++ << 164 for (G4int index=0; index<N_DAUGHTER; index++){ 145 daughtermass[index] = G4MT_daughters[index 165 daughtermass[index] = G4MT_daughters[index]->GetPDGMass(); 146 // sumofdaughtermass += daughtermass[index << 166 sumofdaughtermass += daughtermass[index]; 147 } 167 } 148 168 149 G4double EMASS = daughtermass[0]; 169 G4double EMASS = daughtermass[0]; 150 170 151 // create parent G4DynamicParticle at rest << 171 //create parent G4DynamicParticle at rest 152 G4ThreeVector dummy; 172 G4ThreeVector dummy; 153 auto parentparticle = new G4DynamicParticle( << 173 G4DynamicParticle * parentparticle = 154 // create G4Decayproducts << 174 new G4DynamicParticle( G4MT_parent, dummy, 0.0); 155 auto products = new G4DecayProducts(*parentp << 175 //create G4Decayproducts >> 176 G4DecayProducts *products = new G4DecayProducts(*parentparticle); 156 delete parentparticle; 177 delete parentparticle; 157 178 158 G4double x, y; 179 G4double x, y; 159 180 160 const std::size_t MAX_LOOP = 1000; << 181 const size_t MAX_LOOP=1000; 161 182 162 for (std::size_t loop_counter1 = 0; loop_cou << 183 for (size_t loop_counter1=0; loop_counter1<MAX_LOOP; ++loop_counter1){ 163 for (std::size_t loop_counter2 = 0; loop_c << 184 for (size_t loop_counter2=0; loop_counter2<MAX_LOOP; ++loop_counter2){ 164 x = xl + G4UniformRand() * (xu - xl); << 185 x = xl + G4UniformRand()*(xu-xl); 165 y = yl + G4UniformRand() * (yu - yl); << 186 y = yl + G4UniformRand()*(yu-yl); 166 if (x + y > 1.) break; << 187 if (x+y > 1.) break; 167 } 188 } 168 G4double d2w = D2W(x, y); << 189 G4double d2w = D2W(x,y); 169 if (d2w > G4UniformRand() * d2wmax) break; << 190 if (d2w > G4UniformRand()*d2wmax) break; 170 } 191 } 171 192 172 // Calculate the angle between positron and << 193 //----------------------------------------------------------------------- 173 // << 194 // 174 G4double cthetaGE = << 195 // Calculate the angle between positron and photon (cosine) 175 (y * (x - 2.) + 2. * (1. - x + beta * beta << 196 // >> 197 G4double cthetaGE = (y*(x-2.)+2.*(1.-x+beta*beta)) / >> 198 (x*std::sqrt(y*y-4.*beta*beta)); 176 199 177 G4double G = x * EMPI / 2.; << 200 // 178 G4double E = y * EMPI / 2.; << 201 //----------------------------------------------------------------------- >> 202 // >> 203 G4double G = x * EMPI/2.; >> 204 G4double E = y * EMPI/2.; >> 205 // >> 206 //----------------------------------------------------------------------- >> 207 // 179 208 180 if (E < EMASS) E = EMASS; 209 if (E < EMASS) E = EMASS; 181 210 182 // calculate daughter momentum 211 // calculate daughter momentum 183 G4double daughtermomentum[2]; 212 G4double daughtermomentum[2]; 184 213 185 daughtermomentum[0] = std::sqrt(E * E - EMAS << 214 daughtermomentum[0] = std::sqrt(E*E - EMASS*EMASS); 186 215 187 G4double cthetaE = 2. * G4UniformRand() - 1. << 216 G4double cthetaE = 2.*G4UniformRand()-1.; 188 G4double sthetaE = std::sqrt(1. - cthetaE * << 217 G4double sthetaE = std::sqrt(1.-cthetaE*cthetaE); 189 218 190 G4double phiE = twopi * G4UniformRand() * ra << 219 G4double phiE = twopi*G4UniformRand()*rad; 191 G4double cphiE = std::cos(phiE); 220 G4double cphiE = std::cos(phiE); 192 G4double sphiE = std::sin(phiE); 221 G4double sphiE = std::sin(phiE); 193 222 194 // Coordinates of the decay positron << 223 //Coordinates of the decay positron 195 // << 224 196 G4double px = sthetaE * cphiE; << 225 G4double px = sthetaE*cphiE; 197 G4double py = sthetaE * sphiE; << 226 G4double py = sthetaE*sphiE; 198 G4double pz = cthetaE; 227 G4double pz = cthetaE; 199 228 200 G4ThreeVector direction0(px, py, pz); << 229 G4ThreeVector direction0(px,py,pz); 201 230 202 auto daughterparticle0 = << 231 G4DynamicParticle * daughterparticle0 203 new G4DynamicParticle(G4MT_daughters[0], d << 232 = new G4DynamicParticle( G4MT_daughters[0], daughtermomentum[0]*direction0); 204 233 205 products->PushProducts(daughterparticle0); 234 products->PushProducts(daughterparticle0); 206 235 207 daughtermomentum[1] = G; 236 daughtermomentum[1] = G; 208 237 209 G4double sthetaGE = std::sqrt(1. - cthetaGE << 238 G4double sthetaGE = std::sqrt(1.-cthetaGE*cthetaGE); 210 239 211 G4double phiGE = twopi * G4UniformRand() * r << 240 G4double phiGE = twopi*G4UniformRand()*rad; 212 G4double cphiGE = std::cos(phiGE); 241 G4double cphiGE = std::cos(phiGE); 213 G4double sphiGE = std::sin(phiGE); 242 G4double sphiGE = std::sin(phiGE); 214 243 215 // Coordinates of the decay gamma with respe << 244 //Coordinates of the decay gamma with respect to the decay positron 216 // << 245 217 px = sthetaGE * cphiGE; << 246 px = sthetaGE*cphiGE; 218 py = sthetaGE * sphiGE; << 247 py = sthetaGE*sphiGE; 219 pz = cthetaGE; 248 pz = cthetaGE; 220 249 221 G4ThreeVector direction1(px, py, pz); << 250 G4ThreeVector direction1(px,py,pz); 222 251 223 direction1.rotateUz(direction0); 252 direction1.rotateUz(direction0); 224 253 225 auto daughterparticle1 = << 254 G4DynamicParticle * daughterparticle1 226 new G4DynamicParticle(G4MT_daughters[1], d << 255 = new G4DynamicParticle( G4MT_daughters[1], daughtermomentum[1]*direction1); 227 256 228 products->PushProducts(daughterparticle1); 257 products->PushProducts(daughterparticle1); 229 258 230 // output message << 259 // output message 231 #ifdef G4VERBOSE 260 #ifdef G4VERBOSE 232 if (GetVerboseLevel() > 1) { << 261 if (GetVerboseLevel()>1) { 233 G4cout << "G4PionRadiativeDecayChannel::De << 262 G4cout << "G4PionRadiativeDecayChannel::DecayIt "; 234 G4cout << " create decay products in rest << 263 G4cout << " create decay products in rest frame " <<G4endl; 235 products->DumpInfo(); 264 products->DumpInfo(); 236 } 265 } 237 #endif 266 #endif 238 267 239 return products; 268 return products; >> 269 240 } 270 } 241 271