[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 | // $Id: G4ShellDataTest.cc,v 1.6 2008/03/10 19:52:06 pia Exp $ |
---|
| 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
| 29 | // |
---|
| 30 | // ------------------------------------------------------------------- |
---|
| 31 | // GEANT 4 class file --- Copyright CERN 1998 |
---|
| 32 | // CERN Geneva Switzerland |
---|
| 33 | // |
---|
| 34 | // |
---|
| 35 | // File name: G4DataSetManagerTest |
---|
| 36 | // |
---|
| 37 | // Author: Maria Grazia Pia |
---|
| 38 | // |
---|
| 39 | // Creation date: 6 August 2001 |
---|
| 40 | // |
---|
| 41 | // Modifications: |
---|
| 42 | // |
---|
| 43 | // ------------------------------------------------------------------- |
---|
| 44 | |
---|
| 45 | #include "globals.hh" |
---|
| 46 | #include "G4DataVector.hh" |
---|
| 47 | #include "G4ios.hh" |
---|
| 48 | #include <fstream> |
---|
| 49 | #include <iomanip> |
---|
| 50 | |
---|
| 51 | #include "G4ShellData.hh" |
---|
| 52 | |
---|
| 53 | int main() |
---|
| 54 | { |
---|
| 55 | // G4cout.setf( ios::scientific, ios::floatfield ); |
---|
| 56 | |
---|
| 57 | // EADL data |
---|
| 58 | // G4String file = "/fluor/binding"; |
---|
| 59 | // G4ShellData* dataSet = new G4ShellData(); |
---|
| 60 | |
---|
| 61 | // Doppler binding data |
---|
| 62 | G4String file = "/doppler/shell-doppler"; |
---|
| 63 | G4ShellData* dataSet = new G4ShellData(1,100,true); |
---|
| 64 | |
---|
| 65 | dataSet->LoadData(file); |
---|
| 66 | |
---|
| 67 | G4cout << "Enter Z" << G4endl; |
---|
| 68 | G4int Z; |
---|
| 69 | G4cin >> Z; |
---|
| 70 | |
---|
| 71 | G4int n = dataSet->NumberOfShells(Z); |
---|
| 72 | G4cout << "Z = " << Z << " has " << n << " shells" << G4endl; |
---|
| 73 | |
---|
| 74 | G4cout << "Enter shell index " << G4endl; |
---|
| 75 | G4int i; |
---|
| 76 | G4cin >> i; |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | G4int id = dataSet->ShellId(Z,i); |
---|
| 80 | G4double e = dataSet->BindingEnergy(Z,i) / keV; |
---|
| 81 | |
---|
| 82 | G4cout << "Shell id = " << id |
---|
| 83 | << ", Binding energy = " << e << " keV" <<G4endl; |
---|
| 84 | |
---|
| 85 | std::vector<G4double> idVector = dataSet->ShellIdVector(Z); |
---|
| 86 | for (G4int ind=0; ind<n; ind++) |
---|
| 87 | { |
---|
| 88 | G4int idx = (G4int) idVector[ind]; |
---|
| 89 | G4cout << "Id vector(" << ind << ") = " << idx << G4endl; |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | // Select random shell |
---|
| 93 | |
---|
| 94 | for (G4int iter=0; iter<100; iter++) |
---|
| 95 | { |
---|
| 96 | G4int shellIndex = dataSet->RandomSelectShell(Z); |
---|
| 97 | G4cout << "Random selected shell: " << shellIndex << G4endl; |
---|
| 98 | // G4cout << "random = " << random |
---|
| 99 | // << ", i = " << shellIndex |
---|
| 100 | // << ", prob = " << prob[shellIndex] << G4endl; |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | G4cout << "Dump data (1) or stop (2)" << G4endl; |
---|
| 104 | G4int k; |
---|
| 105 | G4cin >> k; |
---|
| 106 | |
---|
| 107 | if (k == 1) dataSet->PrintData(); |
---|
| 108 | |
---|
| 109 | delete dataSet; |
---|
| 110 | |
---|
| 111 | G4cout << "END OF THE MAIN PROGRAM" << G4endl; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | |
---|