25 double Checksum(TGeoManager *geom)
28 TIter next(geom->GetListOfOpticalSurfaces());
29 TGeoOpticalSurface *surf;
30 while ((surf = (TGeoOpticalSurface *)next())) {
31 sum += (double)surf->GetType() + (double)surf->GetModel() + (double)surf->GetFinish() + surf->GetValue();
32 TString name = surf->GetName();
33 sum += (double)name.Hash();
34 name = surf->GetTitle();
35 sum += (double)name.Hash();
42 TString geofile = gROOT->GetTutorialDir() +
"/geom/gdml/opticalsurfaces.gdml";
43 geofile.ReplaceAll(
"\\",
"/");
44 TGeoManager::SetExportPrecision(8);
45 TGeoManager::SetVerboseLevel(0);
46 printf(
"=== Importing %s ...\n", geofile.Data());
47 TGeoManager *geom = TGeoManager::Import(geofile);
48 printf(
"=== List of GDML matrices:\n");
49 geom->GetListOfGDMLMatrices()->Print();
50 printf(
"=== List of optical surfaces:\n");
51 geom->GetListOfOpticalSurfaces()->Print();
52 printf(
"=== List of skin surfaces:\n");
53 geom->GetListOfSkinSurfaces()->Print();
54 printf(
"=== List of border surfaces:\n");
55 geom->GetListOfBorderSurfaces()->Print();
57 double checksum1 = Checksum(geom);
58 printf(
"=== Exporting as .gdml, then importing back\n");
59 geom->Export(
"tmp.gdml");
60 geom = TGeoManager::Import(
"tmp.gdml");
61 double checksum2 = Checksum(geom);
62 assert((checksum2 == checksum1) &&
"Exporting/importing as .gdml not OK");
63 printf(
"=== Exporting as .root, then importing back\n");
64 geom->Export(
"tmp.root");
65 geom = TGeoManager::Import(
"tmp.root");
66 double checksum3 = Checksum(geom);
67 assert((checksum3 == checksum1) &&
"Exporting/importing as .root not OK");