This class contains implementation of converting ROOT's gGeoManager geometry to GDML file.
gGeoManager is the instance of TGeoManager class containing tree of geometries creating resulting geometry. GDML is xml based format of file mirroring the tree of geometries according to GDML schema rules. For more information about GDML see http://gdml.web.cern.ch. Each object in ROOT is represented by xml tag (=xml node/element) in GDML.
This class is not needed to be instanciated. It should always be called by gGeoManager->Export("xyz.gdml") method. Export is driven by extenstion that is why ".gdml" is important in resulting name.
Whenever a new ROOT geometry object is implemented or there is a change in GDML schema this class is needed to be updated to ensure proper mapping between ROOT objects and GDML elements.
Current status of mapping ROOT -> GDML is implemented in method called TGDMLWrite::ChooseObject and it contains following "map":
Solids:
- -> <arb8 ...>
- -> <trap ...> or
- -> <arb8 ...>
- -> <subtraction ...> or
- -> <intersection ...>
Special cases of solids:
- -> element without scale
- intersection of:
Composite shapes are Boolean combinations of two or more shape components.
A shape scaled by a TGeoScale transformation.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Materials:
Base class for chemical elements.
Base class describing materials.
Structure
- -> <assembly ...>
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Base finder class for patterns.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
There are options that can be set to change resulting document
Options:
- with Geant4. It means:
- -> atomic number of material will be changed if <1 to 1
- -> if polycone is set badly it will try to export it correctly
- ->
if widht * ndiv +
offset is more then
width of
object being divided
- (in divisions) then it will be rounded so it will not exceed or
-
if kPhi divsion then it will keep range of
offset in -360 -> 0
f -
if this option is set then names of volumes and solids will have
- pointer as
a suffix to ensure uniqness of names
n -
if this option is set then names will not have suffix, but uniqness is
- of names is not secured
- -
if none of
this two options (
f,
n) is set then
default behaviour is so
- that incremental suffix is added to the names.
- (eg. TGeoBBox_0x1, TGeoBBox_0x2 ...)
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
R__EXTERN TGeoManager * gGeoManager
USAGE:
...
virtual Int_t Export(const char *filename, const char *name="", Option_t *option="vg")
Export this geometry to a file.
Note:
Options discussed above are used only for TGDMLWrite class. There are other options in the TGeoManager::Export(...) method that can be used. See that function for details.
Definition at line 56 of file TGDMLWrite.h.
|
| TGDMLWrite () |
| Default constructor.
|
|
| ~TGDMLWrite () override |
| Destructor.
|
|
void | SetG4Compatibility (Bool_t G4Compatible) |
|
void | SetIgnoreDummyMaterial (bool value) |
| Ignore dummy material instance, which causes trouble reading GDML in Geant4.
|
|
void | SetNamingSpeed (ENamingType naming) |
| Set convention of naming solids and volumes.
|
|
void | WriteGDMLfile (TGeoManager *geomanager, const char *filename="test.gdml", TString option="") |
|
void | WriteGDMLfile (TGeoManager *geomanager, TGeoNode *top_node, const char *filename="test.gdml", TString option="") |
|
void | WriteGDMLfile (TGeoManager *geomanager, TGeoVolume *top_vol, const char *filename="test.gdml", TString option="") |
|
| TObject () |
| TObject constructor.
|
|
| TObject (const TObject &object) |
| TObject copy ctor.
|
|
virtual | ~TObject () |
| TObject destructor.
|
|
void | AbstractMethod (const char *method) const |
| Use this method to implement an "abstract" method that you don't want to leave purely abstract.
|
|
virtual void | AppendPad (Option_t *option="") |
| Append graphics object to current pad.
|
|
virtual void | Browse (TBrowser *b) |
| Browse object. May be overridden for another default action.
|
|
ULong_t | CheckedHash () |
| Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object.
|
|
virtual const char * | ClassName () const |
| Returns name of class to which the object belongs.
|
|
virtual void | Clear (Option_t *="") |
|
virtual TObject * | Clone (const char *newname="") const |
| Make a clone of an object using the Streamer facility.
|
|
virtual Int_t | Compare (const TObject *obj) const |
| Compare abstract method.
|
|
virtual void | Copy (TObject &object) const |
| Copy this to obj.
|
|
virtual void | Delete (Option_t *option="") |
| Delete this object.
|
|
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
| Computes distance from point (px,py) to the object.
|
|
virtual void | Draw (Option_t *option="") |
| Default Draw method for all objects.
|
|
virtual void | DrawClass () const |
| Draw class inheritance tree of the class to which this object belongs.
|
|
virtual TObject * | DrawClone (Option_t *option="") const |
| Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1) .
|
|
virtual void | Dump () const |
| Dump contents of object on stdout.
|
|
virtual void | Error (const char *method, const char *msgfmt,...) const |
| Issue error message.
|
|
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
| Execute method on this object with the given parameter string, e.g.
|
|
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
| Execute method on this object with parameters stored in the TObjArray.
|
|
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
| Execute action corresponding to an event at (px,py).
|
|
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
| Issue fatal error message.
|
|
virtual TObject * | FindObject (const char *name) const |
| Must be redefined in derived classes.
|
|
virtual TObject * | FindObject (const TObject *obj) const |
| Must be redefined in derived classes.
|
|
virtual Option_t * | GetDrawOption () const |
| Get option used by the graphics system to draw this object.
|
|
virtual const char * | GetIconName () const |
| Returns mime type name of object.
|
|
virtual const char * | GetName () const |
| Returns name of object.
|
|
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
| Returns string containing info about the object at position (px,py).
|
|
virtual Option_t * | GetOption () const |
|
virtual const char * | GetTitle () const |
| Returns title of object.
|
|
virtual UInt_t | GetUniqueID () const |
| Return the unique object id.
|
|
virtual Bool_t | HandleTimer (TTimer *timer) |
| Execute action in response of a timer timing out.
|
|
virtual ULong_t | Hash () const |
| Return hash value for this object.
|
|
Bool_t | HasInconsistentHash () const |
| Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e.
|
|
virtual void | Info (const char *method, const char *msgfmt,...) const |
| Issue info message.
|
|
virtual Bool_t | InheritsFrom (const char *classname) const |
| Returns kTRUE if object inherits from class "classname".
|
|
virtual Bool_t | InheritsFrom (const TClass *cl) const |
| Returns kTRUE if object inherits from TClass cl.
|
|
virtual void | Inspect () const |
| Dump contents of this object in a graphics canvas.
|
|
void | InvertBit (UInt_t f) |
|
virtual TClass * | IsA () const |
|
Bool_t | IsDestructed () const |
| IsDestructed.
|
|
virtual Bool_t | IsEqual (const TObject *obj) const |
| Default equal comparison (objects are equal if they have the same address in memory).
|
|
virtual Bool_t | IsFolder () const |
| Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
|
|
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
|
virtual Bool_t | IsSortable () const |
|
R__ALWAYS_INLINE Bool_t | IsZombie () const |
|
virtual void | ls (Option_t *option="") const |
| The ls function lists the contents of a class on stdout.
|
|
void | MayNotUse (const char *method) const |
| Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary).
|
|
virtual Bool_t | Notify () |
| This method must be overridden to handle object notification (the base implementation is no-op).
|
|
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
| Use this method to declare a method obsolete.
|
|
void | operator delete (void *ptr) |
| Operator delete.
|
|
void | operator delete (void *ptr, void *vp) |
| Only called by placement new when throwing an exception.
|
|
void | operator delete[] (void *ptr) |
| Operator delete [].
|
|
void | operator delete[] (void *ptr, void *vp) |
| Only called by placement new[] when throwing an exception.
|
|
void * | operator new (size_t sz) |
|
void * | operator new (size_t sz, void *vp) |
|
void * | operator new[] (size_t sz) |
|
void * | operator new[] (size_t sz, void *vp) |
|
TObject & | operator= (const TObject &rhs) |
| TObject assignment operator.
|
|
virtual void | Paint (Option_t *option="") |
| This method must be overridden if a class wants to paint itself.
|
|
virtual void | Pop () |
| Pop on object drawn in a pad to the top of the display list.
|
|
virtual void | Print (Option_t *option="") const |
| This method must be overridden when a class wants to print itself.
|
|
virtual Int_t | Read (const char *name) |
| Read contents of object with specified name from the current directory.
|
|
virtual void | RecursiveRemove (TObject *obj) |
| Recursively remove this object from a list.
|
|
void | ResetBit (UInt_t f) |
|
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
| Save this object in the file specified by filename.
|
|
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
| Save a primitive as a C++ statement(s) on output stream "out".
|
|
void | SetBit (UInt_t f) |
|
void | SetBit (UInt_t f, Bool_t set) |
| Set or unset the user status bits as specified in f.
|
|
virtual void | SetDrawOption (Option_t *option="") |
| Set drawing option for object.
|
|
virtual void | SetUniqueID (UInt_t uid) |
| Set the unique object id.
|
|
virtual void | Streamer (TBuffer &) |
| Stream an object of class TObject.
|
|
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
|
virtual void | SysError (const char *method, const char *msgfmt,...) const |
| Issue system error message.
|
|
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
|
Int_t | TestBits (UInt_t f) const |
|
virtual void | UseCurrentStyle () |
| Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked.
|
|
virtual void | Warning (const char *method, const char *msgfmt,...) const |
| Issue warning message.
|
|
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
| Write this object to the current directory.
|
|
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
| Write this object to the current directory.
|
|
|
Bool_t | CanProcess (TObject *pointer) |
| Method which tests whether solids can be processed.
|
|
XMLNodePointer_t | ChooseObject (TGeoShape *geoShape) |
| Chooses the object and method that should be used for processing object.
|
|
XMLNodePointer_t | CreateArb8N (TGeoArb8 *geoShape) |
| Creates "arb8" node for GDML.
|
|
XMLNodePointer_t | CreateAtomN (Double_t atom, const char *unit="g/mole") |
| Creates "atom" node for GDML.
|
|
XMLNodePointer_t | CreateBorderSurfaceN (TGeoBorderSurface *geoSurf) |
| Creates "bordersurface" node for GDML.
|
|
XMLNodePointer_t | CreateBoxN (TGeoBBox *geoShape) |
| Creates "box" node for GDML.
|
|
XMLNodePointer_t | CreateCommonBoolN (TGeoCompositeShape *geoShape) |
| Creates common part of union intersection and subtraction nodes.
|
|
XMLNodePointer_t | CreateConeN (TGeoCone *geoShape) |
| Creates "cone" node for GDML from TGeoCone object.
|
|
XMLNodePointer_t | CreateConeN (TGeoConeSeg *geoShape) |
| Creates "cone" node for GDML from TGeoConeSeg object.
|
|
XMLNodePointer_t | CreateConstantN (const char *name, Double_t value) |
| Creates "constant" kind of node for GDML.
|
|
XMLNodePointer_t | CreateCutTubeN (TGeoCtub *geoShape) |
| Creates "cutTube" node for GDML.
|
|
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.
|
|
XMLNodePointer_t | CreateDN (Double_t density, const char *unit="g/cm3") |
| Creates "D" density node for GDML.
|
|
XMLNodePointer_t | CreateElConeN (TGeoScaledShape *geoShape) |
| Creates "elcone" (elliptical cone) node for GDML this is a special case, because elliptical cone is not defined in ROOT so when scaled cone is found, it is considered as a elliptical cone.
|
|
XMLNodePointer_t | CreateElementN (TGeoElement *element, XMLNodePointer_t materials, const char *name) |
| Creates "element" node for GDML element node and attribute.
|
|
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 when intersection of scaled sphere and TGeoBBox is found, it is considered as an ellipsoid.
|
|
XMLNodePointer_t | CreateEltubeN (TGeoEltu *geoShape) |
| Creates "eltube" node for GDML.
|
|
TGeoCompositeShape * | CreateFakeCtub (TGeoCtub *geoShape) |
| Method creating cutTube as an intersection of tube and two boxes.
|
|
XMLNodePointer_t | CreateFractionN (Double_t percentage, const char *refName) |
| Creates "fraction" node for GDML.
|
|
XMLNodePointer_t | CreateHypeN (TGeoHype *geoShape) |
| Creates "hype" node for GDML.
|
|
XMLNodePointer_t | CreateIsotopN (TGeoIsotope *isotope, const char *name) |
| Creates "isotope" node for GDML.
|
|
XMLNodePointer_t | CreateMaterialN (TGeoMaterial *material, TString mname) |
| Creates "material" node for GDML.
|
|
XMLNodePointer_t | CreateMatrixN (TGDMLMatrix const *matrix) |
| Creates "matrix" kind of node for GDML.
|
|
XMLNodePointer_t | CreateMixtureN (TGeoMixture *mixture, XMLNodePointer_t materials, TString mname) |
| Creates "material" node for GDML with references to other sub elements.
|
|
XMLNodePointer_t | CreateOpticalSurfaceN (TGeoOpticalSurface *geoSurf) |
| Creates "opticalsurface" node for GDML.
|
|
XMLNodePointer_t | CreateParaboloidN (TGeoParaboloid *geoShape) |
| Creates "paraboloid" node for GDML.
|
|
XMLNodePointer_t | CreateParaN (TGeoPara *geoShape) |
| Creates "para" 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.
|
|
XMLNodePointer_t | CreatePolyconeN (TGeoPcon *geoShape) |
| Creates "polycone" node for GDML.
|
|
XMLNodePointer_t | CreatePolyhedraN (TGeoPgon *geoShape) |
| Creates "polyhedra" 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 | CreatePropertyN (TNamed const &property) |
| Creates "property" node for GDML.
|
|
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 | CreateScaledN (TGeoScaledShape *geoShape) |
| Creates a scaled 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 | CreateSkinSurfaceN (TGeoSkinSurface *geoSurf) |
| Creates "skinsurface" node for GDML.
|
|
XMLNodePointer_t | CreateSphereN (TGeoSphere *geoShape) |
| Creates "sphere" node for GDML.
|
|
XMLNodePointer_t | CreateTessellatedN (TGeoTessellated *geoShape) |
| Creates "tessellated" (tessellated shape) node for GDML.
|
|
XMLNodePointer_t | CreateTorusN (TGeoTorus *geoShape) |
| Creates "torus" node for GDML.
|
|
XMLNodePointer_t | CreateTrapN (TGeoTrap *geoShape) |
| Creates "trap" node for GDML.
|
|
XMLNodePointer_t | CreateTrdN (TGeoTrd1 *geoShape) |
| Creates "trd" node for GDML from object TGeoTrd1.
|
|
XMLNodePointer_t | CreateTrdN (TGeoTrd2 *geoShape) |
| Creates "trd" node for GDML from object TGeoTrd2.
|
|
XMLNodePointer_t | CreateTubeN (TGeoTube *geoShape) |
| Creates "tube" node for GDML from object TGeoTube.
|
|
XMLNodePointer_t | CreateTubeN (TGeoTubeSeg *geoShape) |
| Creates "tube" node for GDML from object TGeoTubeSeg.
|
|
XMLNodePointer_t | CreateTwistedTrapN (TGeoGtra *geoShape) |
| Creates "twistedtrap" node for GDML.
|
|
XMLNodePointer_t | CreateXtrusionN (TGeoXtru *geoShape) |
| Creates "xtru" node for GDML.
|
|
XMLNodePointer_t | CreateZplaneN (Double_t z, Double_t rmin, Double_t rmax) |
| Creates "zplane" node for GDML.
|
|
void | ExtractBorderSurfaces (TObjArray *surfaces) |
| Method exporting border surfaces.
|
|
void | ExtractConstants (TGeoManager *geom) |
| Method exporting GDML matrices.
|
|
XMLNodePointer_t | ExtractMaterials (TList *materialsLst) |
| Method exporting materials.
|
|
void | ExtractMatrices (TObjArray *matrices) |
| Method exporting GDML matrices.
|
|
void | ExtractOpticalSurfaces (TObjArray *surfaces) |
| Method exporting optical surfaces.
|
|
void | ExtractSkinSurfaces (TObjArray *surfaces) |
| Method exporting skin surfaces.
|
|
TString | ExtractSolid (TGeoShape *volShape) |
| Method creating solid to xml file and returning its name.
|
|
void | ExtractVolumes (TGeoNode *topNode) |
| Method extracting geometry structure recursively.
|
|
void | ExtractVolumes (TGeoVolume *topVolume) |
| Method extracting geometry structure recursively.
|
|
TString | GenName (TString oldname) |
| NCNAME basic restrictions Replace "$" character with empty character etc.
|
|
TString | GenName (TString oldname, TString objPointer) |
| Important function which is responsible for naming volumes, solids and materials.
|
|
UInt_t | GetFltPrecision () const |
|
TString | GetPattAxis (Int_t divAxis, const char *pattName, TString &unit) |
| Method that retrieves axis and unit along which object is divided.
|
|
Xyz | GetXYZangles (const Double_t *rotationMatrix) |
| Retrieves X Y Z angles from rotation matrix.
|
|
Bool_t | IsInList (NameList list, TString name2check) |
| Checks whether name2check is in (NameList) list.
|
|
Bool_t | IsNullParam (Double_t parValue, TString parName, TString objName) |
| Check for null parameter to skip the NULL objects.
|
|
void | SetFltPrecision (UInt_t prec) |
|
XMLNodePointer_t | StartAssemblyN (const char *name) |
| Creates "assembly" node for GDML.
|
|
XMLNodePointer_t | StartVolumeN (const char *name, const char *solid, const char *material) |
| Creates "volume" node for GDML.
|
|
void | UnsetTemporaryBits (TGeoManager *geoMng) |
| Unsetting bits that were changed in gGeoManager during export so that export can be run more times with the same instance of gGeoManager.
|
|
void | WriteGDMLfile (TGeoManager *geomanager, TGeoNode *top_node, TList *materialsLst, const char *filename, TString option) |
| Wrapper of all exporting methods Creates blank GDML file and fills it with gGeoManager structure converted to GDML structure of xml nodes.
|
|
void | WriteGDMLfile (TGeoManager *geomanager, TGeoVolume *top_vol, TList *materialsLst, const char *filename, TString option) |
| Wrapper of all exporting methods Creates blank GDML file and fills it with gGeoManager structure converted to GDML structure of xml nodes.
|
|