337 {
338
339
340 using namespace std;
342 vector<G4AttValue>::const_iterator iValue;
343 for (iValue = fpValues->begin(); iValue != fpValues->end(); ++iValue) {
344 const G4String& valueName = iValue->GetName();
345 const G4String& value = iValue->GetValue();
346 map<G4String,G4AttDef>::const_iterator iDef =
347 fpDefinitions->find(valueName);
348 if (iDef == fpDefinitions->end()) {
349 error = true;
350 } else {
351 const G4String& category = iDef->second.GetCategory();
352 const G4String& extra = iDef->second.GetExtra();
353 const G4String& valueType = iDef->second.GetValueType();
354 if (fCategories.find(category) == fCategories.end() ||
355 (category == "Physics" && fUnits.find(extra) == fUnits.end()) ||
356 fValueTypes.find(valueType) == fValueTypes.end()) {
357 error = true;
358 } else {
359 if (category != "Physics") {
360 standardValues->push_back(*iValue);
361 (*standardDefinitions)[valueName] =
362 fpDefinitions->find(valueName)->second;
363 } else {
364 if (extra.empty()) {
365 if (valueType == "G4ThreeVector") {
368 AddValuesAndDefs
369 (standardValues,standardDefinitions,
370 valueName,valueName+"-X",
372 fpDefinitions->find(valueName)->second.GetDesc()+"-X");
373 AddValuesAndDefs
374 (standardValues,standardDefinitions,
375 valueName,valueName+"-Y",
377 fpDefinitions->find(valueName)->second.GetDesc()+"-Y");
378 AddValuesAndDefs
379 (standardValues,standardDefinitions,
380 valueName,valueName+"-Z",
382 fpDefinitions->find(valueName)->second.GetDesc()+"-Z");
383 } else {
384 standardValues->push_back(*iValue);
385 (*standardDefinitions)[valueName] =
386 fpDefinitions->find(valueName)->second;
387 }
388 } else {
391 if (extra == "G4BestUnit") {
392 valueAndUnit = value;
393 valueAndUnit = valueAndUnit.
strip();
394 unit = valueAndUnit.substr(valueAndUnit.rfind(' ')+1);
395 } else {
396 valueAndUnit = value + ' ' + extra;
397 valueAndUnit = valueAndUnit.
strip();
398 unit = extra;
399 }
401 if (fUnitCategories.find(unitCategory) != fUnitCategories.end()) {
402 G4String standardUnit = fStandardUnits[unitCategory];
405
406 if (valueType == "G4ThreeVector") {
409 AddValuesAndDefs
410 (standardValues,standardDefinitions,
411 valueName,valueName+"-X",
413 (internalValue.
x()/valueOfStandardUnit),
414 standardUnit,
415 fpDefinitions->find(valueName)->second.GetDesc()+"-X");
416 AddValuesAndDefs
417 (standardValues,standardDefinitions,
418 valueName,valueName+"-Y",
420 (internalValue.
y()/valueOfStandardUnit),
421 standardUnit,
422 fpDefinitions->find(valueName)->second.GetDesc()+"-Y");
423 AddValuesAndDefs
424 (standardValues,standardDefinitions,
425 valueName,valueName+"-Z",
427 (internalValue.
z()/valueOfStandardUnit),
428 standardUnit,
429 fpDefinitions->find(valueName)->second.GetDesc()+"-Z");
430 } else {
433 AddValuesAndDefs
434 (standardValues,standardDefinitions,
435 valueName,valueName,
437 (internalValue/valueOfStandardUnit),
438 standardUnit);
439 }
440 }
441 }
442 }
443 }
444 }
445 }
446 if (error) {
447 G4cerr <<
"G4AttCheck::Standard: Conversion error." <<
G4endl;
448 }
449 return error;
450}
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 &)