CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DetectorDescription/Core/src/Material.h

Go to the documentation of this file.
00001 #ifndef DDI_Material_h
00002 #define DDI_Material_h
00003 
00004 #include <iostream>
00005 #include <vector>
00006 #include <utility>
00007 #include "DetectorDescription/Core/interface/DDMaterial.h"
00008 
00009 
00010 namespace DDI {
00011 
00012   class Material
00013   {
00014   public:
00015     Material(){}
00016     Material(double z, double a, double d)
00017      : z_(z), a_(a), density_(d) { }
00018      
00019     Material(double d) : z_(0), a_(0), density_(d) { }  
00020     virtual ~Material(){}
00021     int noOfConsituents() const;
00022     
00023     double a() const { return a_; }
00024     double z() const { return z_; }
00025     double density() const { return density_; }
00026     
00027     double& a(){ return a_; }
00028     double& z(){ return z_; }
00029     double& density(){ return density_; }
00030     
00031     int addMaterial(const DDMaterial & m, double fm)
00032      { composites_.push_back(std::make_pair(m,fm));
00033        return noOfConstituents();
00034      }
00035     
00036     const DDMaterial::FractionV::value_type & constituent(int i) const
00037      { return composites_[i]; }
00038      
00039     DDMaterial::FractionV::value_type & constituent(int i)
00040      { return composites_[i]; }
00041      
00042     int noOfConstituents() const { return composites_.size(); } 
00043     
00044   protected:    
00045     double  z_, a_, density_;
00046     DDMaterial::FractionV composites_;
00047   };
00048 
00049 }
00050 #endif