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

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

update to last version 4.9.4

File size: 4.5 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// $Id: G4EMDataSetTest.cc,v 1.4 2008/03/14 22:57:45 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: G4EMDataSetTest
36//
37// Author: Maria Grazia Pia
38//
39// Creation date: 1 August 2001
40//
41// Modifications:
42//
43// -------------------------------------------------------------------
44
45#include "globals.hh"
46#include "G4ios.hh"
47#include <fstream>
48#include <iomanip>
49#include "G4CompositeEMDataSet.hh"
50#include "G4ShellEMDataSet.hh"
51#include "G4EMDataSet.hh"
52#include "G4VEMDataSet.hh"
53#include "G4VDataSetAlgorithm.hh"
54#include "G4LogLogInterpolation.hh"
55
56int main()
57{
58 // Setup
59
60 G4cout << "G4EMDataSet test: dump LLNL data sets" << G4endl;
61
62 G4cout << "Enter Z " << G4endl;
63 G4int Z;
64 G4cin >> Z;
65
66 G4cout << "Enter file name " << G4endl;
67 G4String fileName;
68 // G4cin >> fileName;
69 fileName = "brem/br-cs-";
70
71 // G4cout.setf( ios::scientific, ios::floatfield );
72
73 G4VDataSetAlgorithm* interpolation = new G4LogLogInterpolation();
74
75 G4cout << "Interpolation created" << G4endl;
76
77 G4cout << "Atom (1) or Shell (2) or Composite (3) data set?" << G4endl;
78 G4int type;
79 G4cin >> type;
80
81 G4VEMDataSet* dataSet;
82
83 if (type == 1)
84 {
85 fileName = "brem/br-cs-";
86 // dataSet = new G4EMDataSet(Z,fileName,interpolation);
87 dataSet = new G4EMDataSet(Z,interpolation);
88 dataSet->LoadData(fileName);
89 }
90 else if (type == 2)
91 {
92 fileName = "phot/pe-ss-cs-";
93 // dataSet = new G4ShellEMDataSet(Z,fileName,interpolation);
94 dataSet = new G4ShellEMDataSet(Z,interpolation);
95 dataSet->LoadData(fileName);
96 }
97 else
98 {
99 fileName = "brem/br-cs-";
100 // dataSet = new G4CompositeEMDataSet(fileName,interpolation);
101 dataSet = new G4CompositeEMDataSet(interpolation);
102 dataSet->LoadData(fileName);
103 }
104
105 dataSet->PrintData();
106
107 G4cout << "Enter energy" << G4endl;
108 G4double e;
109 G4cin >> e;
110
111 G4double sigma = dataSet->FindValue(e) / barn;
112 G4cout << "Value = " << sigma << G4endl;
113
114 G4cout << "Enter shell index" << G4endl;
115 G4int id;
116 G4cin >> id;
117
118 const G4VEMDataSet* component = dataSet->GetComponent(id);
119 if (component != 0)
120 {
121 sigma = component->FindValue(e) / barn;
122 G4cout << "Value for id = " << id << ": " << sigma << G4endl;
123 G4DataVector data = component->GetData(id);
124 G4int sizeD = data.size();
125 G4cout << "The energy vector of the component has " << sizeD << " elements" << G4endl;
126 }
127
128 G4DataVector energies = dataSet->GetEnergies(id);
129 G4int sizeE = energies.size();
130 G4cout << "The energy vector of component " << id
131 << " has " << sizeE << " elements" << G4endl;
132
133 delete dataSet;
134
135 G4cout << "END OF THE MAIN PROGRAM" << G4endl;
136}
137
138
139
140
141
142
143
144
145
146
147
148
Note: See TracBrowser for help on using the repository browser.