| 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: G4DopplerProfileTest.cc,v 1.2 2008/03/17 13:46:20 pia Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $
|
|---|
| 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: 8 March 2008
|
|---|
| 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 | #include "G4DopplerProfile.hh"
|
|---|
| 53 | #include "G4VEMDataSet.hh"
|
|---|
| 54 |
|
|---|
| 55 | int main()
|
|---|
| 56 | {
|
|---|
| 57 | // G4cout.setf( ios::scientific, ios::floatfield );
|
|---|
| 58 |
|
|---|
| 59 | // EADL data
|
|---|
| 60 | // G4String file = "/fluor/binding";
|
|---|
| 61 | // G4ShellData* dataSet = new G4ShellData();
|
|---|
| 62 |
|
|---|
| 63 | // Doppler binding data
|
|---|
| 64 | G4String file = "/doppler/shell-doppler";
|
|---|
| 65 | G4DopplerProfile* dataSet = new G4DopplerProfile(1,100);
|
|---|
| 66 |
|
|---|
| 67 | // dataSet->LoadData(file);
|
|---|
| 68 | dataSet->PrintData();
|
|---|
| 69 |
|
|---|
| 70 | // Dump all Doppler profiles
|
|---|
| 71 | for (G4int zDoppler=1; zDoppler<101; zDoppler++)
|
|---|
| 72 | {
|
|---|
| 73 | // const G4VEMDataSet* profiles = dataSet->Profiles(zDoppler);
|
|---|
| 74 | // profiles->PrintData();
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | G4cout << "Enter Z" << G4endl;
|
|---|
| 78 | G4int Z;
|
|---|
| 79 | G4cin >> Z;
|
|---|
| 80 |
|
|---|
| 81 | G4int n = dataSet->NumberOfProfiles(Z);
|
|---|
| 82 | G4cout << "Z = " << Z << " has " << n << " shells" << G4endl;
|
|---|
| 83 | const G4VEMDataSet* profiles = dataSet->Profiles(Z);
|
|---|
| 84 | profiles->PrintData();
|
|---|
| 85 |
|
|---|
| 86 | G4cout << "Enter shell index " << G4endl;
|
|---|
| 87 | G4int i;
|
|---|
| 88 | G4cin >> i;
|
|---|
| 89 |
|
|---|
| 90 | const G4VEMDataSet* profile = dataSet->Profile(Z,i);
|
|---|
| 91 | profile->PrintData();
|
|---|
| 92 |
|
|---|
| 93 | // Test random selection on single and composite profile
|
|---|
| 94 | G4double rando = profile->RandomSelect();
|
|---|
| 95 | rando = profiles->RandomSelect(i);
|
|---|
| 96 |
|
|---|
| 97 | rando = dataSet->RandomSelectMomentum(Z,i);
|
|---|
| 98 |
|
|---|
| 99 | /*
|
|---|
| 100 | G4int id = dataSet->ShellId(Z,i);
|
|---|
| 101 | G4double e = dataSet->BindingEnergy(Z,i) / keV;
|
|---|
| 102 |
|
|---|
| 103 | G4cout << "Shell id = " << id
|
|---|
| 104 | << ", Binding energy = " << e << " keV" <<G4endl;
|
|---|
| 105 |
|
|---|
| 106 | std::vector<G4double> idVector = dataSet->ShellIdVector(Z);
|
|---|
| 107 | for (G4int ind=0; ind<n; ind++)
|
|---|
| 108 | {
|
|---|
| 109 | G4int idx = (G4int) idVector[ind];
|
|---|
| 110 | G4cout << "Id vector(" << ind << ") = " << idx << G4endl;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | // Select random shell
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 | for (G4int iter=0; iter<100; iter++)
|
|---|
| 117 | {
|
|---|
| 118 | G4int shellIndex = dataSet->RandomSelectShell(Z);
|
|---|
| 119 | G4cout << "Random selected shell: " << shellIndex << G4endl;
|
|---|
| 120 | // G4cout << "random = " << random
|
|---|
| 121 | // << ", i = " << shellIndex
|
|---|
| 122 | // << ", prob = " << prob[shellIndex] << G4endl;
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | G4cout << "Dump data (1) or stop (2)" << G4endl;
|
|---|
| 126 | G4int k;
|
|---|
| 127 | G4cin >> k;
|
|---|
| 128 |
|
|---|
| 129 | if (k == 1) dataSet->PrintData();
|
|---|
| 130 | */
|
|---|
| 131 |
|
|---|
| 132 | delete dataSet;
|
|---|
| 133 |
|
|---|
| 134 | G4cout << "END OF THE MAIN PROGRAM" << G4endl;
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|