49 xercesc::XMLPlatformUtils::Initialize();
54 : urcode(true), strip(true)
60 xercesc::XMLPlatformUtils::Initialize();
66 : urcode(true), uwcode(true), strip(true)
72 xercesc::XMLPlatformUtils::Initialize();
78 xercesc::XMLPlatformUtils::Terminate();
94void G4GDMLParser::ImportRegions()
98 for(
auto iaux = auxInfoList->cbegin(); iaux != auxInfoList->cend(); ++iaux)
100 if(iaux->type !=
"Region")
114 "Invalid definition of geometrical region!");
121 for(
auto raux = iaux->auxList->cbegin();
122 raux != iaux->auxList->cend(); ++raux)
133 auto pos = store->
GetMap().find(volname);
134 if(pos != store->
GetMap().cend())
141 if (
pos->second.size()>1)
143 std::ostringstream message;
144 message <<
"There exists more than ONE logical volume "
145 <<
"in store named: " << volname <<
"." <<
G4endl
146 <<
"NOTE: assigning all such volumes as root logical "
147 <<
"volumes for region: " <<
name <<
"!";
151 for (
auto vpos =
pos->second.cbegin();
152 vpos !=
pos->second.cend(); ++vpos)
161 std::ostringstream message;
162 message <<
"Volume NOT found in store !" <<
G4endl
163 <<
" Volume " << volname <<
" NOT found in store !"
165 <<
" No region is being set.";
170 else if(
tag ==
"pcut")
172 const G4String& cvalue = raux->value;
176 G4Exception(
"G4GDMLParser::ImportRegions()",
"InvalidRead",
183 else if(
tag ==
"ecut")
185 const G4String& cvalue = raux->value;
189 G4Exception(
"G4GDMLParser::ImportRegions()",
"InvalidRead",
196 else if(
tag ==
"poscut")
198 const G4String& cvalue = raux->value;
202 G4Exception(
"G4GDMLParser::ImportRegions()",
"InvalidRead",
209 else if(
tag ==
"gamcut")
211 const G4String& cvalue = raux->value;
215 G4Exception(
"G4GDMLParser::ImportRegions()",
"InvalidRead",
222 else if(
tag ==
"ulimits")
225 G4double uekinMin = 0., urangMin = 0.;
226 const G4String& ulname = raux->value;
227 for(
auto uaux = raux->auxList->cbegin();
228 uaux != raux->auxList->cend(); ++uaux)
231 const G4String& uvalue = uaux->value;
234 if(ultag ==
"ustepMax")
238 else if(ultag ==
"utrakMax")
242 else if(ultag ==
"utimeMax")
246 else if(ultag ==
"uekinMin")
250 else if(ultag ==
"urangMin")
256 G4Exception(
"G4GDMLParser::ImportRegions()",
"ReadError",
261 ulname, ustepMax, utrakMax, utimeMax, uekinMin, urangMin);
272void G4GDMLParser::ExportRegions(
G4bool storeReferences)
276 for(std::size_t i = 0; i < rstore->size(); ++i)
279 const G4String& tname = (*rstore)[i]->GetName();
285 auto rlvol_iter = (*rstore)[i]->GetRootLogicalVolumeIterator();
286 for(std::size_t j = 0; j < (*rstore)[i]->GetNumberOfRootVolumes(); ++j)
297 rlist->push_back(rsubaux);
301 = (*rstore)[i]->GetProductionCuts()->GetProductionCut(
"gamma");
304 rlist->push_back(caux1);
305 G4double e_cut = (*rstore)[i]->GetProductionCuts()->GetProductionCut(
"e-");
308 rlist->push_back(caux2);
310 = (*rstore)[i]->GetProductionCuts()->GetProductionCut(
"e+");
313 rlist->push_back(caux3);
315 = (*rstore)[i]->GetProductionCuts()->GetProductionCut(
"proton");
318 rlist->push_back(caux4);
319 if((*rstore)[i]->GetUserLimits())
323 const G4String& utype = (*rstore)[i]->GetUserLimits()->GetType();
326 = (*rstore)[i]->GetUserLimits()->GetMaxAllowedStep(fake_trk);
329 ullist->push_back(ulaux1);
331 = (*rstore)[i]->GetUserLimits()->GetUserMaxTrackLength(fake_trk);
334 ullist->push_back(ulaux2);
336 = (*rstore)[i]->GetUserLimits()->GetUserMaxTime(fake_trk);
339 ullist->push_back(ulaux3);
341 = (*rstore)[i]->GetUserLimits()->GetUserMinEkine(fake_trk);
344 ullist->push_back(ulaux4);
346 = (*rstore)[i]->GetUserLimits()->GetUserMinRange(fake_trk);
349 ullist->push_back(ulaux5);
350 rlist->push_back(uaux);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
G4double Evaluate(const G4String &)
G4String ConvertToString(G4int ival)
const G4GDMLAuxListType * GetAuxList() const
void AddAuxiliary(G4GDMLAuxStructType myaux)
void StripName(G4String &) const
G4String GenerateName(const G4String &, const void *const)
const std::map< G4String, std::vector< G4LogicalVolume * > > & GetMap() const
static G4LogicalVolumeStore * GetInstance()
const G4String & GetName() const
void SetProductionCut(G4double cut, G4int index)
G4bool IsReflected(G4LogicalVolume *lv) const
G4LogicalVolume * GetReflectedLV(G4LogicalVolume *lv) const
static G4ReflectionFactory * Instance()
G4bool IsConstituent(G4LogicalVolume *lv) const
static G4RegionStore * GetInstance()
void SetProductionCuts(G4ProductionCuts *cut)
void SetUserLimits(G4UserLimits *ul)
void AddRootLogicalVolume(G4LogicalVolume *lv, G4bool search=true)
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)
const char * name(G4int ptype)
G4bool contains(const G4String &str, std::string_view ss)
Check if a string contains a given substring.