352{
353
354
355 using namespace std;
357 vector<G4AttValue>::const_iterator iValue;
358 for (iValue = fpValues->begin(); iValue != fpValues->end(); ++iValue) {
359 const G4String& valueName = iValue->GetName();
360 const G4String& value = iValue->GetValue();
361 map<G4String,G4AttDef>::const_iterator iDef =
362 fpDefinitions->find(valueName);
363 if (iDef == fpDefinitions->end()) {
364 error = true;
365 } else {
366 const G4String& category = iDef->second.GetCategory();
367 const G4String& extra = iDef->second.GetExtra();
368 const G4String& valueType = iDef->second.GetValueType();
369 if (fCategories->find(category) == fCategories->end() ||
370 (category == "Physics" && fUnits->find(extra) == fUnits->end()) ||
371 fValueTypes->find(valueType) == fValueTypes->end()) {
372 error = true;
373 } else {
374 if (category != "Physics") {
375 standardValues->push_back(*iValue);
376 (*standardDefinitions)[valueName] =
377 fpDefinitions->find(valueName)->second;
378 } else {
379 if (extra.empty()) {
380 if (valueType == "G4ThreeVector") {
383 AddValuesAndDefs
384 (standardValues,standardDefinitions,
385 valueName,valueName+"-X",
387 fpDefinitions->find(valueName)->second.GetDesc()+"-X");
388 AddValuesAndDefs
389 (standardValues,standardDefinitions,
390 valueName,valueName+"-Y",
392 fpDefinitions->find(valueName)->second.GetDesc()+"-Y");
393 AddValuesAndDefs
394 (standardValues,standardDefinitions,
395 valueName,valueName+"-Z",
397 fpDefinitions->find(valueName)->second.GetDesc()+"-Z");
398 } else {
399 standardValues->push_back(*iValue);
400 (*standardDefinitions)[valueName] =
401 fpDefinitions->find(valueName)->second;
402 }
403 } else {
406 if (extra == "G4BestUnit") {
407 valueAndUnit = value;
408 valueAndUnit = valueAndUnit.
strip();
409 unit = valueAndUnit.substr(valueAndUnit.rfind(' ')+1);
410 } else {
411 valueAndUnit = value + ' ' + extra;
412 valueAndUnit = valueAndUnit.
strip();
413 unit = extra;
414 }
416 if (fUnitCategories->find(unitCategory) != fUnitCategories->end()) {
417 G4String standardUnit = (*fStandardUnits)[unitCategory];
420
421 if (valueType == "G4ThreeVector") {
424 AddValuesAndDefs
425 (standardValues,standardDefinitions,
426 valueName,valueName+"-X",
428 (internalValue.
x()/valueOfStandardUnit),
429 standardUnit,
430 fpDefinitions->find(valueName)->second.GetDesc()+"-X");
431 AddValuesAndDefs
432 (standardValues,standardDefinitions,
433 valueName,valueName+"-Y",
435 (internalValue.
y()/valueOfStandardUnit),
436 standardUnit,
437 fpDefinitions->find(valueName)->second.GetDesc()+"-Y");
438 AddValuesAndDefs
439 (standardValues,standardDefinitions,
440 valueName,valueName+"-Z",
442 (internalValue.
z()/valueOfStandardUnit),
443 standardUnit,
444 fpDefinitions->find(valueName)->second.GetDesc()+"-Z");
445 } else {
448 AddValuesAndDefs
449 (standardValues,standardDefinitions,
450 valueName,valueName,
452 (internalValue/valueOfStandardUnit),
453 standardUnit);
454 }
455 }
456 }
457 }
458 }
459 }
460 }
461 if (error) {
462 G4cerr <<
"G4AttCheck::Standard: Conversion error." <<
G4endl;
463 }
464 return error;
465}
G4String strip(G4int strip_Type=trailing, char c=' ')
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 &)