Tests importing/exporting optical surfaces from GDML.
Optical surfaces, skin surfaces and border surfaces are imported in object arrays stored by TGeoManager class. Optical surfaces do not store property arrays but point to GDML matrices describing such properties. One can get the data for such property like:
const char *property = surf=>GetPropertyRef("REFLECTIVITY");
TGeoGDMLMatrix *
m = geom->GetGDMLMatrix(
property);
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
This is a wrapper class to G4OpticalSurface.
Skin surfaces and border surfaces can be retrieved from the TGeoManager object by using:
TObjArray *skin_array = geom->GetListOfSkinSurfaces();
TObjArra8 *border_array = geom->GetListOfBorderSurfaces();
Alternatively accessors by name can also be used: GetSkinSurface(name)/GetBorderSurface(name)
#include <cassert>
{
}
}
int testoptical()
{
TString geofile =
gROOT->GetTutorialDir() +
"/visualisation/geom/gdml/opticalsurfaces.gdml";
printf(
"=== Importing %s ...\n", geofile.
Data());
printf("=== List of GDML matrices:\n");
printf("=== List of optical surfaces:\n");
printf("=== List of skin surfaces:\n");
printf("=== List of border surfaces:\n");
double checksum1 = Checksum(geom);
printf("=== Exporting as .gdml, then importing back\n");
double checksum2 = Checksum(geom);
assert((checksum2 == checksum1) && "Exporting/importing as .gdml not OK");
printf("=== Exporting as .root, then importing back\n");
double checksum3 = Checksum(geom);
assert((checksum3 == checksum1) && "Exporting/importing as .root not OK");
printf("all OK\n");
return 0;
}
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
The manager class for any TGeo geometry.
static void SetExportPrecision(UInt_t prec)
TObjArray * GetListOfSkinSurfaces() const
TObjArray * GetListOfGDMLMatrices() const
virtual Int_t Export(const char *filename, const char *name="", Option_t *option="vg")
Export this geometry to a file.
TObjArray * GetListOfBorderSurfaces() const
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
static void SetVerboseLevel(Int_t vl)
Return current verbosity level (static function).
TObjArray * GetListOfOpticalSurfaces() const
ESurfaceModel GetModel() const
ESurfaceFinish GetFinish() const
Double_t GetValue() const
ESurfaceType GetType() const
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static uint64_t sum(uint64_t i)
- Author
- Andrei Gheata
Definition in file testoptical.C.