Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TVirtualGeoConverter.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Mihaela Gheata 30/03/16
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TVirtualGeoConverter
13\ingroup Geometry_classes
14
15Abstract class for geometry converters
16*/
17
19
20#include "TError.h"
21#include "TROOT.h"
22#include "TPluginManager.h"
23#include "TGeoManager.h"
24
26
28
29////////////////////////////////////////////////////////////////////////////////
30/// Geometry converter default constructor
31
33
34////////////////////////////////////////////////////////////////////////////////
35/// Geometry converter default destructor
36
38{
39 fgGeoConverter = nullptr;
40}
41
42////////////////////////////////////////////////////////////////////////////////
43/// Static function returning a pointer to the current geometry converter.
44/// The converter implements the ConvertGeometry function.
45/// If the geometry converter does not exist a default converter is created.
46
48{
49 // if no converter set yet, create a default converter via the PluginManager
50 TGeoManager *mgr = geom;
51 if (!mgr)
52 mgr = gGeoManager;
53 if (!fgGeoConverter) {
55 if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualGeoConverter"))) {
56 if (h->LoadPlugin() == -1) {
57 ::Error("TVirtualGeoConverter::Instance()",
58 "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
59 "It appears that you are missing or having outdated support for VecGeom package. "
60 "To enable it, configure ROOT with:\n"
61 " -Dvecgeom -DCMAKE_PREFIX_PATH=<vecgeom_prefix_path>/lib/CMake/VecGeom"
62 "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
63 return nullptr;
64 }
65 fgGeoConverter = (TVirtualGeoConverter *)h->ExecPlugin(1, mgr);
66 }
67 }
70 return fgGeoConverter;
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Static function to set an alternative converter.
75
77{
79}
#define h(i)
Definition RSha256.hxx:106
#define ClassImp(name)
Definition Rtypes.h:382
R__EXTERN TGeoManager * gGeoManager
#define gROOT
Definition TROOT.h:406
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1005
Abstract class for geometry converters.
static TVirtualGeoConverter * fgGeoConverter
static TVirtualGeoConverter * Instance(TGeoManager *geom=nullptr)
Static function returning a pointer to the current geometry converter.
TVirtualGeoConverter(TGeoManager *geom)
Geometry converter default constructor.
void SetGeometry(TGeoManager *geom)
~TVirtualGeoConverter() override
Geometry converter default destructor.
static void SetConverter(const TVirtualGeoConverter *conv)
Static function to set an alternative converter.