Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/graphics_reps/src/G4AttCheck.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /graphics_reps/src/G4AttCheck.cc (Version 11.3.0) and /graphics_reps/src/G4AttCheck.cc (Version 8.1.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4AttCheck.cc,v 1.8 2006/06/29 19:06:34 gunter Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
 27                                                    29 
 28 #include "G4AttCheck.hh"                           30 #include "G4AttCheck.hh"
 29                                                    31 
 30 #include "globals.hh"                              32 #include "globals.hh"
 31                                                    33 
 32 #include "G4AttDef.hh"                             34 #include "G4AttDef.hh"
 33 #include "G4AttDefStore.hh"                    << 
 34 #include "G4AttValue.hh"                           35 #include "G4AttValue.hh"
 35 #include "G4UnitsTable.hh"                         36 #include "G4UnitsTable.hh"
 36 #include "G4UIcommand.hh"                          37 #include "G4UIcommand.hh"
 37                                                    38 
 38 G4ThreadLocal G4bool G4AttCheck::fFirst = true << 
 39                                                << 
 40 G4ThreadLocal std::set<G4String> *G4AttCheck:: << 
 41                                                << 
 42 G4ThreadLocal std::map<G4String,G4String> *G4A << 
 43                                                << 
 44 G4ThreadLocal std::set<G4String> *G4AttCheck:: << 
 45                                                << 
 46 G4ThreadLocal std::set<G4String> *G4AttCheck:: << 
 47                                                << 
 48 G4ThreadLocal std::set<G4String> *G4AttCheck:: << 
 49                                                << 
 50 G4AttCheck::G4AttCheck                             39 G4AttCheck::G4AttCheck
 51 (const std::vector<G4AttValue>* values,            40 (const std::vector<G4AttValue>* values,
 52  const std::map<G4String,G4AttDef>* definition     41  const std::map<G4String,G4AttDef>* definitions):
 53   fpValues(values),                                42   fpValues(values),
 54   fpDefinitions(definitions)                       43   fpDefinitions(definitions)
 55 {                                                  44 {
 56   Init();                                      << 
 57                                                << 
 58   if (fFirst) {  // Initialise static containe     45   if (fFirst) {  // Initialise static containers.
 59     fFirst = false;                                46     fFirst = false;
 60                                                    47 
 61     // Legal Unit Category Types...                48     // Legal Unit Category Types...
 62     fUnitCategories->insert("Length");         <<  49     fUnitCategories.insert("Length");
 63     fUnitCategories->insert("Energy");         <<  50     fUnitCategories.insert("Energy");
 64     fUnitCategories->insert("Time");           <<  51     fUnitCategories.insert("Time");
 65     fUnitCategories->insert("Electric charge") <<  52     fUnitCategories.insert("Electric charge");
 66     fUnitCategories->insert("Volumic Mass");   << 
 67                                                    53 
 68     // Corresponding Standard Units...             54     // Corresponding Standard Units...
 69     (*fStandardUnits)["Length"] = "m";         <<  55     fStandardUnits["Length"] = "m";
 70     (*fStandardUnits)["Energy"] = "MeV";       <<  56     fStandardUnits["Energy"] = "MeV";
 71     (*fStandardUnits)["Time"] = "ns";          <<  57     fStandardUnits["Time"] = "ns";
 72     (*fStandardUnits)["Electric charge"] = "e+ <<  58     fStandardUnits["Electric charge"] = "e+";
 73     (*fStandardUnits)["Volumic Mass"] = "kg/m3 << 
 74                                                    59 
 75     // Legal Categories...                         60     // Legal Categories...
 76     fCategories->insert("Bookkeeping");        <<  61     fCategories.insert("Bookkeeping");
 77     fCategories->insert("Draw");               <<  62     fCategories.insert("Draw");
 78     fCategories->insert("Physics");            <<  63     fCategories.insert("Physics");
 79     fCategories->insert("PickAction");         <<  64     fCategories.insert("PickAction");
 80     fCategories->insert("Association");        <<  65     fCategories.insert("Association");
 81                                                    66 
 82     // Legal units...                              67     // Legal units...
 83     fUnits->insert("");                        <<  68     fUnits.insert("G4BestUnit");
 84     fUnits->insert("G4BestUnit");              << 
 85     // ...plus any legal unit symbol ("MeV", "     69     // ...plus any legal unit symbol ("MeV", "km", etc.)...
 86     G4UnitsTable& units = G4UnitDefinition::Ge     70     G4UnitsTable& units = G4UnitDefinition::GetUnitsTable();
 87     for (size_t i = 0; i < units.size(); ++i)      71     for (size_t i = 0; i < units.size(); ++i) {
 88       if (fUnitCategories->find(units[i]->GetN <<  72       if (fUnitCategories.find(units[i]->GetName()) !=
 89           fUnitCategories->end()) {            <<  73     fUnitCategories.end()) {
 90         //G4cout << units[i]->GetName() << G4e <<  74   //G4cout << units[i]->GetName() << G4endl;
 91         G4UnitsContainer& container = units[i] <<  75   G4UnitsContainer& container = units[i]->GetUnitsList();
 92         for (auto & j : container) {           <<  76   for (size_t j = 0; j < container.size(); ++j) {
 93           //G4cout << container[j]->GetName()  <<  77     //G4cout << container[j]->GetName() << ' '
 94           //       << container[j]->GetSymbol( <<  78     //       << container[j]->GetSymbol() << G4endl;
 95           fUnits->insert(j->GetSymbol());      <<  79     fUnits.insert(container[j]->GetSymbol());
 96         }                                      <<  80   }
 97       }                                            81       }
 98     }                                              82     }
 99                                                    83 
100     // Legal Value Types...                        84     // Legal Value Types...
101     fValueTypes->insert("G4String");           <<  85     fValueTypes.insert("G4String");
102     fValueTypes->insert("G4int");              <<  86     fValueTypes.insert("G4int");
103     fValueTypes->insert("G4double");           <<  87     fValueTypes.insert("G4double");
104     fValueTypes->insert("G4ThreeVector");      <<  88     fValueTypes.insert("G4ThreeVector");
105     fValueTypes->insert("G4bool");             << 
106   }                                                89   }
107 }                                                  90 }
108                                                    91 
109 void G4AttCheck::Init()                        <<  92 G4AttCheck::~G4AttCheck() {}
110 {                                              << 
111   if (fValueTypes == nullptr) fValueTypes = ne << 
112   if (fUnits == nullptr) fUnits = new std::set << 
113   if (fCategories == nullptr) fCategories = ne << 
114   if (fStandardUnits == nullptr) fStandardUnit << 
115   if (fUnitCategories == nullptr) fUnitCategor << 
116 }                                              << 
117                                                    93 
118 G4bool G4AttCheck::Check(const G4String& leade <<  94 G4bool G4AttCheck::fFirst = true;
119 {                                              <<  95 
                                                   >>  96 std::set<G4String> G4AttCheck::fUnitCategories;
                                                   >>  97 
                                                   >>  98 std::map<G4String,G4String> G4AttCheck::fStandardUnits;
                                                   >>  99 
                                                   >> 100 std::set<G4String> G4AttCheck::fCategories;
                                                   >> 101 
                                                   >> 102 std::set<G4String> G4AttCheck::fUnits;
                                                   >> 103 
                                                   >> 104 std::set<G4String> G4AttCheck::fValueTypes;
                                                   >> 105 
                                                   >> 106 G4bool G4AttCheck::Check(const G4String& leader) const {
120   // Check only.  Silent unless error - then G    107   // Check only.  Silent unless error - then G4cerr.  Returns error.
121   G4bool error = false;                           108   G4bool error = false;
122   static G4ThreadLocal G4int iError = 0;       << 109   static G4int iError = 0;
123   G4bool print = false;                           110   G4bool print = false;
124   if (iError < 10 || iError%100 == 0) {           111   if (iError < 10 || iError%100 == 0) {
125     print = true;                                 112     print = true;
126   }                                               113   }
127   using namespace std;                            114   using namespace std;
128   if (fpValues == nullptr) return error;  // A << 115   if (!fpValues) return error;  // A null values vector is a valid situation.
129   if (fpDefinitions == nullptr) {              << 116   if (!fpDefinitions) {
130     ++iError;                                     117     ++iError;
131     error = true;                                 118     error = true;
132     if (print) {                                  119     if (print) {
133       G4cerr <<                                   120       G4cerr <<
134         "\n*********************************** << 121   "\n*******************************************************";
135       if (!leader.empty()) {                   << 122       if (leader != "") {
136         G4cerr << '\n' << leader;              << 123   G4cerr << '\n' << leader;
137       }                                           124       }
138       G4cerr <<                                   125       G4cerr <<
139         "\nG4AttCheck: ERROR " << iError << ": << 126   "\nERROR " << iError << ": Null definitions map<G4String,G4AttDef>*"
140         "\n*********************************** << 127   "\n*******************************************************"
141              << G4endl;                        << 128        << G4endl;
                                                   >> 129       return error;
142     }                                             130     }
143     return error;                              << 
144   }                                               131   }
145   vector<G4AttValue>::const_iterator iValue;      132   vector<G4AttValue>::const_iterator iValue;
146   for (iValue = fpValues->begin(); iValue != f    133   for (iValue = fpValues->begin(); iValue != fpValues->end(); ++iValue) {
147     const G4String& valueName = iValue->GetNam    134     const G4String& valueName = iValue->GetName();
148     const G4String& value = iValue->GetValue()    135     const G4String& value = iValue->GetValue();
149     // NOLINTNEXTLINE(modernize-use-auto): Exp << 
150     map<G4String,G4AttDef>::const_iterator iDe    136     map<G4String,G4AttDef>::const_iterator iDef =
151       fpDefinitions->find(valueName);             137       fpDefinitions->find(valueName);
152     if (iDef == fpDefinitions->end()) {           138     if (iDef == fpDefinitions->end()) {
153       ++iError;                                   139       ++iError;
154       error = true;                               140       error = true;
155       if (print) {                                141       if (print) {
156         G4cerr <<                              << 142   G4cerr <<
157           "\n********************************* << 143     "\n*******************************************************";
158         if (!leader.empty()) {                 << 144   if (leader != "") {
159           G4cerr << '\n' << leader;            << 145     G4cerr << '\n' << leader;
160         }                                      << 146   }
161         G4cerr <<                              << 147   G4cerr <<
162           "\nG4AttCheck: ERROR " << iError <<  << 148     "\nERROR " << iError << ": No G4AttDef for G4AttValue \""
163                <<  valueName << "\": " << valu << 149          <<  valueName << "\": " << value <<
164           "\n********************************* << 150     "\n*******************************************************"
165                << G4endl;                      << 151          << G4endl;
166       }                                           152       }
167     } else {                                      153     } else {
168       const G4String& category = iDef->second.    154       const G4String& category = iDef->second.GetCategory();
169       const G4String& extra = iDef->second.Get    155       const G4String& extra = iDef->second.GetExtra();
170       const G4String& valueType = iDef->second    156       const G4String& valueType = iDef->second.GetValueType();
171       if (fCategories->find(category) == fCate << 157       if (fCategories.find(category) == fCategories.end()) {
172         ++iError;                              << 158   ++iError;
173         error = true;                          << 159   error = true;
174         if (print) {                           << 160   if (print) {
175           G4cerr <<                            << 161     G4cerr <<
176             "\n******************************* << 162       "\n*******************************************************";
177           if (!leader.empty()) {               << 163     if (leader != "") {
178             G4cerr << '\n' << leader;          << 164       G4cerr << '\n' << leader;
179           }                                    << 165     }
180           G4cerr <<                            << 166     G4cerr <<
181             "\nG4AttCheck: ERROR " << iError < << 167       "\nERROR " << iError << ": Illegal Category Field \""
182                  << category << "\" for G4AttV << 168      << category << "\" for G4AttValue \""
183                  << valueName << "\": " << val << 169      << valueName << "\": " << value <<
184             "\n  Possible Categories:";        << 170       "\n  Possible Categories:";
185           set<G4String>::iterator i;           << 171     set<G4String>::iterator i;
186           for (i = fCategories->begin(); i !=  << 172     for (i = fCategories.begin(); i != fCategories.end(); ++i) {
187             G4cerr << ' ' << *i;               << 173       G4cerr << ' ' << *i;
188           }                                    << 174     }
189           G4cerr <<                            << 175     G4cerr <<
190             "\n******************************* << 176       "\n*******************************************************"
191                  << G4endl;                    << 177      << G4endl;
192         }                                      << 178   }
193       }                                        << 179       }
194       if(category == "Physics" && fUnits->find << 180       if(category == "Physics" && fUnits.find(extra) == fUnits.end()) {
195         ++iError;                              << 181   ++iError;
196         error = true;                          << 182   error = true;
197         if (print) {                           << 183   if (print) {
198           G4cerr <<                            << 184     G4cerr <<
199             "\n******************************* << 185       "\n*******************************************************";
200           if (!leader.empty()) {               << 186     if (leader != "") {
201             G4cerr << '\n' << leader;          << 187       G4cerr << '\n' << leader;
202           }                                    << 188     }
203           G4cerr <<                            << 189     G4cerr <<
204             "\nG4AttCheck: ERROR " << iError < << 190       "\nERROR " << iError << ": Illegal Extra field \""
205                  << extra << "\" for G4AttValu << 191      << extra << "\" for G4AttValue \""
206                  << valueName << "\": " << val << 192      << valueName << "\": " << value <<
207             "\n  Possible Extra fields if Cate << 193       "\n  Possible Extra fields if Category==\"Physics\":\n    ";
208           set<G4String>::iterator i;           << 194     set<G4String>::iterator i;
209           for (i = fUnits->begin(); i != fUnit << 195     for (i = fUnits.begin(); i != fUnits.end(); ++i) {
210             G4cerr << ' ' << *i;               << 196       G4cerr << ' ' << *i;
211           }                                    << 197     }
212           G4cerr <<                            << 198     G4cerr <<
213             "\n******************************* << 199       "\n*******************************************************"
214                  << G4endl;                    << 200      << G4endl;
215         }                                      << 201   }
216       }                                        << 202       }
217       if (fValueTypes->find(valueType) == fVal << 203       if (fValueTypes.find(valueType) == fValueTypes.end()) {
218         ++iError;                              << 204   ++iError;
219         error = true;                          << 205   error = true;
220         if (print) {                           << 206   if (print) {
221           G4cerr <<                            << 207     G4cerr <<
222             "\n******************************* << 208       "\n*******************************************************";
223           if (!leader.empty()) {               << 209     if (leader != "") {
224             G4cerr << '\n' << leader;          << 210       G4cerr << '\n' << leader;
225           }                                    << 211     }
226           G4cerr <<                            << 212     G4cerr <<
227             "\nG4AttCheck: ERROR " << iError < << 213       "\nERROR " << iError << ": Illegal Value Type field \""
228                  << valueType << "\" for G4Att << 214      << valueType << "\" for G4AttValue \""
229                  << valueName << "\": " << val << 215      << valueName << "\": " << value <<
230             "\n  Possible Value Types:";       << 216       "\n  Possible Value Types:";
231           set<G4String>::iterator i;           << 217     set<G4String>::iterator i;
232           for (i = fValueTypes->begin(); i !=  << 218     for (i = fValueTypes.begin(); i != fValueTypes.end(); ++i) {
233             G4cerr << ' ' << *i;               << 219       G4cerr << ' ' << *i;
234           }                                    << 220     }
235           G4cerr <<                            << 221     G4cerr <<
236             "\n******************************* << 222       "\n*******************************************************"
237                << G4endl;                      << 223          << G4endl;
238         }                                      << 224   }
239       }                                           225       }
240     }                                             226     }
241   }                                               227   }
242   return error;                                   228   return error;
243 }                                                 229 }
244                                                   230 
245 std::ostream& operator<< (std::ostream& os, co << 231 std::ostream& operator<< (std::ostream& os, const G4AttCheck& ac) {
246 {                                              << 
247   using namespace std;                            232   using namespace std;
248   if (ac.fpDefinitions == nullptr) {           << 
249     os << "G4AttCheck: ERROR: zero definitions << 
250     return os;                                 << 
251   }                                            << 
252   G4String storeKey;                           << 
253   if (G4AttDefStore::GetStoreKey(ac.fpDefiniti << 
254     os << storeKey << ':' << endl;             << 
255   }                                            << 
256   if (ac.fpValues == nullptr) {                << 
257     // A null values vector is a valid situati << 
258     os << "G4AttCheck: zero values pointer." < << 
259     return os;                                 << 
260   }                                            << 
261   vector<G4AttValue>::const_iterator iValue;      233   vector<G4AttValue>::const_iterator iValue;
262   for (iValue = ac.fpValues->begin(); iValue !    234   for (iValue = ac.fpValues->begin(); iValue != ac.fpValues->end(); ++iValue) {
263     const G4String& valueName = iValue->GetNam    235     const G4String& valueName = iValue->GetName();
264     const G4String& value = iValue->GetValue()    236     const G4String& value = iValue->GetValue();
265     // NOLINTNEXTLINE(modernize-use-auto): Exp << 237     map<G4String,G4AttDef>::const_iterator iDef =
266     map<G4String,G4AttDef>::const_iterator iDe << 
267       ac.fpDefinitions->find(valueName);          238       ac.fpDefinitions->find(valueName);
268     G4bool error = false;                         239     G4bool error = false;
269     if (iDef == ac.fpDefinitions->end()) {        240     if (iDef == ac.fpDefinitions->end()) {
270       error = true;                               241       error = true;
271       os << "G4AttCheck: ERROR: No G4AttDef fo << 242       os << "ERROR: No G4AttDef for G4AttValue \""
272          << valueName << "\": " << value << en << 243    << valueName << "\": " << value << endl;
273     } else {                                      244     } else {
274       const G4String& category = iDef->second.    245       const G4String& category = iDef->second.GetCategory();
275       const G4String& extra = iDef->second.Get    246       const G4String& extra = iDef->second.GetExtra();
276       const G4String& valueType = iDef->second    247       const G4String& valueType = iDef->second.GetValueType();
277       if (ac.fCategories->find(category) == ac << 248       if (ac.fCategories.find(category) == ac.fCategories.end()) {
278         error = true;                          << 249   error = true;
279         os <<                                  << 250   os <<
280           "G4AttCheck: ERROR: Illegal Category << 251     "ERROR: Illegal Category Field \"" << category
281            << "\" for G4AttValue \"" << valueN << 252      << "\" for G4AttValue \"" << valueName << "\": " << value <<
282           "\n  Possible Categories:";          << 253     "\n  Possible Categories:";
283         set<G4String>::iterator i;             << 254   set<G4String>::iterator i;
284         for (i = ac.fCategories->begin(); i != << 255   for (i = ac.fCategories.begin(); i != ac.fCategories.end(); ++i) {
285           os << ' ' << *i;                     << 256     os << ' ' << *i;
286         }                                      << 257   }
287         os << endl;                            << 258   os << endl;
288       }                                        << 259       }
289       if(category == "Physics" && ac.fUnits->f << 260       if(category == "Physics" && ac.fUnits.find(extra) == ac.fUnits.end()) {
290         error = true;                          << 261   error = true;
291         os <<                                  << 262   os <<
292           "G4AttCheck: ERROR: Illegal Extra fi << 263     "ERROR: Illegal Extra field \""<< extra << "\" for G4AttValue \""
293            << "\" for G4AttValue \"" << valueN << 264      << valueName << "\": " << value <<
294           "\n  Possible Extra fields if Catego << 265     "\n  Possible Extra fields if Category==\"Physics\":\n    ";
295         set<G4String>::iterator i;             << 266   set<G4String>::iterator i;
296         for (i = ac.fUnits->begin(); i != ac.f << 267   for (i = ac.fUnits.begin(); i != ac.fUnits.end(); ++i) {
297           os << ' ' << *i;                     << 268     os << ' ' << *i;
298         }                                      << 269   }
299         os << endl;                            << 270   os << endl;
300       }                                        << 271       }
301       if (ac.fValueTypes->find(valueType) == a << 272       if (ac.fValueTypes.find(valueType) == ac.fValueTypes.end()) {
302         error = true;                          << 273   error = true;
303         os <<                                  << 274   os <<
304           "G4AttCheck: ERROR: Illegal Value Ty << 275     "ERROR: Illegal Value Type field \"" << valueType
305            << "\" for G4AttValue \"" << valueN << 276      << "\" for G4AttValue \"" << valueName << "\": " << value <<
306           "\n  Possible Value Types:";         << 277     "\n  Possible Value Types:";
307         set<G4String>::iterator i;             << 278   set<G4String>::iterator i;
308         for (i = ac.fValueTypes->begin(); i != << 279   for (i = ac.fValueTypes.begin(); i != ac.fValueTypes.end(); ++i) {
309           os << ' ' << *i;                     << 280     os << ' ' << *i;
310         }                                      << 281   }
311         os << endl;                            << 282   os << endl;
312       }                                           283       }
313     }                                             284     }
314     if (!error) {                                 285     if (!error) {
315       os << iDef->second.GetDesc()             << 286       os << iDef->second.GetDesc() << ": "
316          << " (" << valueName                  << 287    << iValue->GetValue();
317          << "): " << value;                    << 288       if (iDef->second.GetCategory() == "Physics") {
318       if (iDef->second.GetCategory() == "Physi << 289   os << " ("
319           !iDef->second.GetExtra().empty()) {  << 290      << iDef->second.GetExtra() << ")";
320         os << " (" << iDef->second.GetExtra()  << 
321       }                                           291       }
322       os << endl;                                 292       os << endl;
323     }                                             293     }
324   }                                               294   }
325   return os;                                      295   return os;
326 }                                                 296 }
327                                                   297 
328 void G4AttCheck::AddValuesAndDefs                 298 void G4AttCheck::AddValuesAndDefs
329 (std::vector<G4AttValue>* standardValues,         299 (std::vector<G4AttValue>* standardValues,
330  std::map<G4String,G4AttDef>* standardDefiniti    300  std::map<G4String,G4AttDef>* standardDefinitions,
331  const G4String& oldName,                         301  const G4String& oldName,
332  const G4String& name,                            302  const G4String& name,
333  const G4String& value,                           303  const G4String& value,
334  const G4String& extra,                           304  const G4String& extra,
335  const G4String& description) const            << 305  const G4String& description) const {
336 {                                              << 
337   // Add new G4AttDeff...                         306   // Add new G4AttDeff...
338   standardValues->push_back(G4AttValue(name,va    307   standardValues->push_back(G4AttValue(name,value,""));
339   // Copy original G4AttDef...                    308   // Copy original G4AttDef...
340   (*standardDefinitions)[name] = fpDefinitions    309   (*standardDefinitions)[name] = fpDefinitions->find(oldName)->second;
341   // ...and make appropriate changes...           310   // ...and make appropriate changes...
342   (*standardDefinitions)[name].SetName(name);     311   (*standardDefinitions)[name].SetName(name);
343   (*standardDefinitions)[name].SetExtra(extra)    312   (*standardDefinitions)[name].SetExtra(extra);
344   if (!description.empty()) (*standardDefiniti << 313   if (description != "") (*standardDefinitions)[name].SetDesc(description);
345 }                                                 314 }
346                                                   315 
347 G4bool G4AttCheck::Standard                       316 G4bool G4AttCheck::Standard
348 (std::vector<G4AttValue>* standardValues,         317 (std::vector<G4AttValue>* standardValues,
349  std::map<G4String,G4AttDef>* standardDefiniti << 318  std::map<G4String,G4AttDef>* standardDefinitions) const {
350 {                                              << 
351   // Places standard versions in provided vect    319   // Places standard versions in provided vector and map and returns error.
352   // Assumes valid input.  Use Check to check. << 
353   using namespace std;                            320   using namespace std;
354   G4bool error = false;                           321   G4bool error = false;
355   vector<G4AttValue>::const_iterator iValue;      322   vector<G4AttValue>::const_iterator iValue;
356   for (iValue = fpValues->begin(); iValue != f    323   for (iValue = fpValues->begin(); iValue != fpValues->end(); ++iValue) {
357     const G4String& valueName = iValue->GetNam    324     const G4String& valueName = iValue->GetName();
358     const G4String& value = iValue->GetValue()    325     const G4String& value = iValue->GetValue();
359     // NOLINTNEXTLINE(modernize-use-auto): Exp << 
360     map<G4String,G4AttDef>::const_iterator iDe    326     map<G4String,G4AttDef>::const_iterator iDef =
361       fpDefinitions->find(valueName);             327       fpDefinitions->find(valueName);
362     if (iDef == fpDefinitions->end()) {           328     if (iDef == fpDefinitions->end()) {
363       error = true;                               329       error = true;
364     } else {                                      330     } else {
365       const G4String& category = iDef->second.    331       const G4String& category = iDef->second.GetCategory();
366       const G4String& extra = iDef->second.Get    332       const G4String& extra = iDef->second.GetExtra();
367       const G4String& valueType = iDef->second    333       const G4String& valueType = iDef->second.GetValueType();
368       if (fCategories->find(category) == fCate << 334       if (fCategories.find(category) == fCategories.end() ||
369           (category == "Physics" && fUnits->fi << 335     (category == "Physics" && fUnits.find(extra) == fUnits.end()) ||
370           fValueTypes->find(valueType) == fVal << 336     fValueTypes.find(valueType) == fValueTypes.end()) {
371         error = true;                          << 337   error = true;
372       } else {                                    338       } else {
373         if (category != "Physics") {  // Simpl << 339   if (category != "Physics") {  // Simply copy...
374           standardValues->push_back(*iValue);  << 340     standardValues->push_back(*iValue);
375           (*standardDefinitions)[valueName] =  << 341     (*standardDefinitions)[valueName] =
376             fpDefinitions->find(valueName)->se << 342       fpDefinitions->find(valueName)->second;
377         } else {  // "Physics"...              << 343   } else {
378           if (extra.empty()) {  // Dimensionle << 344     G4String valueAndUnit;
379             if (valueType == "G4ThreeVector")  << 345     G4String unit;
380               G4ThreeVector internalValue =    << 346     if (extra == "G4BestUnit") {
381                 G4UIcommand::ConvertTo3Vector( << 347       valueAndUnit = value;
382               AddValuesAndDefs                 << 348       valueAndUnit = valueAndUnit.strip();
383                 (standardValues,standardDefini << 349       unit = valueAndUnit.substr(valueAndUnit.rfind(' ')+1);
384                  valueName,valueName+"-X",     << 350     } else {
385                  G4UIcommand::ConvertToString( << 351       valueAndUnit = value + ' ' + extra;
386                  fpDefinitions->find(valueName << 352       unit = extra;
387               AddValuesAndDefs                 << 353     }
388                 (standardValues,standardDefini << 354     G4String unitCategory = G4UnitDefinition::GetCategory(unit);
389                  valueName,valueName+"-Y",     << 355     if (fUnitCategories.find(unitCategory) != fUnitCategories.end()) {
390                  G4UIcommand::ConvertToString( << 356       G4String standardUnit = fStandardUnits[unitCategory];
391                  fpDefinitions->find(valueName << 357       G4double valueOfUnit = G4UnitDefinition::GetValueOf(standardUnit);
392               AddValuesAndDefs                 << 358       G4String extra = iDef->second.GetExtra();
393                 (standardValues,standardDefini << 359       if (valueType == "G4ThreeVector") {
394                  valueName,valueName+"-Z",     << 360         G4ThreeVector internalValue =
395                  G4UIcommand::ConvertToString( << 361     G4UIcommand::ConvertToDimensioned3Vector(valueAndUnit);
396                  fpDefinitions->find(valueName << 362         AddValuesAndDefs
397             } else {  // Simply copy...        << 363     (standardValues,standardDefinitions,
398               standardValues->push_back(*iValu << 364      valueName,valueName+"-X",
399               (*standardDefinitions)[valueName << 365      G4UIcommand::ConvertToString(internalValue.x()/valueOfUnit),
400                 fpDefinitions->find(valueName) << 366      standardUnit,
401             }                                  << 367      fpDefinitions->find(valueName)->second.GetDesc()+"-X");
402           } else {  // Dimensioned...          << 368         AddValuesAndDefs
403             G4String valueAndUnit;             << 369     (standardValues,standardDefinitions,
404             G4String unit;                     << 370      valueName,valueName+"-Y",
405             if (extra == "G4BestUnit") {       << 371      G4UIcommand::ConvertToString(internalValue.y()/valueOfUnit),
406               valueAndUnit = G4StrUtil::strip_ << 372      standardUnit,
407               unit = valueAndUnit.substr(value << 373      fpDefinitions->find(valueName)->second.GetDesc()+"-Y");
408             } else {                           << 374         AddValuesAndDefs
409               valueAndUnit = G4StrUtil::strip_ << 375     (standardValues,standardDefinitions,
410               unit = extra;                    << 376      valueName,valueName+"-Z",
411             }                                  << 377      G4UIcommand::ConvertToString(internalValue.z()/valueOfUnit),
412             G4String unitCategory = G4UnitDefi << 378      standardUnit,
413             if (fUnitCategories->find(unitCate << 379      fpDefinitions->find(valueName)->second.GetDesc()+"-Z");
414               G4String standardUnit = (*fStand << 380       } else {
415               G4double valueOfStandardUnit =   << 381         G4double internalValue =
416                 G4UnitDefinition::GetValueOf(s << 382     G4UIcommand::ConvertToDimensionedDouble(valueAndUnit);
417 //              G4String exstr = iDef->second. << 383         AddValuesAndDefs
418               if (valueType == "G4ThreeVector" << 384     (standardValues,standardDefinitions,
419                 G4ThreeVector internalValue =  << 385      valueName,valueName,
420                   G4UIcommand::ConvertToDimens << 386      G4UIcommand::ConvertToString(internalValue/valueOfUnit),
421                 AddValuesAndDefs               << 387      standardUnit);
422                   (standardValues,standardDefi << 388       }
423                    valueName,valueName+"-X",   << 389     }
424                    G4UIcommand::ConvertToStrin << 390   }
425                    (internalValue.x()/valueOfS << 
426                    standardUnit,               << 
427                    fpDefinitions->find(valueNa << 
428                 AddValuesAndDefs               << 
429                   (standardValues,standardDefi << 
430                    valueName,valueName+"-Y",   << 
431                    G4UIcommand::ConvertToStrin << 
432                    (internalValue.y()/valueOfS << 
433                    standardUnit,               << 
434                    fpDefinitions->find(valueNa << 
435                 AddValuesAndDefs               << 
436                   (standardValues,standardDefi << 
437                    valueName,valueName+"-Z",   << 
438                    G4UIcommand::ConvertToStrin << 
439                    (internalValue.z()/valueOfS << 
440                    standardUnit,               << 
441                    fpDefinitions->find(valueNa << 
442               } else {                         << 
443                 G4double internalValue =       << 
444                   G4UIcommand::ConvertToDimens << 
445                 AddValuesAndDefs               << 
446                   (standardValues,standardDefi << 
447                    valueName,valueName,        << 
448                    G4UIcommand::ConvertToStrin << 
449                    (internalValue/valueOfStand << 
450                    standardUnit);              << 
451               }                                << 
452             }                                  << 
453           }                                    << 
454         }                                      << 
455       }                                           391       }
456     }                                             392     }
457   }                                            << 
458   if (error) {                                 << 
459     G4cerr << "G4AttCheck::Standard: Conversio << 
460   }                                               393   }
461   return error;                                   394   return error;
462 }                                                 395 }
463                                                   396