Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
GeometryRoot.hh
Go to the documentation of this file.
1// Abstract base class for components
2
3#ifndef G_GEOMETRY_ROOT_H
4#define G_GEOMETRY_ROOT_H
5
6#include <vector>
7
8#include <TGeoManager.h>
9#include <TGeoMaterial.h>
10
11#include "GeometryBase.hh"
12
13namespace Garfield {
14
15class GeometryRoot : public GeometryBase {
16
17 public:
18 // Constructors
20 // Destructor
22
23 // Set the geometry (pointer to ROOT TGeoManager)
24 void SetGeometry(TGeoManager* geoman);
25
26 // Get the medium at a given point (x, y, z)
27 Medium* GetMedium(const double x, const double y,
28 const double z) const;
29
30 // Get the number of materials defined in the ROOT geometry
32 // Get pointer to ROOT material with given index/name
33 TGeoMaterial* GetMaterial(const int i);
34 TGeoMaterial* GetMaterial(const char* name);
35 // Associate ROOT material with Garfield medium
36 void SetMedium(const int imat, Medium* med);
37 void SetMedium(const char* mat, Medium* med);
38
39 bool IsInside(const double x, const double y, const double z) const {
40
41 if (m_geoManager) {
42 m_geoManager->SetCurrentPoint(x, y, z);
43 return !m_geoManager->IsOutside();
44 }
45 return false;
46 }
47
48 // Bounding box (envelope of geometry)
49 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
50 double& ymax, double& zmax);
51
52 // Switch on/off debugging and warning messages
53 void EnableDebugging() { m_debug = true; }
54 void DisableDebugging() { m_debug = false; }
55
56 protected:
57 // ROOT geometry manager
58 TGeoManager* m_geoManager;
59
60 // List of ROOT materials associated to Garfield media
62 struct material {
63 std::string name;
65 };
66 std::vector<material> m_materials;
67
68 // Switch on/off debugging messages
69 bool m_debug;
70};
71}
72
73#endif
TGeoManager * m_geoManager
Definition: GeometryRoot.hh:58
void SetMedium(const int imat, Medium *med)
Definition: GeometryRoot.cc:84
std::vector< material > m_materials
Definition: GeometryRoot.hh:66
TGeoMaterial * GetMaterial(const int i)
Definition: GeometryRoot.cc:60
bool IsInside(const double x, const double y, const double z) const
Definition: GeometryRoot.hh:39
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
void SetGeometry(TGeoManager *geoman)
Definition: GeometryRoot.cc:18
Medium * GetMedium(const double x, const double y, const double z) const
Definition: GeometryRoot.cc:31