-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a "CartesianGridUV" segmentation class, providing for a readout a…
…t an angle w.r.t. X,Y axes.
- Loading branch information
Showing
8 changed files
with
439 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_CARTESIANGRIDUV_H | ||
#define DD4HEP_CARTESIANGRIDUV_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 CartesianGridUV; } | ||
|
||
/// We need some abbreviation to make the code more readable. | ||
typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridUV> > CartesianGridUVHandle; | ||
|
||
/// Implementation class for the grid UV 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 CartesianGridUV : public CartesianGridUVHandle { | ||
public: | ||
/// Default constructor | ||
CartesianGridUV() = default; | ||
/// Copy constructor | ||
CartesianGridUV(const CartesianGridUV& e) = default; | ||
/// Copy Constructor from segmentation base object | ||
CartesianGridUV(const Segmentation& e) : Handle<Object>(e) { } | ||
/// Copy constructor from handle | ||
CartesianGridUV(const Handle<Object>& e) : Handle<Object>(e) { } | ||
/// Copy constructor from other equivalent handle | ||
template <typename Q> CartesianGridUV(const Handle<Q>& e) : Handle<Object>(e) { } | ||
/// Assignment operator | ||
CartesianGridUV& operator=(const CartesianGridUV& seg) = default; | ||
/// Equality operator | ||
bool operator==(const CartesianGridUV& 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 U | ||
double gridSizeU() const; | ||
/// access the grid size in V | ||
double gridSizeV() const; | ||
/// set the grid size in U | ||
void setGridSizeU(double cellSize) const; | ||
/// set the grid size in V | ||
void setGridSizeV(double cellSize) const; | ||
/// access the coordinate offset in U | ||
double offsetU() const; | ||
/// access the coordinate offset in V | ||
double offsetV() const; | ||
/// access the rotation angle | ||
double gridAngle() const; | ||
/// set the coordinate offset in U | ||
void setOffsetU(double offset) const; | ||
/// set the coordinate offset in V | ||
void setOffsetV(double offset) const; | ||
/// set the rotation angle | ||
void setGridAngle(double angle) const; | ||
/// access the field name used for U | ||
const std::string& fieldNameU() const; | ||
/// access the field name used for V | ||
const std::string& fieldNameV() const; | ||
/** \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 2: | ||
-# size in U | ||
-# size in V | ||
*/ | ||
std::vector<double> cellDimensions(const CellID& cellID) const; | ||
}; | ||
|
||
} /* End namespace dd4hep */ | ||
#endif // DD4HEP_CARTESIANGRIDUV_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
//========================================================================== | ||
// 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. | ||
// | ||
//========================================================================== | ||
/* | ||
* CartesianGridUV.h | ||
* | ||
* Created on: December 5, 2024 | ||
* Author: Yann Bedfer, ePIC/Saclay | ||
*/ | ||
|
||
#ifndef DDSEGMENTATION_CARTESIANGRIDUV_H | ||
#define DDSEGMENTATION_CARTESIANGRIDUV_H | ||
|
||
#include <DDSegmentation/CartesianGrid.h> | ||
|
||
namespace dd4hep { | ||
namespace DDSegmentation { | ||
|
||
/// Segmentation base class describing cartesian grid segmentation in along U,V rotated some angle from local X,Y axes | ||
class CartesianGridUV: public CartesianGrid { | ||
public: | ||
/// Default constructor passing the encoding string | ||
CartesianGridUV(const std::string& cellEncoding = ""); | ||
/// Default constructor used by derived classes passing an existing decoder | ||
CartesianGridUV(const BitFieldCoder* decoder); | ||
/// destructor | ||
virtual ~CartesianGridUV(); | ||
|
||
/// 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 grid size in U | ||
double gridSizeU() const { | ||
return _gridSizeU; | ||
} | ||
/// access the grid size in V | ||
double gridSizeV() const { | ||
return _gridSizeV; | ||
} | ||
/// access the coordinate offset in U | ||
double offsetU() const { | ||
return _offsetU; | ||
} | ||
/// access the coordinate offset in V | ||
double offsetV() const { | ||
return _offsetV; | ||
} | ||
/// access the rotation angle | ||
double gridAngle() const { | ||
return _gridAngle; | ||
} | ||
/// access the field name used for U | ||
const std::string& fieldNameU() const { | ||
return _uId; | ||
} | ||
/// access the field name used for V | ||
const std::string& fieldNameV() const { | ||
return _vId; | ||
} | ||
/// set the grid size in U | ||
void setGridSizeU(double cellSize) { | ||
_gridSizeU = cellSize; | ||
} | ||
/// set the grid size in V | ||
void setGridSizeV(double cellSize) { | ||
_gridSizeV = cellSize; | ||
} | ||
/// set the coordinate offset in U | ||
void setOffsetU(double offset) { | ||
_offsetU = offset; | ||
} | ||
/// set the coordinate offset in V | ||
void setOffsetV(double offset) { | ||
_offsetV = offset; | ||
} | ||
/// set the rotation angle | ||
void setGridAngle(double angle) { | ||
_gridAngle = angle; | ||
} | ||
/// set the field name used for U | ||
void setFieldNameU(const std::string& fieldName) { | ||
_uId = fieldName; | ||
} | ||
/// set the field name used for V | ||
void setFieldNameV(const std::string& fieldName) { | ||
_vId = 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 2: | ||
-# size in U | ||
-# size in V | ||
*/ | ||
virtual std::vector<double> cellDimensions(const CellID& cellID) const; | ||
|
||
protected: | ||
/// the grid size in U | ||
double _gridSizeU; | ||
/// the coordinate offset in U | ||
double _offsetU; | ||
/// the grid size in V | ||
double _gridSizeV; | ||
/// the coordinate offset in V | ||
double _offsetV; | ||
/// the field name used for U | ||
std::string _uId; | ||
/// the field name used for V | ||
std::string _vId; | ||
/// the U grid angle | ||
double _gridAngle; | ||
}; | ||
|
||
} /* namespace DDSegmentation */ | ||
} /* namespace dd4hep */ | ||
#endif // DDSEGMENTATION_CARTESIANGRIDUV_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
//========================================================================== | ||
// 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 : M.Frank | ||
// | ||
//========================================================================== | ||
|
||
// Framework include files | ||
#include <DD4hep/CartesianGridUV.h> | ||
#include <DDSegmentation/CartesianGridUV.h> | ||
|
||
using namespace dd4hep; | ||
|
||
/// determine the position based on the cell ID | ||
Position CartesianGridUV::position(const CellID& id) const { | ||
return Position(access()->implementation->position(id)); | ||
} | ||
|
||
/// determine the cell ID based on the position | ||
dd4hep::CellID CartesianGridUV::cellID(const Position& local, | ||
const Position& global, | ||
const VolumeID& volID) const | ||
{ | ||
return access()->implementation->cellID(local, global, volID); | ||
} | ||
|
||
/// access the grid size in U | ||
double CartesianGridUV::gridSizeU() const { | ||
return access()->implementation->gridSizeU(); | ||
} | ||
|
||
/// access the grid size in V | ||
double CartesianGridUV::gridSizeV() const { | ||
return access()->implementation->gridSizeV(); | ||
} | ||
|
||
/// set the grid size in U | ||
void CartesianGridUV::setGridSizeU(double cellSize) const { | ||
access()->implementation->setGridSizeU(cellSize); | ||
} | ||
|
||
/// set the grid size in V | ||
void CartesianGridUV::setGridSizeV(double cellSize) const { | ||
access()->implementation->setGridSizeV(cellSize); | ||
} | ||
|
||
/// access the coordinate offset in U | ||
double CartesianGridUV::offsetU() const { | ||
return access()->implementation->offsetU(); | ||
} | ||
|
||
/// access the coordinate offset in V | ||
double CartesianGridUV::offsetV() const { | ||
return access()->implementation->offsetV(); | ||
} | ||
|
||
/// access the rotation angle | ||
double CartesianGridUV::gridAngle() const { | ||
return access()->implementation->gridAngle(); | ||
} | ||
|
||
/// set the coordinate offset in U | ||
void CartesianGridUV::setOffsetU(double offset) const { | ||
access()->implementation->setOffsetU(offset); | ||
} | ||
|
||
/// set the coordinate offset in V | ||
void CartesianGridUV::setOffsetV(double offset) const { | ||
access()->implementation->setOffsetV(offset); | ||
} | ||
|
||
/// access the field name used for U | ||
const std::string& CartesianGridUV::fieldNameU() const { | ||
return access()->implementation->fieldNameU(); | ||
} | ||
|
||
/// access the field name used for V | ||
const std::string& CartesianGridUV::fieldNameV() const { | ||
return access()->implementation->fieldNameV(); | ||
} | ||
|
||
// Returns a vector<double> of the cellDimensions of the given cell ID | ||
std::vector<double> CartesianGridUV::cellDimensions(const CellID& id) const { | ||
return access()->implementation->cellDimensions(id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.