16 std::cerr <<
m_className <<
"::SetGeometry: Null pointer.\n";
29 std::string name(cnode->GetMedium()->GetMaterial()->GetName());
70 std::cerr <<
m_className <<
"::SetMedium: Null pointer.\n";
77 <<
" ROOT material " << imat <<
" does not exist.\n";
81 std::string name(mat->GetName());
86 <<
" Replacing existing association of material " << name
87 <<
" with medium " << med->
GetName() <<
".\n";
92 const double rho1 = mat->GetDensity();
95 <<
" ROOT material: " << name <<
"\n"
96 <<
" Density: " << rho1 <<
" g / cm3\n"
97 <<
" Medium: " << med->
GetName() <<
"\n"
98 <<
" Density: " << rho2 <<
" g / cm3\n";
99 if (rho1 > 0 && fabs(rho1 - rho2) / rho1 > 0.01) {
100 std::cout <<
" WARNING: Densities differ by > 1%.\n";
111 std::cerr <<
m_className <<
"::SetMedium: Null pointer.\n";
118 <<
" ROOT material " << name <<
" does not exist.\n";
135 double& xmax,
double& ymax,
double& zmax) {
138 if (!top)
return false;
139 if (!top->GetShape())
return false;
140 TGeoBBox* box = (TGeoBBox*)
m_geoManager->GetTopVolume()->GetShape();
141 if (!box)
return false;
142 const double dx = box->GetDX();
143 const double dy = box->GetDY();
144 const double dz = box->GetDZ();
145 const double ox = box->GetOrigin()[0];
146 const double oy = box->GetOrigin()[1];
147 const double oz = box->GetOrigin()[2];
160 <<
" ROOT geometry is not defined. Call SetGeometry first.\n";
TGeoManager * m_geoManager
unsigned int GetNumberOfMaterials()
Get the number of materials defined in the ROOT geometry.
GeometryRoot()
Constructor.
bool IsInside(const double x, const double y, const double z, const bool tesselated=false) const override
Check if a point is inside the geometry.
void SetMedium(const unsigned int imat, Medium *med)
Associate a ROOT material with a Garfield medium.
void PrintGeoNotDefined(const std::string &fcn) const
std::map< std::string, Medium * > m_materials
void SetGeometry(TGeoManager *geoman)
Set the geometry (pointer to ROOT TGeoManager).
TGeoMaterial * GetMaterial(const unsigned int i)
Get a pointer to the ROOT material with a given index.
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box (envelope of the geometry).
Medium * GetMedium(const double x, const double y, const double z, const bool tesselated=false) const override
Retrieve the medium at a given point.
Abstract base class for geometry classes.
Abstract base class for media.
virtual double GetMassDensity() const
Get the mass density [g/cm3].
const std::string & GetName() const
Get the medium name/identifier.