51(
const std::vector<G4AttValue>* values,
52 const std::map<G4String,G4AttDef>* definitions):
54 fpDefinitions(definitions)
69 (*fStandardUnits)[
"Length"] =
"m";
70 (*fStandardUnits)[
"Energy"] =
"MeV";
71 (*fStandardUnits)[
"Time"] =
"ns";
72 (*fStandardUnits)[
"Electric charge"] =
"e+";
73 (*fStandardUnits)[
"Volumic Mass"] =
"kg/m3";
84 fUnits->insert(
"G4BestUnit");
87 for (
size_t i = 0; i < units.size(); ++i) {
92 for (
size_t j = 0; j < container.size(); ++j) {
95 fUnits->insert(container[j]->GetSymbol());
128 if (iError < 10 || iError%100 == 0) {
138 "\n*******************************************************";
143 "\nG4AttCheck: ERROR " << iError <<
": Null definitions pointer"
144 "\n*******************************************************"
149 vector<G4AttValue>::const_iterator iValue;
151 const G4String& valueName = iValue->GetName();
152 const G4String& value = iValue->GetValue();
153 map<G4String,G4AttDef>::const_iterator iDef =
160 "\n*******************************************************";
165 "\nG4AttCheck: ERROR " << iError <<
": No G4AttDef for G4AttValue \""
166 << valueName <<
"\": " << value <<
167 "\n*******************************************************"
171 const G4String& category = iDef->second.GetCategory();
172 const G4String& extra = iDef->second.GetExtra();
173 const G4String& valueType = iDef->second.GetValueType();
179 "\n*******************************************************";
184 "\nG4AttCheck: ERROR " << iError <<
": Illegal Category Field \""
185 << category <<
"\" for G4AttValue \""
186 << valueName <<
"\": " << value <<
187 "\n Possible Categories:";
188 set<G4String>::iterator i;
193 "\n*******************************************************"
197 if(category ==
"Physics" &&
fUnits->find(extra) ==
fUnits->end()) {
202 "\n*******************************************************";
207 "\nG4AttCheck: ERROR " << iError <<
": Illegal Extra field \""
208 << extra <<
"\" for G4AttValue \""
209 << valueName <<
"\": " << value <<
210 "\n Possible Extra fields if Category==\"Physics\":\n ";
211 set<G4String>::iterator i;
216 "\n*******************************************************"
225 "\n*******************************************************";
230 "\nG4AttCheck: ERROR " << iError <<
": Illegal Value Type field \""
231 << valueType <<
"\" for G4AttValue \""
232 << valueName <<
"\": " << value <<
233 "\n Possible Value Types:";
234 set<G4String>::iterator i;
239 "\n*******************************************************"
252 os <<
"G4AttCheck: ERROR: zero definitions pointer." << endl;
257 os << storeKey <<
':' << endl;
261 os <<
"G4AttCheck: zero values pointer." << endl;
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 =
273 os <<
"G4AttCheck: ERROR: No G4AttDef for G4AttValue \""
274 << valueName <<
"\": " << value << endl;
276 const G4String& category = iDef->second.GetCategory();
277 const G4String& extra = iDef->second.GetExtra();
278 const G4String& valueType = iDef->second.GetValueType();
282 "G4AttCheck: ERROR: Illegal Category Field \"" << category
283 <<
"\" for G4AttValue \"" << valueName <<
"\": " << value <<
284 "\n Possible Categories:";
285 set<G4String>::iterator i;
291 if(category ==
"Physics" && ac.
fUnits->find(extra) == ac.
fUnits->end()) {
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) {
306 "G4AttCheck: ERROR: Illegal Value Type field \"" << valueType
307 <<
"\" for G4AttValue \"" << valueName <<
"\": " << value <<
308 "\n Possible Value Types:";
309 set<G4String>::iterator i;
317 os << iDef->second.GetDesc()
320 if (iDef->second.GetCategory() ==
"Physics" &&
321 !iDef->second.GetExtra().empty()) {
322 os <<
" (" << iDef->second.GetExtra() <<
")";
331(std::vector<G4AttValue>* standardValues,
332 std::map<G4String,G4AttDef>* standardDefinitions,
344 (*standardDefinitions)[
name].SetName(
name);
345 (*standardDefinitions)[
name].SetExtra(extra);
346 if (description !=
"") (*standardDefinitions)[
name].SetDesc(description);
350(std::vector<G4AttValue>* standardValues,
351 std::map<G4String,G4AttDef>* standardDefinitions)
const
357 vector<G4AttValue>::const_iterator iValue;
359 const G4String& valueName = iValue->GetName();
360 const G4String& value = iValue->GetValue();
361 map<G4String,G4AttDef>::const_iterator iDef =
366 const G4String& category = iDef->second.GetCategory();
367 const G4String& extra = iDef->second.GetExtra();
368 const G4String& valueType = iDef->second.GetValueType();
370 (category ==
"Physics" &&
fUnits->find(extra) ==
fUnits->end()) ||
374 if (category !=
"Physics") {
375 standardValues->push_back(*iValue);
376 (*standardDefinitions)[valueName] =
380 if (valueType ==
"G4ThreeVector") {
384 (standardValues,standardDefinitions,
385 valueName,valueName+
"-X",
389 (standardValues,standardDefinitions,
390 valueName,valueName+
"-Y",
394 (standardValues,standardDefinitions,
395 valueName,valueName+
"-Z",
399 standardValues->push_back(*iValue);
400 (*standardDefinitions)[valueName] =
406 if (extra ==
"G4BestUnit") {
408 unit = valueAndUnit.substr(valueAndUnit.rfind(
' ')+1);
415 G4String standardUnit = (*fStandardUnits)[unitCategory];
419 if (valueType ==
"G4ThreeVector") {
423 (standardValues,standardDefinitions,
424 valueName,valueName+
"-X",
426 (internalValue.
x()/valueOfStandardUnit),
430 (standardValues,standardDefinitions,
431 valueName,valueName+
"-Y",
433 (internalValue.
y()/valueOfStandardUnit),
437 (standardValues,standardDefinitions,
438 valueName,valueName+
"-Z",
440 (internalValue.
z()/valueOfStandardUnit),
447 (standardValues,standardDefinitions,
450 (internalValue/valueOfStandardUnit),
460 G4cerr <<
"G4AttCheck::Standard: Conversion error." <<
G4endl;
std::vector< G4UnitDefinition * > G4UnitsContainer
std::vector< G4UnitsCategory * > G4UnitsTable
void print(G4double elem)
G4GLOB_DLL std::ostream G4cerr
static G4ThreadLocal std::set< G4String > * fUnits
const std::map< G4String, G4AttDef > * fpDefinitions
static G4ThreadLocal std::set< G4String > * fCategories
void AddValuesAndDefs(std::vector< G4AttValue > *newValues, std::map< G4String, G4AttDef > *newDefinitions, const G4String &oldName, const G4String &name, const G4String &value, const G4String &extra, const G4String &description="") const
G4AttCheck(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *definitions)
static G4ThreadLocal G4bool fFirst
static G4ThreadLocal std::set< G4String > * fUnitCategories
G4bool Check(const G4String &leader="") const
static G4ThreadLocal std::set< G4String > * fValueTypes
const std::vector< G4AttValue > * fpValues
G4bool Standard(std::vector< G4AttValue > *standardValues, std::map< G4String, G4AttDef > *standardDefinitions) const
static G4ThreadLocal std::map< G4String, G4String > * fStandardUnits
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 &)
static G4UnitsTable & GetUnitsTable()
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
G4bool GetStoreKey(const std::map< G4String, G4AttDef > *definitions, G4String &key)
const char * name(G4int ptype)
G4String strip_copy(G4String str, char c=' ')
Return copy of string with leading and trailing characters removed.
static PROLOG_HANDLER error