Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoVGConverter.cxx
Go to the documentation of this file.
1// @(#)root/vecgeom:$Id:$
2// Author: Mihaela Gheata 30/03/16
3/*************************************************************************
4 * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11/** \class TGeoVGConverter
12\ingroup Geometry_classes
13
14Geometry converter to VecGeom
15*/
16
17#include "TGeoVGConverter.h"
18#include "TGeoVGShape.h"
19
20
21////////////////////////////////////////////////////////////////////////////////
22/// Default constructor.
23
28
29////////////////////////////////////////////////////////////////////////////////
30/// Default destructor.
31
33
34////////////////////////////////////////////////////////////////////////////////
35/// Main geometry conversion method.
36/// Convert all geometry shapes connected to volumes to VecGeom shapes
37
39{
40 // First convert the top volume
42 TGeoVGShape *vgshape = nullptr;
43 if (!top->GetShape()->IsVecGeom())
45 Int_t nconverted = 0;
46 // If shape of top volume not known by VecGeom, keep old one
47 if (vgshape) {
48 nconverted++;
49 top->SetShape(vgshape);
50 }
51 // Now iterate the active geometry tree
53 TGeoNode *node;
54 while ((node = next.Next())) {
55 TGeoVolume *vol = node->GetVolume();
56 // If shape not already converted, convert it
57 if (vol->GetShape()->IsVecGeom())
58 continue;
59 // printf("Converting %s\n", vol->GetName());
61 if (vgshape) {
62 nconverted++;
63 vol->SetShape(vgshape);
64 }
65 }
66 printf("# Converted %d shapes to VecGeom ones\n", nconverted);
67}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
A geometry iterator.
Definition TGeoNode.h:248
TGeoNode * Next()
Returns next node.
The manager class for any TGeo geometry.
Definition TGeoManager.h:45
TGeoVolume * GetMasterVolume() const
TGeoVolume * GetTopVolume() const
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
TGeoVolume * GetVolume() const
Definition TGeoNode.h:99
virtual Bool_t IsVecGeom() const
Definition TGeoShape.h:149
TGeoVGConverter(TGeoManager *manager)
Default constructor.
void ConvertGeometry() override
Main geometry conversion method.
~TGeoVGConverter() override
Default destructor.
Bridge class for using a VecGeom solid as TGeoShape.
Definition TGeoVGShape.h:30
static TGeoVGShape * Create(TGeoShape *shape)
Factory creating TGeoVGShape from a Root shape.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
void SetShape(const TGeoShape *shape)
set the shape associated with this volume
TGeoShape * GetShape() const
Definition TGeoVolume.h:190
Abstract class for geometry converters.
static void SetConverter(const TVirtualGeoConverter *conv)
Static function to set an alternative converter.