26 using namespace DD4hep;
27 using namespace DD4hep::Geometry;
32 SurfaceInstaller::SurfaceInstaller(
LCDD& lcdd,
int argc,
char** argv)
33 : m_lcdd(lcdd), m_det(), m_stopScanning(false)
36 string det_name = argv[0];
37 string n = det_name[0] ==
'-' ? det_name.substr(1) : det_name;
41 err <<
"The subdetector " << det_name <<
" is not known to the geometry.";
43 throw runtime_error(err.str());
48 throw runtime_error(
"The plugin takes at least one argument. No argument supplied");
55 printout(
FATAL,
"SurfaceInstaller",
"+++ Surfaces for: %s",det);
57 printout(
FATAL,
"SurfaceInstaller",
"+++ You sure you apply the correct plugin to generate");
58 printout(
FATAL,
"SurfaceInstaller",
"+++ surfaces for a detector of type %s",typ);
59 throw std::runtime_error(
"+++ Failed to install Surfaces to detector "+
string(det));
73 TGeoMatrix* mat = component.
placement()->GetMatrix();
74 const double* trans = mat->GetTranslation();
89 log <<
"Lookup " <<
" Detector[" << det_elts.size() <<
"]: " << elt_path;
92 log <<
" " <<
" Places[" << all_nodes.size() <<
"]: " << node_path;
95 log <<
" " <<
" Matrices[" << all_nodes.size() <<
"]: ";
96 for(PlacementPath::const_reverse_iterator i=all_nodes.rbegin(); i!=all_nodes.rend(); ++i) {
98 log << (
void*)(placed->GetMatrix()) <<
" ";
99 if ( placed->GetUserExtension() ) {
101 for(PlacedVolume::VolIDs::const_iterator j=vid.begin(); j!=vid.end(); ++j) {
102 log << (*j).first <<
":" << (*j).second <<
" ";
106 if ( i+1 == all_nodes.rend() ) log <<
"( -> " << placed->GetName() <<
")";
113 <<
" Sensitive: " << (vol.
isSensitive() ?
"YES" :
"NO ")
114 <<
" Volume: " << (
void*)vol.
ptr() <<
" "
119 cout << component.
name() <<
": " << pv.
name() << endl;
126 for (_C::const_iterator i=children.begin(); !
m_stopScanning && i!=children.end(); ++i)
const double * placementTranslation(DetElement component) const
Shortcut to access the translation vector of a given component.
DetElement m_det
Reference to the detector element of the subdetector.
Handle class holding a placed volume (also called physical volume)
Solid solid() const
Access to Solid (Shape)
Volume volume() const
Logical volume of this placement.
const VolIDs & volIDs() const
Access to the volume IDs.
const char * name() const
Access the object name (or "" if not supported by the object)
Volume parentVolume(DetElement component) const
Shortcut to access the parent detectorelement's volume.
bool isValid() const
Check the validity of the object held by the handle.
void invalidInstaller(const std::string &msg) const
Indicate error message and throw exception.
Geometry::DetectorTools::PlacementPath PlacementPath
const Children & children() const
Access to the list of children.
std::string type() const
Access detector type (structure, tracker, calorimeter, etc.).
T * ptr() const
Access to the held object.
bool m_stopScanning
Flag to inhibit useless further scans.
Handle class holding a placed volume (also called physical volume)
void scan()
Scan through tree of detector elements.
virtual DetElement detector(const std::string &name) const =0
Retrieve a field component by it's name from the detector description.
std::string toString(int precision=2) const
Conversion to string for pretty print.
static ComponentCast * component(void *p)
PlacedVolume placement() const
Access to the physical volume of this detector element.
virtual void install(DetElement e, PlacedVolume pv)
Install volume information. Default implementation only prints!
DetElement parent() const
Access to the detector elements's parent.
Handle class describing a detector element.
Geometry::DetectorTools::ElementPath ElementPath
The main interface to the DD4hep detector description package.
std::map< std::string, DetElement > Children
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
bool isSensitive() const
Accessor if volume is sensitive (ie. is attached to a sensitive detector)