16 std::cerr <<
m_className <<
"::SetGeometry: Null pointer.\n";
25 const double z)
const {
30 std::string name(cnode->GetMedium()->GetMaterial()->GetName());
33 for (
unsigned int i = 0; i < nMaterials; ++i) {
75 std::cerr <<
m_className <<
"::SetMedium: Null pointer.\n";
82 <<
" ROOT material " << imat <<
" does not exist.\n";
86 std::string name(mat->GetName());
90 for (
unsigned int i = 0; i < nMaterials; ++i) {
93 <<
" Current association of material " << name
94 <<
" with medium " << med->
GetName() <<
" is overwritten.\n";
102 newMaterial.
name = name;
108 const double rho1 = mat->GetDensity();
111 <<
" ROOT material: " << name <<
"\n"
112 <<
" Density: " << rho1 <<
" g / cm3\n"
113 <<
" Medium: " << med->
GetName() <<
"\n"
114 <<
" Density: " << rho2 <<
" g / cm3\n";
115 if (rho1 > 0 && fabs(rho1 - rho2) / rho1 > 0.01) {
116 std::cout <<
" WARNING: Densities differ by > 1%.\n";
127 std::cerr <<
m_className <<
"::SetMedium: Null pointer.\n";
134 <<
" ROOT material " << name <<
" does not exist.\n";
142 double& xmax,
double& ymax,
double& zmax) {
145 if (!top)
return false;
146 if (!top->GetShape())
return false;
147 TGeoBBox* box = (TGeoBBox*)
m_geoManager->GetTopVolume()->GetShape();
148 if (!box)
return false;
149 const double dx = box->GetDX();
150 const double dy = box->GetDY();
151 const double dz = box->GetDZ();
152 const double ox = box->GetOrigin()[0];
153 const double oy = box->GetOrigin()[1];
154 const double oz = box->GetOrigin()[2];
167 <<
" ROOT geometry is not defined. Call SetGeometry first.\n";
Abstract base class for geometry classes.
TGeoManager * m_geoManager
unsigned int GetNumberOfMaterials()
Get the number of materials defined in the ROOT geometry.
std::vector< material > m_materials
GeometryRoot()
Constructor.
void SetMedium(const unsigned int imat, Medium *med)
Associate a ROOT material with Garfield medium.
void PrintGeoNotDefined(const std::string &fcn) const
void SetGeometry(TGeoManager *geoman)
Set the geometry (pointer to ROOT TGeoManager).
Medium * GetMedium(const double x, const double y, const double z) const override
Retrieve the medium at a given point.
TGeoMaterial * GetMaterial(const unsigned int i)
Get pointer to ROOT material with 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).
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.