Skip to content
Snippets Groups Projects
Commit 19c2800f authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Added new StereoStrip Segmentation

- Adds an angle to the 1D segmentation.

	new file:   DDCore/include/DDSegmentation/StereoStrip.h
	modified:   DDCore/src/SegmentationDictionary.h
	modified:   DDCore/src/Segmentations.cpp
	modified:   DDCore/src/plugins/ReadoutSegmentations.cpp
	new file:   DDCore/src/segmentations/StereoStrip.cpp
parent 7dcf0d1f
No related branches found
No related tags found
1 merge request!1Added new StereoStrip Segmentation
//==========================================================================
// AIDA Detector description implementation
//--------------------------------------------------------------------------
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
// All rights reserved.
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
//==========================================================================
/*
* StereoStrip.h
*
* Created on: April 12, 2020
* Author: Whitney Armstrong, ANL
*/
#ifndef DDSegmentation_StereoStrip_H_
#define DDSegmentation_StereoStrip_H_
#include "DDSegmentation/CartesianStrip.h"
namespace dd4hep {
namespace DDSegmentation {
/// Segmentation base class describing cartesian strip segmentation in X
class StereoStrip : public DDSegmentation::CartesianStrip {
public:
/// Default constructor passing the encoding string
StereoStrip(const std::string& cellEncoding = "");
/// Default constructor used by derived classes passing an existing decoder
StereoStrip(const BitFieldCoder* decoder);
/// destructor
virtual ~StereoStrip();
/// determine the position based on the cell ID
virtual Vector3D position(const CellID& cellID) const;
/// determine the cell ID based on the position
virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition,
const VolumeID& volumeID) const;
/// access the strip size in X
double stripSizeU() const { return _stripSizeU; }
/// access the coordinate offset in X
double offsetU() const { return _offsetU; }
/// access the field name used for X
const std::string& fieldNameU() const { return _uId; }
/// set the strip size in X
void setStripSizeU(double cellSize) { _stripSizeU = cellSize; }
/// set the coordinate offset in X
void setOffsetU(double offset) { _offsetU = offset; }
/// set the field name used for X
void setFieldNameU(const std::string& fieldName) { _uId = fieldName; }
/** \brief Returns a vector<double> of the cellDimensions of the given cell ID
in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
Returns a vector of the cellDimensions of the given cell ID
\param cellID is ignored as all cells have the same dimension
\return std::vector<double> size 1:
-# size in x
*/
virtual std::vector<double> cellDimensions(const CellID& cellID) const;
protected:
/// the U strip angle
double _stripAngle;
/// the strip size in X
double _stripSizeU;
/// the coordinate offset in X
double _offsetU;
/// the field name used for X
std::string _uId;
};
} // namespace DDSegmentation
} /* namespace dd4hep */
#endif // DDSegmentation_StereoStrip_H_
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "DDSegmentation/PolarGridRPhi2.h" #include "DDSegmentation/PolarGridRPhi2.h"
#include "DDSegmentation/PolarGridRPhi.h" #include "DDSegmentation/PolarGridRPhi.h"
#include "DDSegmentation/ProjectiveCylinder.h" #include "DDSegmentation/ProjectiveCylinder.h"
#include "DDSegmentation/StereoStrip.h"
#include "DDSegmentation/SegmentationParameter.h" #include "DDSegmentation/SegmentationParameter.h"
#include "DDSegmentation/TiledLayerGridXY.h" #include "DDSegmentation/TiledLayerGridXY.h"
...@@ -89,6 +90,7 @@ typedef dd4hep::DDSegmentation::CellID CellID; ...@@ -89,6 +90,7 @@ typedef dd4hep::DDSegmentation::CellID CellID;
#pragma link C++ class dd4hep::DDSegmentation::TiledLayerGridXY+; #pragma link C++ class dd4hep::DDSegmentation::TiledLayerGridXY+;
#pragma link C++ class dd4hep::DDSegmentation::TiledLayerSegmentation+; #pragma link C++ class dd4hep::DDSegmentation::TiledLayerSegmentation+;
#pragma link C++ class dd4hep::DDSegmentation::WaferGridXY+; #pragma link C++ class dd4hep::DDSegmentation::WaferGridXY+;
#pragma link C++ class dd4hep::DDSegmentation::StereoStrip+;
#pragma link C++ class dd4hep::DDSegmentation::BitFieldElement+; #pragma link C++ class dd4hep::DDSegmentation::BitFieldElement+;
#pragma link C++ class dd4hep::DDSegmentation::BitFieldCoder+; #pragma link C++ class dd4hep::DDSegmentation::BitFieldCoder+;
......
...@@ -175,3 +175,6 @@ DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::ProjectiveCylinder); ...@@ -175,3 +175,6 @@ DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::ProjectiveCylinder);
#include "DDSegmentation/MultiSegmentation.h" #include "DDSegmentation/MultiSegmentation.h"
DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::MultiSegmentation); DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::MultiSegmentation);
#include "DDSegmentation/StereoStrip.h"
DD4HEP_INSTANTIATE_SEGMENTATION_HANDLE(DDSegmentation::StereoStrip);
...@@ -75,3 +75,6 @@ DECLARE_SEGMENTATION(ProjectiveCylinder,create_segmentation<dd4hep::DDSegmentati ...@@ -75,3 +75,6 @@ DECLARE_SEGMENTATION(ProjectiveCylinder,create_segmentation<dd4hep::DDSegmentati
#include "DDSegmentation/MultiSegmentation.h" #include "DDSegmentation/MultiSegmentation.h"
DECLARE_SEGMENTATION(MultiSegmentation,create_segmentation<dd4hep::DDSegmentation::MultiSegmentation>) DECLARE_SEGMENTATION(MultiSegmentation,create_segmentation<dd4hep::DDSegmentation::MultiSegmentation>)
#include "DDSegmentation/StereoStrip.h"
DECLARE_SEGMENTATION(StereoStrip,create_segmentation<dd4hep::DDSegmentation::StereoStrip>)
/*
* StereoStrip.cpp
*
* Created on: April 12, 2020
* Author: Whitney Armstrong, ANL
*
*/
#include "DDSegmentation/StereoStrip.h"
#include "DD4hep/Objects.h"
namespace dd4hep {
namespace DDSegmentation {
/// default constructor using an encoding string
StereoStrip::StereoStrip(const std::string& cellEncoding) : CartesianStrip(cellEncoding) {
// define type and description
_type = "StereoStrip";
_description = "Strip segmentation U rotated some angle from local X axis";
// register all necessary parameters
registerParameter("strip_angle", "Strip stereo angle in U direction", _stripAngle, 1., SegmentationParameter::AngleUnit);
registerParameter("strip_size", "Cell size in U", _stripSizeU, 1., SegmentationParameter::LengthUnit);
registerParameter("offset_u", "Cell offset in u", _offsetU, 0., SegmentationParameter::LengthUnit, true);
registerIdentifier("identifier_u", "Cell ID identifier for U", _uId, "u");
}
/// Default constructor used by derived classes passing an existing decoder
StereoStrip::StereoStrip(const BitFieldCoder* decode) : CartesianStrip(decode) {
// define type and description
_type = "StereoStrip";
_description = "Cartesian segmentation on the local X axis";
// register all necessary parameters
registerParameter("strip_angle", "Strip stereo angle in U direction", _stripAngle, 1., SegmentationParameter::AngleUnit);
registerParameter("strip_size", "Cell size in U", _stripSizeU, 1., SegmentationParameter::LengthUnit);
registerParameter("offset_u", "Cell offset in U", _offsetU, 0., SegmentationParameter::LengthUnit, true);
registerIdentifier("identifier_u", "Cell ID identifier for U", _uId, "u");
}
/// destructor
StereoStrip::~StereoStrip() {}
/// determine the position based on the cell ID
Vector3D StereoStrip::position(const CellID& cID) const {
Position cellPosition;
cellPosition.SetX( binToPosition(_decoder->get(cID, _uId), _stripSizeU, _offsetU));
cellPosition = RotationZ(_stripAngle)*cellPosition;
return cellPosition;
}
/// determine the cell ID based on the position
CellID StereoStrip::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */,
const VolumeID& vID) const {
CellID cID = vID;
_decoder->set(cID, _uId, positionToBin((RotationZ(-1.0*_stripAngle)*localPosition).X, _stripSizeU, _offsetU));
return cID;
}
std::vector<double> StereoStrip::cellDimensions(const CellID&) const {
#if __cplusplus >= 201103L
return {_stripSizeU};
#else
std::vector<double> cellDims(1, 0.0);
cellDims[0] = _stripSizeU;
return cellDims;
#endif
}
REGISTER_SEGMENTATION(StereoStrip)
} // namespace DDSegmentation
} /* namespace dd4hep */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment