diff --git a/DDSegmentation/include/DDSegmentation/CellIDDecoder.h b/DDSegmentation/include/DDSegmentation/CellIDDecoder.h deleted file mode 100644 index 139c7704dd9cb2cd92bcd62a317c922b7b796a03..0000000000000000000000000000000000000000 --- a/DDSegmentation/include/DDSegmentation/CellIDDecoder.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CellIDDecoder.h - * This is an example of mixing the segmentation interface with the volume manager. Could move into Readout class. - * Created on: Sep 16, 2013 - * Author: Christian Grefe, CERN - */ - -#ifndef CELLIDDECODER_H_ -#define CELLIDDECODER_H_ - -#include "DD4hep/VolumeManager.h" -#include "DD4hep/Objects.h" -#include "DD4hep/TGeoUnits.h" -#include "DDSegmentation/Segmentation.h" - -namespace DD4hep { -namespace DDSegmentation { - -class CellIDDecoder { -public: - CellIDDecoder(const Geometry::VolumeManager& volManager, const Segmentation* segmentation) : _volManager(volManager), _segmentation(segmentation) { - - } - - virtual ~CellIDDecoder() { - delete _segmentation; - } - - Geometry::PlacedVolume getPlacement(const long& cellID) const { - return _volManager.lookupPlacement(cellID); - } - - Geometry::DetElement getSubDetector(const long& cellID) const { - return _volManager.lookupDetector(cellID); - } - - Geometry::DetElement getDetectorElement(const long& cellID) const { - return _volManager.lookupDetElement(cellID); - } - - Geometry::Position getPosition(const long64& cellID) const { - double global[3] = {0., 0., 0.}; - _volManager.worldTransformation(cellID).LocalToMaster(&(_segmentation->getLocalPosition(cellID))[0], global); - return Geometry::Position(global[0]/tgeo::mm, global[1]/tgeo::mm, global[2]/tgeo::mm); - } - - const TGeoMatrix& getWorldTransformation(const long& cellID) const { - return _volManager.worldTransformation(cellID); - } - - Geometry::Position getLocalPosition(const long64& cellID) const { - std::vector<double> v = _segmentation->getLocalPosition(cellID); - return Geometry::Position(v[0], v[1], v[2]); - } - - long64 getCellID(double x, double y, double z) const { - return _segmentation->getCellID(x, y, z); - } - - std::string fieldDescription() const { - return _segmentation->fieldDescription(); - } - -protected: - const Segmentation* _segmentation; - const Geometry::VolumeManager _volManager; -}; - -} /* namespace DDSegmentation */ -} /* namespace DD4hep */ -#endif /* CELLIDDECODER_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/CellIDDecoderFactory.h b/DDSegmentation/include/DDSegmentation/CellIDDecoderFactory.h deleted file mode 100644 index d796c6209f97a80421cf916fb2de60fd92019eb5..0000000000000000000000000000000000000000 --- a/DDSegmentation/include/DDSegmentation/CellIDDecoderFactory.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CellIDDecoderFactory.h - * - * This class would be obsolete if Geometry::Segmentation would directly use the DDSegmentation classes - * - * Created on: Sep 16, 2013 - * Author: Christian Grefe, CERN - */ - -#ifndef CELLIDDECODERFACTORY_H_ -#define CELLIDDECODERFACTORY_H_ - -#include "DD4hep/LCDD.h" -#include "DD4hep/Segmentations.h" -#include "DDSegmentation/CartesianGridXY.h" - -#include <iostream> -#include <string> - -namespace DD4hep { -namespace DDSegmentation { - -namespace CellIDDecoderFactory { -CellIDDecoder getCellIDDecoder(const std::string& collectionName) { - Geometry::LCDD& lcdd = Geometry::LCDD::getInstance(); - Geometry::VolumeManager volManager = lcdd.volumeManager(); - Geometry::Readout readout = lcdd.readout(collectionName); - Geometry::Segmentation s = readout.segmentation(); - Segmentation* segmentation; - std::string type = s.type(); - if (type == "grid_xyz") { - Geometry::GridXYZ g = (Geometry::GridXY) s; - segmentation = new CartesianGridXY(readout.idSpec().decoder(), g.getGridSizeX(), g.getGridSizeY()); - } else { - throw std::runtime_error("The segmentation type "+type+" is not supported by CellIDDecoderFactory."); - } - return CellIDDecoder(volManager, segmentation); -} -} - -} /* namespace DDSegmentation */ -} /* namespace DD4hep */ -#endif /* CELLIDDECODERFACTORY_H_ */