Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // INCL++ intra-nuclear cascade model 27 // Alain Boudard, CEA-Saclay, France 28 // Joseph Cugnon, University of Liege, Belgium 29 // Jean-Christophe David, CEA-Saclay, France 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H 31 // Sylvie Leray, CEA-Saclay, France 32 // Davide Mancusi, CEA-Saclay, France 33 // 34 #define INCLXX_IN_GEANT4_MODE 1 35 36 #include "globals.hh" 37 38 #include "G4INCLNpiToLKChannel.hh" 39 #include "G4INCLKinematicsUtils.hh" 40 #include "G4INCLBinaryCollisionAvatar.hh" 41 #include "G4INCLRandom.hh" 42 #include "G4INCLGlobals.hh" 43 #include "G4INCLLogger.hh" 44 #include <algorithm> 45 #include "G4INCLPhaseSpaceGenerator.hh" 46 47 namespace G4INCL { 48 49 NpiToLKChannel::NpiToLKChannel(Particle *p1, 50 : particle1(p1), particle2(p2) 51 {} 52 53 NpiToLKChannel::~NpiToLKChannel(){} 54 55 void NpiToLKChannel::fillFinalState(FinalSta 56 57 Particle *nucleon; 58 Particle *pion; 59 60 if(particle1->isNucleon()){ 61 nucleon = particle1; 62 pion = particle2; 63 } 64 else{ 65 nucleon = particle2; 66 pion = particle1; 67 } 68 69 const G4int iso = ParticleTable::getIsospi 70 71 ParticleType KaonType; 72 73 if(iso == 1) KaonType = KPlus; 74 else if(iso == -1) KaonType = KZero; 75 else{ 76 INCL_ERROR("NpiToLKChannel called with a 77 return; 78 } 79 80 ThreeVector mom_kaon = KaonMomentum(pion,n 81 82 nucleon->setType(Lambda); 83 pion->setType(KaonType); 84 85 G4double norm = KinematicsUtils::momentumI 86 87 pion->setMomentum(mom_kaon*norm); 88 nucleon->setMomentum(-mom_kaon*norm); 89 90 nucleon->adjustEnergyFromMomentum(); 91 pion->adjustEnergyFromMomentum(); 92 93 //INCL_DEBUG("NpiToLK " << (pion->getMomen 94 95 #ifdef INCLXX_IN_GEANT4_MODE 96 // Erase the parent resonance information 97 nucleon->setParentResonancePDGCode(0); 98 nucleon->setParentResonanceID(0); 99 pion->setParentResonancePDGCode(0); 100 pion->setParentResonanceID(0); 101 #endif 102 103 fs->addModifiedParticle(nucleon); 104 fs->addModifiedParticle(pion); 105 106 } 107 108 ThreeVector NpiToLKChannel::KaonMomentum(Par 109 110 const G4double pLab = KinematicsUtils::mom 111 112 if(pLab < 930.) return Random::normVector( 113 114 G4double cos_theta = 1.; 115 G4double sin_theta = 0.; 116 const G4double cos_phi = std::cos(Random:: 117 const G4double sin_phi = std::sqrt(1-cos_p 118 119 const G4double x = pion->getMomentum().get 120 const G4double y = pion->getMomentum().get 121 const G4double z = pion->getMomentum().get 122 123 const G4double r = std::sqrt(x*x+y*y+z*z); 124 const G4double rho = std::sqrt(x*x+y*y); 125 126 if(pLab >= 2375.){ 127 const G4double b = 12. * pLab/2375.; // 128 cos_theta = std::log(Random::shoot()*(st 129 sin_theta = std::sqrt(1-cos_theta*cos_th 130 131 } 132 else{ 133 const G4double Legendre_coef[290][8] = { 134 {930,0.18739,-0.06,-0.00621,-2e-05,0,0 135 {935,0.22915,-0.05104,-0.00013,-2e-05, 136 {940,0.27087,-0.04199,0.006,-2e-05,0,0 137 {945,0.31247,-0.0327,0.01223,-2e-05,0, 138 {950,0.35388,-0.02306,0.01863,-2e-05,0 139 {955,0.39503,-0.01292,0.02525,-2e-05,0 140 {960,0.43586,-0.00217,0.03214,-3e-05,0 141 {965,0.4763,0.00933,0.03938,-3e-05,0,0 142 {970,0.51629,0.02171,0.04702,-3e-05,0, 143 {975,0.55575,0.03509,0.05511,-3e-05,0, 144 {980,0.59462,0.04962,0.06371,-3e-05,0, 145 {985,0.63291,0.06537,0.073,-3e-05,0,0, 146 {990,0.6706,0.08222,0.0833,-3e-05,0,0, 147 {995,0.70756,0.09998,0.09494,-2e-05,0, 148 {1000,0.74362,0.11842,0.10816,-2e-05,0 149 {1005,0.77857,0.13733,0.12261,-2e-05,0 150 {1010,0.8121,0.15648,0.13737,-1e-05,0, 151 {1015,0.84402,0.17556,0.15102,-1e-05,0 152 {1020,0.87447,0.19424,0.16201,0,0,0,0} 153 {1025,0.90358,0.21231,0.16943,1e-05,0, 154 {1030,0.93118,0.22961,0.17264,2e-05,0, 155 {1035,0.95642,0.24598,0.17205,4e-05,0, 156 {1040,0.9784,0.26128,0.16958,6e-05,0,0 157 {1045,0.99681,0.2754,0.16737,8e-05,0,0 158 {1050,1.01213,0.2883,0.16575,1e-04,0,0 159 {1055,1.02473,0.29992,0.16397,0.00012, 160 {1060,1.03467,0.31018,0.16082,0.00015, 161 {1065,1.0417,0.31907,0.15599,0.00018,0 162 {1070,1.04567,0.32661,0.14947,0.00021, 163 {1075,1.04705,0.3329,0.14185,0.00024,0 164 {1080,1.04645,0.33806,0.13383,0.00027, 165 {1085,1.04451,0.34222,0.12613,3e-04,0, 166 {1090,1.04182,0.34551,0.11946,0.00032, 167 {1095,1.03903,0.34804,0.11454,0.00034, 168 {1100,1.03662,0.34992,0.11184,0.00036, 169 {1105,1.03464,0.35117,0.11087,0.00037, 170 {1110,1.03303,0.3518,0.11087,0.00037,0 171 {1115,1.0317,0.35178,0.1111,0.00037,0, 172 {1120,1.03059,0.35112,0.11082,0.00035, 173 {1125,1.02963,0.34981,0.10927,0.00031, 174 {1130,1.02873,0.34786,0.10573,0.00027, 175 {1135,1.02779,0.34528,0.09967,2e-04,0, 176 {1140,1.02643,0.34217,0.09158,0.00012, 177 {1145,1.02426,0.33869,0.08216,2e-05,0, 178 {1150,1.02085,0.33495,0.07213,-0.00011 179 {1155,1.01581,0.33109,0.0622,-0.00026, 180 {1160,1.00873,0.32726,0.05308,-0.00044 181 {1165,0.99942,0.32354,0.04523,-0.00065 182 {1170,0.98823,0.31998,0.03857,-9e-04,0 183 {1175,0.97557,0.31661,0.03292,-0.00117 184 {1180,0.96183,0.31345,0.02813,-0.00148 185 {1185,0.94743,0.31053,0.02403,-0.00183 186 {1190,0.93279,0.30788,0.02045,-0.00221 187 {1195,0.91829,0.30552,0.01722,-0.00263 188 {1200,0.90437,0.30349,0.0142,-0.00309, 189 {1205,0.89141,0.30181,0.0112,-0.0036,1 190 {1210,0.87983,0.30052,0.00806,-0.00414 191 {1215,0.87005,0.29962,0.00463,-0.00473 192 {1220,0.86245,0.29917,0.00072,-0.00537 193 {1225,0.85746,0.29917,-0.00381,-0.0060 194 {1230,0.85526,0.29965,-0.00909,-0.0067 195 {1235,0.85551,0.30056,-0.01516,-0.0075 196 {1240,0.85783,0.30188,-0.02202,-0.0083 197 {1245,0.86183,0.30357,-0.02969,-0.0091 198 {1250,0.86711,0.30559,-0.03818,-0.0099 199 {1255,0.87328,0.30789,-0.0475,-0.0107, 200 {1260,0.87995,0.31046,-0.05768,-0.0114 201 {1265,0.88672,0.31324,-0.06872,-0.0121 202 {1270,0.89321,0.3162,-0.08064,-0.01285 203 {1275,0.89901,0.31931,-0.09346,-0.0134 204 {1280,0.90375,0.32252,-0.10718,-0.0140 205 {1285,0.90702,0.3258,-0.12182,-0.01447 206 {1290,0.90844,0.32912,-0.13739,-0.0148 207 {1295,0.90798,0.33251,-0.15381,-0.0150 208 {1300,0.90606,0.33607,-0.17084,-0.0151 209 {1305,0.90314,0.33995,-0.18827,-0.0150 210 {1310,0.89965,0.34425,-0.20584,-0.0146 211 {1315,0.89606,0.34911,-0.22335,-0.0139 212 {1320,0.89281,0.35464,-0.24054,-0.0129 213 {1325,0.89036,0.36097,-0.2572,-0.01157 214 {1330,0.88915,0.36823,-0.27308,-0.0097 215 {1335,0.88959,0.37652,-0.28798,-0.0074 216 {1340,0.89162,0.38589,-0.30176,-0.0046 217 {1345,0.89499,0.39635,-0.31438,-0.0011 218 {1350,0.89948,0.40792,-0.32575,0.00291 219 {1355,0.90484,0.42061,-0.3358,0.00773, 220 {1360,0.91082,0.43443,-0.34446,0.01335 221 {1365,0.91718,0.44939,-0.35167,0.01983 222 {1370,0.92368,0.46552,-0.35736,0.02723 223 {1375,0.93008,0.48281,-0.36144,0.03562 224 {1380,0.93614,0.50128,-0.36387,0.04506 225 {1385,0.94161,0.52096,-0.36455,0.05562 226 {1390,0.94624,0.54184,-0.36343,0.06737 227 {1395,0.94981,0.56394,-0.36043,0.08036 228 {1400,0.95212,0.58725,-0.35554,0.09464 229 {1405,0.95323,0.61167,-0.34898,0.11013 230 {1410,0.95325,0.63706,-0.34102,0.12669 231 {1415,0.95229,0.6633,-0.33195,0.14424, 232 {1420,0.95046,0.69026,-0.32204,0.16264 233 {1425,0.94788,0.7178,-0.31156,0.1818,- 234 {1430,0.94466,0.74581,-0.30079,0.20158 235 {1435,0.9409,0.77415,-0.29002,0.22189, 236 {1440,0.93673,0.80269,-0.2795,0.24261, 237 {1445,0.93225,0.8313,-0.26953,0.26362, 238 {1450,0.92757,0.85985,-0.26038,0.28481 239 {1455,0.92282,0.88822,-0.25232,0.30607 240 {1460,0.91806,0.91629,-0.24556,0.3273, 241 {1465,0.9133,0.94406,-0.24008,0.34847, 242 {1470,0.90849,0.97153,-0.23576,0.36956 243 {1475,0.90359,0.99871,-0.2325,0.39056, 244 {1480,0.89857,1.02561,-0.2302,0.41146, 245 {1485,0.89338,1.05224,-0.22876,0.43223 246 {1490,0.88799,1.0786,-0.22808,0.45286, 247 {1495,0.88235,1.1047,-0.22805,0.47333, 248 {1500,0.87644,1.13056,-0.22858,0.49364 249 {1505,0.87021,1.15617,-0.22955,0.51376 250 {1510,0.86362,1.18155,-0.23086,0.53368 251 {1515,0.85663,1.20671,-0.23242,0.55338 252 {1520,0.84921,1.23163,-0.23416,0.57284 253 {1525,0.84136,1.25616,-0.23614,0.59195 254 {1530,0.83308,1.28016,-0.23847,0.6106, 255 {1535,0.82437,1.30346,-0.24125,0.62869 256 {1540,0.81522,1.32589,-0.24459,0.6461, 257 {1545,0.80565,1.34729,-0.2486,0.66271, 258 {1550,0.79564,1.3675,-0.25336,0.67841, 259 {1555,0.78521,1.38636,-0.259,0.6931,0. 260 {1560,0.77436,1.4037,-0.26561,0.70666, 261 {1565,0.76308,1.41937,-0.2733,0.71898, 262 {1570,0.75138,1.4332,-0.28217,0.72994, 263 {1575,0.73925,1.44502,-0.29233,0.73943 264 {1580,0.72671,1.45474,-0.30383,0.74739 265 {1585,0.71375,1.46248,-0.31657,0.75388 266 {1590,0.7004,1.46841,-0.33037,0.75901, 267 {1595,0.68665,1.47272,-0.3451,0.76289, 268 {1600,0.67251,1.4756,-0.36058,0.76565, 269 {1605,0.658,1.47722,-0.37667,0.76737,0 270 {1610,0.64313,1.47777,-0.3932,0.76819, 271 {1615,0.6279,1.47743,-0.41002,0.76821, 272 {1620,0.61232,1.47637,-0.42696,0.76754 273 {1625,0.59641,1.47479,-0.44387,0.76629 274 {1630,0.58017,1.47287,-0.4606,0.76457, 275 {1635,0.56361,1.47078,-0.47698,0.7625, 276 {1640,0.54674,1.4687,-0.49286,0.76019, 277 {1645,0.52957,1.46683,-0.50808,0.75774 278 {1650,0.51216,1.46529,-0.5225,0.75525, 279 {1655,0.49484,1.46406,-0.53609,0.75274 280 {1660,0.47796,1.46306,-0.54882,0.75023 281 {1665,0.46188,1.4622,-0.56068,0.7477,- 282 {1670,0.44698,1.46141,-0.57165,0.74517 283 {1675,0.43363,1.46061,-0.58171,0.74264 284 {1680,0.42219,1.45972,-0.59084,0.74012 285 {1685,0.41302,1.45866,-0.59903,0.73761 286 {1690,0.40649,1.45737,-0.60625,0.73511 287 {1695,0.40298,1.45575,-0.6125,0.73264, 288 {1700,0.40284,1.45373,-0.61774,0.73018 289 {1705,0.40645,1.45123,-0.62196,0.72776 290 {1710,0.41402,1.44822,-0.62516,0.72539 291 {1715,0.42517,1.44489,-0.6274,0.72323, 292 {1720,0.43937,1.44146,-0.62876,0.72143 293 {1725,0.45609,1.43817,-0.62931,0.72016 294 {1730,0.4748,1.43525,-0.62913,0.71959, 295 {1735,0.49497,1.43292,-0.6283,0.71989, 296 {1740,0.51607,1.43142,-0.6269,0.72121, 297 {1745,0.53758,1.43098,-0.62499,0.72373 298 {1750,0.55895,1.43183,-0.62267,0.7276, 299 {1755,0.57967,1.4342,-0.61999,0.73301, 300 {1760,0.5992,1.43833,-0.61705,0.74011, 301 {1765,0.61701,1.44443,-0.61392,0.74907 302 {1770,0.63257,1.45275,-0.61067,0.76005 303 {1775,0.64535,1.46351,-0.60738,0.77322 304 {1780,0.65496,1.47687,-0.60408,0.78868 305 {1785,0.66162,1.49263,-0.60057,0.80621 306 {1790,0.66566,1.51054,-0.5966,0.82552, 307 {1795,0.66742,1.53032,-0.59194,0.84633 308 {1800,0.66727,1.55172,-0.58634,0.86836 309 {1805,0.66553,1.57446,-0.57955,0.89131 310 {1810,0.66256,1.59828,-0.57132,0.9149, 311 {1815,0.6587,1.62291,-0.56141,0.93885, 312 {1820,0.6543,1.64809,-0.54958,0.96288, 313 {1825,0.64971,1.67356,-0.53558,0.98668 314 {1830,0.64526,1.69904,-0.51916,1.00999 315 {1835,0.64131,1.72427,-0.50008,1.0325, 316 {1840,0.63821,1.74898,-0.47809,1.05395 317 {1845,0.63629,1.77291,-0.45295,1.07404 318 {1850,0.63591,1.79579,-0.42441,1.09248 319 {1855,0.63741,1.81736,-0.39222,1.10899 320 {1860,0.64113,1.83735,-0.35615,1.12328 321 {1865,0.64742,1.8555,-0.31594,1.13507, 322 {1870,0.65664,1.87153,-0.27136,1.14408 323 {1875,0.66911,1.88519,-0.22214,1.15001 324 {1880,0.68509,1.89627,-0.16819,1.15266 325 {1885,0.70432,1.90488,-0.10992,1.15218 326 {1890,0.72647,1.91118,-0.04788,1.14879 327 {1895,0.75118,1.91533,0.01738,1.14272, 328 {1900,0.77812,1.91751,0.08531,1.13419, 329 {1905,0.80692,1.91788,0.15535,1.12342, 330 {1910,0.83725,1.91661,0.22697,1.11064, 331 {1915,0.86875,1.91386,0.2996,1.09608,0 332 {1920,0.90109,1.90981,0.37269,1.07996, 333 {1925,0.9339,1.90461,0.4457,1.06251,0. 334 {1930,0.96685,1.89844,0.51808,1.04394, 335 {1935,0.99958,1.89146,0.58927,1.02449, 336 {1940,1.03175,1.88384,0.65873,1.00439, 337 {1945,1.06301,1.87575,0.72589,0.98385, 338 {1950,1.09301,1.86735,0.79022,0.9631,0 339 {1955,1.1214,1.85881,0.85116,0.94236,1 340 {1960,1.14785,1.8503,0.90817,0.92187,1 341 {1965,1.17199,1.84198,0.96068,0.90184, 342 {1970,1.19348,1.83402,1.00815,0.88251, 343 {1975,1.21198,1.82659,1.05004,0.86409, 344 {1980,1.22713,1.81986,1.08578,0.84681, 345 {1985,1.23859,1.81398,1.11483,0.8309,1 346 {1990,1.24601,1.80914,1.13664,0.81658, 347 {1995,1.24905,1.80549,1.15065,0.80408, 348 {2000,1.24735,1.8032,1.15632,0.79362,1 349 {2005,1.2407,1.80242,1.15334,0.78541,1 350 {2010,1.22949,1.80321,1.14236,0.77959, 351 {2015,1.21419,1.80564,1.12429,0.7763,1 352 {2020,1.19533,1.80973,1.10003,0.77565, 353 {2025,1.17341,1.81555,1.07046,0.77778, 354 {2030,1.14892,1.82314,1.0365,0.78281,1 355 {2035,1.12238,1.83254,0.99904,0.79087, 356 {2040,1.09429,1.84381,0.95898,0.8021,1 357 {2045,1.06515,1.85699,0.91723,0.8166,1 358 {2050,1.03547,1.87214,0.87467,0.83452, 359 {2055,1.00576,1.88929,0.83222,0.85598, 360 {2060,0.97644,1.90846,0.79062,0.88103, 361 {2065,0.94767,1.92947,0.75007,0.90941, 362 {2070,0.91954,1.95211,0.71063,0.94081, 363 {2075,0.89213,1.97615,0.67234,0.97489, 364 {2080,0.86552,2.0014,0.63526,1.01133,1 365 {2085,0.83981,2.02762,0.59943,1.04978, 366 {2090,0.81506,2.0546,0.56491,1.08994,1 367 {2095,0.79138,2.08213,0.53175,1.13146, 368 {2100,0.76883,2.11,0.5,1.17402,1.09732 369 {2105,0.74751,2.13798,0.46972,1.2173,1 370 {2110,0.72751,2.16586,0.44094,1.26096, 371 {2115,0.70889,2.19343,0.41374,1.30467, 372 {2120,0.69174,2.22049,0.38814,1.34815, 373 {2125,0.67605,2.24701,0.36417,1.39128, 374 {2130,0.6618,2.27294,0.34183,1.43399,0 375 {2135,0.64897,2.29827,0.32114,1.47621, 376 {2140,0.63754,2.32297,0.3021,1.51786,0 377 {2145,0.62749,2.34703,0.28473,1.55887, 378 {2150,0.61881,2.37041,0.26902,1.59918, 379 {2155,0.61148,2.39309,0.25499,1.63869, 380 {2160,0.60547,2.41504,0.24265,1.67735, 381 {2165,0.60077,2.43625,0.23201,1.71507, 382 {2170,0.59735,2.45669,0.22308,1.75179, 383 {2175,0.59521,2.47634,0.21586,1.78743, 384 {2180,0.59431,2.49517,0.21037,1.82192, 385 {2185,0.59465,2.51315,0.20661,1.85518, 386 {2190,0.59619,2.53027,0.20459,1.88715, 387 {2195,0.59893,2.5465,0.20433,1.91774,0 388 {2200,0.60284,2.56181,0.20582,1.9469,0 389 {2205,0.60791,2.57618,0.20909,1.97453, 390 {2210,0.61411,2.5896,0.21413,2.00058,0 391 {2215,0.62143,2.60202,0.22096,2.02496, 392 {2220,0.62984,2.61344,0.22959,2.04761, 393 {2225,0.63934,2.62382,0.24002,2.06845, 394 {2230,0.64989,2.63314,0.25227,2.0874,0 395 {2235,0.66148,2.64138,0.26634,2.1044,0 396 {2240,0.67408,2.64852,0.28223,2.1194,0 397 {2245,0.68768,2.6546,0.29989,2.13244,0 398 {2250,0.70222,2.65965,0.31925,2.14359, 399 {2255,0.71767,2.66371,0.34024,2.15294, 400 {2260,0.73399,2.66683,0.36281,2.16054, 401 {2265,0.75115,2.66903,0.38688,2.16649, 402 {2270,0.76912,2.67037,0.41239,2.17083, 403 {2275,0.78785,2.67088,0.43927,2.17366, 404 {2280,0.80731,2.67059,0.46746,2.17504, 405 {2285,0.82746,2.66956,0.49689,2.17504, 406 {2290,0.84826,2.66782,0.5275,2.17375,0 407 {2295,0.86969,2.66541,0.55922,2.17122, 408 {2300,0.89169,2.66236,0.59199,2.16753, 409 {2305,0.91425,2.65872,0.62574,2.16276, 410 {2310,0.93731,2.65453,0.6604,2.15697,0 411 {2315,0.96085,2.64983,0.69591,2.15025, 412 {2320,0.98482,2.64466,0.7322,2.14266,0 413 {2325,1.00919,2.63905,0.76922,2.13427, 414 {2330,1.03393,2.63304,0.80688,2.12516, 415 {2335,1.05899,2.62669,0.84513,2.11541, 416 {2340,1.08434,2.62001,0.88391,2.10507, 417 {2345,1.10995,2.61307,0.92313,2.09423, 418 {2350,1.13577,2.60588,0.96275,2.08296, 419 {2355,1.16178,2.5985,1.0027,2.07133,1. 420 {2360,1.18793,2.59097,1.0429,2.05941,1 421 {2365,1.21419,2.58332,1.0833,2.04728,1 422 {2370,1.24052,2.57559,1.12382,2.035,1. 423 {2375,1.26688,2.56782,1.16441,2.02266, 424 425 const G4int coef_ener = G4int((pLab-Lege 426 const G4double sup_ener = pLab/5. - coef 427 //std::cout << "sup_ener\t" << sup_ener 428 429 // assert(pLab >= Legendre_coef[coef_ener][0] 430 431 // Legendre coefficient normalized 432 const G4double A0 = 1.; 433 const G4double A1 = (1-sup_ener)*Legendr 434 const G4double A2 = (1-sup_ener)*Legendr 435 const G4double A3 = (1-sup_ener)*Legendr 436 const G4double A4 = (1-sup_ener)*Legendr 437 const G4double A5 = (1-sup_ener)*Legendr 438 const G4double A6 = (1-sup_ener)*Legendr 439 const G4double A7 = (1-sup_ener)*Legendr 440 441 // Theoritical max if all Ai > 0 (often 442 const G4double A = std::fabs(A0) + std:: 443 444 G4bool success = false; 445 G4int maxloop = 0; 446 447 while(!success && maxloop < 1000){ 448 449 cos_theta = Random::shoot()*2-1.; // n 450 451 // Legendre Polynomial 452 G4double P0 = A0; 453 G4double P1 = A1*cos_theta; 454 G4double P2 = A2/2.*(3*std::pow(cos_th 455 G4double P3 = A3/2.*(5*std::pow(cos_th 456 G4double P4 = A4/8.*(35*std::pow(cos_t 457 G4double P5 = A5/8.*(63*std::pow(cos_t 458 G4double P6 = A6/16.*(231*std::pow(cos 459 G4double P7 = A7/16.*(429*std::pow(cos 460 461 G4double P = (P0 + P1 + P2 + P3 + P4 + 462 463 if(Random::shoot()*A < P) success = tr 464 maxloop +=1 ; 465 if(maxloop==1000) cos_theta = std::log 466 } 467 sin_theta = std::sqrt(1-cos_theta*cos_th 468 } 469 470 if(rho == 0) return ThreeVector(sin_theta* 471 // Rotation in the direction of the incide 472 const G4double px = x/r*cos_theta - y/rho* 473 const G4double py = y/r*cos_theta + x/rho* 474 const G4double pz = z/r*cos_theta - rho/r* 475 476 477 return ThreeVector(px,py,pz); 478 } 479 480 } 481