49 G4String CCalMaterialFactory::elementfile =
"";
50 G4String CCalMaterialFactory::mixturefile =
"";
55 if ((matfile==
"" || matfile==elementfile) &&
56 (mixfile==
"" || mixfile==mixturefile))
58 else if ((matfile !=
"" && elementfile !=
"" && matfile != elementfile) ||
59 (mixfile !=
"" && mixturefile !=
"" && mixfile != mixturefile)) {
60 G4cerr <<
"ERROR: Trying to get materials from " << matfile <<
" and "
61 << mixfile <<
" while previously were retrieved from "
62 << elementfile <<
" and " << mixturefile <<
"." <<
G4endl;
65 if (elementfile ==
"")
67 if (mixturefile ==
"")
80 if (elementfile==
"" || mixturefile==
"") {
81 G4cerr <<
"ERROR: You haven't defined files to be used for materials in "
82 <<
"CCalMaterialFactory::getInstance(const G4String&,const G4String&)"
97 CCalMaterialTable::iterator ite;
98 for(ite = theCCalMaterials.begin(); ite != theCCalMaterials.end(); ite++ ){
101 theCCalMaterials.clear();
102 CCalAMaterialTable::iterator itea;
103 for(itea = theCCalAMaterials.begin(); itea != theCCalAMaterials.end();
107 theCCalAMaterials.clear();
116 G4cout <<
"Material " << mat <<
" already defined. Returning previous "
129 G4cerr <<
" Could not build material " << mat <<
"." <<
G4endl;
135 G4cout <<
"Material " << mat <<
" has been built successfully." <<
G4endl;
139 G4cerr <<
"ERROR: Material " << mat <<
" not found in CCal database!!!"
149 for (
unsigned int i=0; i<theElements.size(); i++)
150 if (theElements[i]->GetName()==
mat){
154 return theElements[i];
168 theCCalAMaterials.push_back(theMat);
183 addCCalMaterial(name, density, nconst, mats, prop, md);
190 G4String path = getenv(
"CCAL_GLOBALPATH");
191 G4cout <<
" ==> Opening file " << matfile <<
" to read elements..." <<
G4endl;
195 G4cerr <<
"ERROR: Could not open file " << matfile <<
G4endl;
210 G4String path = getenv(
"CCAL_GLOBALPATH");
211 G4cout <<
" ==> Opening file " << matfile <<
" to read materials..." <<
G4endl;
215 G4cerr <<
"ERROR: Could not open file " << matfile <<
G4endl;
234 for (
unsigned int i=0; i<theG4Materials.size(); i++) {
235 if (theG4Materials[i]->GetName()==
mat){
236 return theG4Materials[i];
245 for (
unsigned int i=0; i<theCCalMaterials.size(); i++)
246 if (theCCalMaterials[i]->Name()==
mat){
248 G4cout <<
"CCalMaterial " << mat <<
" found!" <<
G4endl;
250 return theCCalMaterials[i];
258 for (
unsigned int i=0; i<theCCalAMaterials.size(); i++)
259 if (theCCalAMaterials[i]->Name()==
mat){
261 G4cout <<
"CCalMaterial " << mat <<
" found!" <<
G4endl;
263 return theCCalAMaterials[i];
283 for (
G4int i=0; i<nconst; i++){
289 G4cerr <<
"ERROR: Trying to build" << name <<
" out of unknown "
290 << mats[i] <<
"." <<
G4endl
291 <<
"Skiping this material!" <<
G4endl;
301 G4cerr <<
"ERROR: Trying to build" <<name <<
" out of unknown "
302 << mats[i] <<
"." <<
G4endl
303 <<
"Skiping this material!" <<
G4endl;
315 theCCalAMaterials.push_back(amaterial);
329 theCCalMaterials.push_back(material);
343 G4cout <<
" Element \tsymbol\tA\tZ\tdensity\tX_0 abs_l"<<
G4endl;
349 while (name !=
"*ENDDO") {
352 is >> symbol >> A >> Z >> density >>
jump;
354 G4cout <<
" " << name <<
" \t" << symbol <<
"\t"
355 << A <<
"\t" << Z <<
"\t" << density <<
G4endl;
361 <<
" elements read from file" << G4endl <<
G4endl;
378 density,
kStateGas, temperature, pressure);
383 while (name !=
"*ENDDO") {
388 is >> nElem >> dens >>
jump;
392 <<
" made of " << nElem
393 <<
" elements. Density=" << dens
397 G4int absnelem = std::abs(nElem);
403 for(
int i=0; i<absnelem; i++) {
407 weights[i]=std::abs(prop);
410 if (nElem>0 && prop<0)
417 addCCalMaterial(matname, dens, absnelem, mats, weights, md);
424 G4cout <<
" " << theCCalMaterials.size() <<
" materials read from "
425 << mixturefile << G4endl <<
G4endl;
429 CCalMaterialFactory::CCalMaterialFactory() {