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