Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CylindricalGridPhiZ files #1294

Merged
merged 8 commits into from
Jul 24, 2024
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/CartesianGridXY.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
4 changes: 2 additions & 2 deletions DDCore/include/DD4hep/CartesianGridXYZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down Expand Up @@ -105,7 +105,7 @@ namespace dd4hep {

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 2:
\return std::vector<double> size 3:
-# size in x
-# size in y
-# size in z
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/CartesianGridXZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/CartesianGridYZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/CartesianStripX.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef Handle<SegmentationWrapper<DDSegmentation::CartesianStripX> > CartesianS
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
4 changes: 2 additions & 2 deletions DDCore/include/DD4hep/CartesianStripY.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef Handle<SegmentationWrapper<DDSegmentation::CartesianStripY> > CartesianS
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down Expand Up @@ -87,7 +87,7 @@ class CartesianStripY : public CartesianStripYHandle {
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
-# size in y
*/
std::vector<double> cellDimensions(const CellID& cellID) const;
};
Expand Down
4 changes: 2 additions & 2 deletions DDCore/include/DD4hep/CartesianStripZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef Handle<SegmentationWrapper<DDSegmentation::CartesianStripZ> > CartesianS
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down Expand Up @@ -88,7 +88,7 @@ class CartesianStripZ : public CartesianStripZHandle {
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
-# size in z
*/
std::vector<double> cellDimensions(const CellID& cellID) const;
};
Expand Down
111 changes: 111 additions & 0 deletions DDCore/include/DD4hep/CylindricalGridPhiZ.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//==========================================================================
// 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.
//
// \author Markus Frank
// \date 2016-10-18
// \version 1.0
//
//==========================================================================
#ifndef DD4HEP_CYLINDRICALGRIDPHIZ_H
#define DD4HEP_CYLINDRICALGRIDPHIZ_H 1

// Framework include files
#include <DD4hep/Segmentations.h>

/// Namespace for the AIDA detector description toolkit
namespace dd4hep {

/// Namespace for base segmentations
namespace DDSegmentation { class CylindricalGridPhiZ; }

/// We need some abbreviation to make the code more readable.
typedef Handle<SegmentationWrapper<DDSegmentation::CylindricalGridPhiZ> > CylindricalGridPhiZHandle;

/// Implementation class for the grid PhiZ segmentation.
/**
* Concrete user handle to serve specific needs of client code
* which requires access to the base functionality not served
* by the super-class Segmentation.
*
* Note:
* We only check the validity of the underlying handle.
* If for whatever reason the implementation object is not valid
* This is not checked.
* In principle this CANNOT happen unless some brain-dead has
* fiddled with the handled object directly.....
*
* Note:
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
* \version 1.0
* \ingroup DD4HEP_CORE
*/
class CylindricalGridPhiZ : public CylindricalGridPhiZHandle {
public:
/// Default constructor
CylindricalGridPhiZ() = default;
/// Copy constructor
CylindricalGridPhiZ(const CylindricalGridPhiZ& e) = default;
/// Copy Constructor from segmentation base object
CylindricalGridPhiZ(const Segmentation& e) : Handle<Object>(e) {}
/// Copy constructor from handle
CylindricalGridPhiZ(const Handle<Object>& e) : Handle<Object>(e) {}
/// Copy constructor from other polymorph/equivalent handle
template <typename Q>
CylindricalGridPhiZ(const Handle<Q>& e) : Handle<Object>(e) {}
/// Assignment operator
CylindricalGridPhiZ& operator=(const CylindricalGridPhiZ& seg) = default;
/// Equality operator
bool operator==(const CylindricalGridPhiZ& seg) const
{ return m_element == seg.m_element; }

/// determine the position based on the cell ID
Position position(const CellID& cellID) const;
/// determine the cell ID based on the position
CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const;
/// access the grid size in phi
double gridSizePhi() const;
/// access the grid size in Z
double gridSizeZ() const;
/// access the radius
double radius() const;
/// access the coordinate offset in phi
double offsetPhi() const;
/// access the coordinate offset in Z
double offsetZ() const;

/// set the grid size in phi
void setGridSizePhi(double cellSize) const;
/// set the grid size in Z
void setGridSizeZ(double cellSize) const;
/// set the coordinate offset in phi
void setOffsetPhi(double offset) const;
/// set the coordinate offset in Z
void setOffsetZ(double offset) const;
/// set the radius
void setRadius(double radius);
/// access the field name used for phi
const std::string& fieldNamePhi() const;
/// access the field name used for Z
const std::string& fieldNameZ() const;
/** \brief Returns a vector<double> of the cellDimensions of the given cell ID
in the following order: R*dPhi,dZ

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 2:
-# size in x = R * size in phi
-# size in z
*/
std::vector<double> cellDimensions(const CellID& cellID) const;
};
} /* End namespace dd4hep */
#endif // DD4HEP_CYLINDRICALGRIDPHIZ_H
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/GridPhiEta.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author A. Zaborowska
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/GridRPhiEta.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author A. Zaborowska
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/MultiSegmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/PolarGridRPhi.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/PolarGridRPhi2.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DD4hep/WaferGridXY.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dd4hep {
* fiddled with the handled object directly.....
*
* Note:
* The handle base corrsponding to this object in for
* The handle base corresponding to this object in for
* conveniance reasons instantiated in dd4hep/src/Segmentations.cpp.
*
* \author M.Frank
Expand Down
2 changes: 1 addition & 1 deletion DDCore/include/DDSegmentation/CartesianGridXZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//==========================================================================
/*
* CartesianGridXY.h
* CartesianGridXZ.h
*
* Created on: Jun 28, 2013
* Author: Christian Grefe, CERN
Expand Down
127 changes: 127 additions & 0 deletions DDCore/include/DDSegmentation/CylindricalGridPhiZ.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
//==========================================================================
// 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.
//
//==========================================================================
/*
* CylindricalGridPhiZ.h
*
* Created on: Jun 28, 2024
* Author: Yann Bedfer, ePIC/Saclay
*/

#ifndef DDSEGMENTATION_CYLINDRICALGRIDPHIZ_H
#define DDSEGMENTATION_CYLINDRICALGRIDPHIZ_H

#include <DDSegmentation/CylindricalSegmentation.h>

namespace dd4hep {
namespace DDSegmentation {

/// Segmentation base class describing cylindrical grid segmentation in the Phi-Z cylinder
class CylindricalGridPhiZ: public CylindricalSegmentation {
public:
/// default constructor using an arbitrary type
CylindricalGridPhiZ(const std::string& cellEncoding);
/// Default constructor used by derived classes passing an existing decoder
CylindricalGridPhiZ(const BitFieldCoder* decoder);
/// destructor
virtual ~CylindricalGridPhiZ();

/// determine the local 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 grid size in phi
double gridSizePhi() const {
return _gridSizePhi;
}
/// access the grid size in Z
double gridSizeZ() const {
return _gridSizeZ;
}
/// access the coordinate offset in phi
double offsetPhi() const {
return _offsetPhi;
}
/// access the coordinate offset in Z
double offsetZ() const {
return _offsetZ;
}
/// access the radius
double radius() const {
return _radius;
}
/// access the field name used for phi
const std::string& fieldNamePhi() const {
return _phiId;
}
/// access the field name used for Z
const std::string& fieldNameZ() const {
return _zId;
}
/// set the grid size in phi
void setGridSizePhi(double cellSize) {
_gridSizePhi = cellSize;
}
/// set the grid size in Z
void setGridSizeZ(double cellSize) {
_gridSizeZ = cellSize;
}
/// set the coordinate offset in phi
void setOffsetPhi(double offset) {
_offsetPhi = offset;
}
/// set the coordinate offset in Z
void setOffsetZ(double offset) {
_offsetZ = offset;
}
/// set the radius
void setRadius(double radius) {
_radius = radius;
}
/// set the field name used for phi
void setFieldNamePhi(const std::string& fieldName) {
_phiId = fieldName;
}
/// set the field name used for Z
void setFieldNameZ(const std::string& fieldName) {
_zId = fieldName;
}
/** \brief Returns a vector<double> of the cellDimensions of the given cell ID
in the following order: R*dPhi,dZ

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 2:
-# size in x = R * size in phi
-# size in z
*/
virtual std::vector<double> cellDimensions(const CellID& cellID) const;

protected:
/// the grid size in phi
double _gridSizePhi;
/// the coordinate offset in phi
double _offsetPhi;
/// the grid size in Z
double _gridSizeZ;
/// the coordinate offset in Z
double _offsetZ;
/// the radius
double _radius;
/// the field name used for phi
std::string _phiId;
/// the field name used for Z
std::string _zId;
/// encoding field used for the module
};

} /* namespace DDSegmentation */
} /* namespace dd4hep */
#endif // DDSEGMENTATION_CYLINDRICALGRIDPHIZ_H
Loading
Loading