#ifndef MIXTURE_HPP #define MIXTURE_HPP // Created: 27-OCT-1998 Stephen Kahn // // $Revision: 1.2 $ // // This code describes a mixture of materials in a manner similar to // Geant 3.21. This inherits from the Material class which describes // the effective material description. This class contains the relative // weights of each material element and stores a vector containing the // element materials. // // Include files #include #include namespace D0Material { /** The D0 Mixture Class. This class is used to represent composite material as needed by the D0 reconstruction program. */ class Mixture: public Material { public: /** Constructor calculates effective Material class parameters from weights of elements in composite material. The procudure is that used in GEANT 3.21. */ Mixture( const std::string& name, const std::string& symbol, const std::vector elements, const std::vector weights, const bool weights_are_fractions=true); /// Deprecated intermediate constructor Mixture( const std::string& name, const std::string& symbol); /// Default constructor. Needed for STL use Mixture() {} /// Returns a vector of materials used to build this mixture std::vector get_materials() const { return _elements; } /// Returns vector of material weights std::vector get_weights() const { return _weights; } /// Returns ith material Material get_material(int i) const { return _elements[i]; } /// Returns ith material atomic fraction double atomic_fraction(int i) const; /// Returns ith material weight fraction double weight_fraction( int i) const; /// Returns weight type bool weight_type() const { return _wtype; } /// Returns number of elements int numb_elements() const { return _nlmat; } /// Add a new part to the composite, specifying its weight void add_material_by_weight( const double, const Material& ); /// Add a new part of the composite, specificying the fraction of the total void add_material_by_fraction(const double, const Material&); /// Compute the properties of the composite void calc_eff_material(); /// Stream insertion friend std::ostream& operator <<(std::ostream& os, const Mixture& me); private: /// Fraction of total of each material in the composite std::vector _weights; // atomic fractions /// List of materials which form the composite std::vector _elements; // Material of each element int _nlmat; // number of materials in Mixture /// total weight -- used internally for normalization double _wtot; /// Flag indicating if weight are by number fraction(false) or weight fraction bool _wtype; }; // end class std::ostream& operator <<(std::ostream& os, const Mixture& me); } // end namespace #endif // MIXTURE_HPP