Ejemplo n.º 1
0
/// Default constructor
IDDecoder::IDDecoder() {
	LCDD& lcdd = LCDD::getInstance();
	_volumeManager = lcdd.volumeManager();
	if (not _volumeManager.isValid()) {
		_volumeManager = VolumeManager(lcdd, "volman", lcdd.world(), Readout(), VolumeManager::TREE);
	}
	_tgeoMgr = lcdd.world().volume()->GetGeoManager();
}
Ejemplo n.º 2
0
// helper method to find the corresponding Readout object to a DetElement
Readout IDDecoder::findReadout(const Geometry::DetElement& det) const {

	// first check if top level is a sensitive detector
	if (det.volume().isValid() and det.volume().isSensitive()) {
		Geometry::SensitiveDetector sd = det.volume().sensitiveDetector();
		if (sd.isValid() and sd.readout().isValid()) {
			return sd.readout();
		}
	}

	// check all children recursively for the first valid Readout object
	const DetElement::Children& children = det.children();
	DetElement::Children::const_iterator it = children.begin();
	while (it != children.end()) {
		Readout r = findReadout(it->second);
		if (r.isValid()) {
			return r;
		}
		++it;
	}

	// neither this or any daughter is sensitive
	return Readout();
}