VGM Version 5.3
Loading...
Searching...
No Matches
material.cxx
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The BaseVGM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
12// VGM::IMaterial output stream
13// ------------------------
14//
15// Author: Ivana Hrivnacova; IPN Orsay
16
19
20#include <string>
21
22//_____________________________________________________________________________
23std::ostream& operator<<(std::ostream& out, const VGM::IMaterial& material)
24{
25 std::string stateName;
26 switch (material.State()) {
27 case VGM::kSolid:
28 stateName = "Solid";
29 break;
30 case VGM::kLiquid:
31 stateName = "Liquid";
32 break;
33 case VGM::kGas:
34 stateName = "Gas";
35 break;
36 case VGM::kUndefined:
37 default:
38 stateName = "Undefined";
39 }
40
41 out << "Material: "
42 << "\"" << material.Name() << "\""
43 << " density " << material.Density() << " g/cm3"
44 << " radlen " << material.RadiationLength() / 10. << " cm"
45 << " intlen " << material.NuclearInterLength() / 10. << " cm"
46 << " state "
47 << "\"" << stateName << "\""
48 << " temperature " << material.Temperature() << " kelvin"
49 << " pressure " << material.Pressure() << " atm" << std::endl;
50
51 for (int i = 0; i < material.NofElements(); i++) {
52 out << " " << i << "th element: " << *material.Element(i)
53 << " Elm mass fraction: " << material.MassFraction(i) * 100. << " %";
54 if (i < material.NofElements() - 1) out << std::endl;
55 }
56
57 return out;
58}
The VGM interface to materials.
Definition IMaterial.h:44
virtual double Pressure() const =0
Return the density in atmosphere.
virtual IElement * Element(int iel) const =0
Return the i-th element constituing this material.
virtual double NuclearInterLength() const =0
Return the nuclear interaction length in mm.
virtual double Density() const =0
Return the density in g/cm3.
virtual double Temperature() const =0
Return the temperature in kelvins.
virtual std::string Name() const =0
Return the name of this element.
virtual double RadiationLength() const =0
Return the radiation length in mm.
virtual MaterialState State() const =0
Return the material state.
virtual double MassFraction(int iel) const =0
Return the mass fraction of the i-th element constituing this material.
virtual int NofElements() const =0
Return the number of elements constituing this material.
std::ostream & operator<<(std::ostream &out, const VGM::IMaterial &material)
Definition material.cxx:23
@ kGas
Gas materila.
Definition IMaterial.h:40
@ kLiquid
Liquid material.
Definition IMaterial.h:39
@ kSolid
Solid material.
Definition IMaterial.h:38
@ kUndefined
Undefined material state.
Definition IMaterial.h:37