CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Friends
DDMaterial Class Reference

DDMaterial is used to define and access material information. More...

#include <DDMaterial.h>

Inheritance diagram for DDMaterial:
DDBase< DDName, std::unique_ptr< DDI::Material > >

Public Types

using FractionV = std::vector< std::pair< DDMaterial, double > >
 
- Public Types inherited from DDBase< DDName, std::unique_ptr< DDI::Material > >
using def_type = std::pair< const DDName *, bool >
 
using StoreT = DDI::Singleton< DDI::Store< DDName, std::unique_ptr< DDI::Material > > >
 

Public Member Functions

double a () const
 returns the atomic mass More...
 
int addMaterial (const DDMaterial &m, double fm)
 adds a material to the mixture proportional to its fraction-mass fm. More...
 
FractionV::value_type constituent (int i) const
 returns the i-th compound material and its fraction-mass More...
 
 DDMaterial ()
 Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference objects) More...
 
 DDMaterial (const DDName &name)
 Creates a initialized reference-object or a reference to an allready defined material. More...
 
 DDMaterial (const DDName &name, double density)
 Constructor for mixtures. More...
 
 DDMaterial (const DDName &name, double z, double a, double d)
 Constructor for construction of an elementary material. More...
 
double density () const
 returns the density More...
 
int noOfConstituents () const
 returns the number of compound materials or 0 for elementary materials More...
 
double z () const
 retruns the atomic number More...
 
- Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDI::Material > >
void create (const DDName &name)
 
void create (const DDName &name, std::unique_ptr< DDI::Material > vals)
 
 DDBase ()
 
const DDNameddname () const
 
def_type isDefined () const
 
bool isValid () const
 true, if the wrapped pointer is valid More...
 
const DDNamename () const
 
 operator bool () const
 
bool operator< (const DDBase &b) const
 
bool operator== (const DDBase &b) const
 
bool operator> (const DDBase &b) const
 
DDI::rep_traits< DDName, std::unique_ptr< DDI::Material > >::reference rep ()
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Material > >::reference rep () const
 
std::string toString () const
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Material > >::reference val ()
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Material > >::reference val () const
 
virtual ~DDBase ()
 

Friends

std::ostream & operator<< (std::ostream &, const DDMaterial &)
 

Additional Inherited Members

- Static Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDI::Material > >
static auto begin ()
 
static auto end ()
 

Detailed Description

DDMaterial is used to define and access material information.

An object of this class is a reference-object and thus leightweighted. It is uniquely identified by its DDName. Further details concerning reference-objects can be found in the documentation of DDLogicalPart.

A DDMaterial can recursively consist of compound materials (which are DDMaterials as well). Materials consisting of compound materials are called mixtures. Mixtures are defined by their Materials which do not consist of compound materials are called elementary materials.

To define an elementray material, use it like this:

DDMaterial hydrogen("Hydrogen",
double z=1,
double a=1.1*g/mole,
density=2*g/cm3);

To define a mixture:

DDMaterial mixt("Mix", double density = 5*g/cm3);
mixt.addMaterial(hydrogen,0.3);
// code for additional compounds belonging to the mixture ...

Note the usage DDUnits replacing CLHEP/SystemOfUnits to specify the units of the quantities making up a material.

Definition at line 45 of file DDMaterial.h.

Member Typedef Documentation

◆ FractionV

using DDMaterial::FractionV = std::vector<std::pair<DDMaterial, double> >

Definition at line 49 of file DDMaterial.h.

Constructor & Destructor Documentation

◆ DDMaterial() [1/4]

DDMaterial::DDMaterial ( )

Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference objects)

Definition at line 15 of file DDMaterial.cc.

◆ DDMaterial() [2/4]

DDMaterial::DDMaterial ( const DDName name)

Creates a initialized reference-object or a reference to an allready defined material.

If a DDMaterial with name was already defined, this constructor creates a reference object to the defined material. Otherwise it creates a (default) initialized reference-object to a material with DDName name.

For further details concerning the usage of reference-objects refere to the documentation of DDLogicalPart.

Definition at line 25 of file DDMaterial.cc.

References DDBase< DDName, std::unique_ptr< DDI::Material > >::create(), and DDBase< DDName, std::unique_ptr< DDI::Material > >::name().

◆ DDMaterial() [3/4]

DDMaterial::DDMaterial ( const DDName name,
double  z,
double  a,
double  d 
)

Constructor for construction of an elementary material.

  • z atomic number
  • a atomic mass
  • density density

Example:

DDMaterial hydrogen("Hydrogen",
double z=1,
double a=1.1*g/mole,
density=2*g/cm3);

Definition at line 40 of file DDMaterial.cc.

41  create(name, std::make_unique<Material>(z, a, d));
42 }

References a(), DDBase< DDName, std::unique_ptr< DDI::Material > >::create(), ztail::d, DDBase< DDName, std::unique_ptr< DDI::Material > >::name(), and z().

◆ DDMaterial() [4/4]

DDMaterial::DDMaterial ( const DDName name,
double  density 
)

Constructor for mixtures.

For a mixture material it is sufficient to specify the density of the mixture (in addition to the name). The compounds are added by using the addMaterial(..) method.

The result of this constructor is a reference-object. One can use the mixture material immidiately (without specifying the compund materials). Compound materials can be added at any later stage.

For further details concerning the usage of reference-objects refere to the documentation of DDLogicalPart.

Definition at line 56 of file DDMaterial.cc.

57  create(name, std::make_unique<Material>(0, 0, density));
58 }

References DDBase< DDName, std::unique_ptr< DDI::Material > >::create(), density(), and DDBase< DDName, std::unique_ptr< DDI::Material > >::name().

Member Function Documentation

◆ a()

double DDMaterial::a ( ) const

◆ addMaterial()

int DDMaterial::addMaterial ( const DDMaterial m,
double  fm 
)

adds a material to the mixture proportional to its fraction-mass fm.

The fraction-masses of all compounds must sum up to 1

Definition at line 63 of file DDMaterial.cc.

63  {
64  if (m.ddname() == ddname()) {
65  throw cms::Exception("DDException") << "DDMaterial::addMaterial(..): name-clash\n trying to add material "
66  << m << " to itself! ";
67  }
68  rep().addMaterial(m, fm);
69  return rep().noOfConstituents();
70 }

References DDBase< DDName, std::unique_ptr< DDI::Material > >::ddname(), Exception, visualization-live-secondInstance_cfg::m, and DDBase< DDName, std::unique_ptr< DDI::Material > >::rep().

Referenced by DDLCompositeMaterial::processElement(), and regressionTest_setup().

◆ constituent()

DDMaterial::FractionV::value_type DDMaterial::constituent ( int  i) const

◆ density()

double DDMaterial::density ( ) const

◆ noOfConstituents()

int DDMaterial::noOfConstituents ( ) const

◆ z()

double DDMaterial::z ( ) const

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const DDMaterial mat 
)
friend

Definition at line 101 of file DDMaterial.cc.

101 { return doStream(os, mat, 0); }
mps_fire.i
i
Definition: mps_fire.py:355
DDMaterial::density
double density() const
returns the density
Definition: DDMaterial.cc:80
DDMaterial::z
double z() const
retruns the atomic number
Definition: DDMaterial.cc:78
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
DDBase< DDName, std::unique_ptr< DDI::Material > >::name
const DDName & name() const
Definition: DDBase.h:59
DDMaterial::a
double a() const
returns the atomic mass
Definition: DDMaterial.cc:76
DDBase< DDName, std::unique_ptr< DDI::Material > >::rep
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Material > >::reference rep() const
Definition: DDBase.h:65
DDBase< DDName, std::unique_ptr< DDI::Material > >::ddname
const DDName & ddname() const
Definition: DDBase.h:61
DDBase< DDName, std::unique_ptr< DDI::Material > >::create
void create(const DDName &name, std::unique_ptr< DDI::Material > vals)
Definition: DDBase.h:96
Exception
Definition: hltDiff.cc:246
ztail.d
d
Definition: ztail.py:151
DDBase
Definition: DDBase.h:10
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4