[1199] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | |
---|
| 28 | #include <iostream> |
---|
| 29 | #include <iomanip> |
---|
| 30 | #include "globals.hh" |
---|
| 31 | |
---|
| 32 | #include "G4Evaporation.hh" |
---|
| 33 | #include "G4NucleiProperties.hh" |
---|
| 34 | #include "G4Gamma.hh" |
---|
| 35 | #include "G4Neutron.hh" |
---|
| 36 | #include "G4Proton.hh" |
---|
| 37 | #include "G4He3.hh" |
---|
| 38 | #include "G4Alpha.hh" |
---|
| 39 | #include "G4Deuteron.hh" |
---|
| 40 | #include "G4Triton.hh" |
---|
| 41 | #include "G4Electron.hh" |
---|
| 42 | #include "G4Fragment.hh" |
---|
| 43 | #include "G4ParticleTable.hh" |
---|
| 44 | #include "G4IonTable.hh" |
---|
| 45 | #include "G4ThreeVector.hh" |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | int main() |
---|
| 49 | { |
---|
| 50 | G4ParticleDefinition *theGamma = G4Gamma::GammaDefinition(); |
---|
| 51 | G4ParticleDefinition *theElectron = G4Electron::ElectronDefinition(); |
---|
| 52 | G4ParticleDefinition *theNeutron = G4Neutron::NeutronDefinition(); |
---|
| 53 | G4ParticleDefinition *theProton = G4Proton::ProtonDefinition(); |
---|
| 54 | G4ParticleDefinition *theDeuteron = G4Deuteron::DeuteronDefinition(); |
---|
| 55 | G4ParticleDefinition *theTriton = G4Triton::TritonDefinition(); |
---|
| 56 | G4ParticleDefinition *theHelium3 = G4He3::He3Definition(); |
---|
| 57 | G4ParticleDefinition *theAlpha = G4Alpha::AlphaDefinition(); |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | theProton->SetCuts(1.0); |
---|
| 61 | theGamma->SetCuts(1.0); |
---|
| 62 | theElectron->SetCuts(1.0); |
---|
| 63 | theNeutron->SetCuts(1.0); |
---|
| 64 | theDeuteron->SetCuts(1.0); |
---|
| 65 | theTriton->SetCuts(1.0); |
---|
| 66 | theHelium3->SetCuts(1.0); |
---|
| 67 | theAlpha->SetCuts(1.0); |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | cout << G4endl << "Evaporation Test program" << G4endl; |
---|
| 71 | |
---|
| 72 | G4Evaporation * theEvaporation = new G4Evaporation; |
---|
| 73 | |
---|
| 74 | G4int mode = -1; |
---|
| 75 | while (mode != 0 && mode != 1) { |
---|
| 76 | cout << "Mode (0 or 1): "; |
---|
| 77 | G4cin >> mode; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | cout << G4endl << G4endl << G4endl; |
---|
| 81 | |
---|
| 82 | if (mode == 0) { |
---|
| 83 | |
---|
| 84 | cout << "A = "; |
---|
| 85 | G4int MyA; |
---|
| 86 | G4cin >> MyA; |
---|
| 87 | cout << "Z = "; |
---|
| 88 | G4int MyZ; |
---|
| 89 | G4cin >> MyZ; |
---|
| 90 | cout << "ExcitationEnergy (MeV) = "; |
---|
| 91 | G4double MyExE; |
---|
| 92 | G4cin >> MyExE; |
---|
| 93 | // MyExE *= MyA; |
---|
| 94 | G4double AtomicMass = G4NucleiProperties::GetAtomicMass(MyA,MyZ)/MeV + MyExE; |
---|
| 95 | cout << "Momentum (MeV): " << G4endl; |
---|
| 96 | cout << " Px = "; |
---|
| 97 | G4double MyPx; |
---|
| 98 | G4cin >> MyPx; |
---|
| 99 | cout << " Py = "; |
---|
| 100 | G4double MyPy; |
---|
| 101 | G4cin >> MyPy; |
---|
| 102 | cout << " Pz = "; |
---|
| 103 | G4double MyPz; |
---|
| 104 | G4cin >> MyPz; |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | G4ThreeVector triV(MyPx*MeV,MyPy*MeV,MyPz*MeV); |
---|
| 108 | // G4LorentzVector initialMomentum(triV,sqrt(triV.mag2()+AtomicMass*AtomicMass)); |
---|
| 109 | G4LorentzVector initialMomentum(triV,std::sqrt(triV.mag2()+AtomicMass*AtomicMass*MeV*MeV)); |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | // put info about excited nucleus in fragment class |
---|
| 113 | G4Fragment theExcitedNucleus(MyA,MyZ,initialMomentum); |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | G4int events = 1; |
---|
| 117 | cout << "Iterations: "; |
---|
| 118 | G4cin >> events; |
---|
| 119 | |
---|
| 120 | G4double NofP = 0.0; |
---|
| 121 | G4double NofN = 0.0; |
---|
| 122 | |
---|
| 123 | for (G4int i = 0; i < events; i++) { |
---|
| 124 | |
---|
| 125 | cout << "Iteration: " << i+1 << G4endl; |
---|
| 126 | cout << "----------------" << G4endl; |
---|
| 127 | cout << " Initial fragment" << G4endl; |
---|
| 128 | cout << theExcitedNucleus << G4endl << G4endl; |
---|
| 129 | |
---|
| 130 | cout << " Fragments evaporated" << G4endl << G4endl; |
---|
| 131 | // DeExcite the nucleus |
---|
| 132 | G4FragmentVector * theFragVector = theEvaporation->BreakItUp(theExcitedNucleus); |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | G4LorentzVector TestMomentum(initialMomentum); |
---|
| 136 | for (G4int j=0; j < theFragVector->entries(); j++) { |
---|
| 137 | cout << theFragVector->at(j) << G4endl; |
---|
| 138 | |
---|
| 139 | // Test 4-momentum conservation |
---|
| 140 | TestMomentum -= theFragVector->at(j)->GetMomentum(); |
---|
| 141 | |
---|
| 142 | // Calculating multiplicities |
---|
| 143 | if (theFragVector->at(j)->GetA() == 1 && theFragVector->at(j)->GetZ() == 1) NofP++; |
---|
| 144 | else if (theFragVector->at(j)->GetA() == 1 && theFragVector->at(j)->GetZ() == 0) NofN++; |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | cout << "******************" << G4endl; |
---|
| 148 | cout << "* Test Momentum = " << TestMomentum << G4endl; |
---|
| 149 | cout << "******************" << G4endl; |
---|
| 150 | |
---|
| 151 | theFragVector->clearAndDestroy(); |
---|
| 152 | delete theFragVector; |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | G4cout << "Multiplicities: Neutrons -> " << NofN/events << " Protons -> " << NofP/events << G4endl; |
---|
| 156 | } else if (mode == 1) { |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | G4int events = 0; |
---|
| 160 | cout << "Number of events: "; |
---|
| 161 | G4cin >> events; |
---|
| 162 | |
---|
| 163 | for (G4int i = 0; i < events; i++) { |
---|
| 164 | |
---|
| 165 | cout << "Event number: " << i+1 << G4endl; |
---|
| 166 | cout << "--------------------" << G4endl; |
---|
| 167 | |
---|
| 168 | G4int MyA = RandFlat::shoot(17,200); |
---|
| 169 | |
---|
| 170 | G4int MyZ = RandFlat::shoot(G4NucleiPropertiesTable::MinZ(MyA), |
---|
| 171 | G4NucleiPropertiesTable::MaxZ(MyA)); |
---|
| 172 | |
---|
| 173 | G4double AtomicMass = G4NucleiProperties::GetAtomicMass(MyA,MyZ)/MeV; |
---|
| 174 | |
---|
| 175 | G4double MyExE = RandFlat::shoot(2.0*MyA,10.0*MyA); |
---|
| 176 | G4double MyPx = RandFlat::shoot(-2000,2000); |
---|
| 177 | G4double MyPy = RandFlat::shoot(-2000,2000); |
---|
| 178 | G4double MyPz = RandFlat::shoot(-2000,2000); |
---|
| 179 | |
---|
| 180 | G4ThreeVector triV(MyPx*MeV,MyPy*MeV,MyPz*MeV); |
---|
| 181 | G4LorentzVector initialMomentum(triV,std::sqrt(triV.mag2()+ |
---|
| 182 | (AtomicMass*MeV+MyExE*MeV)* |
---|
| 183 | (AtomicMass*MeV+MyExE*MeV)) |
---|
| 184 | ); |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | // put info about excited nucleus in fragment class |
---|
| 188 | G4Fragment theExcitedNucleus(MyA,MyZ,initialMomentum); |
---|
| 189 | |
---|
| 190 | cout << "Excited fragment: "<< G4endl; |
---|
| 191 | cout << theExcitedNucleus << G4endl; |
---|
| 192 | |
---|
| 193 | G4FragmentVector * theFragVector = theEvaporation->BreakItUp(theExcitedNucleus); |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | G4LorentzVector TestMomentum(initialMomentum); |
---|
| 197 | for (G4int j=0; j < theFragVector->entries(); j++) { |
---|
| 198 | // cout << theFragVector->at(j) << G4endl; |
---|
| 199 | |
---|
| 200 | // Test 4-momentum conservation |
---|
| 201 | TestMomentum -= theFragVector->at(j)->GetMomentum(); |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | cout << "******************" << G4endl; |
---|
| 205 | cout << "* Test Momentum = " << TestMomentum << G4endl; |
---|
| 206 | cout << "******************" << G4endl; |
---|
| 207 | |
---|
| 208 | |
---|
| 209 | |
---|
| 210 | theFragVector->clearAndDestroy(); |
---|
| 211 | delete theFragVector; |
---|
| 212 | |
---|
| 213 | } |
---|
| 214 | |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | delete theEvaporation; |
---|
| 218 | |
---|
| 219 | |
---|
| 220 | return 0; |
---|
| 221 | |
---|
| 222 | } |
---|
| 223 | |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | |
---|