DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
dd4hep::DDSegmentation::Segmentation Class Referenceabstract

Base class for all segmentations. More...

#include <Segmentation.h>

Inheritance diagram for dd4hep::DDSegmentation::Segmentation:
dd4hep::DDSegmentation::CartesianGrid dd4hep::DDSegmentation::CartesianStrip dd4hep::DDSegmentation::CylindricalSegmentation dd4hep::DDSegmentation::GridPhiEta dd4hep::DDSegmentation::HexGrid dd4hep::DDSegmentation::MultiSegmentation dd4hep::DDSegmentation::NoSegmentation dd4hep::DDSegmentation::PolarGrid dd4hep::DDSegmentation::TiledLayerSegmentation

Public Member Functions

virtual ~Segmentation ()
 Destructor. More...
 
virtual void addSubsegmentation (long key_min, long key_max, Segmentation *entry)
 Add subsegmentation. Call only valid for Multi-segmentations. Default implementation throws an exception. More...
 
virtual Vector3D position (const CellID &cellID) const =0
 Determine the local position based on the cell ID. More...
 
virtual CellID cellID (const Vector3D &localPosition, const Vector3D &globalPosition, const VolumeID &volumeID) const =0
 Determine the cell ID based on the position. More...
 
virtual VolumeID volumeID (const CellID &cellID) const
 Determine the volume ID from the full cell ID by removing all local fields. More...
 
virtual void neighbours (const CellID &cellID, std::set< CellID > &neighbours) const
 Calculates the neighbours of the given cell ID and adds them to the list of neighbours. More...
 
virtual std::string fieldDescription () const
 Access the encoding string. More...
 
virtual const std::string & name () const
 Access the segmentation name. More...
 
virtual void setName (const std::string &value)
 Set the segmentation name. More...
 
virtual const std::string & type () const
 Access the segmentation type. More...
 
virtual const std::string & description () const
 Access the description of the segmentation. More...
 
virtual const BitFieldCoderdecoder () const
 Access the underlying decoder. More...
 
virtual void setDecoder (const BitFieldCoder *decoder)
 Set the underlying decoder. More...
 
virtual Parameter parameter (const std::string &parameterName) const
 Access to parameter by name. More...
 
virtual Parameters parameters () const
 Access to all parameters. More...
 
virtual void setParameters (const Parameters &parameters)
 Set all parameters from an existing set of parameters. More...
 
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, e.g., dx/dy/dz, or dr/r*dPhi. More...
 

Protected Member Functions

 Segmentation (const std::string &cellEncoding="")
 Default constructor used by derived classes passing the encoding string. More...
 
 Segmentation (const BitFieldCoder *decoder)
 Default constructor used by derived classes passing an existing decoder. More...
 
template<typename TYPE >
void registerParameter (const std::string &nam, const std::string &desc, TYPE &param, const TYPE &defaultVal, UnitType unitTyp=SegmentationParameter::NoUnit, bool isOpt=false)
 Add a parameter to this segmentation. Used by derived classes to define their parameters. More...
 
void registerIdentifier (const std::string &nam, const std::string &desc, std::string &ident, const std::string &defaultVal)
 Add a cell identifier to this segmentation. Used by derived classes to define their required identifiers. More...
 

Static Protected Member Functions

static double binToPosition (FieldID bin, double cellSize, double offset=0.)
 Helper method to convert a bin number to a 1D position. More...
 
static int positionToBin (double position, double cellSize, double offset=0.)
 Helper method to convert a 1D position to a cell ID. More...
 
static double binToPosition (FieldID bin, std::vector< double > const &cellBoundaries, double offset=0.)
 Helper method to convert a bin number to a 1D position given a vector of binBoundaries. More...
 
static int positionToBin (double position, std::vector< double > const &cellBoundaries, double offset=0.)
 Helper method to convert a 1D position to a cell ID given a vector of binBoundaries. More...
 

Protected Attributes

std::string _name
 The segmentation name. More...
 
std::string _type
 The segmentation type. More...
 
std::string _description
 The description of the segmentation. More...
 
std::map< std::string, Parameter_parameters
 The parameters for this segmentation. More...
 
std::map< std::string, StringParameter_indexIdentifiers
 The indices used for the encoding. More...
 
const BitFieldCoder_decoder = 0
 The cell ID encoder and decoder. More...
 
bool _ownsDecoder = false
 Keeps track of the decoder ownership. More...
 

Private Member Functions

 Segmentation (const Segmentation &)
 No copy constructor allowed. More...
 

Detailed Description

Base class for all segmentations.

Definition at line 75 of file Segmentation.h.

Constructor & Destructor Documentation

◆ ~Segmentation()

dd4hep::DDSegmentation::Segmentation::~Segmentation ( )
virtual

Destructor.

Definition at line 50 of file Segmentation.cpp.

◆ Segmentation() [1/3]

dd4hep::DDSegmentation::Segmentation::Segmentation ( const std::string &  cellEncoding = "")
protected

Default constructor used by derived classes passing the encoding string.

Definition at line 39 of file Segmentation.cpp.

◆ Segmentation() [2/3]

dd4hep::DDSegmentation::Segmentation::Segmentation ( const BitFieldCoder decoder)
protected

Default constructor used by derived classes passing an existing decoder.

Definition at line 45 of file Segmentation.cpp.

◆ Segmentation() [3/3]

dd4hep::DDSegmentation::Segmentation::Segmentation ( const Segmentation )
private

No copy constructor allowed.

Member Function Documentation

◆ addSubsegmentation()

void dd4hep::DDSegmentation::Segmentation::addSubsegmentation ( long  key_min,
long  key_max,
Segmentation entry 
)
virtual

Add subsegmentation. Call only valid for Multi-segmentations. Default implementation throws an exception.

Reimplemented in dd4hep::DDSegmentation::MultiSegmentation.

Definition at line 61 of file Segmentation.cpp.

◆ binToPosition() [1/2]

double dd4hep::DDSegmentation::Segmentation::binToPosition ( FieldID  bin,
double  cellSize,
double  offset = 0. 
)
staticprotected

Helper method to convert a bin number to a 1D position.

Definition at line 145 of file Segmentation.cpp.

◆ binToPosition() [2/2]

double dd4hep::DDSegmentation::Segmentation::binToPosition ( FieldID  bin,
std::vector< double > const &  cellBoundaries,
double  offset = 0. 
)
staticprotected

Helper method to convert a bin number to a 1D position given a vector of binBoundaries.

Definition at line 158 of file Segmentation.cpp.

◆ cellDimensions()

std::vector< double > dd4hep::DDSegmentation::Segmentation::cellDimensions ( const CellID cellID) const
virtual

◆ cellID()

virtual CellID dd4hep::DDSegmentation::Segmentation::cellID ( const Vector3D localPosition,
const Vector3D globalPosition,
const VolumeID volumeID 
) const
pure virtual

◆ decoder()

virtual const BitFieldCoder* dd4hep::DDSegmentation::Segmentation::decoder ( ) const
inlinevirtual

Access the underlying decoder.

Definition at line 112 of file Segmentation.h.

◆ description()

virtual const std::string& dd4hep::DDSegmentation::Segmentation::description ( ) const
inlinevirtual

Access the description of the segmentation.

Definition at line 108 of file Segmentation.h.

◆ fieldDescription()

virtual std::string dd4hep::DDSegmentation::Segmentation::fieldDescription ( ) const
inlinevirtual

Access the encoding string.

Definition at line 92 of file Segmentation.h.

◆ name()

virtual const std::string& dd4hep::DDSegmentation::Segmentation::name ( ) const
inlinevirtual

Access the segmentation name.

Definition at line 96 of file Segmentation.h.

◆ neighbours()

void dd4hep::DDSegmentation::Segmentation::neighbours ( const CellID cellID,
std::set< CellID > &  neighbours 
) const
virtual

Calculates the neighbours of the given cell ID and adds them to the list of neighbours.

Definition at line 77 of file Segmentation.cpp.

◆ parameter()

Parameter dd4hep::DDSegmentation::Segmentation::parameter ( const std::string &  parameterName) const
virtual

Access to parameter by name.

Definition at line 110 of file Segmentation.cpp.

◆ parameters()

Parameters dd4hep::DDSegmentation::Segmentation::parameters ( ) const
virtual

Access to all parameters.

Definition at line 121 of file Segmentation.cpp.

◆ position()

virtual Vector3D dd4hep::DDSegmentation::Segmentation::position ( const CellID cellID) const
pure virtual

◆ positionToBin() [1/2]

int dd4hep::DDSegmentation::Segmentation::positionToBin ( double  position,
double  cellSize,
double  offset = 0. 
)
staticprotected

Helper method to convert a 1D position to a cell ID.

Definition at line 150 of file Segmentation.cpp.

◆ positionToBin() [2/2]

int dd4hep::DDSegmentation::Segmentation::positionToBin ( double  position,
std::vector< double > const &  cellBoundaries,
double  offset = 0. 
)
staticprotected

Helper method to convert a 1D position to a cell ID given a vector of binBoundaries.

Definition at line 162 of file Segmentation.cpp.

◆ registerIdentifier()

void dd4hep::DDSegmentation::Segmentation::registerIdentifier ( const std::string &  nam,
const std::string &  desc,
std::string &  ident,
const std::string &  defaultVal 
)
protected

Add a cell identifier to this segmentation. Used by derived classes to define their required identifiers.

Definition at line 135 of file Segmentation.cpp.

◆ registerParameter()

template<typename TYPE >
void dd4hep::DDSegmentation::Segmentation::registerParameter ( const std::string &  nam,
const std::string &  desc,
TYPE &  param,
const TYPE &  defaultVal,
UnitType  unitTyp = SegmentationParameter::NoUnit,
bool  isOpt = false 
)
inlineprotected

Add a parameter to this segmentation. Used by derived classes to define their parameters.

Definition at line 138 of file Segmentation.h.

◆ setDecoder()

void dd4hep::DDSegmentation::Segmentation::setDecoder ( const BitFieldCoder decoder)
virtual

Set the underlying decoder.

Reimplemented in dd4hep::DDSegmentation::MultiSegmentation.

Definition at line 100 of file Segmentation.cpp.

◆ setName()

virtual void dd4hep::DDSegmentation::Segmentation::setName ( const std::string &  value)
inlinevirtual

Set the segmentation name.

Definition at line 100 of file Segmentation.h.

◆ setParameters()

void dd4hep::DDSegmentation::Segmentation::setParameters ( const Parameters parameters)
virtual

Set all parameters from an existing set of parameters.

Definition at line 129 of file Segmentation.cpp.

◆ type()

virtual const std::string& dd4hep::DDSegmentation::Segmentation::type ( ) const
inlinevirtual

Access the segmentation type.

Definition at line 104 of file Segmentation.h.

◆ volumeID()

VolumeID dd4hep::DDSegmentation::Segmentation::volumeID ( const CellID cellID) const
virtual

Determine the volume ID from the full cell ID by removing all local fields.

Definition at line 66 of file Segmentation.cpp.

Member Data Documentation

◆ _decoder

const BitFieldCoder* dd4hep::DDSegmentation::Segmentation::_decoder = 0
protected

The cell ID encoder and decoder.

No ROOT persistency

Definition at line 168 of file Segmentation.h.

◆ _description

std::string dd4hep::DDSegmentation::Segmentation::_description
protected

The description of the segmentation.

Definition at line 162 of file Segmentation.h.

◆ _indexIdentifiers

std::map<std::string, StringParameter> dd4hep::DDSegmentation::Segmentation::_indexIdentifiers
protected

The indices used for the encoding.

No ROOT persistency

Definition at line 166 of file Segmentation.h.

◆ _name

std::string dd4hep::DDSegmentation::Segmentation::_name
protected

The segmentation name.

Definition at line 158 of file Segmentation.h.

◆ _ownsDecoder

bool dd4hep::DDSegmentation::Segmentation::_ownsDecoder = false
protected

Keeps track of the decoder ownership.

Definition at line 170 of file Segmentation.h.

◆ _parameters

std::map<std::string, Parameter> dd4hep::DDSegmentation::Segmentation::_parameters
protected

The parameters for this segmentation.

Definition at line 164 of file Segmentation.h.

◆ _type

std::string dd4hep::DDSegmentation::Segmentation::_type
protected

The segmentation type.

Definition at line 160 of file Segmentation.h.


The documentation for this class was generated from the following files: