Logo ROOT   6.10/09
Reference Guide
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 
15 Abstract class for geometry converters
16 */
17 
18 #include "TVirtualGeoConverter.h"
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  :TObject(), fGeom(geom)
34 {
35 }
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 /// Geometry converter default destructor
39 
41 {
42  fgGeoConverter = 0;
43 }
44 
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// Static function returning a pointer to the current geometry converter.
48 /// The converter implements the ConvertGeometry function.
49 /// If the geometry converter does not exist a default converter is created.
50 
52 {
53  // if no converter set yet, create a default converter via the PluginManager
54  TGeoManager *mgr = geom;
55  if (!mgr) mgr = gGeoManager;
56  if (!fgGeoConverter) {
58  if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualGeoConverter"))) {
59  if (h->LoadPlugin() == -1) {
60  ::Error("TVirtualGeoConverter::Instance()",
61  "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
62  "It appears that you are missing or having outdated support for VecGeom package. "
63  "To enable it, configure ROOT with:\n"
64  " -Dvecgeom -DCMAKE_PREFIX_PATH=<vecgeom_prefix_path>/lib/CMake/VecGeom"
65  "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
66  return 0;
67  }
69  }
70  }
72  return fgGeoConverter;
73 }
74 
75 ////////////////////////////////////////////////////////////////////////////////
76 /// Static function to set an alternative converter.
77 
79 {
81 }
static void SetConverter(const TVirtualGeoConverter *conv)
Static function to set an alternative converter.
The manager class for any TGeo geometry.
Definition: TGeoManager.h:37
TH1 * h
Definition: legend2.C:5
#define gROOT
Definition: TROOT.h:375
Int_t LoadPlugin()
Load the plugin library for this handler.
static TVirtualGeoConverter * fgGeoConverter
Long_t ExecPlugin(int nargs, const T &... params)
static TVirtualGeoConverter * Instance(TGeoManager *geom=0)
Static function returning a pointer to the current geometry converter.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:873
virtual ~TVirtualGeoConverter()
Geometry converter default destructor.
#define ClassImp(name)
Definition: Rtypes.h:336
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:553
Mother of all ROOT objects.
Definition: TObject.h:37
Abstract class for geometry converters.
void SetGeometry(TGeoManager *geom)