CMS 3D CMS Logo

Material.h
Go to the documentation of this file.
1 #ifndef DDI_Material_h
2 #define DDI_Material_h
3 
4 #include <iostream>
5 #include <vector>
6 #include <utility>
8 
9 
10 namespace DDI {
11 
12  class Material
13  {
14  public:
16  Material(double z, double a, double d)
17  : z_(z), a_(a), density_(d) { }
18 
19  Material(double d) : z_(0), a_(0), density_(d) { }
20  virtual ~Material(){}
21  int noOfConsituents() const;
22 
23  double a() const { return a_; }
24  double z() const { return z_; }
25  double density() const { return density_; }
26 
27  double& a(){ return a_; }
28  double& z(){ return z_; }
29  double& density(){ return density_; }
30 
31  int addMaterial(const DDMaterial & m, double fm)
32  { composites_.emplace_back(std::make_pair(m,fm));
33  return noOfConstituents();
34  }
35 
37  { return composites_[i]; }
38 
40  { return composites_[i]; }
41 
42  int noOfConstituents() const { return composites_.size(); }
43 
44  protected:
45  double z_, a_, density_;
47  };
48 
49 }
50 #endif
int noOfConsituents() const
DDMaterial::FractionV composites_
Definition: Material.h:46
virtual ~Material()
Definition: Material.h:20
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
double z_
Definition: Material.h:45
int addMaterial(const DDMaterial &m, double fm)
Definition: Material.h:31
DDMaterial::FractionV::value_type & constituent(int i)
Definition: Material.h:39
std::vector< std::pair< DDMaterial, double > > FractionV
Definition: DDMaterial.h:46
double & z()
Definition: Material.h:28
double & a()
Definition: Material.h:27
double a_
Definition: Material.h:45
const DDMaterial::FractionV::value_type & constituent(int i) const
Definition: Material.h:36
Material(double d)
Definition: Material.h:19
int noOfConstituents() const
Definition: Material.h:42
double z() const
Definition: Material.h:24
double density() const
Definition: Material.h:25
Material(double z, double a, double d)
Definition: Material.h:16
double & density()
Definition: Material.h:29
double a() const
Definition: Material.h:23
double density_
Definition: Material.h:45