source: trunk/source/global/management/test/testPhysicsOrderedFreeVector.cc@ 1315

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

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 4.7 KB
RevLine 
[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: testPhysicsOrderedFreeVector.cc,v 1.6 2006/06/29 19:05:05 gunter Exp $
[1315]28// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
[1199]29//
30#include "globals.hh"
31#include "G4PhysicsOrderedFreeVector.hh"
32
33void LoopUntilPressEnter();
34
35int main ()
36{
37 const G4int NUMENTRIES = 32;
38 G4double anEnergy, aValue;
39
40 G4double PPCKOV[NUMENTRIES] =
41 { 2.038E-9, 2.072E-9, 2.107E-9, 2.143E-9, 2.181E-9,
42 2.220E-9, 2.260E-9, 2.302E-9, 2.346E-9, 2.391E-9,
43 2.438E-9, 2.486E-9, 2.537E-9, 2.590E-9, 2.645E-9,
44 2.702E-9, 2.763E-9, 2.825E-9, 2.891E-9, 2.960E-9,
45 3.032E-9, 3.108E-9, 3.188E-9, 3.271E-9, 3.360E-9,
46 3.453E-9, 3.552E-9, 3.656E-9, 3.767E-9, 3.884E-9,
47 4.010E-9, 4.144E-9 };
48
49 G4double RINDEX[NUMENTRIES] =
50 { 1.33, 1.33, 1.33, 1.33, 1.33, 1.33, 1.33,
51 1.33, 1.33, 1.34, 1.34, 1.34, 1.34, 1.34,
52 1.34, 1.34, 1.34, 1.34, 1.34, 1.34, 1.34,
53 1.34, 1.34, 1.35, 1.35, 1.35, 1.35, 1.35,
54 1.35, 1.35, 1.35, 1.35 };
55
56 // Test Vector creation
57 // --------------------
58 G4cout << "Test Vector creation" << G4endl;
59 G4cout << "--------------------" << G4endl << G4endl;
60
61 G4PhysicsOrderedFreeVector aVector(PPCKOV, RINDEX, NUMENTRIES);
62 aVector.DumpValues();
63 LoopUntilPressEnter();
64
65 // Test GetEnergy
66 // --------------
67 G4cout << "Test GetEnergy" << G4endl;
68 G4cout << "--------------" << G4endl;
69 G4cout << "Input a value within the vector range for which you" << G4endl;
70 G4cout << "wish to find the corresponding energy: " << G4endl;
71 G4cin >> aValue;
72
73 anEnergy = aVector.GetEnergy(aValue);
74 G4cout << "The corresponding energy is " << anEnergy << G4endl;
75
76 // Test GetMaxValue
77 // ----------------
78 G4cout << "Test GetMaxValue" << G4endl;
79 G4cout << "----------------" << G4endl << G4endl;
80 LoopUntilPressEnter();
81
82 aValue = aVector.GetMaxValue();
83
84 G4cout << "The Max Value is: " << aValue << G4endl;
85 LoopUntilPressEnter();
86
87 // Test GetMinValue
88 // ----------------
89 G4cout << "Test GetMinValue" << G4endl;
90 G4cout << "----------------" << G4endl << G4endl;
91
92 aValue = aVector.GetMinValue();
93
94 G4cout << "The Max Value is: " << aValue << G4endl;
95 LoopUntilPressEnter();
96
97 // Test GetMaxLowEdgeEnergy
98 // ------------------------
99 G4cout << "Test GetMaxLowEdgeEnergy" << G4endl;
100 G4cout << "------------------------" << G4endl << G4endl;
101
102 anEnergy = aVector.GetMaxLowEdgeEnergy();
103
104 G4cout << "The Max Value is: " << anEnergy << G4endl;
105 LoopUntilPressEnter();
106
107 // Test GetMinLowEdgeEnergy
108 // ------------------------
109 G4cout << "Test GetMinLowEdgeEnergy" << G4endl;
110 G4cout << "------------------------" << G4endl << G4endl;
111
112 anEnergy = aVector.GetMinLowEdgeEnergy();
113
114 G4cout << "The Max Value is: " << anEnergy << G4endl;
115
116 return EXIT_SUCCESS;
117}
118
119// LoopUntilPressEnter
120// -------------------
121//
122void LoopUntilPressEnter()
123{
124 char ch;
125 G4cout << "Press <Enter> to continue ... ";
126 while ( G4cin.get(ch) )
127 {
128 if (ch == '\n') break;
129 }
130 G4cout << G4endl;
131}
Note: See TracBrowser for help on using the repository browser.