246{
248 if (ac.fpDefinitions == nullptr) {
249 os << "G4AttCheck: ERROR: zero definitions pointer." << endl;
250 return os;
251 }
254 os << storeKey << ':' << endl;
255 }
256 if (ac.fpValues == nullptr) {
257
258 os << "G4AttCheck: zero values pointer." << endl;
259 return os;
260 }
261 vector<G4AttValue>::const_iterator iValue;
262 for (iValue = ac.fpValues->begin(); iValue != ac.fpValues->end(); ++iValue) {
263 const G4String& valueName = iValue->GetName();
264 const G4String& value = iValue->GetValue();
265
266 map<G4String,G4AttDef>::const_iterator iDef =
267 ac.fpDefinitions->find(valueName);
269 if (iDef == ac.fpDefinitions->end()) {
270 error = true;
271 os << "G4AttCheck: ERROR: No G4AttDef for G4AttValue \""
272 << valueName << "\": " << value << endl;
273 } else {
274 const G4String& category = iDef->second.GetCategory();
275 const G4String& extra = iDef->second.GetExtra();
276 const G4String& valueType = iDef->second.GetValueType();
277 if (ac.fCategories->find(category) == ac.fCategories->end()) {
278 error = true;
279 os <<
280 "G4AttCheck: ERROR: Illegal Category Field \"" << category
281 << "\" for G4AttValue \"" << valueName << "\": " << value <<
282 "\n Possible Categories:";
283 set<G4String>::iterator i;
284 for (i = ac.fCategories->begin(); i != ac.fCategories->end(); ++i) {
285 os << ' ' << *i;
286 }
287 os << endl;
288 }
289 if(category == "Physics" && ac.fUnits->find(extra) == ac.fUnits->end()) {
290 error = true;
291 os <<
292 "G4AttCheck: ERROR: Illegal Extra field \""<< extra
293 << "\" for G4AttValue \"" << valueName << "\": " << value <<
294 "\n Possible Extra fields if Category==\"Physics\":\n ";
295 set<G4String>::iterator i;
296 for (i = ac.fUnits->begin(); i != ac.fUnits->end(); ++i) {
297 os << ' ' << *i;
298 }
299 os << endl;
300 }
301 if (ac.fValueTypes->find(valueType) == ac.fValueTypes->end()) {
302 error = true;
303 os <<
304 "G4AttCheck: ERROR: Illegal Value Type field \"" << valueType
305 << "\" for G4AttValue \"" << valueName << "\": " << value <<
306 "\n Possible Value Types:";
307 set<G4String>::iterator i;
308 for (i = ac.fValueTypes->begin(); i != ac.fValueTypes->end(); ++i) {
309 os << ' ' << *i;
310 }
311 os << endl;
312 }
313 }
314 if (!error) {
315 os << iDef->second.GetDesc()
316 << " (" << valueName
317 << "): " << value;
318 if (iDef->second.GetCategory() == "Physics" &&
319 !iDef->second.GetExtra().empty()) {
320 os << " (" << iDef->second.GetExtra() << ")";
321 }
322 os << endl;
323 }
324 }
325 return os;
326}
G4bool GetStoreKey(const std::map< G4String, G4AttDef > *definitions, G4String &key)