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 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 26 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 27 // 27 // 28 // MODULE: G4RadioactivityTable.c 28 // MODULE: G4RadioactivityTable.cc 29 // 29 // 30 // Version: 0.a 30 // Version: 0.a 31 // Date: 29/10/2010 31 // Date: 29/10/2010 32 // Author: F Lei 32 // Author: F Lei 33 // Organisation: QinetiQ UK 33 // Organisation: QinetiQ UK 34 // Customer: ESA/ESTEC, NOORDWIJK 34 // Customer: ESA/ESTEC, NOORDWIJK 35 // Contract: 12115/96/JG/NL Work Or 35 // Contract: 12115/96/JG/NL Work Order No. 3 36 // 36 // 37 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 37 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 38 // 38 // 39 // CHANGE HISTORY 39 // CHANGE HISTORY 40 // -------------- 40 // -------------- 41 // 41 // 42 // 29 October 2010, F. Lei QinetiQ UK 42 // 29 October 2010, F. Lei QinetiQ UK 43 // first release. 43 // first release. 44 // 44 // 45 ////////////////////////////////////////////// 45 /////////////////////////////////////////////////////////////////////////////// 46 46 47 47 48 #include "G4RadioactivityTable.hh" 48 #include "G4RadioactivityTable.hh" 49 49 50 #include <map> 50 #include <map> 51 51 52 G4RadioactivityTable::G4RadioactivityTable() 52 G4RadioactivityTable::G4RadioactivityTable() 53 { 53 { 54 } 54 } 55 ////////////////////////////////////////////// 55 /////////////////////////////////////////////////////////////////////////////// 56 // 56 // 57 G4RadioactivityTable::~G4RadioactivityTable() 57 G4RadioactivityTable::~G4RadioactivityTable() 58 { 58 { 59 fRadioactivity.clear(); 59 fRadioactivity.clear(); 60 } 60 } 61 ////////////////////////////////////////////// 61 /////////////////////////////////////////////////////////////////////////////// 62 // 62 // 63 63 64 G4int G4RadioactivityTable::Entries() const 64 G4int G4RadioactivityTable::Entries() const 65 { 65 { 66 return (G4int) fRadioactivity.size(); 66 return (G4int) fRadioactivity.size(); 67 } 67 } 68 ////////////////////////////////////////////// 68 /////////////////////////////////////////////////////////////////////////////// 69 // 69 // 70 void G4RadioactivityTable::AddIsotope(G4int Z, << 70 void G4RadioactivityTable::AddIsotope(G4int Z, G4int A, G4double E, G4double rate) 71 { 71 { 72 G4double drate = rate*weight; << 72 std::map<G4ThreeVector,G4double>::iterator it; 73 G4double derror = drate*rate; << 74 G4TwoVector entry = G4TwoVector(drate,derror << 75 std::map<G4ThreeVector,G4TwoVector>::iterato << 76 it = fRadioactivity.find(G4ThreeVector(Z,A,E 73 it = fRadioactivity.find(G4ThreeVector(Z,A,E)); 77 if (it == fRadioactivity.end()) { 74 if (it == fRadioactivity.end()) { 78 fRadioactivity[G4ThreeVector(Z,A,E)] = ent << 75 fRadioactivity[G4ThreeVector(Z,A,E)] = rate; 79 } else { 76 } else { 80 fRadioactivity[G4ThreeVector(Z,A,E)] += en << 77 fRadioactivity[G4ThreeVector(Z,A,E)] += rate; 81 } 78 } 82 } 79 } 83 ////////////////////////////////////////////// 80 /////////////////////////////////////////////////////////////////////////////// 84 // 81 // 85 G4TwoVector G4RadioactivityTable::GetRate(G4in << 82 G4double G4RadioactivityTable::GetRate(G4int Z, G4int A, G4double E) 86 { 83 { 87 if (fRadioactivity.end() == fRadioactivity.f 84 if (fRadioactivity.end() == fRadioactivity.find(G4ThreeVector(Z,A,E))) { 88 G4cout << G4ThreeVector(Z,A,E) << " is not 85 G4cout << G4ThreeVector(Z,A,E) << " is not in the map" << G4endl; 89 G4TwoVector rate = G4TwoVector(0.,0.); << 86 G4double rate = 0.; 90 return rate ; 87 return rate ; 91 } 88 } 92 else 89 else 93 return fRadioactivity[G4ThreeVector(Z,A,E) 90 return fRadioactivity[G4ThreeVector(Z,A,E)]; 94 } 91 } 95 ////////////////////////////////////////////// 92 /////////////////////////////////////////////////////////////////////////////// 96 // 93 // 97 map<G4ThreeVector,G4TwoVector>* G4Radioactivi << 94 map<G4ThreeVector,G4double>* G4RadioactivityTable::GetTheMap() 98 { 95 { 99 return &fRadioactivity; 96 return &fRadioactivity; 100 } 97 } 101 ////////////////////////////////////////////// 98 /////////////////////////////////////////////////////////////////////////////// 102 // 99 // 103 100 104 101 105 102 106 103 107 104 108 105 109 106 110 107 111 108 112 109 113 110 114 111 115 112 116 113 117 114