| 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: G4UnitsTest.cc,v 1.6 2006/06/29 19:04:53 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // ----------------------------------------------------------------------
|
|---|
| 32 | #include "G4ios.hh"
|
|---|
| 33 | #include "globals.hh"
|
|---|
| 34 | #include "G4UnitsTable.hh"
|
|---|
| 35 |
|
|---|
| 36 | int main()
|
|---|
| 37 | {
|
|---|
| 38 | G4cout << " *** value of units *** " << G4endl << G4endl ;
|
|---|
| 39 |
|
|---|
| 40 | G4cout << "mm = " << mm << G4endl;
|
|---|
| 41 |
|
|---|
| 42 | G4cout << "cm = " << cm << G4endl;
|
|---|
| 43 |
|
|---|
| 44 | G4cout << "fermi = " << fermi << G4endl;
|
|---|
| 45 |
|
|---|
| 46 | G4cout << "cm2 = " << cm2 << G4endl;
|
|---|
| 47 |
|
|---|
| 48 | G4cout << "barn = " << barn << G4endl;
|
|---|
| 49 |
|
|---|
| 50 | G4cout << "second = " << s << G4endl;
|
|---|
| 51 |
|
|---|
| 52 | G4cout << "joule = " << joule << G4endl;
|
|---|
| 53 |
|
|---|
| 54 | G4cout << "kg = " << kg << G4endl;
|
|---|
| 55 |
|
|---|
| 56 | G4cout << "watt = " << watt << G4endl;
|
|---|
| 57 |
|
|---|
| 58 | G4cout << "newton = " << newton << G4endl;
|
|---|
| 59 |
|
|---|
| 60 | G4cout << "pascal = " << pascal << G4endl;
|
|---|
| 61 |
|
|---|
| 62 | G4cout << "bar = " << bar << G4endl;
|
|---|
| 63 |
|
|---|
| 64 | G4cout << "coulomb= " << coulomb << G4endl;
|
|---|
| 65 |
|
|---|
| 66 | G4cout << "ampere = " << ampere << G4endl;
|
|---|
| 67 |
|
|---|
| 68 | G4cout << "volt = " << volt << G4endl;
|
|---|
| 69 |
|
|---|
| 70 | G4cout << "ohm = " << ohm << G4endl;
|
|---|
| 71 |
|
|---|
| 72 | G4cout << "farad = " << farad << G4endl;
|
|---|
| 73 |
|
|---|
| 74 | G4cout << "weber = " << weber << G4endl;
|
|---|
| 75 |
|
|---|
| 76 | G4cout << "tesla = " << tesla << G4endl;
|
|---|
| 77 |
|
|---|
| 78 | G4cout << "gauss = " << gauss << G4endl;
|
|---|
| 79 |
|
|---|
| 80 | G4cout << "henry = " << henry << G4endl;
|
|---|
| 81 |
|
|---|
| 82 | G4cout << "kelvin = " << kelvin << G4endl;
|
|---|
| 83 |
|
|---|
| 84 | G4cout << G4endl ;
|
|---|
| 85 | //
|
|---|
| 86 | // Physical Constants
|
|---|
| 87 | //
|
|---|
| 88 | G4cout << " *** Physical Constants *** " << G4endl << G4endl ;
|
|---|
| 89 |
|
|---|
| 90 | G4cout << "Avogadro = " << Avogadro << G4endl;
|
|---|
| 91 |
|
|---|
| 92 | G4cout << "c_light = " << c_light << G4endl;
|
|---|
| 93 |
|
|---|
| 94 | G4cout << "h_Planck = " << h_Planck << G4endl;
|
|---|
| 95 |
|
|---|
| 96 | G4cout << "hbar_Planck = " << hbar_Planck << G4endl;
|
|---|
| 97 |
|
|---|
| 98 | G4cout << "hbarc = " << hbarc << G4endl;
|
|---|
| 99 |
|
|---|
| 100 | G4cout << "amu = " << amu << G4endl;
|
|---|
| 101 |
|
|---|
| 102 | G4cout << "mu0 = " << mu0 << G4endl;
|
|---|
| 103 |
|
|---|
| 104 | G4cout << "epsilon0 = " << epsilon0 << G4endl;
|
|---|
| 105 |
|
|---|
| 106 | G4cout << "elm_coupling = " << elm_coupling << G4endl;
|
|---|
| 107 |
|
|---|
| 108 | G4cout << "fine_structure_const = " << fine_structure_const << G4endl;
|
|---|
| 109 |
|
|---|
| 110 | G4cout << "classic_electr_radius = " << classic_electr_radius << G4endl;
|
|---|
| 111 |
|
|---|
| 112 | G4cout << "electron_Compton_length = " << electron_Compton_length << G4endl;
|
|---|
| 113 |
|
|---|
| 114 | G4cout << "Bohr_radius = " << Bohr_radius << G4endl;
|
|---|
| 115 |
|
|---|
| 116 | G4cout << "alpha_rcl2 = " << alpha_rcl2 << G4endl;
|
|---|
| 117 |
|
|---|
| 118 | G4cout << "twopi_mc2_rcl2 = " << twopi_mc2_rcl2 << G4endl;
|
|---|
| 119 |
|
|---|
| 120 | G4cout << "k_Boltzmann = " << k_Boltzmann << G4endl;
|
|---|
| 121 |
|
|---|
| 122 | //
|
|---|
| 123 | // test the UnitsTable class
|
|---|
| 124 | //
|
|---|
| 125 | new G4UnitDefinition( "meter","m" ,"Length",m);
|
|---|
| 126 | new G4UnitDefinition("centimeter","cm","Length",cm);
|
|---|
| 127 | new G4UnitDefinition("millimeter","mm","Length",mm);
|
|---|
| 128 | new G4UnitDefinition("millimeter3","mm3","Volume",mm3);
|
|---|
| 129 | new G4UnitDefinition( "electronvolt","eV" ,"Energy",eV);
|
|---|
| 130 | new G4UnitDefinition("kiloelectronvolt","keV","Energy",keV);
|
|---|
| 131 | new G4UnitDefinition("megaelectronvolt","MeV","Energy",MeV);
|
|---|
| 132 | new G4UnitDefinition("gigaelectronvolt","GeV","Energy",GeV);
|
|---|
| 133 | new G4UnitDefinition("joule" ,"J" ,"Energy",joule);
|
|---|
| 134 |
|
|---|
| 135 | G4UnitDefinition::PrintUnitsTable();
|
|---|
| 136 |
|
|---|
| 137 | G4cout << " meter = " << G4UnitDefinition::GetValueOf("meter") << G4endl;
|
|---|
| 138 | G4cout << " cm = " << G4UnitDefinition::GetValueOf("cm") << G4endl;
|
|---|
| 139 | G4cout << " joule = " << G4UnitDefinition::GetValueOf("J") << G4endl;
|
|---|
| 140 |
|
|---|
| 141 | G4double a = 0.5*GeV, b = 0.15*MeV, c = 4000*MeV;
|
|---|
| 142 |
|
|---|
| 143 | G4cout << " a = " << G4BestUnit (a,"Energy")
|
|---|
| 144 | << " b = " << G4BestUnit (b,"Energy")
|
|---|
| 145 | << " c = " << G4BestUnit (c,"Energy") << G4endl;
|
|---|
| 146 |
|
|---|
| 147 | return 0;
|
|---|
| 148 | }
|
|---|