00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4tgrMaterialMixture.cc 69803 2013-05-15 15:24:50Z gcosmo $ 00028 // 00029 // 00030 // class G4tgrMaterialMixture 00031 00032 // History: 00033 // - Created. P.Arce, CIEMAT (November 2007) 00034 // ------------------------------------------------------------------------- 00035 00036 #include "G4tgrMaterialMixture.hh" 00037 00038 #include "G4SystemOfUnits.hh" 00039 #include "G4tgrUtils.hh" 00040 #include "G4tgrMessenger.hh" 00041 00042 //----------------------------------------------------------- 00043 G4tgrMaterialMixture::G4tgrMaterialMixture() 00044 { 00045 } 00046 00047 00048 //----------------------------------------------------------- 00049 G4tgrMaterialMixture::~G4tgrMaterialMixture() 00050 { 00051 } 00052 00053 00054 //----------------------------------------------------------- 00055 G4tgrMaterialMixture::G4tgrMaterialMixture(const G4String& matType, 00056 const std::vector<G4String>& wl) 00057 { 00058 //---------- Check for miminum number of words read 00059 G4tgrUtils::CheckWLsize( wl, 6, WLSIZE_GE, 00060 "G4tgrMaterialMixture::G4tgrMaterialMixture" ); 00061 00062 theMateType = matType; 00063 00064 //---------- Fill private data 00065 theName = G4tgrUtils::GetString( wl[1] ); 00066 theDensity = std::fabs(G4tgrUtils::GetDouble( wl[2], g/cm3 ) ); 00067 theNoComponents = G4tgrUtils::GetInt( wl[3] ); 00068 00069 G4tgrUtils::CheckWLsize( wl, 4+theNoComponents*2, WLSIZE_GE, 00070 "G4tgrMaterialMixture::G4tgrMaterialMixture" ); 00071 for(G4int ii=0; ii<theNoComponents; ii++) 00072 { 00073 #ifdef G4VERBOSE 00074 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 00075 { 00076 G4cout << " G4tgrMaterialMixture::G4tgrMaterialMixture() -" 00077 << " adding component: " << wl[ii*2+4] << " Fraction= " 00078 << G4tgrUtils::GetDouble(wl[ii*2+1+4]) << G4endl; 00079 } 00080 #endif 00081 theComponents.push_back( G4tgrUtils::GetString( wl[ii*2+4] ) ); 00082 theFractions.push_back( G4tgrUtils::GetDouble(wl[ii*2+1+4]) ); 00083 } 00084 00085 #ifdef G4VERBOSE 00086 if( G4tgrMessenger::GetVerboseLevel() >= 1 ) 00087 { 00088 G4cout << " Created " << *this << G4endl; 00089 } 00090 #endif 00091 } 00092 00093 00094 //----------------------------------------------------------- 00095 std::ostream& operator<<(std::ostream& os, const G4tgrMaterialMixture& mate) 00096 { 00097 os << "G4tgrMaterialMixture=: " << mate.theName << G4endl 00098 << "density= " << mate.theDensity/g*cm3 00099 << " g/cm3. Number of Components: " << mate.theNoComponents << G4endl; 00100 for (G4int ii=0; ii<mate.theNoComponents; ii++) 00101 { 00102 os << '\t' << mate.theComponents[ii] 00103 << '\t' << mate.theFractions[ii] << G4endl; 00104 } 00105 return os; 00106 }