DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
HexGrid.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 //==========================================================================
11 
12 /*
13  * HexGrid.h
14  *
15  * Created on: August 9, 2023
16  * Author: Sebouh J. Paul, UC Riverside
17  */
18 
19 #ifndef DDSEGMENTATION_HEXGRID_H
20 #define DDSEGMENTATION_HEXGRID_H
21 
23 
24 namespace dd4hep {
25  namespace DDSegmentation {
26 
28  class HexGrid: public Segmentation {
29  public:
31  virtual ~HexGrid();
32  //protected:
34  HexGrid(const std::string& cellEncoding = "");
37 
39  virtual Vector3D position(const CellID& cellID) const;
41  virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const;
42  // access the stagger mode: 0=no stagger; 1=stagger cycling through 3 offsets
43  int stagger() const {
44  return _stagger;
45  }
46 
48  double sideLength() const {
49  return _sideLength;
50  }
52  double offsetX() const {
53  return _offsetX;
54  }
56  double offsetY() const {
57  return _offsetY;
58  }
60  const std::string& fieldNameX() const {
61  return _xId;
62  }
64  const std::string& fieldNameY() const {
65  return _yId;
66  }
68  const std::string& staggerKeyword() const {
69  return _staggerKeyword;
70  }
71 
73  void setStagger(int stagger) {
75  }
77  void setSideLength(double cellSize) {
78  _sideLength = cellSize;
79  }
81  void setOffsetX(double offset) {
82  _offsetX = offset;
83  }
85  void setOffsetY(double offset) {
86  _offsetY = offset;
87  }
89  void setFieldNameX(const std::string& fieldName) {
90  _xId = fieldName;
91  }
93  void setFieldNameY(const std::string& fieldName) {
94  _yId = fieldName;
95  }
97  void setStaggerKeyword(const std::string& staggerKeyword) {
99  }
109  virtual std::vector<double> cellDimensions(const CellID& cellID) const;
110 
111  protected:
113  // 2=cycle through 4 differnt offsets (H4)
114  int _stagger;
116  double _sideLength;
118  double _offsetX;
120  double _offsetY;
122  std::string _xId;
124  std::string _yId;
126  std::string _staggerKeyword;
127  };
128 
129  } /* namespace DDSegmentation */
130 } /* namespace dd4hep */
131 #endif // DDSEGMENTATION_HEXGRID_H
dd4hep::DDSegmentation::VolumeID
uint64_t VolumeID
Definition: BitFieldCoder.h:27
dd4hep::DDSegmentation::HexGrid::_staggerKeyword
std::string _staggerKeyword
the keyword used to determine which volumes to stagger
Definition: HexGrid.h:126
dd4hep::DDSegmentation::HexGrid::_yId
std::string _yId
the field name used for Y
Definition: HexGrid.h:124
dd4hep::DDSegmentation::HexGrid::setFieldNameY
void setFieldNameY(const std::string &fieldName)
set the field name used for Y
Definition: HexGrid.h:93
dd4hep::DDSegmentation::HexGrid::fieldNameX
const std::string & fieldNameX() const
access the field name used for X
Definition: HexGrid.h:60
dd4hep::DDSegmentation::Vector3D
Simple container for a physics vector.
Definition: Segmentation.h:48
dd4hep::DDSegmentation::BitFieldCoder
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
Definition: BitFieldCoder.h:114
dd4hep::DDSegmentation::HexGrid::position
virtual Vector3D position(const CellID &cellID) const
determine the position based on the cell ID
Definition: HexGrid.cpp:59
dd4hep::DDSegmentation::HexGrid::staggerKeyword
const std::string & staggerKeyword() const
access the keyword for staggering
Definition: HexGrid.h:68
dd4hep::DDSegmentation::HexGrid::setStaggerKeyword
void setStaggerKeyword(const std::string &staggerKeyword)
set the keyword used to determine which volumes to stagger
Definition: HexGrid.h:97
dd4hep::DDSegmentation::HexGrid::HexGrid
HexGrid(const std::string &cellEncoding="")
Default constructor used by derived classes passing the encoding string.
Definition: HexGrid.cpp:22
dd4hep::DDSegmentation::HexGrid::setFieldNameX
void setFieldNameX(const std::string &fieldName)
set the field name used for X
Definition: HexGrid.h:89
dd4hep::DDSegmentation::HexGrid::setStagger
void setStagger(int stagger)
set the stagger mode: 0=no stagger; 1=stagger cycling through 3 offsets
Definition: HexGrid.h:73
dd4hep::DDSegmentation::HexGrid::_stagger
int _stagger
the stagger mode: 0=off ; 1=cycle through 3 different offsets (H3)
Definition: HexGrid.h:114
dd4hep::DDSegmentation::HexGrid::setSideLength
void setSideLength(double cellSize)
set the grid size in X
Definition: HexGrid.h:77
dd4hep::DDSegmentation::HexGrid::_xId
std::string _xId
the field name used for X
Definition: HexGrid.h:122
dd4hep::DDSegmentation::Segmentation::decoder
virtual const BitFieldCoder * decoder() const
Access the underlying decoder.
Definition: Segmentation.h:112
dd4hep::DDSegmentation::HexGrid::fieldNameY
const std::string & fieldNameY() const
access the field name used for Y
Definition: HexGrid.h:64
dd4hep::DDSegmentation::HexGrid::setOffsetY
void setOffsetY(double offset)
set the coordinate offset in Y
Definition: HexGrid.h:85
dd4hep::DDSegmentation::HexGrid::offsetX
double offsetX() const
access the coordinate offset in X
Definition: HexGrid.h:52
dd4hep::DDSegmentation::HexGrid::cellID
virtual CellID cellID(const Vector3D &localPosition, const Vector3D &globalPosition, const VolumeID &volumeID) const
determine the cell ID based on the position
Definition: HexGrid.cpp:95
dd4hep::DDSegmentation::CellID
uint64_t CellID
Definition: BitFieldCoder.h:26
dd4hep::DDSegmentation::Segmentation::volumeID
virtual VolumeID volumeID(const CellID &cellID) const
Determine the volume ID from the full cell ID by removing all local fields.
Definition: Segmentation.cpp:66
dd4hep::DDSegmentation::HexGrid::cellDimensions
virtual std::vector< double > cellDimensions(const CellID &cellID) const
Returns a vector<double> of the cellDimensions of the given cell ID in natural order of dimensions,...
Definition: HexGrid.cpp:135
dd4hep::DDSegmentation::HexGrid::_sideLength
double _sideLength
the length of one side of a hexagon
Definition: HexGrid.h:116
dd4hep::DDSegmentation::HexGrid::sideLength
double sideLength() const
access the grid size
Definition: HexGrid.h:48
dd4hep::DDSegmentation::HexGrid::~HexGrid
virtual ~HexGrid()
Destructor.
Definition: HexGrid.cpp:55
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::DDSegmentation::HexGrid::stagger
int stagger() const
Definition: HexGrid.h:43
dd4hep::DDSegmentation::HexGrid::_offsetY
double _offsetY
the coordinate offset in Y
Definition: HexGrid.h:120
Segmentation.h
dd4hep::DDSegmentation::HexGrid::offsetY
double offsetY() const
access the coordinate offset in Y
Definition: HexGrid.h:56
dd4hep::DDSegmentation::Segmentation
Base class for all segmentations.
Definition: Segmentation.h:75
dd4hep::DDSegmentation::HexGrid
Segmentation base class describing hexagonal grid segmentation, with or without staggering.
Definition: HexGrid.h:28
dd4hep::DDSegmentation::HexGrid::_offsetX
double _offsetX
the coordinate offset in X
Definition: HexGrid.h:118
dd4hep::DDSegmentation::HexGrid::setOffsetX
void setOffsetX(double offset)
set the coordinate offset in X
Definition: HexGrid.h:81