Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TGeoTessellated ROOT compatibility and test location #618

Merged
merged 3 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DDCore/include/DD4hep/Shapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "TGeoParaboloid.h"
#include "TGeoCompositeShape.h"
#include "TGeoShapeAssembly.h"
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
#include "TGeoTessellated.h"
#endif

Expand Down Expand Up @@ -1422,7 +1422,7 @@ namespace dd4hep {
EightPointSolid& operator=(const EightPointSolid& copy) = default;
};

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
/// Class describing a tessellated shape
/**
* For any further documentation please see the following ROOT documentation:
Expand Down
2 changes: 1 addition & 1 deletion DDCore/src/Handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ DD4HEP_INSTANTIATE_SHAPE_HANDLE(TGeoTrd2);
DD4HEP_INSTANTIATE_SHAPE_HANDLE(TGeoSphere);
DD4HEP_INSTANTIATE_SHAPE_HANDLE(TGeoTorus);

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
#include "TGeoTessellated.h"
DD4HEP_INSTANTIATE_SHAPE_HANDLE(TGeoTessellated);
#endif
Expand Down
16 changes: 8 additions & 8 deletions DDCore/src/ShapeUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace dd4hep {
template bool isInstance<PolyhedraRegular> (const Handle<TGeoShape>& solid);
template bool isInstance<Polyhedra> (const Handle<TGeoShape>& solid);
template bool isInstance<ExtrudedPolygon> (const Handle<TGeoShape>& solid);
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
template bool isInstance<TessellatedSolid> (const Handle<TGeoShape>& solid);
#endif
template bool isInstance<BooleanSolid> (const Handle<TGeoShape>& solid);
Expand Down Expand Up @@ -151,7 +151,7 @@ namespace dd4hep {
template bool isA<ExtrudedPolygon>(const Handle<TGeoShape>& solid);
template bool isA<Polycone>(const Handle<TGeoShape>& solid);
template bool isA<EightPointSolid>(const Handle<TGeoShape>& solid);
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
template bool isA<TessellatedSolid>(const Handle<TGeoShape>& solid);
#endif
template <> bool isA<TwistedTube>(const Handle<TGeoShape>& solid) {
Expand Down Expand Up @@ -338,7 +338,7 @@ namespace dd4hep {
return pars;
}

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
template <> vector<double> dimensions<TGeoTessellated>(const TGeoShape* shape) {
TGeoTessellated* sh = get_ptr<TGeoTessellated>(shape);
int num_facet = sh->GetNfacets();
Expand Down Expand Up @@ -416,7 +416,7 @@ namespace dd4hep {
template vector<double> dimensions<Polyhedra> (const Handle<TGeoShape>& shape);
template vector<double> dimensions<ExtrudedPolygon> (const Handle<TGeoShape>& shape);
template vector<double> dimensions<EightPointSolid> (const Handle<TGeoShape>& shape);
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
template vector<double> dimensions<TessellatedSolid> (const Handle<TGeoShape>& shape);
#endif
template vector<double> dimensions<BooleanSolid> (const Handle<TGeoShape>& shape);
Expand Down Expand Up @@ -511,7 +511,7 @@ namespace dd4hep {
return dimensions<TGeoXtru>(shape.ptr());
else if (cl == TGeoScaledShape::Class())
return dimensions<TGeoScaledShape>(shape.ptr());
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
else if (cl == TGeoTessellated::Class())
return dimensions<TGeoTessellated>(shape.ptr());
#endif
Expand Down Expand Up @@ -745,7 +745,7 @@ namespace dd4hep {
s_sh.access()->SetDimensions(&pars[3]);
}

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
template <> void set_dimensions(TGeoTessellated* sh, const std::vector<double>& params) {
int num_vtx = params[0];
int num_facet = params[1];
Expand Down Expand Up @@ -837,7 +837,7 @@ namespace dd4hep {
{ set_dimensions(shape.ptr(), params); }
template <> void set_dimensions(EightPointSolid shape, const std::vector<double>& params)
{ set_dimensions(shape.ptr(), params); }
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
template <> void set_dimensions(TessellatedSolid shape, const std::vector<double>& params)
{ set_dimensions(shape.ptr(), params); }
#endif
Expand Down Expand Up @@ -1041,7 +1041,7 @@ namespace dd4hep {
set_dimensions(ExtrudedPolygon(shape), params);
else if (cl == TGeoArb8::Class())
set_dimensions(EightPointSolid(shape), params);
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
else if (cl == TGeoTessellated::Class())
set_dimensions(TessellatedSolid(shape), params);
#endif
Expand Down
4 changes: 2 additions & 2 deletions DDCore/src/Shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ void EightPointSolid::make(const string& nam, double dz, const double* vtx) {
_assign(new TGeoArb8(nam.c_str(), dz, (double*)vtx), "", EIGHTPOINTSOLID_TAG, true);
}

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
/// Internal helper method to support object construction
void TessellatedSolid::make(const std::string& nam, int num_facets) {
_assign(new TGeoTessellated(nam.c_str(), num_facets), nam, TESSELLATEDSOLID_TAG, false);
Expand Down Expand Up @@ -952,6 +952,6 @@ INSTANTIATE(TGeoTrd1);
INSTANTIATE(TGeoTrd2);
INSTANTIATE(TGeoCompositeShape);

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
INSTANTIATE(TGeoTessellated);
#endif
4 changes: 2 additions & 2 deletions DDCore/src/plugins/ShapePlugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static Handle<TObject> create_EightPointSolid(Detector&, xml_h element) {
}
DECLARE_XML_SHAPE(EightPointSolid__shape_constructor,create_EightPointSolid)

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
/// Plugin factory to created tessellated shapes
static Handle<TObject> create_TessellatedSolid(Detector&, xml_h element) {
xml_dim_t e(element);
Expand Down Expand Up @@ -631,7 +631,7 @@ static Ref_t create_shape(Detector& description, xml_h e, Ref_t /* sens */) {
instance_test = isInstance<EllipticalTube>(solid);
else if ( 0 == strcasecmp(solid->GetTitle(),EXTRUDEDPOLYGON_TAG) )
instance_test = isInstance<ExtrudedPolygon>(solid);
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
else if ( 0 == strcasecmp(solid->GetTitle(),TESSELLATEDSOLID_TAG) )
instance_test = isInstance<TessellatedSolid>(solid);
#endif
Expand Down
2 changes: 1 addition & 1 deletion DDG4/src/Geant4Converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c
solid = convertShape<TGeoTrap>(shape);
else if (isa == TGeoArb8::Class())
solid = convertShape<TGeoArb8>(shape);
#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
else if (isa == TGeoTessellated::Class())
solid = convertShape<TGeoTessellated>(shape);
#endif
Expand Down
2 changes: 1 addition & 1 deletion DDG4/src/Geant4ShapeConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ namespace dd4hep {
} // End namespace sim
} // End namespace dd4hep

#if ROOT_VERSION_CODE > ROOT_VERSION(6,19,0)
#if ROOT_VERSION_CODE > ROOT_VERSION(6,21,0)
#include "G4TessellatedSolid.hh"
#include "G4TriangularFacet.hh"
#include "G4QuadrangularFacet.hh"
Expand Down
2 changes: 1 addition & 1 deletion examples/ClientTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ list(APPEND ClientTests_ShapeTests Box Cone ConeSegment Tube ElTube CutTube Hype
list(APPEND ClientTests_ShapeTests EightPointSolid Eightpoint_Reflect_Volume Eightpoint_Reflect_DetElement)
list(APPEND ClientTests_ShapeTests Polycone Polyhedra PseudoTrap PseudoTrap2 Sphere Torus Trap Trd1 Trd2)
list(APPEND ClientTests_ShapeTests TruncatedTube ExtrudedPolygon)
if(${ROOT_VERSION} VERSION_GREATER 6.19.00)
if(${ROOT_VERSION} VERSION_GREATER 6.21.00)
list(APPEND ClientTests_ShapeTests Tesselated)
endif()
foreach (test ${ClientTests_ShapeTests})
Expand Down
2 changes: 1 addition & 1 deletion examples/ClientTests/compact/Check_Shape_Tesselated.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
<position x="0" y="0" z="0"/>
<rotation x="0" y="0" z="0"/>
</check>
<test type="DD4hep_Mesh_Verifier" ref="${DD4hepExamplesINSTALL}/examples/ClientTests/ref/Ref_Tessellated.txt" create="CheckShape_create"/>
<test type="DD4hep_Mesh_Verifier" ref="${DD4hepExamplesINSTALL}/ClientTests/ref/Ref_Tessellated.txt" create="CheckShape_create"/>
<test_writing_reference type="DD4hep_Mesh_Verifier" ref="${DD4hepExamplesINSTALL}/examples/ClientTests/ref/Ref_Tessellated.txt" create="1"/>
</detector>
</detectors>
Expand Down