source: trunk/source/processes/electromagnetic/lowenergy/test/PIXEtest.cc @ 1350

Last change on this file since 1350 was 1350, checked in by garnier, 13 years ago

update to last version 4.9.4

File size: 5.3 KB
Line 
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:    Alfonso Mantero  (alfonso.mantero@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.6 2010/11/22 18:32:00 mantero Exp $
46// GEANT4 tag $Name: geant4-09-04-ref-00 $
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 "G4teoCrossSection.hh"
56#include "G4empCrossSection.hh"
57#include "G4AtomicTransitionManager.hh"
58#include "G4Proton.hh"
59#include "G4Alpha.hh"
60//#include "AIDA/AIDA.h"
61
62int main()
63{ 
64   G4int Z; 
65   G4double incidentEnergy;
66   G4double mass;
67   G4double deltaEnergy;
68   size_t shellNumber;
69   G4String fileName;
70   G4String partType;
71   G4String shellName;
72   G4String model;
73   G4String nameId;
74   G4VhShellCrossSection* shellCS;
75   G4ParticleDefinition* particle;
76
77   //    G4VhShellCrossSection* shellExp = new G4hShellCrossSectionDoubleExp();
78   //  here you deiude the implementation: G4teoCrossSection is ECPSSR theory:
79   //  you can choose the "analytical" implementetation of the theory or the "interpolated"
80   //  implementation from ISICS tables.
81   //  G4hShellCrossSectionDoubleExp is previous work with ownmade fitting functions to Pauli for Alpha.
82
83   G4cout << "Enter model (analytical/interpolated): " << G4endl;
84   G4cin >> model;
85
86   if (model == "analytical" || model == "interpolated") {
87
88     shellCS = new G4teoCrossSection(model);
89   }
90   else if (model == "empirical") {
91     shellCS = new G4empCrossSection();
92   }
93
94   G4cout << "Enter particle (p/a): " << G4endl;
95   G4cin >> partType;
96 
97   if (partType == "p") {
98   //  G4Proton* aProtone = G4Proton::Proton();
99     particle = G4Proton::Proton();
100   
101   }
102   else if (partType == "a") {
103     particle  = G4Alpha::Alpha();
104   }
105
106   mass = particle->GetPDGMass();
107
108   std::vector<G4double> energies;
109
110   
111  for (G4double i=-2; i<123; i=i+1)
112     {
113       energies.push_back(std::pow(10,(0.05*i+1)) *keV);
114     } 
115 
116
117   G4cout << "Enter shell number: " << G4endl;
118   G4cin >> shellNumber;
119
120   if (shellNumber == 0) {shellName = "K";}
121   else if (shellNumber == 1) {shellName = "L1";}
122   else if (shellNumber == 2) {shellName = "L2";}
123   else if (shellNumber == 3) {shellName = "L3";}
124
125   if (model  == "analytical" ) { nameId = "A";}
126   else if (model  == "interpolated" ) { nameId = "I";}
127
128   G4String fileNameTxt = fileName;
129   char buffer[3];
130   std::ofstream myfile;
131
132   //Z is the atomic number
133   for (Z = 6; Z<=92; Z++)
134     { 
135       G4cout << "Z = " << Z << G4endl;
136       snprintf(buffer, 3, "%d", Z);
137
138       
139       fileNameTxt = nameId + "-" + shellName + "-" + partType + "-" + buffer + ".dat";
140       
141       myfile.open (fileNameTxt);
142       
143       
144       //Cross section for each incident energy
145       for (size_t k=0; k<energies.size();k++)
146         {
147           incidentEnergy = energies[k]*MeV;
148           deltaEnergy = 0.0;
149                   
150           std::vector<G4double> CS = shellCS->GetCrossSection(Z,incidentEnergy,mass,deltaEnergy,false);
151           
152           
153           myfile << incidentEnergy << "\t\t" << CS[shellNumber]/barn << G4endl; 
154           
155           
156         }
157       
158       myfile.close();
159       fileNameTxt = fileName;     
160       
161     } 
162   delete shellCS;
163   
164   G4cout<<"END OF THE MAIN PROGRAM"<<G4endl;
165}
Note: See TracBrowser for help on using the repository browser.