void BuildMaterialTables() { #ifdef DAGGEOMETRY_DEBUG std::cout << "==> FluDAG BuildMaterialTables()" << std::endl; #endif //some terminal printout also std::cout << "\t* Storing information..." << std::endl; //The logic is the folloing: //Get the Material Table and: // 1) For materials with density <= 1.00e-10*g/cm3 assign vacuum // 2) For each single element material build a material equivalent // 3) For the rest: // 3.a) Build materials for each not already known element // 3.b) Build the compound out of them // initialize with predefined materials initmat = InitFlukaMat(); #ifdef DAGGEOMETRY_DEBUG std::cout << "end init predef mat " << std::endl; #endif //Get the Material Table and iterate const G4MaterialTable* matTable = DagG4Material::GetMaterialTable(); for (MatTableIterator i = matTable->begin(); i != matTable->end(); i++) { //Get some basic material information G4Material* material = (*i); DString matName = material->GetName(); const G4double matDensity = material->GetDensity(); const int nMatElements = material->GetNumberOfElements(); #ifdef DAGGEOMETRY_DEBUG std::cout << " treating material " << matName << std::endl; #endif std::cout << " mat " << matName << ": dens. = " << matDensity/(g/cm3) << "g/cm3" << ", nElem = " << nMatElements << std::endl; // 1) For materials with density <= 1.00e-10*g/cm3 assign vacuum // FlukaMaterial* is in that case if (matDensity <= 1.00e-10*g/cm3) { #ifdef DAGGEOMETRY_DEBUG std::cout << " vacuum? "<< matDensity << std::endl; #endif DString elemName("VACUUM"); FlukaMaterial *flukamat = FlukaMaterial::GetFlukaMaterial(elemName); G4FlukaMaterialMap[material] = flukamat; std::cout << "\t\t Stored as " << flukamat->GetRealName() << std::endl; } // 2) For each single element material build a material equivalent else if (nMatElements == 1) { #ifdef DAGGEOMETRY_DEBUG std::cout << " single element " << std::endl; #endif FlukaMaterial *flukamat = BuildFlukaMaterialFromElement(material->GetElement(0), matDensity); G4FlukaMaterialMap[material] = flukamat; std::cout << " Stored as " << flukamat->GetRealName() << std::endl; } //else if (material->GetNumberOfElements() == 1) // 3) For the rest: // 3.a) Build materials for each not already known element // 3.b) Build the compound out of them else { #ifdef DAGGEOMETRY_DEBUG std::cout << " not vacuum : call Comp. "<< matDensity/(g/cm3) << std::endl; #endif FlukaCompound* flukacomp = BuildFlukaCompoundFromMaterial(material); G4FlukaCompoundMap[material] = flukacomp; std::cout << "\t\t Stored as " << flukacomp->GetRealName() << std::endl; } //else for case 3) } //for (materials) #ifdef DAGGEOMETRY_DEBUG std::cout << "<== Flugg FGeometryInit::BuildMaterialTables()" << std::endl; #endif }