ATLAS Offline Software
Loading...
Searching...
No Matches
ServiceMaterial Class Reference

#include <ServiceMaterial.h>

Collaboration diagram for ServiceMaterial:

Classes

struct  Entry
 Structure holding one service material. More...

Public Types

typedef std::vector< EntryEntryContainer
typedef EntryContainer::const_iterator EntryIter

Public Member Functions

 ServiceMaterial ()
 ServiceMaterial (const std::string &name, const std::vector< Entry > &cmp)
 ServiceMaterial (const std::string &name)
const std::string & name () const
 Constructor for elementary material (no components)
const std::vector< Entry > & components () const
void addEntry (const Entry &e)
void addEntry (const std::string &nam, int num, bool lin, double w=1)
void multiply (int factor)
void dump (std::ostream &os) const

Private Attributes

std::string m_name
std::vector< Entrym_components

Detailed Description

Definition at line 12 of file ServiceMaterial.h.

Member Typedef Documentation

◆ EntryContainer

typedef std::vector< Entry> ServiceMaterial::EntryContainer

Definition at line 31 of file ServiceMaterial.h.

◆ EntryIter

typedef EntryContainer::const_iterator ServiceMaterial::EntryIter

Definition at line 32 of file ServiceMaterial.h.

Constructor & Destructor Documentation

◆ ServiceMaterial() [1/3]

ServiceMaterial::ServiceMaterial ( )
inline

Definition at line 34 of file ServiceMaterial.h.

34{}

◆ ServiceMaterial() [2/3]

ServiceMaterial::ServiceMaterial ( const std::string & name,
const std::vector< Entry > & cmp )
inline

Definition at line 36 of file ServiceMaterial.h.

36 :
37 m_name(name), m_components(cmp) {}
const std::string & name() const
Constructor for elementary material (no components)
std::vector< Entry > m_components
std::string m_name

◆ ServiceMaterial() [3/3]

ServiceMaterial::ServiceMaterial ( const std::string & name)
inline

Definition at line 39 of file ServiceMaterial.h.

39 :
40 m_name(name), m_components() { m_components.reserve(6);}

Member Function Documentation

◆ addEntry() [1/2]

void ServiceMaterial::addEntry ( const Entry & e)
inline

Definition at line 50 of file ServiceMaterial.h.

50{ m_components.push_back( e);}

◆ addEntry() [2/2]

void ServiceMaterial::addEntry ( const std::string & nam,
int num,
bool lin,
double w = 1 )
inline

Definition at line 52 of file ServiceMaterial.h.

52 {
53 m_components.push_back( Entry( nam, num, lin, w));
54 }
Structure holding one service material.

◆ components()

const std::vector< Entry > & ServiceMaterial::components ( ) const
inline

Definition at line 48 of file ServiceMaterial.h.

48{return m_components;}

◆ dump()

void ServiceMaterial::dump ( std::ostream & os) const

Definition at line 8 of file ServiceMaterial.cxx.

9{
10 os << std::endl << "Dump of ServiceMaterial " << name()
11 << " containing " << components().size() << " components" << std::endl;
12 double totalWeight = 0;
13 for (unsigned int i=0; i<components().size(); i++) {
14 ServiceMaterial::Entry comp = components().at(i);
15 os << "Comp. " << i << " name " << comp.name
16 << " number " << comp.number
17 << " weight " << comp.weight
18 << " is linear? " << comp.linear
19 << std::endl;
20 totalWeight += comp.weight * comp.number;
21 }
22 os << "Total weight: " << totalWeight << std::endl;
23}
const std::vector< Entry > & components() const

◆ multiply()

void ServiceMaterial::multiply ( int factor)
inline

Definition at line 57 of file ServiceMaterial.h.

57 {
58 for ( std::vector< Entry>::iterator i=m_components.begin(); i!=m_components.end(); ++i) {
59 i->number *= factor;
60 }
61 }

◆ name()

const std::string & ServiceMaterial::name ( ) const
inline

Constructor for elementary material (no components)

Definition at line 46 of file ServiceMaterial.h.

46{return m_name;}

Member Data Documentation

◆ m_components

std::vector< Entry> ServiceMaterial::m_components
private

Definition at line 68 of file ServiceMaterial.h.

◆ m_name

std::string ServiceMaterial::m_name
private

Definition at line 67 of file ServiceMaterial.h.


The documentation for this class was generated from the following files: