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 /** \file G4INCLNaturalIsotopicDistributions.c 39 * \brief Classes that stores isotopic abundan 40 * 41 * \date 21st October 2012 42 * \author Davide Mancusi 43 */ 44 45 #include "G4INCLNaturalIsotopicDistributions.h 46 #include "G4INCLRandom.hh" 47 #include "G4INCLLogger.hh" 48 // #include <cassert> 49 #include <utility> 50 #include <iostream> 51 52 namespace G4INCL { 53 54 Isotope::Isotope(const G4int A, const G4doub 55 theA(A), 56 theAbundance(abundance) 57 {} 58 59 IsotopicDistribution::IsotopicDistribution(I 60 theIsotopes(aVector) 61 { 62 G4double previousAbundance = 0.; 63 // Cumulate the abundances 64 for(IsotopeIter i=theIsotopes.begin(), e=t 65 i->theAbundance += previousAbundance; 66 previousAbundance = i->theAbundance; 67 } 68 // Normalize the abundances to 1 69 const G4double normalisation = 1./theIsoto 70 for(IsotopeIter i=theIsotopes.begin(), e=t 71 i->theAbundance *= normalisation; 72 } 73 74 G4int IsotopicDistribution::drawRandomIsotop 75 const G4double r = Random::shoot(); 76 for(unsigned int i=0; i<theIsotopes.size() 77 if(r<=theIsotopes.at(i).theAbundance) 78 return theIsotopes.at(i).theA; 79 } 80 return theIsotopes.back().theA; 81 } 82 83 IsotopeVector const &IsotopicDistribution::g 84 return theIsotopes; 85 } 86 87 IsotopicDistribution const &NaturalIsotopicD 88 std::map<G4int, IsotopicDistribution>::con 89 if(i!=theDistributions.end()) 90 return i->second; 91 else { 92 INCL_FATAL("Requested natural isotopic d 93 return theDistributions.begin()->second; 94 } 95 } 96 97 G4int NaturalIsotopicDistributions::drawRand 98 return getIsotopicDistribution(Z).drawRand 99 } 100 101 namespace { 102 std::pair<G4int, Isotope> theRawDistributi 103 std::pair<G4int, Isotope>(1, Isotope(1, 104 std::pair<G4int, Isotope>(1, Isotope(2, 105 std::pair<G4int, Isotope>(2, Isotope(3, 106 std::pair<G4int, Isotope>(2, Isotope(4, 107 std::pair<G4int, Isotope>(3, Isotope(6, 108 std::pair<G4int, Isotope>(3, Isotope(7, 109 std::pair<G4int, Isotope>(4, Isotope(9, 110 std::pair<G4int, Isotope>(5, Isotope(10, 111 std::pair<G4int, Isotope>(5, Isotope(11, 112 std::pair<G4int, Isotope>(6, Isotope(12, 113 std::pair<G4int, Isotope>(6, Isotope(13, 114 std::pair<G4int, Isotope>(7, Isotope(14, 115 std::pair<G4int, Isotope>(7, Isotope(15, 116 std::pair<G4int, Isotope>(8, Isotope(16, 117 std::pair<G4int, Isotope>(8, Isotope(17, 118 std::pair<G4int, Isotope>(8, Isotope(18, 119 std::pair<G4int, Isotope>(9, Isotope(19, 120 std::pair<G4int, Isotope>(10, Isotope(20 121 std::pair<G4int, Isotope>(10, Isotope(21 122 std::pair<G4int, Isotope>(10, Isotope(22 123 std::pair<G4int, Isotope>(11, Isotope(23 124 std::pair<G4int, Isotope>(12, Isotope(24 125 std::pair<G4int, Isotope>(12, Isotope(25 126 std::pair<G4int, Isotope>(12, Isotope(26 127 std::pair<G4int, Isotope>(13, Isotope(27 128 std::pair<G4int, Isotope>(14, Isotope(28 129 std::pair<G4int, Isotope>(14, Isotope(29 130 std::pair<G4int, Isotope>(14, Isotope(30 131 std::pair<G4int, Isotope>(15, Isotope(31 132 std::pair<G4int, Isotope>(16, Isotope(32 133 std::pair<G4int, Isotope>(16, Isotope(33 134 std::pair<G4int, Isotope>(16, Isotope(34 135 std::pair<G4int, Isotope>(16, Isotope(36 136 std::pair<G4int, Isotope>(17, Isotope(35 137 std::pair<G4int, Isotope>(17, Isotope(37 138 std::pair<G4int, Isotope>(18, Isotope(36 139 std::pair<G4int, Isotope>(18, Isotope(38 140 std::pair<G4int, Isotope>(18, Isotope(40 141 std::pair<G4int, Isotope>(19, Isotope(39 142 std::pair<G4int, Isotope>(19, Isotope(40 143 std::pair<G4int, Isotope>(19, Isotope(41 144 std::pair<G4int, Isotope>(20, Isotope(40 145 std::pair<G4int, Isotope>(20, Isotope(42 146 std::pair<G4int, Isotope>(20, Isotope(43 147 std::pair<G4int, Isotope>(20, Isotope(44 148 std::pair<G4int, Isotope>(20, Isotope(46 149 std::pair<G4int, Isotope>(20, Isotope(48 150 std::pair<G4int, Isotope>(21, Isotope(45 151 std::pair<G4int, Isotope>(22, Isotope(46 152 std::pair<G4int, Isotope>(22, Isotope(47 153 std::pair<G4int, Isotope>(22, Isotope(48 154 std::pair<G4int, Isotope>(22, Isotope(49 155 std::pair<G4int, Isotope>(22, Isotope(50 156 std::pair<G4int, Isotope>(23, Isotope(50 157 std::pair<G4int, Isotope>(23, Isotope(51 158 std::pair<G4int, Isotope>(24, Isotope(50 159 std::pair<G4int, Isotope>(24, Isotope(52 160 std::pair<G4int, Isotope>(24, Isotope(53 161 std::pair<G4int, Isotope>(24, Isotope(54 162 std::pair<G4int, Isotope>(25, Isotope(55 163 std::pair<G4int, Isotope>(26, Isotope(54 164 std::pair<G4int, Isotope>(26, Isotope(56 165 std::pair<G4int, Isotope>(26, Isotope(57 166 std::pair<G4int, Isotope>(26, Isotope(58 167 std::pair<G4int, Isotope>(27, Isotope(59 168 std::pair<G4int, Isotope>(28, Isotope(58 169 std::pair<G4int, Isotope>(28, Isotope(60 170 std::pair<G4int, Isotope>(28, Isotope(61 171 std::pair<G4int, Isotope>(28, Isotope(62 172 std::pair<G4int, Isotope>(28, Isotope(64 173 std::pair<G4int, Isotope>(29, Isotope(63 174 std::pair<G4int, Isotope>(29, Isotope(65 175 std::pair<G4int, Isotope>(30, Isotope(64 176 std::pair<G4int, Isotope>(30, Isotope(66 177 std::pair<G4int, Isotope>(30, Isotope(67 178 std::pair<G4int, Isotope>(30, Isotope(68 179 std::pair<G4int, Isotope>(30, Isotope(70 180 std::pair<G4int, Isotope>(31, Isotope(69 181 std::pair<G4int, Isotope>(31, Isotope(71 182 std::pair<G4int, Isotope>(32, Isotope(70 183 std::pair<G4int, Isotope>(32, Isotope(72 184 std::pair<G4int, Isotope>(32, Isotope(73 185 std::pair<G4int, Isotope>(32, Isotope(74 186 std::pair<G4int, Isotope>(32, Isotope(76 187 std::pair<G4int, Isotope>(33, Isotope(75 188 std::pair<G4int, Isotope>(34, Isotope(74 189 std::pair<G4int, Isotope>(34, Isotope(76 190 std::pair<G4int, Isotope>(34, Isotope(77 191 std::pair<G4int, Isotope>(34, Isotope(78 192 std::pair<G4int, Isotope>(34, Isotope(80 193 std::pair<G4int, Isotope>(34, Isotope(82 194 std::pair<G4int, Isotope>(35, Isotope(79 195 std::pair<G4int, Isotope>(35, Isotope(81 196 std::pair<G4int, Isotope>(36, Isotope(78 197 std::pair<G4int, Isotope>(36, Isotope(80 198 std::pair<G4int, Isotope>(36, Isotope(82 199 std::pair<G4int, Isotope>(36, Isotope(83 200 std::pair<G4int, Isotope>(36, Isotope(84 201 std::pair<G4int, Isotope>(36, Isotope(86 202 std::pair<G4int, Isotope>(37, Isotope(85 203 std::pair<G4int, Isotope>(37, Isotope(87 204 std::pair<G4int, Isotope>(38, Isotope(84 205 std::pair<G4int, Isotope>(38, Isotope(86 206 std::pair<G4int, Isotope>(38, Isotope(87 207 std::pair<G4int, Isotope>(38, Isotope(88 208 std::pair<G4int, Isotope>(39, Isotope(89 209 std::pair<G4int, Isotope>(40, Isotope(90 210 std::pair<G4int, Isotope>(40, Isotope(91 211 std::pair<G4int, Isotope>(40, Isotope(92 212 std::pair<G4int, Isotope>(40, Isotope(94 213 std::pair<G4int, Isotope>(40, Isotope(96 214 std::pair<G4int, Isotope>(41, Isotope(93 215 std::pair<G4int, Isotope>(42, Isotope(92 216 std::pair<G4int, Isotope>(42, Isotope(94 217 std::pair<G4int, Isotope>(42, Isotope(95 218 std::pair<G4int, Isotope>(42, Isotope(96 219 std::pair<G4int, Isotope>(42, Isotope(97 220 std::pair<G4int, Isotope>(42, Isotope(98 221 std::pair<G4int, Isotope>(42, Isotope(10 222 std::pair<G4int, Isotope>(44, Isotope(96 223 std::pair<G4int, Isotope>(44, Isotope(98 224 std::pair<G4int, Isotope>(44, Isotope(99 225 std::pair<G4int, Isotope>(44, Isotope(10 226 std::pair<G4int, Isotope>(44, Isotope(10 227 std::pair<G4int, Isotope>(44, Isotope(10 228 std::pair<G4int, Isotope>(44, Isotope(10 229 std::pair<G4int, Isotope>(45, Isotope(10 230 std::pair<G4int, Isotope>(46, Isotope(10 231 std::pair<G4int, Isotope>(46, Isotope(10 232 std::pair<G4int, Isotope>(46, Isotope(10 233 std::pair<G4int, Isotope>(46, Isotope(10 234 std::pair<G4int, Isotope>(46, Isotope(10 235 std::pair<G4int, Isotope>(46, Isotope(11 236 std::pair<G4int, Isotope>(47, Isotope(10 237 std::pair<G4int, Isotope>(47, Isotope(10 238 std::pair<G4int, Isotope>(48, Isotope(10 239 std::pair<G4int, Isotope>(48, Isotope(10 240 std::pair<G4int, Isotope>(48, Isotope(11 241 std::pair<G4int, Isotope>(48, Isotope(11 242 std::pair<G4int, Isotope>(48, Isotope(11 243 std::pair<G4int, Isotope>(48, Isotope(11 244 std::pair<G4int, Isotope>(48, Isotope(11 245 std::pair<G4int, Isotope>(48, Isotope(11 246 std::pair<G4int, Isotope>(49, Isotope(11 247 std::pair<G4int, Isotope>(49, Isotope(11 248 std::pair<G4int, Isotope>(50, Isotope(11 249 std::pair<G4int, Isotope>(50, Isotope(11 250 std::pair<G4int, Isotope>(50, Isotope(11 251 std::pair<G4int, Isotope>(50, Isotope(11 252 std::pair<G4int, Isotope>(50, Isotope(11 253 std::pair<G4int, Isotope>(50, Isotope(11 254 std::pair<G4int, Isotope>(50, Isotope(11 255 std::pair<G4int, Isotope>(50, Isotope(12 256 std::pair<G4int, Isotope>(50, Isotope(12 257 std::pair<G4int, Isotope>(50, Isotope(12 258 std::pair<G4int, Isotope>(51, Isotope(12 259 std::pair<G4int, Isotope>(51, Isotope(12 260 std::pair<G4int, Isotope>(52, Isotope(12 261 std::pair<G4int, Isotope>(52, Isotope(12 262 std::pair<G4int, Isotope>(52, Isotope(12 263 std::pair<G4int, Isotope>(52, Isotope(12 264 std::pair<G4int, Isotope>(52, Isotope(12 265 std::pair<G4int, Isotope>(52, Isotope(12 266 std::pair<G4int, Isotope>(52, Isotope(12 267 std::pair<G4int, Isotope>(52, Isotope(13 268 std::pair<G4int, Isotope>(53, Isotope(12 269 std::pair<G4int, Isotope>(54, Isotope(12 270 std::pair<G4int, Isotope>(54, Isotope(12 271 std::pair<G4int, Isotope>(54, Isotope(12 272 std::pair<G4int, Isotope>(54, Isotope(12 273 std::pair<G4int, Isotope>(54, Isotope(13 274 std::pair<G4int, Isotope>(54, Isotope(13 275 std::pair<G4int, Isotope>(54, Isotope(13 276 std::pair<G4int, Isotope>(54, Isotope(13 277 std::pair<G4int, Isotope>(54, Isotope(13 278 std::pair<G4int, Isotope>(55, Isotope(13 279 std::pair<G4int, Isotope>(56, Isotope(13 280 std::pair<G4int, Isotope>(56, Isotope(13 281 std::pair<G4int, Isotope>(56, Isotope(13 282 std::pair<G4int, Isotope>(56, Isotope(13 283 std::pair<G4int, Isotope>(56, Isotope(13 284 std::pair<G4int, Isotope>(56, Isotope(13 285 std::pair<G4int, Isotope>(56, Isotope(13 286 std::pair<G4int, Isotope>(57, Isotope(13 287 std::pair<G4int, Isotope>(57, Isotope(13 288 std::pair<G4int, Isotope>(58, Isotope(13 289 std::pair<G4int, Isotope>(58, Isotope(13 290 std::pair<G4int, Isotope>(58, Isotope(14 291 std::pair<G4int, Isotope>(58, Isotope(14 292 std::pair<G4int, Isotope>(59, Isotope(14 293 std::pair<G4int, Isotope>(60, Isotope(14 294 std::pair<G4int, Isotope>(60, Isotope(14 295 std::pair<G4int, Isotope>(60, Isotope(14 296 std::pair<G4int, Isotope>(60, Isotope(14 297 std::pair<G4int, Isotope>(60, Isotope(14 298 std::pair<G4int, Isotope>(60, Isotope(14 299 std::pair<G4int, Isotope>(60, Isotope(15 300 std::pair<G4int, Isotope>(62, Isotope(14 301 std::pair<G4int, Isotope>(62, Isotope(14 302 std::pair<G4int, Isotope>(62, Isotope(14 303 std::pair<G4int, Isotope>(62, Isotope(14 304 std::pair<G4int, Isotope>(62, Isotope(15 305 std::pair<G4int, Isotope>(62, Isotope(15 306 std::pair<G4int, Isotope>(62, Isotope(15 307 std::pair<G4int, Isotope>(63, Isotope(15 308 std::pair<G4int, Isotope>(63, Isotope(15 309 std::pair<G4int, Isotope>(64, Isotope(15 310 std::pair<G4int, Isotope>(64, Isotope(15 311 std::pair<G4int, Isotope>(64, Isotope(15 312 std::pair<G4int, Isotope>(64, Isotope(15 313 std::pair<G4int, Isotope>(64, Isotope(15 314 std::pair<G4int, Isotope>(64, Isotope(15 315 std::pair<G4int, Isotope>(64, Isotope(16 316 std::pair<G4int, Isotope>(65, Isotope(15 317 std::pair<G4int, Isotope>(66, Isotope(15 318 std::pair<G4int, Isotope>(66, Isotope(15 319 std::pair<G4int, Isotope>(66, Isotope(16 320 std::pair<G4int, Isotope>(66, Isotope(16 321 std::pair<G4int, Isotope>(66, Isotope(16 322 std::pair<G4int, Isotope>(66, Isotope(16 323 std::pair<G4int, Isotope>(66, Isotope(16 324 std::pair<G4int, Isotope>(67, Isotope(16 325 std::pair<G4int, Isotope>(68, Isotope(16 326 std::pair<G4int, Isotope>(68, Isotope(16 327 std::pair<G4int, Isotope>(68, Isotope(16 328 std::pair<G4int, Isotope>(68, Isotope(16 329 std::pair<G4int, Isotope>(68, Isotope(16 330 std::pair<G4int, Isotope>(68, Isotope(17 331 std::pair<G4int, Isotope>(69, Isotope(16 332 std::pair<G4int, Isotope>(70, Isotope(16 333 std::pair<G4int, Isotope>(70, Isotope(17 334 std::pair<G4int, Isotope>(70, Isotope(17 335 std::pair<G4int, Isotope>(70, Isotope(17 336 std::pair<G4int, Isotope>(70, Isotope(17 337 std::pair<G4int, Isotope>(70, Isotope(17 338 std::pair<G4int, Isotope>(70, Isotope(17 339 std::pair<G4int, Isotope>(71, Isotope(17 340 std::pair<G4int, Isotope>(71, Isotope(17 341 std::pair<G4int, Isotope>(72, Isotope(17 342 std::pair<G4int, Isotope>(72, Isotope(17 343 std::pair<G4int, Isotope>(72, Isotope(17 344 std::pair<G4int, Isotope>(72, Isotope(17 345 std::pair<G4int, Isotope>(72, Isotope(17 346 std::pair<G4int, Isotope>(72, Isotope(18 347 std::pair<G4int, Isotope>(73, Isotope(18 348 std::pair<G4int, Isotope>(73, Isotope(18 349 std::pair<G4int, Isotope>(74, Isotope(18 350 std::pair<G4int, Isotope>(74, Isotope(18 351 std::pair<G4int, Isotope>(74, Isotope(18 352 std::pair<G4int, Isotope>(74, Isotope(18 353 std::pair<G4int, Isotope>(74, Isotope(18 354 std::pair<G4int, Isotope>(75, Isotope(18 355 std::pair<G4int, Isotope>(75, Isotope(18 356 std::pair<G4int, Isotope>(76, Isotope(18 357 std::pair<G4int, Isotope>(76, Isotope(18 358 std::pair<G4int, Isotope>(76, Isotope(18 359 std::pair<G4int, Isotope>(76, Isotope(18 360 std::pair<G4int, Isotope>(76, Isotope(18 361 std::pair<G4int, Isotope>(76, Isotope(19 362 std::pair<G4int, Isotope>(76, Isotope(19 363 std::pair<G4int, Isotope>(77, Isotope(19 364 std::pair<G4int, Isotope>(77, Isotope(19 365 std::pair<G4int, Isotope>(78, Isotope(19 366 std::pair<G4int, Isotope>(78, Isotope(19 367 std::pair<G4int, Isotope>(78, Isotope(19 368 std::pair<G4int, Isotope>(78, Isotope(19 369 std::pair<G4int, Isotope>(78, Isotope(19 370 std::pair<G4int, Isotope>(78, Isotope(19 371 std::pair<G4int, Isotope>(79, Isotope(19 372 std::pair<G4int, Isotope>(80, Isotope(19 373 std::pair<G4int, Isotope>(80, Isotope(19 374 std::pair<G4int, Isotope>(80, Isotope(19 375 std::pair<G4int, Isotope>(80, Isotope(20 376 std::pair<G4int, Isotope>(80, Isotope(20 377 std::pair<G4int, Isotope>(80, Isotope(20 378 std::pair<G4int, Isotope>(80, Isotope(20 379 std::pair<G4int, Isotope>(81, Isotope(20 380 std::pair<G4int, Isotope>(81, Isotope(20 381 std::pair<G4int, Isotope>(82, Isotope(20 382 std::pair<G4int, Isotope>(82, Isotope(20 383 std::pair<G4int, Isotope>(82, Isotope(20 384 std::pair<G4int, Isotope>(82, Isotope(20 385 std::pair<G4int, Isotope>(83, Isotope(20 386 std::pair<G4int, Isotope>(90, Isotope(23 387 std::pair<G4int, Isotope>(92, Isotope(23 388 std::pair<G4int, Isotope>(92, Isotope(23 389 std::pair<G4int, Isotope>(92, Isotope(23 390 }; 391 392 // Cool hack to get the size of an array i 393 template<typename T, ::std::size_t N> ::st 394 return N; 395 } 396 } 397 398 NaturalIsotopicDistributions::NaturalIsotopi 399 G4int oldZ = -1; 400 IsotopeVector aVector; 401 for(unsigned int i=0; i<sizeOfArray(theRaw 402 std::pair<G4int, Isotope> const &aPair = 403 if(aPair.first == oldZ) { 404 aVector.push_back(aPair.second); 405 } else { 406 if(oldZ!=-1) 407 theDistributions.insert(std::pair<G4 408 oldZ = aPair.first; 409 aVector.clear(); 410 aVector.push_back(aPair.second); 411 } 412 } 413 // last element 414 theDistributions.insert(std::pair<G4int, I 415 } 416 417 } 418 419