[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 | // GEANT4 Test file |
---|
| 29 | // |
---|
| 30 | // File name: PIXEtest |
---|
| 31 | // |
---|
| 32 | // Author: Simona Saliceti (simona.saliceti@ge.infn.it) |
---|
| 33 | // |
---|
| 34 | // History: |
---|
| 35 | // -------- |
---|
| 36 | // |
---|
| 37 | // 22 Apr 2009 ALF 1st implementation based on work of Simona Saliceti |
---|
| 38 | // 24 Apr 2009 ALF revision |
---|
| 39 | // -------------------------------------------------------------------- |
---|
| 40 | // |
---|
| 41 | // Test Description: |
---|
| 42 | // ------------------ |
---|
| 43 | // Test of second implementation of the Empiric Model for shell cross sections in proton ionisation |
---|
| 44 | // -------------------------------------------------------------------- |
---|
| 45 | // $Id: PIXEtest.cc,v 1.2 2009/06/18 16:18:42 mantero Exp $ |
---|
| 46 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
| 47 | |
---|
| 48 | #include "globals.hh" |
---|
| 49 | #include "G4ios.hh" |
---|
| 50 | #include <stdio.h> |
---|
| 51 | #include <vector> |
---|
| 52 | #include <iostream> |
---|
| 53 | #include <fstream> |
---|
| 54 | #include "G4VhShellCrossSection.hh" |
---|
| 55 | #include "G4hShellCrossSection.hh" |
---|
| 56 | #include "G4hShellCrossSectionDoubleExp.hh" |
---|
| 57 | #include "G4teoCrossSection.hh" |
---|
| 58 | #include "G4empCrossSection.hh" |
---|
| 59 | #include "G4AtomicTransitionManager.hh" |
---|
| 60 | #include "G4Proton.hh" |
---|
| 61 | //#include "AIDA/AIDA.h" |
---|
| 62 | |
---|
| 63 | int main() |
---|
| 64 | { |
---|
| 65 | G4int Z; |
---|
| 66 | G4double incidentEnergy; |
---|
| 67 | G4double mass; |
---|
| 68 | G4double deltaEnergy; |
---|
| 69 | size_t shellNumber; |
---|
| 70 | G4String fileName; |
---|
| 71 | |
---|
| 72 | // G4VhShellCrossSection* shellExp = new G4hShellCrossSectionDoubleExp(); |
---|
| 73 | // here you deciude the implementation: G4teoCrossSection is ECPSSR for K + Orlic for L shells |
---|
| 74 | // G4hShellCrossSectionDoubleExp is previous work with ownmade fitting functions to Pauli for Alpha. |
---|
| 75 | |
---|
| 76 | G4VhShellCrossSection* shellCS = new G4teoCrossSection("ecpssr"); |
---|
| 77 | //G4VhShellCrossSection* shellCS = new G4empCrossSection(); |
---|
| 78 | |
---|
| 79 | //proton mass in Kg |
---|
| 80 | //mass = 1.67262158e-27 * kg; |
---|
| 81 | G4Proton* aProtone = G4Proton::Proton(); |
---|
| 82 | mass = aProtone->GetPDGMass(); |
---|
| 83 | |
---|
| 84 | std::vector<G4double> energies; |
---|
| 85 | //Energy from 0.005 MeV to 500 MeV |
---|
| 86 | for (G4double i=-5.5; i<6.5; i=i+0.125) |
---|
| 87 | { |
---|
| 88 | energies.push_back(std::exp(i)*MeV); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | G4cout << "Enter shell number: " << G4endl; |
---|
| 92 | G4cin >> shellNumber; |
---|
| 93 | |
---|
| 94 | G4cout << "Enter filename: " << G4endl; |
---|
| 95 | G4cin >> fileName; |
---|
| 96 | |
---|
| 97 | if (fileName == "" ) {fileName = "PIXECrossSection";} |
---|
| 98 | |
---|
| 99 | G4String fileNameTxt = fileName; |
---|
| 100 | char buffer[3]; |
---|
| 101 | std::ofstream myfile; |
---|
| 102 | |
---|
| 103 | //Z is the atomic number |
---|
| 104 | for (Z = 6; Z<=92; Z++) |
---|
| 105 | { |
---|
| 106 | G4cout << "Z = " << Z << G4endl; |
---|
| 107 | snprintf(buffer, 3, "%d", Z); |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | fileNameTxt = fileName + buffer + ".dat"; |
---|
| 111 | |
---|
| 112 | myfile.open (fileNameTxt); |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | //Cross section for each incident energy |
---|
| 116 | for (size_t k=0; k<energies.size();k++) |
---|
| 117 | { |
---|
| 118 | incidentEnergy = energies[k]*MeV; |
---|
| 119 | deltaEnergy = 0.0; |
---|
| 120 | |
---|
| 121 | std::vector<G4double> CS = shellCS->GetCrossSection(Z,incidentEnergy,mass,deltaEnergy,false); |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | myfile << incidentEnergy << "\t" << CS[shellNumber] << G4endl; //barn //error in ecpssr/orlic class: correct units management! |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | myfile.close(); |
---|
| 130 | fileNameTxt = fileName; |
---|
| 131 | |
---|
| 132 | } |
---|
| 133 | delete shellCS; |
---|
| 134 | |
---|
| 135 | G4cout<<"END OF THE MAIN PROGRAM"<<G4endl; |
---|
| 136 | } |
---|