source: trunk/source/materials/test/testAdditionOf_MPT_toMaterial.cc@ 1258

Last change on this file since 1258 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

File size: 5.8 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: testAdditionOf_MPT_toMaterial.cc,v 1.6 2006/06/29 19:13:25 gunter Exp $
28// GEANT4 tag $Name: materials-V09-02-18 $
29//
30//
31// ------------------------------------------------------------
32#include "G4MaterialPropertyVector.hh"
33#include "G4MaterialPropertiesTable.hh"
34#include "G4Material.hh"
35
36#include "G4ios.hh"
37
38//void G4RWTPtrOrderedVector<G4MPVEntry>::clearAndDestroy(void);
39//G4MPVEntry* G4RWTPtrOrderedVector<G4MPVEntry>::find(const G4MPVEntry*) const;
40//void G4RWTPtrOrderedVector<G4DecayChannel>::clearAndDestroy(void);
41
42// G4RWTPtrOrderedVector<G4MPVEntry> lof;
43// #include "G4DecayChannel.hh"
44// G4RWTPtrOrderedVector<G4DecayChannel> lof3;
45// void lof2() {
46// lof.clearAndDestroy();
47// lof3.clearAndDestroy();
48// lof.find(0);
49// }
50
51
52void LoopUntilPressEnter();
53
54int main()
55{
56 //--------- Material definition ---------
57
58 G4String name;
59 G4String symbol;
60 G4int iz, n, nel;
61 G4double z, a, density;
62
63 a = 1.01*g/mole;
64 G4Isotope* ih1 = new G4Isotope("Hydrogen",iz=1,n=1,a);
65 a= 2.01*g/mole;
66 G4Isotope* ih2 = new G4Isotope("Deuterium",iz=1,n=2,a);
67
68 G4Element* elH = new G4Element(name="Hydrogen",symbol="H",2);
69 elH->AddIsotope(ih1,.999);
70 elH->AddIsotope(ih2,.001);
71
72 a = 16.00*g/mole;
73 G4Element* elO = new G4Element(name="Oxygen",symbol="O", z=8., a);
74
75 density = 1.00*g/cm3;
76 G4Material* Water = new G4Material(name="Water", density, nel=2);
77 Water->AddElement(elH, 2);
78 Water->AddElement(elO, 1);
79
80 // Some Test Data
81
82 const G4int NUMENTRIES = 32;
83
84 G4double PPCKOV[NUMENTRIES] =
85 { 2.038E-9, 2.072E-9, 2.107E-9, 2.143E-9, 2.181E-9,
86 2.220E-9, 2.260E-9, 2.302E-9, 2.346E-9, 2.391E-9,
87 2.438E-9, 2.486E-9, 2.537E-9, 2.590E-9, 2.645E-9,
88 2.702E-9, 2.763E-9, 2.825E-9, 2.891E-9, 2.960E-9,
89 3.032E-9, 3.108E-9, 3.188E-9, 3.271E-9, 3.360E-9,
90 3.453E-9, 3.552E-9, 3.656E-9, 3.767E-9, 3.884E-9,
91 4.010E-9, 4.144E-9 };
92
93 G4double EFFIC[NUMENTRIES] =
94 { 0.005,0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07,
95 0.08, 0.09, 0.10, 0.115,0.13, 0.15, 0.16, 0.18,
96 0.195,0.22, 0.23, 0.24, 0.25, 0.255,0.26, 0.265,
97 0.26, 0.25, 0.24, 0.215,0.175,0.14, 0.085, 0.0 };
98
99
100 G4double RINDEX[NUMENTRIES] =
101 { 1.33, 1.33, 1.33, 1.33, 1.33, 1.33, 1.33,
102 1.33, 1.33, 1.34, 1.34, 1.34, 1.34, 1.34,
103 1.34, 1.34, 1.34, 1.34, 1.34, 1.34, 1.34,
104 1.34, 1.34, 1.35, 1.35, 1.35, 1.35, 1.35,
105 1.35, 1.35, 1.35, 1.35 };
106
107
108 G4double ABSCO[NUMENTRIES] =
109 { 344.8, 408.2, 632.9, 917.4, 1234.6, 1388.9,
110 1515.2, 1724.1, 1886.8, 2000.0, 2631.6, 3571.4,
111 4545.5, 4761.9, 5263.2, 5263.2, 5555.6, 5263.2,
112 5263.2, 4761.9, 4545.5, 4166.7, 3703.7, 3333.3,
113 3000.0, 2850.0, 2700.0, 2450.0, 2200.0, 1950.0,
114 1750.0, 1450.0 };
115
116 G4MaterialPropertiesTable myMPT;
117
118
119//////////////////////////////////////////////////////////////////////////////
120// Add some properties to MPT
121//////////////////////////////////////////////////////////////////////////////
122
123 myMPT.AddProperty("EFFIC", PPCKOV, EFFIC, NUMENTRIES);
124 myMPT.AddProperty("ABSCO", PPCKOV, ABSCO, NUMENTRIES);
125 myMPT.AddProperty("RINDEX", PPCKOV, RINDEX, NUMENTRIES);
126
127//////////////////////////////////////////////////////////////////////////////
128// test addition of MPT to G4Material
129//////////////////////////////////////////////////////////////////////////////
130
131 G4cout << "\n Testing Addition of MPT to Water\n\n";
132
133 // Add myMPT to Water
134
135 Water->SetMaterialPropertiesTable(&myMPT);
136
137 // Get myMPT from the Water
138
139 G4MaterialPropertiesTable *anotherMPT;
140 anotherMPT = Water->GetMaterialPropertiesTable();
141 anotherMPT->DumpTable();
142 G4cout << "\n\n\n<END OF TEST>\n\n\n";
143
144 return EXIT_SUCCESS;
145}
146
147// LoopUntilPressEnter
148// -------------------
149//
150void LoopUntilPressEnter()
151{
152 char ch;
153 G4cout << "Press <Enter> to continue ... ";
154 while ( G4cin.get(ch) )
155 {
156 if (ch == '\n') break;
157 }
158 G4cout << G4endl;
159}
160
Note: See TracBrowser for help on using the repository browser.