Skip to content

Commit c04dae6

Browse files
committed
Addressing reviewer comments, plus fix in TGeoCompositeShape
1 parent 4a4b9e6 commit c04dae6

File tree

5 files changed

+37
-23
lines changed

5 files changed

+37
-23
lines changed

geom/geom/inc/TGeoShape.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class TGeoShape : public TNamed {
6161
kGeoParaboloid = BIT(28),
6262
kGeoHalfSpace = BIT(29),
6363
kGeoHype = BIT(30),
64+
kGeoScaled = BIT(31),
6465
kGeoSavePrimitive = BIT(20)
6566
};
6667

geom/geom/src/TGeoCompositeShape.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ TGeoCompositeShape::TGeoCompositeShape(const char *expression) : TGeoBBox(0, 0,
257257

258258
TGeoCompositeShape::TGeoCompositeShape(const char *name, TGeoBoolNode *node) : TGeoBBox(0, 0, 0)
259259
{
260+
SetShapeBit(TGeoShape::kGeoComb);
260261
SetName(name);
261262
fNode = node;
262263
if (!fNode) {

geom/geom/src/TGeoScaledShape.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ A shape scaled by a TGeoScale transformation
3333

3434
TGeoScaledShape::TGeoScaledShape()
3535
{
36+
SetShapeBit(TGeoShape::kGeoScaled);
3637
fShape = nullptr;
3738
fScale = nullptr;
3839
}
@@ -42,6 +43,7 @@ TGeoScaledShape::TGeoScaledShape()
4243

4344
TGeoScaledShape::TGeoScaledShape(const char *name, TGeoShape *shape, TGeoScale *scale) : TGeoBBox(name, 0, 0, 0)
4445
{
46+
SetShapeBit(TGeoShape::kGeoScaled);
4547
fShape = shape;
4648
fScale = scale;
4749
if (!fScale->IsRegistered())
@@ -54,6 +56,7 @@ TGeoScaledShape::TGeoScaledShape(const char *name, TGeoShape *shape, TGeoScale *
5456

5557
TGeoScaledShape::TGeoScaledShape(TGeoShape *shape, TGeoScale *scale)
5658
{
59+
SetShapeBit(TGeoShape::kGeoScaled);
5760
fShape = shape;
5861
fScale = scale;
5962
if (!fScale->IsRegistered())

geom/vecgeom/src/TGeoVGConverter.cxx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ void TGeoVGConverter::ConvertGeometry()
7676
top->SetShape(vgshape);
7777
}
7878

79-
// Uncomment to print info about selected/excluded shapes
80-
// if ( ! fSelectedShapeTypes.empty()) {
81-
// printf("# %zu selected shape type for conversion \n", fSelectedShapeTypes.size());
82-
// }
83-
// if ( ! fExcludedShapeTypes.empty()) {
84-
// printf("# %zu shape types excluded from conversion \n", fExcludedShapeTypes.size());
85-
// }
79+
// Print info about selected/excluded shapes
80+
if (gGeoManager->GetVerboseLevel() > 1) {
81+
if ( ! fSelectedShapeTypes.empty()) {
82+
Info("ConvertGeometry","# %zu selected shape type for conversion \n", fSelectedShapeTypes.size());
83+
}
84+
if ( ! fExcludedShapeTypes.empty()) {
85+
Info("ConvertGeometry","# %zu shape types excluded from conversion \n", fExcludedShapeTypes.size());
86+
}
87+
}
8688

8789
// Now iterate the active geometry tree
8890
TGeoIterator next(fGeom->GetTopVolume());
@@ -96,29 +98,38 @@ void TGeoVGConverter::ConvertGeometry()
9698
// If fSelectedShapeTypes is not empty, convert only selected shapes
9799
if ((! fSelectedShapeTypes.empty()) &&
98100
(! isInSelection(vol->GetShape(), fSelectedShapeTypes))) {
99-
printf("# Shape type %s is not selected for conversion\n", vol->GetShape()->IsA()->GetName());
101+
if (gGeoManager->GetVerboseLevel() > 1) {
102+
Info("ConvertGeometry","# Shape type %s is not selected for conversion\n",
103+
vol->GetShape()->IsA()->GetName());
104+
}
100105
continue;
101106
}
102107

103108
// Skip shapes excluded from conversion
104109
if (isInSelection(vol->GetShape(), fExcludedShapeTypes)) {
105-
printf("# Shape type %s is excluded from conversion\n", vol->GetShape()->IsA()->GetName());
110+
if (gGeoManager->GetVerboseLevel() > 1) {
111+
Info("ConvertGeometry","# Shape type %s is excluded from conversion\n",
112+
vol->GetShape()->IsA()->GetName());
113+
}
106114
continue;
107115
}
108116

109-
// printf("Converting %s\n", vol->GetName());
117+
// Info("ConvertGeometry","Converting %s\n", vol->GetName());
110118
vgshape = TGeoVGShape::Create(vol->GetShape());
111119
if (vgshape) {
112120
nconverted++;
113121
vol->SetShape(vgshape);
114122
}
115123
}
116-
printf("# Converted %d shapes to VecGeom ones\n", nconverted);
124+
if (gGeoManager->GetVerboseLevel() > 0) {
125+
Info("ConvertGeometry","# Converted %d shapes to VecGeom ones\n", nconverted);
126+
}
117127
}
118128

119129
////////////////////////////////////////////////////////////////////////////////
120130
/// Select shape(s) for conversion.
121-
/// Conversion is performed only on selected shapes (if set)
131+
/// Conversion is performed only on selected shapes. If unset, all solid types
132+
/// will be converted.
122133

123134
void TGeoVGConverter::SelectShapeType(TGeoShape::EShapeType shapeType)
124135
{
@@ -127,6 +138,7 @@ void TGeoVGConverter::SelectShapeType(TGeoShape::EShapeType shapeType)
127138

128139
////////////////////////////////////////////////////////////////////////////////
129140
/// Exclude shape(s) from conversion.
141+
/// Excluded types have precedence in case a type is also selected.
130142

131143
void TGeoVGConverter::ExcludeShapeType(TGeoShape::EShapeType shapeType)
132144
{

geom/vecgeom/src/TGeoVGShape.cxx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,14 @@ vecgeom::cxx::VUnplacedVolume *TGeoVGShape::Convert(TGeoShape const *const shape
293293

294294
// THE SCALED SHAPE
295295
if (shape->IsA() == TGeoScaledShape::Class()) {
296-
// TGeoScaledShape const *const p = static_cast<TGeoScaledShape const *>(shape);
297-
// // First convert the referenced shape
298-
// VUnplacedVolume *referenced_shape = Convert(p->GetShape());
299-
// if (!referenced_shape)
300-
// return nullptr;
301-
// const double *scale_root = p->GetScale()->GetScale();
302-
// unplaced_volume =
303-
// GeoManager::MakeInstance<UnplacedScaledShape>(referenced_shape, scale_root[0], scale_root[1], scale_root[2]);
304-
305-
// temporarily skip scaled solids which cannot be excluded via EShapeType selection
306-
printf("Unsupported scaled shape\n");
296+
TGeoScaledShape const *const p = static_cast<TGeoScaledShape const *>(shape);
297+
// First convert the referenced shape
298+
VUnplacedVolume *referenced_shape = Convert(p->GetShape());
299+
if (!referenced_shape)
300+
return nullptr;
301+
const double *scale_root = p->GetScale()->GetScale();
302+
unplaced_volume =
303+
GeoManager::MakeInstance<UnplacedScaledShape>(referenced_shape, scale_root[0], scale_root[1], scale_root[2]);
307304
}
308305

309306
// THE CUT TUBE

0 commit comments

Comments
 (0)