13 : m_geoManager(NULL), m_debug(false) {
21 std::cerr <<
m_className <<
"::SetGeometry:\n Null pointer.";
30 const double z)
const {
36 std::string name(cnode->GetMedium()->GetMaterial()->GetName());
39 for (
unsigned int i = 0; i < nMaterials; ++i) {
50 std::cerr <<
"GeometryRoot::GetNumberOfMaterials:\n";
51 std::cerr <<
" ROOT geometry is not defined.\n";
52 std::cerr <<
" Call SetGeometry first.\n";
62 std::cerr <<
"GeometryRoot::GetMaterial:\n";
63 std::cerr <<
" ROOT geometry is not defined.\n";
64 std::cerr <<
" Call SetGeometry first.\n";
74 std::cerr <<
"GeometryRoot::GetMaterial:\n";
75 std::cerr <<
" ROOT geometry is not defined.\n";
76 std::cerr <<
" Call SetGeometry first.\n";
86 std::cerr <<
"GeometryRoot::SetMedium:\n";
87 std::cerr <<
" ROOT geometry is not defined.\n";
88 std::cerr <<
" Call SetGeometry first.\n";
93 std::cerr <<
"GeometryRoot::SetMedium:\n";
94 std::cerr <<
" Medium pointer is null.\n";
100 std::cerr <<
"GeometryRoot::SetMedium:\n";
101 std::cerr <<
" ROOT material with index " << imat
102 <<
" does not exist.\n";
106 std::string name(mat->GetName());
109 const unsigned int nMaterials =
m_materials.size();
110 for (
unsigned int i = 0; i < nMaterials; ++i) {
112 std::cout <<
"GeometryRoot::SetMedium:\n";
113 std::cout <<
" Current association of material " << name
114 <<
" with medium " << med->
GetName() <<
" is overwritten.\n";
122 newMaterial.
name = name;
128 const double rho1 = mat->GetDensity();
130 std::cout <<
"GeometryROOT::SetMedium:\n";
131 std::cout <<
" ROOT material: " << name <<
"\n";
132 std::cout <<
" Density: " << rho1 <<
" g / cm3\n";
133 std::cout <<
" Medium: " << med->
GetName() <<
"\n";
134 std::cout <<
" Density: " << rho2 <<
" g / cm3\n";
135 if (rho1 > 0 && fabs(rho1 - rho2) / rho1 > 0.01) {
136 std::cout <<
" WARNING: Densities differ by > 1%.\n";
143 std::cerr <<
"GeometryRoot::SetMedium:\n";
144 std::cerr <<
" ROOT geometry is not defined.\n";
145 std::cerr <<
" Call SetGeometry first.\n";
150 std::cerr <<
"GeometryRoot::SetMedium:\n";
151 std::cerr <<
" Medium pointer is null.\n";
157 std::cerr <<
"GeometryRoot::SetMedium:" << std::endl;
158 std::cerr <<
" ROOT material " << name <<
" does not exist."
167 double& xmax,
double& ymax,
double& zmax) {
170 TGeoBBox* box = (TGeoBBox*)
m_geoManager->GetTopVolume()->GetShape();
171 const double dx = box->GetDX();
172 const double dy = box->GetDY();
173 const double dz = box->GetDZ();
174 const double ox = box->GetOrigin()[0];
175 const double oy = box->GetOrigin()[1];
176 const double oz = box->GetOrigin()[2];
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)
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
void SetGeometry(TGeoManager *geoman)
Set the geometry (pointer to ROOT TGeoManager).
TGeoMaterial * GetMaterial(const unsigned int i)
Get pointer to ROOT material with given index.
Medium * GetMedium(const double x, const double y, const double z) const
Abstract base class for media.
virtual double GetMassDensity() const
const std::string & GetName() const