350{
351
352
355 vector<G4AttValue>::const_iterator iValue;
356 for (iValue = fpValues->begin(); iValue != fpValues->end(); ++iValue) {
357 const G4String& valueName = iValue->GetName();
358 const G4String& value = iValue->GetValue();
359
360 map<G4String,G4AttDef>::const_iterator iDef =
361 fpDefinitions->find(valueName);
362 if (iDef == fpDefinitions->end()) {
363 error = true;
364 } else {
365 const G4String& category = iDef->second.GetCategory();
366 const G4String& extra = iDef->second.GetExtra();
367 const G4String& valueType = iDef->second.GetValueType();
368 if (fCategories->find(category) == fCategories->end() ||
369 (category == "Physics" && fUnits->find(extra) == fUnits->end()) ||
370 fValueTypes->find(valueType) == fValueTypes->end()) {
371 error = true;
372 } else {
373 if (category != "Physics") {
374 standardValues->push_back(*iValue);
375 (*standardDefinitions)[valueName] =
376 fpDefinitions->find(valueName)->second;
377 } else {
378 if (extra.empty()) {
379 if (valueType == "G4ThreeVector") {
382 AddValuesAndDefs
383 (standardValues,standardDefinitions,
384 valueName,valueName+"-X",
386 fpDefinitions->find(valueName)->second.GetDesc()+"-X");
387 AddValuesAndDefs
388 (standardValues,standardDefinitions,
389 valueName,valueName+"-Y",
391 fpDefinitions->find(valueName)->second.GetDesc()+"-Y");
392 AddValuesAndDefs
393 (standardValues,standardDefinitions,
394 valueName,valueName+"-Z",
396 fpDefinitions->find(valueName)->second.GetDesc()+"-Z");
397 } else {
398 standardValues->push_back(*iValue);
399 (*standardDefinitions)[valueName] =
400 fpDefinitions->find(valueName)->second;
401 }
402 } else {
405 if (extra == "G4BestUnit") {
407 unit = valueAndUnit.substr(valueAndUnit.rfind(' ')+1);
408 } else {
410 unit = extra;
411 }
413 if (fUnitCategories->find(unitCategory) != fUnitCategories->end()) {
414 G4String standardUnit = (*fStandardUnits)[unitCategory];
417
418 if (valueType == "G4ThreeVector") {
421 AddValuesAndDefs
422 (standardValues,standardDefinitions,
423 valueName,valueName+"-X",
425 (internalValue.
x()/valueOfStandardUnit),
426 standardUnit,
427 fpDefinitions->find(valueName)->second.GetDesc()+"-X");
428 AddValuesAndDefs
429 (standardValues,standardDefinitions,
430 valueName,valueName+"-Y",
432 (internalValue.
y()/valueOfStandardUnit),
433 standardUnit,
434 fpDefinitions->find(valueName)->second.GetDesc()+"-Y");
435 AddValuesAndDefs
436 (standardValues,standardDefinitions,
437 valueName,valueName+"-Z",
439 (internalValue.
z()/valueOfStandardUnit),
440 standardUnit,
441 fpDefinitions->find(valueName)->second.GetDesc()+"-Z");
442 } else {
445 AddValuesAndDefs
446 (standardValues,standardDefinitions,
447 valueName,valueName,
449 (internalValue/valueOfStandardUnit),
450 standardUnit);
451 }
452 }
453 }
454 }
455 }
456 }
457 }
458 if (error) {
459 G4cerr <<
"G4AttCheck::Standard: Conversion error." <<
G4endl;
460 }
461 return error;
462}
static G4ThreeVector ConvertTo3Vector(const char *st)
static G4String ConvertToString(G4bool boolVal)
static G4double ConvertToDimensionedDouble(const char *st)
static G4ThreeVector ConvertToDimensioned3Vector(const char *st)
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)
G4String strip_copy(G4String str, char ch=' ')
Return copy of string with leading and trailing characters removed.