174std::string str_replace(
const std::string &str,
const std::string &pattern,
const std::string &replacement)
176 std::string res = str;
177 for (
size_t id = res.find(pattern);
id != std::string::npos;
id = res.find(pattern))
178 res.replace(
id, pattern.length(), replacement);
183std::string make_NCName(
const std::string &in)
185 std::string res = str_replace(in,
"/",
"_");
186 res = str_replace(res,
"#",
"_");
191struct MaterialExtractor {
192 std::set<TGeoMaterial *> materials;
195 materials.insert(
v->GetMaterial());
196 for (
Int_t i = 0; i <
v->GetNdaughters(); ++i)
197 (*
this)(
v->GetNode(i)->GetVolume());
207 fIsotopeList(nullptr),
208 fElementList(nullptr),
213 fgG4Compatibility(false),
217 fDefineNode(nullptr),
218 fMaterialsNode(nullptr),
219 fSolidsNode(nullptr),
220 fStructureNode(nullptr),
269 Info(
"WriteGDMLfile",
"Top volume does not exist!");
282 TList materials, volumes, nodes;
283 MaterialExtractor extract;
285 Info(
"WriteGDMLfile",
"Invalid Volume reference to extract GDML information!");
297 materials.
Clear(
"nodelete");
298 volumes.
Clear(
"nodelete");
299 nodes.
Clear(
"nodelete");
312 if (
option.Contains(
"g")) {
314 Info(
"WriteGDMLfile",
"Geant4 compatibility mode set");
318 if (
option.Contains(
"f")) {
320 Info(
"WriteGDMLfile",
"Fast naming convention with pointer suffix set");
321 }
else if (
option.Contains(
"n")) {
323 Info(
"WriteGDMLfile",
"Naming without prefix set - be careful uniqness of name is not ensured");
326 Info(
"WriteGDMLfile",
"Potentially slow with incremental suffix naming convention set");
341 Int_t outputLayout = 1;
342 const char *krootNodeName =
"gdml";
343 const char *knsRefGeneral =
"http://www.w3.org/2001/XMLSchema-instance";
344 const char *knsNameGeneral =
"xsi";
345 const char *knsRefGdml =
"http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd";
346 const char *knsNameGdml =
"xsi:noNamespaceSchemaLocation";
360 fGdmlE->
NewNS(rootNode, knsRefGeneral, knsNameGeneral);
400 startT = time(
nullptr);
405 Info(
"WriteGDMLfile",
"Extracting volumes");
408 Info(
"WriteGDMLfile",
"%i volumes added",
fVolCnt);
413 endT = time(
nullptr);
421 Double_t tdiffI = difftime(endT, startT);
423 Info(
"WriteGDMLfile",
"Exporting time: %s", tdiffS.
Data());
444 TIter next(matrixList);
524 Warning(
"ExtractBorderSurfaces",
525 "Inconsistent border surface extraction %s: Node %s"
526 " is not part of GDML!",
530 Warning(
"ExtractBorderSurfaces",
531 "Inconsistent border surface extraction %s: Node %s"
532 " is not part of GDML!",
548 Info(
"ExtractMaterials",
"Extracting materials");
554 TIter next(materialsLst);
558 std::string dummy_nam = dummy_mat ? dummy_mat->
GetName() :
"dummy";
562 std::string mname = lmaterial->
GetName();
564 Info(
"ExtractMaterials",
"Skip dummy material: %s", dummy_nam.c_str());
580 Info(
"ExtractMaterials",
"%i materials added", matcnt);
593 if (solidN !=
nullptr)
609 TString volname, matname, solname, pattClsName, nodeVolNameBak;
635 if (solname ==
"-1") {
636 Info(
"ExtractVolumes",
"ERROR! %s volume was not added, because solid is either not supported or corrupted",
663 while ((geoNode = (
TGeoNode *)next())) {
674 if (nodevolname.
Contains(
"missing_")) {
678 nodeVolNameBak = nodevolname;
681 if (isPattern ==
kFALSE) {
683 TString nodename, posname, rotname;
685 nodename = nodename +
"in" + volname;
688 posname = nodename +
"pos";
710 fGdmlE->
NewAttr(scaleN,
nullptr,
"name", (nodename +
"scl").Data());
727 if ((lxyz.
x != 0.0) || (lxyz.
y != 0.0) || (lxyz.
z != 0.0)) {
728 rotname = nodename +
"rot";
742 if (isPattern && pattFinder) {
844 for (
Int_t idx = 0; idx < nOfIso; idx++) {
847 Fatal(
"CreateElementN",
"Missing isotopes for element %s", element->
GetName());
872 for (NameListI::iterator itr = wCounter.begin(); itr != wCounter.end(); ++itr) {
873 if (itr->second > 1) {
874 Info(
"CreateMixtureN",
"WARNING! 2 equal isotopes in one element. Check: %s isotope of %s element",
875 itr->first.Data(),
name);
882 Int_t valZ = element->
Z();
887 Int_t valN = element->
N();
905 TIter next(&properties);
912 if (const_properties.
GetSize()) {
913 TIter next(&const_properties);
927 for (
Int_t idx = 0; idx < nOfElm; idx++) {
939 wPercentage[lname] += mixture->
GetWmixt()[idx];
953 for (NameListI::iterator itr = wCounter.begin(); itr != wCounter.end(); ++itr) {
954 if (itr->second > 1) {
955 Info(
"CreateMixtureN",
"WARNING! 2 equal elements in one material. Check: %s element of %s material",
956 itr->first.Data(), mname.
Data());
978 if (tmpname ==
"vacuum") {
982 Info(
"CreateMaterialN",
983 "WARNING! value of Z in %s material can't be < 1 in Geant4, that is why it was changed to 1, please "
984 "check it manually! ",
988 Info(
"CreateMaterialN",
"WARNING! value of Z in %s material can't be < 1 in Geant4", mname.
Data());
997 TIter next(&properties);
1004 if (const_properties.
GetSize()) {
1005 TIter next(&const_properties);
1203 if ((geoShape->
GetBl1() == 0 || geoShape->
GetTl1() == 0 || geoShape->
GetH1() == 0) ||
1204 (geoShape->
GetBl2() == 0 || geoShape->
GetTl2() == 0 || geoShape->
GetH2() == 0)) {
1249 if ((geoShape->
GetBl1() == 0 && geoShape->
GetTl1() == 0 && geoShape->
GetH1() == 0) ||
1250 (geoShape->
GetBl2() == 0 && geoShape->
GetTl2() == 0 && geoShape->
GetH2() == 0)) {
1267 mainN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"twistedtrap",
nullptr);
1289 Info(
"CreateTwistedTrapN",
1290 "ERROR! Object %s is not exported correctly because parameter Alpha2 is not declared in GDML schema",
1394 Info(
"CreateCutTubeN",
"WARNING! %s - CutTube was replaced by intersection of TGeoTubSeg and two TGeoBBoxes",
1472 for (
Int_t it = 0; it < nZPlns; it++) {
1476 if ((it < nZPlns - 1) && (geoShape->
GetZ(it) == geoShape->
GetZ(it + 1))) {
1486 Info(
"CreatePolyconeN",
"WARNING! One plane was added to %s solid to be compatible with Geant4",
1489 Info(
"CreatePolyconeN",
"WARNING! Solid %s definition seems not contiguous may cause problems in Geant4",
1502 Info(
"CreatePolyconeN",
"WARNING! One plane was added to %s solid to be compatible with Geant4",
1505 Info(
"CreatePolyconeN",
"WARNING! Solid %s definition seems not contiguous may cause problems in Geant4",
1554 for (
Int_t it = 0; it < geoShape->
GetNz(); it++) {
1623 if (vertNum < 3 || secNum < 2) {
1624 Info(
"CreateXtrusionN",
"ERROR! TGeoXtru %s has only %i vertices and %i sections. It was not exported",
1625 lname.
Data(), vertNum, secNum);
1629 for (
Int_t it = 0; it < vertNum; it++) {
1631 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"twoDimVertex",
nullptr);
1636 for (
Int_t it = 0; it < secNum; it++) {
1675 Double_t zcut1 = 2 * zorig - zcut2;
1700 Double_t zmax = zcut * ((rx1 + rx2) / (rx1 - rx2));
1727 nodPos.
x = vertex[0];
1728 nodPos.
y = vertex[1];
1729 nodPos.
z = vertex[2];
1740 auto facet = geoShape->
GetFacet(it);
1741 bool triangular = facet.
GetNvert() == 3;
1742 TString ntype = (triangular) ?
"triangular" :
"quadrangular";
1771 if (unscaledN !=
nullptr) {
1775 if (uname.
Contains(
"missing_") || uname ==
"") {
1776 Info(
"CreateScaledN",
"ERROR! Unscaled node is NULL - Scaled shape will be skipped");
1787 mainN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"scaledSolid",
nullptr);
1791 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"solidref",
nullptr);
1797 fGdmlE->
NewAttr(childN,
nullptr,
"name", (nodeName +
"scl").Data());
1832 if (strcmp(leftS->
ClassName(),
"TGeoScaledShape") == 0 && strcmp(rightS->
ClassName(),
"TGeoBBox") == 0) {
1834 if (lboolType ==
"intersection") {
1841 Xyz translL, translR;
1859 if (ndL !=
nullptr) {
1863 if (lname.
Contains(
"missing_") || lname ==
"") {
1864 Info(
"CreateCommonBoolN",
"ERROR! Left node is NULL - Boolean Shape will be skipped");
1868 if (ndR !=
nullptr) {
1872 if (rname.
Contains(
"missing_") || rname ==
"") {
1873 Info(
"CreateCommonBoolN",
"ERROR! Right node is NULL - Boolean Shape will be skipped");
1902 if ((translL.
x != 0.0) || (translL.
y != 0.0) || (translL.
z != 0.0)) {
1907 if ((lrot.
x != 0.0) || (lrot.
y != 0.0) || (lrot.
z != 0.0)) {
1908 childN =
CreateRotationN((nodeName + lname +
"rot").Data(), lrot,
"firstrotation");
1912 if ((translR.
x != 0.0) || (translR.
y != 0.0) || (translR.
z != 0.0)) {
1917 if ((rrot.
x != 0.0) || (rrot.
y != 0.0) || (rrot.
z != 0.0)) {
1918 childN =
CreateRotationN((nodeName + rname +
"rot").Data(), rrot,
"rotation");
1932 std::string
name = make_NCName(geoSurf->
GetName());
1942 TIter next(&properties);
1956 std::string
name = make_NCName(geoSurf->
GetName());
1976 std::string
name = make_NCName(geoSurf->
GetName());
1988 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"physvolref",
nullptr);
2030 std::stringstream vals;
2031 size_t cols = matrix->
GetCols();
2032 size_t rows = matrix->
GetRows();
2036 for (
size_t i = 0; i < rows; ++i) {
2037 for (
size_t j = 0; j < cols; ++j) {
2038 vals << matrix->
Get(i, j);
2045 fGdmlE->
NewAttr(mainN,
nullptr,
"values", vals.str().c_str());
2084 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"materialref",
nullptr);
2088 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"solidref",
nullptr);
2118 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"volumeref",
nullptr);
2122 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"positionref",
nullptr);
2127 if (strcmp(rotref,
"") != 0) {
2128 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"rotationref",
nullptr);
2132 if (scaleN !=
nullptr) {
2143 const char *unit,
const char *volref)
2154 if ((
offset >= 0.) && (strcmp(axis,
"kPhi") == 0)) {
2158 offset = (offsetI % 360) + decimals - 360;
2165 if (strcmp(volref,
"") != 0) {
2166 childN =
fGdmlE->
NewChild(
nullptr,
nullptr,
"volumeref",
nullptr);
2179 const char *clsname = geoShape->
ClassName();
2187 if (strcmp(clsname,
"TGeoBBox") == 0) {
2189 }
else if (strcmp(clsname,
"TGeoParaboloid") == 0) {
2191 }
else if (strcmp(clsname,
"TGeoSphere") == 0) {
2193 }
else if (strcmp(clsname,
"TGeoArb8") == 0) {
2195 }
else if (strcmp(clsname,
"TGeoConeSeg") == 0) {
2197 }
else if (strcmp(clsname,
"TGeoCone") == 0) {
2199 }
else if (strcmp(clsname,
"TGeoPara") == 0) {
2201 }
else if (strcmp(clsname,
"TGeoTrap") == 0) {
2203 }
else if (strcmp(clsname,
"TGeoGtra") == 0) {
2205 }
else if (strcmp(clsname,
"TGeoTrd1") == 0) {
2207 }
else if (strcmp(clsname,
"TGeoTrd2") == 0) {
2209 }
else if (strcmp(clsname,
"TGeoTubeSeg") == 0) {
2211 }
else if (strcmp(clsname,
"TGeoCtub") == 0) {
2213 }
else if (strcmp(clsname,
"TGeoTube") == 0) {
2215 }
else if (strcmp(clsname,
"TGeoPcon") == 0) {
2217 }
else if (strcmp(clsname,
"TGeoTorus") == 0) {
2219 }
else if (strcmp(clsname,
"TGeoPgon") == 0) {
2221 }
else if (strcmp(clsname,
"TGeoEltu") == 0) {
2223 }
else if (strcmp(clsname,
"TGeoHype") == 0) {
2225 }
else if (strcmp(clsname,
"TGeoXtru") == 0) {
2227 }
else if (strcmp(clsname,
"TGeoTessellated") == 0) {
2229 }
else if (strcmp(clsname,
"TGeoScaledShape") == 0) {
2231 }
else if (strcmp(clsname,
"TGeoCompositeShape") == 0) {
2233 }
else if (strcmp(clsname,
"TGeoUnion") == 0) {
2235 }
else if (strcmp(clsname,
"TGeoIntersection") == 0) {
2237 }
else if (strcmp(clsname,
"TGeoSubtraction") == 0) {
2240 Info(
"ChooseObject",
"ERROR! %s Solid CANNOT be processed, solid is NOT supported", clsname);
2243 if (solidN ==
nullptr) {
2266 if (cosb > 0.00001) {
2303 Double_t boxdx = 1E8 * (2 * rmax) + (2 * z);
2362 Bool_t isIN = list[name2check];
2390 TString fstLet = newname(0, 1);
2392 newname =
"O" + newname(1, newname.
Length());
2403 if (newname != oldname) {
2405 Info(
"GenName",
"WARNING! Name of the object was changed because it failed to comply with NCNAME xml datatype "
2408 Info(
"GenName",
"WARNING! Probably more names are going to be changed to comply with NCNAME xml datatype "
2409 "restriction, but it will not be displayed on the screen.");
2426 newname = newname + nameIter;
2445 return !(isProcessed);
2457 if (strcmp(pattName,
"TGeoPatternX") == 0) {
2459 }
else if (strcmp(pattName,
"TGeoPatternCylR") == 0) {
2464 if (strcmp(pattName,
"TGeoPatternY") == 0) {
2466 }
else if (strcmp(pattName,
"TGeoPatternCylPhi") == 0) {
2472 if (strcmp(pattName,
"TGeoPatternZ") == 0) {
2476 default:
return "kUndefined";
break;
2478 return "kUndefined";
2486 if (parValue == 0.) {
2487 Info(
"IsNullParam",
"ERROR! %s is NULL due to %s = %.12g, Volume based on this shape will be skipped",
2488 objName.
Data(), parName.
Data(), parValue);
2518 TList materials, volumes, nodes;
2519 MaterialExtractor extract;
2521 Info(
"WriteGDMLfile",
"Invalid Volume reference to extract GDML information!");
2533 materials.
Clear(
"nodelete");
2534 volumes.
Clear(
"nodelete");
2535 nodes.
Clear(
"nodelete");
2548 if (
option.Contains(
"g")) {
2550 Info(
"WriteGDMLfile",
"Geant4 compatibility mode set");
2554 if (
option.Contains(
"f")) {
2556 Info(
"WriteGDMLfile",
"Fast naming convention with pointer suffix set");
2557 }
else if (
option.Contains(
"n")) {
2559 Info(
"WriteGDMLfile",
"Naming without prefix set - be careful uniqness of name is not ensured");
2562 Info(
"WriteGDMLfile",
"Potentially slow with incremental suffix naming convention set");
2566 Int_t outputLayout = 1;
2567 const char *krootNodeName =
"gdml";
2568 const char *knsRefGeneral =
"http://www.w3.org/2001/XMLSchema-instance";
2569 const char *knsNameGeneral =
"xsi";
2570 const char *knsRefGdml =
"http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd";
2571 const char *knsNameGdml =
"xsi:noNamespaceSchemaLocation";
2585 fGdmlE->
NewNS(rootNode, knsRefGeneral, knsNameGeneral);
2586 fGdmlE->
NewAttr(rootNode,
nullptr, knsNameGdml, knsRefGdml);
2624 time_t startT, endT;
2625 startT = time(
nullptr);
2630 Info(
"WriteGDMLfile",
"Extracting volumes");
2632 Info(
"WriteGDMLfile",
"%i solids added",
fSolCnt);
2633 Info(
"WriteGDMLfile",
"%i volumes added",
fVolCnt);
2638 endT = time(
nullptr);
2646 Double_t tdiffI = difftime(endT, startT);
2648 Info(
"WriteGDMLfile",
"Exporting time: %s", tdiffS.
Data());
2667 TString volname, matname, solname, pattClsName, nodeVolNameBak;
2691 if (solname ==
"-1") {
2692 Info(
"ExtractVolumes",
"ERROR! %s volume was not added, because solid is either not supported or corrupted",
2714 TIter next(nodeLst);
2719 while ((geoNode = (
TGeoNode *)next())) {
2729 if (nodevolname.
Contains(
"missing_")) {
2733 nodeVolNameBak = nodevolname;
2736 if (isPattern ==
kFALSE) {
2738 TString nodename, posname, rotname;
2740 nodename = nodename +
"in" + volname;
2743 posname = nodename +
"pos";
2765 fGdmlE->
NewAttr(scaleN,
nullptr,
"name", (nodename +
"scl").Data());
2782 if ((lxyz.
x != 0.0) || (lxyz.
y != 0.0) || (lxyz.
z != 0.0)) {
2783 rotname = nodename +
"rot";
2797 if (isPattern && pattFinder) {
2799 Int_t ndiv, divaxis;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t atom
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TGeoManager * gGeoManager
TRObject operator()(const T1 &t1) const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
This class is used in the process of reading and writing the GDML "matrix" tag.
Double_t Get(size_t r, size_t c) const
This class contains implementation of converting ROOT's gGeoManager geometry to GDML file.
XMLNodePointer_t fSolidsNode
void UnsetTemporaryBits(TGeoManager *geoMng)
Unsetting bits that were changed in gGeoManager during export so that export can be run more times wi...
std::map< TString, Bool_t > NameList
XMLNodePointer_t CreateDivisionN(Double_t offset, Double_t width, Int_t number, const char *axis, const char *unit, const char *volref)
Creates "divisionvol" node for GDML.
static const UInt_t fgkProcBitVol
XMLNodePointer_t CreatePolyconeN(TGeoPcon *geoShape)
Creates "polycone" node for GDML.
XMLNodePointer_t CreateFractionN(Double_t percentage, const char *refName)
Creates "fraction" node for GDML.
void ExtractMatrices(TObjArray *matrices)
Method exporting GDML matrices.
XMLDocPointer_t fGdmlFile
void SetG4Compatibility(Bool_t G4Compatible)
XMLNodePointer_t CreateParaboloidN(TGeoParaboloid *geoShape)
Creates "paraboloid" node for GDML.
TGeoCompositeShape * CreateFakeCtub(TGeoCtub *geoShape)
Method creating cutTube as an intersection of tube and two boxes.
TGDMLWrite()
Default constructor.
Int_t fIgnoreDummyMaterial
XMLNodePointer_t CreateBoxN(TGeoBBox *geoShape)
Creates "box" node for GDML.
std::map< TString, Float_t > NameListF
XMLNodePointer_t CreateMaterialN(TGeoMaterial *material, TString mname)
Creates "material" node for GDML.
XMLNodePointer_t CreateSphereN(TGeoSphere *geoShape)
Creates "sphere" node for GDML.
XMLNodePointer_t CreateTwistedTrapN(TGeoGtra *geoShape)
Creates "twistedtrap" node for GDML.
XMLNodePointer_t CreateZplaneN(Double_t z, Double_t rmin, Double_t rmax)
Creates "zplane" node for GDML.
static const UInt_t fgkMaxNameErr
Bool_t IsNullParam(Double_t parValue, TString parName, TString objName)
Check for null parameter to skip the NULL objects.
static TGDMLWrite * fgGDMLWrite
TString ExtractSolid(TGeoShape *volShape)
Method creating solid to xml file and returning its name.
XMLNodePointer_t CreateHypeN(TGeoHype *geoShape)
Creates "hype" node for GDML.
XMLNodePointer_t CreateElConeN(TGeoScaledShape *geoShape)
Creates "elcone" (elliptical cone) node for GDML this is a special case, because elliptical cone is n...
XMLNodePointer_t CreateConstantN(const char *name, Double_t value)
Creates "constant" kind of node for GDML.
XMLNodePointer_t CreateMatrixN(TGDMLMatrix const *matrix)
Creates "matrix" kind of node for GDML.
XMLNodePointer_t CreateOpticalSurfaceN(TGeoOpticalSurface *geoSurf)
Creates "opticalsurface" node for GDML.
XMLNodePointer_t CreateMixtureN(TGeoMixture *mixture, XMLNodePointer_t materials, TString mname)
Creates "material" node for GDML with references to other sub elements.
std::map< TString, Int_t > NameListI
void ExtractBorderSurfaces(TObjArray *surfaces)
Method exporting border surfaces.
static const UInt_t fgkProcBit
floating point precision when writing
Bool_t CanProcess(TObject *pointer)
Method which tests whether solids can be processed.
XMLNodePointer_t CreatePolyhedraN(TGeoPgon *geoShape)
Creates "polyhedra" node for GDML.
void WriteGDMLfile(TGeoManager *geomanager, const char *filename="test.gdml", TString option="")
XMLNodePointer_t CreateRotationN(const char *name, Xyz rotation, const char *type="rotation", const char *unit="deg")
Creates "rotation" kind of node for GDML.
XMLNodePointer_t CreatePropertyN(TNamed const &property)
Creates "property" node for GDML.
XMLNodePointer_t CreateElementN(TGeoElement *element, XMLNodePointer_t materials, const char *name)
Creates "element" node for GDML element node and attribute.
XMLNodePointer_t CreateConeN(TGeoConeSeg *geoShape)
Creates "cone" node for GDML from TGeoConeSeg object.
XMLNodePointer_t CreateSkinSurfaceN(TGeoSkinSurface *geoSurf)
Creates "skinsurface" node for GDML.
XMLNodePointer_t CreateTessellatedN(TGeoTessellated *geoShape)
Creates "tessellated" (tessellated shape) node for GDML.
XMLNodePointer_t CreateCutTubeN(TGeoCtub *geoShape)
Creates "cutTube" node for GDML.
XMLNodePointer_t fStructureNode
void ExtractSkinSurfaces(TObjArray *surfaces)
Method exporting skin surfaces.
XMLNodePointer_t fDefineNode
XMLNodePointer_t CreateTorusN(TGeoTorus *geoShape)
Creates "torus" node for GDML.
XMLNodePointer_t CreatePositionN(const char *name, Xyz position, const char *type, const char *unit)
Creates "position" kind of node for GDML.
XMLNodePointer_t ExtractMaterials(TList *materialsLst)
Method exporting materials.
XMLNodePointer_t fMaterialsNode
void ExtractOpticalSurfaces(TObjArray *surfaces)
Method exporting optical surfaces.
XMLNodePointer_t CreateDN(Double_t density, const char *unit="g/cm3")
Creates "D" density node for GDML.
void ExtractConstants(TGeoManager *geom)
Method exporting GDML matrices.
XMLNodePointer_t CreateArb8N(TGeoArb8 *geoShape)
Creates "arb8" node for GDML.
void SetFltPrecision(UInt_t prec)
XMLNodePointer_t StartVolumeN(const char *name, const char *solid, const char *material)
Creates "volume" node for GDML.
void SetNamingSpeed(ENamingType naming)
Set convention of naming solids and volumes.
TString GetPattAxis(Int_t divAxis, const char *pattName, TString &unit)
Method that retrieves axis and unit along which object is divided.
TString GenName(TString oldname)
NCNAME basic restrictions Replace "$" character with empty character etc.
XMLNodePointer_t CreateXtrusionN(TGeoXtru *geoShape)
Creates "xtru" node for GDML.
XMLNodePointer_t CreatePhysVolN(const char *name, Int_t copyno, const char *volref, const char *posref, const char *rotref, XMLNodePointer_t scaleN)
Creates "physvol" node for GDML.
Bool_t IsInList(NameList list, TString name2check)
Checks whether name2check is in (NameList) list.
XMLNodePointer_t StartAssemblyN(const char *name)
Creates "assembly" node for GDML.
void SetIgnoreDummyMaterial(bool value)
Ignore dummy material instance, which causes trouble reading GDML in Geant4.
~TGDMLWrite() override
Destructor.
XMLNodePointer_t CreateParaN(TGeoPara *geoShape)
Creates "para" node for GDML.
XMLNodePointer_t CreateSetupN(const char *topVolName, const char *name="default", const char *version="1.0")
Creates "setup" node for GDML.
XMLNodePointer_t CreateTrapN(TGeoTrap *geoShape)
Creates "trap" node for GDML.
Xyz GetXYZangles(const Double_t *rotationMatrix)
Retrieves X Y Z angles from rotation matrix.
XMLNodePointer_t CreateTubeN(TGeoTubeSeg *geoShape)
Creates "tube" node for GDML from object TGeoTubeSeg.
XMLNodePointer_t CreateBorderSurfaceN(TGeoBorderSurface *geoSurf)
Creates "bordersurface" node for GDML.
XMLNodePointer_t CreateAtomN(Double_t atom, const char *unit="g/mole")
Creates "atom" node for GDML.
XMLNodePointer_t CreateEltubeN(TGeoEltu *geoShape)
Creates "eltube" node for GDML.
void ExtractVolumes(TGeoNode *topNode)
Method extracting geometry structure recursively.
XMLNodePointer_t CreateEllipsoidN(TGeoCompositeShape *geoShape, TString elName)
Creates "ellipsoid" node for GDML this is a special case, because ellipsoid is not defined in ROOT so...
XMLNodePointer_t CreateIsotopN(TGeoIsotope *isotope, const char *name)
Creates "isotope" node for GDML.
XMLNodePointer_t CreateCommonBoolN(TGeoCompositeShape *geoShape)
Creates common part of union intersection and subtraction nodes.
XMLNodePointer_t CreateTrdN(TGeoTrd1 *geoShape)
Creates "trd" node for GDML from object TGeoTrd1.
XMLNodePointer_t CreateScaledN(TGeoScaledShape *geoShape)
Creates a scaled node for GDML.
XMLNodePointer_t ChooseObject(TGeoShape *geoShape)
Chooses the object and method that should be used for processing object.
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Bool_t TestAttBit(UInt_t f) const
virtual const Double_t * GetOrigin() const
virtual Double_t GetDX() const
virtual Double_t GetDZ() const
virtual Double_t GetDY() const
virtual EGeoBoolType GetBooleanOperator() const =0
TGeoMatrix * GetRightMatrix() const
TGeoShape * GetLeftShape() const
TGeoMatrix * GetLeftMatrix() const
TGeoShape * GetRightShape() const
TGeoNode const * GetNode2() const
TGeoOpticalSurface const * GetSurface() const
TGeoNode const * GetNode1() const
Class describing rotation + translation.
Composite shapes are Boolean combinations of two or more shape components.
TGeoBoolNode * GetBoolNode() const
A cone segment is a cone having a range in phi.
The cones are defined by 5 parameters:
virtual Double_t GetRmax2() const
virtual Double_t GetDz() const
virtual Double_t GetRmin2() const
virtual Double_t GetRmin1() const
virtual Double_t GetRmax1() const
The cut tubes constructor has the form:
const Double_t * GetNlow() const
const Double_t * GetNhigh() const
Base class for chemical elements.
Int_t GetNisotopes() const
Bool_t HasIsotopes() const
Double_t GetRelativeAbundance(Int_t i) const
Return relative abundance of i-th isotope in this element.
TGeoIsotope * GetIsotope(Int_t i) const
Return i-th isotope in the element.
An elliptical tube is defined by the two semi-axes A and B.
virtual Double_t GetA() const
virtual Double_t GetB() const
Double_t GetTwistAngle() const
const Double_t * GetRotationMatrix() const override
A hyperboloid is represented as a solid limited by two planes perpendicular to the Z axis (top and bo...
Double_t GetStOut() const
The manager class for any TGeo geometry.
static EDefaultUnits GetDefaultUnits()
TObjArray * GetListOfVolumes() const
TObjArray * GetListOfSkinSurfaces() const
TObjArray * GetListOfGDMLMatrices() const
Int_t GetNproperties() const
TObjArray * GetListOfBorderSurfaces() const
TGeoNode * GetTopNode() const
Double_t GetProperty(const char *name, Bool_t *error=nullptr) const
Get a user-defined property.
static UInt_t GetExportPrecision()
TObjArray * GetListOfOpticalSurfaces() const
TList * GetListOfMaterials() const
Base class describing materials.
virtual Bool_t IsMixture() const
TList const & GetConstProperties() const
TList const & GetProperties() const
virtual Double_t GetA() const
virtual Double_t GetDensity() const
virtual Double_t GetZ() const
Geometrical transformation package.
virtual const Double_t * GetTranslation() const =0
Bool_t IsReflection() const
virtual const Double_t * GetRotationMatrix() const =0
virtual TGeoHMatrix Inverse() const =0
Media are used to store properties related to tracking and which are useful only when using geometry ...
TGeoMaterial * GetMaterial() const
Int_t GetNelements() const override
Double_t * GetWmixt() const
TGeoElement * GetElement(Int_t i=0) const override
Retrieve the pointer to the element corresponding to component I.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
TGeoVolume * GetVolume() const
virtual TGeoMatrix * GetMatrix() const =0
This is a wrapper class to G4OpticalSurface.
TList const & GetProperties() const
static const char * ModelToString(ESurfaceModel model)
static const char * TypeToString(ESurfaceType type)
ESurfaceModel GetModel() const
ESurfaceFinish GetFinish() const
static const char * FinishToString(ESurfaceFinish finish)
Double_t GetValue() const
ESurfaceType GetType() const
Double_t GetAlpha() const
Double_t GetTheta() const
A paraboloid is defined by the revolution surface generated by a parabola and is bounded by two plane...
Base finder class for patterns.
virtual Int_t GetDivAxis()
Double_t GetStart() const
A polycone is represented by a sequence of tubes/cones, glued together at defined Z planes.
Double_t * GetRmax() const
Double_t * GetRmin() const
Polygons are defined in the same way as polycones, the difference being just that the segments betwee...
Class describing rotations.
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
Set matrix elements according to Euler angles.
const Double_t * GetScale() const override
A shape scaled by a TGeoScale transformation.
TGeoShape * GetShape() const
TGeoScale * GetScale() const
Base abstract class for all shapes.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
const char * GetName() const override
Get the shape name.
TGeoVolume const * GetVolume() const
TGeoOpticalSurface const * GetSurface() const
TGeoSphere are not just balls having internal and external radii, but sectors of a sphere having defi...
virtual Double_t GetRmin() const
Double_t GetTheta2() const
virtual Double_t GetRmax() const
Double_t GetTheta1() const
const TGeoFacet & GetFacet(int i) const
const Vertex_t & GetVertex(int i) const
The torus is defined by its axial radius, its inner and outer radius.
Class describing translations.
Double_t GetAlpha2() const
Double_t GetTheta() const
Double_t GetAlpha1() const
A trapezoid with only X varying with Z.
A trapezoid with only X varying with Z.
A tube segment is a tube having a range in phi.
virtual Double_t GetRmin() const
virtual Double_t GetDz() const
virtual Double_t GetRmax() const
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
TGeoMaterial * GetMaterial() const
TGeoPatternFinder * GetFinder() const
static TGeoMedium * DummyMedium()
TGeoShape * GetShape() const
virtual Bool_t IsAssembly() const
Returns true if the volume is an assembly or a scaled assembly.
A TGeoXtru shape is represented by the extrusion of an arbitrary polygon with fixed outline between s...
Double_t GetYOffset(Int_t i) const
Double_t GetY(Int_t i) const
Double_t GetScale(Int_t i) const
Double_t GetXOffset(Int_t i) const
Double_t GetX(Int_t i) const
void Clear(Option_t *option="") override
Remove all objects from the list.
void Add(TObject *obj) override
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Int_t GetEntriesFast() const
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void ToLower()
Change string to lower-case.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char *name, const char *content=nullptr)
create new child element for parent node
XMLAttrPointer_t NewAttr(XMLNodePointer_t xmlnode, XMLNsPointer_t, const char *name, const char *value)
creates new attribute for xmlnode, namespaces are not supported for attributes
void SaveDoc(XMLDocPointer_t xmldoc, const char *filename, Int_t layout=1)
store document content to file if layout<=0, no any spaces or newlines will be placed between xmlnode...
void FreeDoc(XMLDocPointer_t xmldoc)
frees allocated document data and deletes document itself
void AddChild(XMLNodePointer_t parent, XMLNodePointer_t child)
add child element to xmlnode
XMLNsPointer_t NewNS(XMLNodePointer_t xmlnode, const char *reference, const char *name=nullptr)
create namespace attribute for xmlnode.
XMLDocPointer_t NewDoc(const char *version="1.0")
creates new xml document with provided version
void SetSkipComments(Bool_t on=kTRUE)
void DocSetRootElement(XMLDocPointer_t xmldoc, XMLNodePointer_t xmlnode)
set main (root) node for document
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.