From 38202cdad4ae0c5b895b470a9b16d258d5658127 Mon Sep 17 00:00:00 2001 From: Markus Frank <markus.frank@cern.ch> Date: Mon, 4 Nov 2013 18:22:53 +0000 Subject: [PATCH] Adapt to new DDSegmentation package --- DDCore/include/DD4hep/Segmentations.h | 8 ++++++- DDCore/src/Readout.cpp | 4 ++-- DDCore/src/Segementations.cpp | 32 +++++++++++++++++++++------ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/DDCore/include/DD4hep/Segmentations.h b/DDCore/include/DD4hep/Segmentations.h index 089fa8518..885cb5f55 100644 --- a/DDCore/include/DD4hep/Segmentations.h +++ b/DDCore/include/DD4hep/Segmentations.h @@ -96,7 +96,7 @@ namespace DD4hep { /// Constructor to be used when reading the already parsed object SegmentationParams(const Segmentation& e) : Segmentation(e) {} /// Segmentation type - const std::string& type() const; + std::string type() const; /// Access to the parameters Parameters parameters() const; }; @@ -116,6 +116,8 @@ namespace DD4hep { Data(BitField64* decoder=0) : Object(), BaseSegmentation(decoder), nphi(0), ntheta(0), nz(0) {} /// Default destructor virtual ~Data(); + /// determine the position based on the cell ID + virtual std::vector<double> getPosition(const long64& cellID) const; /// determine the local position based on the cell ID virtual std::vector<double> getLocalPosition(const long64& cellID) const; /// determine the cell ID based on the local position @@ -153,6 +155,8 @@ namespace DD4hep { Data(BitField64* decoder=0) : Object(), BaseSegmentation(decoder) { grid_size_phi=grid_size_theta=grid_size_z=0;} /// Default destructor virtual ~Data(); + /// determine the position based on the cell ID + virtual std::vector<double> getPosition(const long64& cellID) const; /// determine the local position based on the cell ID virtual std::vector<double> getLocalPosition(const long64& cellID) const; /// determine the cell ID based on the local position @@ -186,6 +190,8 @@ namespace DD4hep { Data(BitField64* decoder=0) : Object(), BaseSegmentation(decoder) { nphi=ntheta=nz=0;} /// Default destructor virtual ~Data(); + /// determine the position based on the cell ID + virtual std::vector<double> getPosition(const long64& cellID) const; /// determine the local position based on the cell ID virtual std::vector<double> getLocalPosition(const long64& cellID) const; /// determine the cell ID based on the local position diff --git a/DDCore/src/Readout.cpp b/DDCore/src/Readout.cpp index 1cd21eed6..d8fa1b9b5 100644 --- a/DDCore/src/Readout.cpp +++ b/DDCore/src/Readout.cpp @@ -95,12 +95,12 @@ DetElement Readout::getDetectorElement(const long64& cellID) const { Position Readout::getPosition(const long64& cellID) const { double global[3] = {0., 0., 0.}; VolumeManager volMan = LCDD::getInstance().volumeManager(); - volMan.worldTransformation(cellID).LocalToMaster(&(segmentation().segmentation()->getLocalPosition(cellID))[0], global); + volMan.worldTransformation(cellID).LocalToMaster(&(segmentation().segmentation()->getPosition(cellID))[0], global); return Position(global[0]/tgeo::mm, global[1]/tgeo::mm, global[2]/tgeo::mm); } Position Readout::getLocalPosition(const long64& cellID) const { - std::vector<double> v = segmentation().segmentation()->getLocalPosition(cellID); + std::vector<double> v = segmentation().segmentation()->getPosition(cellID); return Position(v[0], v[1], v[2]); } diff --git a/DDCore/src/Segementations.cpp b/DDCore/src/Segementations.cpp index 49e31d547..d14440c28 100644 --- a/DDCore/src/Segementations.cpp +++ b/DDCore/src/Segementations.cpp @@ -44,7 +44,7 @@ bool Segmentation::useForHitPosition() const { } /// Segmentation type -const string& SegmentationParams::type() const { +string SegmentationParams::type() const { return object<Object>().segmentation->type(); } @@ -66,15 +66,21 @@ DD4hep::DDSegmentation::Segmentation* Segmentation::segmentation() const { ProjectiveCylinder::Data::~Data() { } +/// determine the local position based on the cell ID +std::vector<double> ProjectiveCylinder::Data::getPosition(const long64& cellID) const { + not_implemented_call("ProjectiveCylinder::Data::getLocalPosition"); + return vector<double>(); +} + /// determine the local position based on the cell ID std::vector<double> ProjectiveCylinder::Data::getLocalPosition(const long64& cellID) const { - not_implemented_call("GridXY::Data::getLocalPosition"); + not_implemented_call("ProjectiveCylinder::Data::getLocalPosition"); return vector<double>(); } /// determine the cell ID based on the local position long64 ProjectiveCylinder::Data::getCellID(double x, double y, double z) const { - not_implemented_call("GridXY::Data::getCellID"); + not_implemented_call("ProjectiveCylinder::Data::getCellID"); return 0; } @@ -117,15 +123,21 @@ void ProjectiveCylinder::setZBins(int value) { NonProjectiveCylinder::Data::~Data() { } +/// determine the local position based on the cell ID +std::vector<double> NonProjectiveCylinder::Data::getPosition(const long64& cellID) const { + not_implemented_call("NonProjectiveCylinder::Data::getLocalPosition"); + return vector<double>(); +} + /// determine the local position based on the cell ID std::vector<double> NonProjectiveCylinder::Data::getLocalPosition(const long64& cellID) const { - not_implemented_call("GridXY::Data::getLocalPosition"); + not_implemented_call("NonProjectiveCylinder::Data::getLocalPosition"); return vector<double>(); } /// determine the cell ID based on the local position long64 NonProjectiveCylinder::Data::getCellID(double x, double y, double z) const { - not_implemented_call("GridXY::Data::getCellID"); + not_implemented_call("NonProjectiveCylinder::Data::getCellID"); return 0; } @@ -160,13 +172,19 @@ ProjectiveZPlane::Data::~Data() { /// determine the local position based on the cell ID std::vector<double> ProjectiveZPlane::Data::getLocalPosition(const long64& cellID) const { - not_implemented_call("GridXY::Data::getLocalPosition"); + not_implemented_call("ProjectiveZPlane::Data::getLocalPosition"); + return vector<double>(); +} + +/// determine the local position based on the cell ID +std::vector<double> ProjectiveZPlane::Data::getPosition(const long64& cellID) const { + not_implemented_call("ProjectiveZPlane::Data::getLocalPosition"); return vector<double>(); } /// determine the cell ID based on the local position long64 ProjectiveZPlane::Data::getCellID(double x, double y, double z) const { - not_implemented_call("GridXY::Data::getCellID"); + not_implemented_call("ProjectiveZPlane::Data::getCellID"); return 0; } -- GitLab