HerdSoftware  0.3.2
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Herd::CaloGeoParams Class Reference

Data structure for the Calo geometry parameters. More...

#include <dataobjects/CaloGeoParams.h>

Classes

struct  CooIndexRange
 Helper struct to hold a CooIndex range. More...
 
struct  EllipsoidalEnvelope
 Parameters of the ellipsoidal CALO envelope. More...
 
class  PrismaticEnvelope
 Parameters of the prismatic CALO envelope. More...
 

Public Types

using Indexes = CooArray< unsigned char >
 

Public Member Functions

 CaloGeoParams ()
 Default constructor. More...
 
virtual ~CaloGeoParams ()=default
 Virtual destructor. More...
 
const PointPosition (unsigned int volID) const
 Return the position of the center of the cube. More...
 
const IndexesCooIndexes (unsigned int volID) const
 Return the cube indexes. More...
 
CooIndexRange CooIndexesRange (RefFrame::Axis axis, unsigned char index1, unsigned char index2)
 Return the CooIndex range for a given row of crystals. More...
 
bool IsEmpty (unsigned int volID) const
 Return true if the cube is masked. More...
 
const float & CubeSize () const
 Return the cube size, i.e the side length [cm]. More...
 
float LYSODensity () const
 Return the LYSO density (g/cm3). More...
 
float LYSORadiationLength () const
 Return the radiation length of the LYSO material constituting the cube (cm). More...
 
float LYSONuclearInteractionLength () const
 Return the nuclear interaction length of the LYSO material constituting the cube (cm). More...
 
const float & CubeSlotSize () const
 Return the size of the tray slot accommodating a single LYSO cube [cm]. More...
 
unsigned int NCubes () const
 Return the total number of cubes. More...
 
unsigned int VolumeID (const Indexes &cooIndex) const
 Return the volume ID starting from the indexes. More...
 
unsigned int VolumeID (const Point &point) const
 Returns the ID of the cube containing the given point. More...
 
std::pair< Point, PointCubeIntersections (const Line &track, const unsigned int volID, const Herd::RefFrame::Coo sort_by_coo=Herd::RefFrame::Coo::NONE) const
 Return the two intersection points between a line and a given cube. More...
 
float SphericalRadius () const
 Gets the radius of the spherical CALO. More...
 
const EllipsoidalEnvelopeSphericalCaloEnvelope () const
 Returns the parameters of the ellipsoidal envelope of the spherical CALO. More...
 
const PrismaticEnvelopePrismaticCaloEnvelope () const
 Returns the parameters of the prismatic envelope of the standard CALO. More...
 
const AxesArray< float > & Gaps () const
 Gets the gaps sizes. More...
 
const AxesArray< float > & Wells () const
 Gets the wells sizes. More...
 
void SetCubes (std::vector< Point > positions, std::vector< Indexes > indexes, float cubeSize, float cubeSlotSize=defaultValue< float >, std::vector< bool > mask={})
 Set the cubes. More...
 
void SetLYSODensity (float density)
 Set the LYSO density. More...
 
void SetSphericalRadius (float radius)
 Sets the radius of the spherical CALO. More...
 

Private Member Functions

void FillCooId2VolIDMatrix ()
 Fill the private lookup table which converts indexes into volume ID. More...
 

Private Attributes

std::vector< Point_positions
 The positions of each cube. More...
 
std::vector< Indexes_indexes
 The indexes of each cube. More...
 
std::vector< bool > _mask
 The mask flag of each cube. More...
 
float _cubeSize
 The size of the cube, i.e. the side length (cm). More...
 
float _cubeSlotSize
 The size of the cube slot (cm). More...
 
float _lysoDensity
 The density the cube (g/cm3). More...
 
AxesArray< float > _gaps
 The gaps between the cubes (cm). More...
 
AxesArray< float > _wells
 The sizes of the wells (cm). More...
 
float _sphericalRadius
 The radius of the spherical CALO expressed in cube ID units. More...
 
EllipsoidalEnvelope _ellipsoidalEnvelopeParams
 Parameters of the ellipsoidal envelope of the spherical CALO. More...
 
PrismaticEnvelope _prismaticEnvelopeParams
 Parameters of the prismatic envelope of the standard CALO. More...
 
std::vector< std::vector< std::vector< unsigned short > > > _cooId2VolIDMatrix
 
unsigned int _nMaxCubesPerSide
 Matrix which contains the cooIndexes -> volumeID conversion. More...
 

Detailed Description

Data structure for the Calo geometry parameters.

Member Typedef Documentation

◆ Indexes

using Herd::CaloGeoParams::Indexes = CooArray<unsigned char>

Constructor & Destructor Documentation

◆ CaloGeoParams()

Herd::CaloGeoParams::CaloGeoParams ( )

Default constructor.

◆ ~CaloGeoParams()

virtual Herd::CaloGeoParams::~CaloGeoParams ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ CooIndexes()

const Indexes& Herd::CaloGeoParams::CooIndexes ( unsigned int  volID) const
inline

Return the cube indexes.

Parameters
volIDVolume identifier.
Returns
the indexes of the cube.

◆ CooIndexesRange()

CaloGeoParams::CooIndexRange Herd::CaloGeoParams::CooIndexesRange ( RefFrame::Axis  axis,
unsigned char  index1,
unsigned char  index2 
)

Return the CooIndex range for a given row of crystals.

This method computes the IDs of the first and last cubes in a given row. The row direction is specified by an axis, which identifies an orthogonal view: in this view the coordinates of a cube are given, and this routine identifies the first and last cubes along the axis on the row identified by the given coordinates. For example:

CooIndexRange(RefFrame::Axis::X, 5, 2)

will return the first and last cubes on the cube row along X identified by the cube with ID_Y=5 and ID_Z=2 on YZ (since the view orthogonal to X is YZ, with Y abscissa and Z ordinate).

Parameters
axisThe axis along which the crystals are aligned
index1The CooIndex in the abscissa of the view ortoghonal to the specified axis
index2The CooIndex in the ordinate of the view ortoghonal to the specified axis
Returns
The CooIndex range for the selected row

◆ CubeIntersections()

std::pair< Point, Point > Herd::CaloGeoParams::CubeIntersections ( const Line track,
const unsigned int  volID,
const Herd::RefFrame::Coo  sort_by_coo = Herd::RefFrame::Coo::NONE 
) const

Return the two intersection points between a line and a given cube.

Parameters
sort_by_cooif specified, determines the order in which points are stored in the output based on increasing coordinate
Returns
a pair of valid points if the line intersects the cube, otherwise the points will be set at their default value (filled with std::numeric_limits<float>::max())

◆ CubeSize()

const float& Herd::CaloGeoParams::CubeSize ( ) const
inline

Return the cube size, i.e the side length [cm].

Returns
the cube size [cm].

◆ CubeSlotSize()

const float& Herd::CaloGeoParams::CubeSlotSize ( ) const
inline

Return the size of the tray slot accommodating a single LYSO cube [cm].

Returns
the slot size [cm].

◆ FillCooId2VolIDMatrix()

void Herd::CaloGeoParams::FillCooId2VolIDMatrix ( )
private

Fill the private lookup table which converts indexes into volume ID.

◆ Gaps()

const AxesArray<float>& Herd::CaloGeoParams::Gaps ( ) const
inline

Gets the gaps sizes.

This method returns the gaps between each cube slot. These corresponds to the thickness of the tray wall along the axes parallel to the tray.

Returns
The gaps size along each axis (cm).

◆ IsEmpty()

bool Herd::CaloGeoParams::IsEmpty ( unsigned int  volID) const
inline

Return true if the cube is masked.

A masked cube is a cube that is present in the original geometry but has been removed from the actual CALO.

Parameters
volIDVolume identifier.
Returns
true if the cube is masked/empty, false otherwise.

◆ LYSODensity()

float Herd::CaloGeoParams::LYSODensity ( ) const
inline

Return the LYSO density (g/cm3).

Returns
the LYSO density (g/cm3).

◆ LYSONuclearInteractionLength()

float Herd::CaloGeoParams::LYSONuclearInteractionLength ( ) const
inline

Return the nuclear interaction length of the LYSO material constituting the cube (cm).

The returned radiation length is computed by scaling 20.589 cm, i.e. the n. i. length of a LYSO cube of density 7.4 g/cm3 as given by Geant4, by the ratio of the reference 7.4 g/cm3 density and the the actual LYSO density.

Returns
the nuclear interaction length of the LYSO.

◆ LYSORadiationLength()

float Herd::CaloGeoParams::LYSORadiationLength ( ) const
inline

Return the radiation length of the LYSO material constituting the cube (cm).

The returned radiation length is computed by scaling 1.172 cm, i.e. the radiation length of a LYSO cube of density 7.4 g/cm3 as given by Geant4, by the ratio of the reference 7.4 g/cm3 density and the the actual LYSO density.

Returns
the radiation length of the LYSO.

◆ NCubes()

unsigned int Herd::CaloGeoParams::NCubes ( ) const
inline

Return the total number of cubes.

Returns
the total number of cubes

◆ Position()

const Point& Herd::CaloGeoParams::Position ( unsigned int  volID) const
inline

Return the position of the center of the cube.

Parameters
volIDVolume identifier.
Returns
the position of the center of the cube.

◆ PrismaticCaloEnvelope()

const CaloGeoParams::PrismaticEnvelope & Herd::CaloGeoParams::PrismaticCaloEnvelope ( ) const

Returns the parameters of the prismatic envelope of the standard CALO.

This method can be called only for standard CALO geometries.

Returns
A PrismaticEnvelope with the parameters of the CALO envelope.
Exceptions
Herd::Exceptionif the CALO is not standard.

◆ SetCubes()

void Herd::CaloGeoParams::SetCubes ( std::vector< Point positions,
std::vector< Indexes indexes,
float  cubeSize,
float  cubeSlotSize = defaultValue<float>,
std::vector< bool >  mask = {} 
)

Set the cubes.

This method sets the positions, indexes and size of each cube; optionally also the slot size and the cubes mask can be specified. The element ID in the vector arguments corresponds to the cube ID. The positions and indexes vectors must have the same number of elements, corresponding to the total number of cubes. The mask vector can be either empty (in this case no mask is applied) or have the same number of elements as the other arguments. The slot size must be greater or equal to the cube size; if the default value is used then it is automatically set equal to the cube size.

This method also computes the sizes of the gaps between the cube slots and of the wells, by computing the distance between two consecutive cubes along the axes for which the indexes differ by 1 (this defines two neighboring cubes along that axis). No more than two values (i.e. for gap and for well) for each axis are expected; if more than one is found then an exception is thrown. If two values are found then the smallest one is assigned to the gap and the other one to the well. If just one value is found it is assigned to both gap and well; if no value is found (e.g. for the transverse axis of a single-layer CALO) then 0 is assigned to both gap and well.

Calling this function resets the CALO type, so SetSphericalRadius must be called after if the set geometry is spherical.

Parameters
positionsThe positions of the cubes (cm).
indexesThe indexes of the cubes.
cubeSizeThe size of the cube (cm).
cubeSlotSizeThe size of the cube slot (cm).
maskThe cubes mask (true: masked, false: not masked).
Exceptions
Herd::Exceptionif the sizes of the argument vectors do not exactly match (but mask size can be zero), if the cube size is less or equal than 0 or if the slot size is less than the cube size, or if more than two values of cube-to-cube distance are found along an axis.

◆ SetLYSODensity()

void Herd::CaloGeoParams::SetLYSODensity ( float  density)
inline

Set the LYSO density.

Parameters
densitythe LYSO density (g/cm3).

◆ SetSphericalRadius()

void Herd::CaloGeoParams::SetSphericalRadius ( float  radius)

Sets the radius of the spherical CALO.

The radius must be expressed in cube ID units. Calling this function also sets the CALO as effectively spherical.

Parameters
radiusThe spherical CALO radius.

◆ SphericalCaloEnvelope()

const CaloGeoParams::EllipsoidalEnvelope & Herd::CaloGeoParams::SphericalCaloEnvelope ( ) const

Returns the parameters of the ellipsoidal envelope of the spherical CALO.

This method can be called only for spherical CALO geometries.

Returns
An EllipsoidalEnvelope with the parameters of the CALO envelope.
Exceptions
Herd::Exceptionif the CALO is not spherical.
See also
SetSphericalRadius

◆ SphericalRadius()

float Herd::CaloGeoParams::SphericalRadius ( ) const
inline

Gets the radius of the spherical CALO.

Returns
radius The spherical CALO radius in cube ID units, or defaultValue<float> if the CALO is not spherical.

◆ VolumeID() [1/2]

unsigned int Herd::CaloGeoParams::VolumeID ( const Indexes cooIndex) const

Return the volume ID starting from the indexes.

This method use a private lookup table which stores the conversion between each combination of indexes and volume IDs. This table is filled after the first request by this method. If one index is >=21 an runtime_error exception is thrown. If the indexes are < 21 but not related with a true crystals, (e.g. (20,20,20)) std::numeric_limits<unsigned int>::max() is returned.

Parameters
cooIndexindexes of this crystal
Returns
unsigned int volume ID of this crystal. If indexes don't point to any cube returns defaultValue<unsigned int>="">.

◆ VolumeID() [2/2]

unsigned int Herd::CaloGeoParams::VolumeID ( const Point point) const

Returns the ID of the cube containing the given point.

Parameters
pointThe point.
Returns
unsigned int The volume ID of the cube containing the given point, or defaultValue<unsigned int> if no cube contains the point.

◆ Wells()

const AxesArray<float>& Herd::CaloGeoParams::Wells ( ) const
inline

Gets the wells sizes.

This method returns the sizes of the wells. If no well is present then the well size is equal to the gap size (since the cubes are always at least separated by the gap).

Returns
The well size along each axis (cm).

Member Data Documentation

◆ _cooId2VolIDMatrix

std::vector<std::vector<std::vector<unsigned short> > > Herd::CaloGeoParams::_cooId2VolIDMatrix
private

◆ _cubeSize

float Herd::CaloGeoParams::_cubeSize
private

The size of the cube, i.e. the side length (cm).

◆ _cubeSlotSize

float Herd::CaloGeoParams::_cubeSlotSize
private

The size of the cube slot (cm).

◆ _ellipsoidalEnvelopeParams

EllipsoidalEnvelope Herd::CaloGeoParams::_ellipsoidalEnvelopeParams
mutableprivate

Parameters of the ellipsoidal envelope of the spherical CALO.

◆ _gaps

AxesArray<float> Herd::CaloGeoParams::_gaps
private

The gaps between the cubes (cm).

◆ _indexes

std::vector<Indexes> Herd::CaloGeoParams::_indexes
private

The indexes of each cube.

◆ _lysoDensity

float Herd::CaloGeoParams::_lysoDensity
private

The density the cube (g/cm3).

◆ _mask

std::vector<bool> Herd::CaloGeoParams::_mask
private

The mask flag of each cube.

◆ _nMaxCubesPerSide

unsigned int Herd::CaloGeoParams::_nMaxCubesPerSide
private

Matrix which contains the cooIndexes -> volumeID conversion.

◆ _positions

std::vector<Point> Herd::CaloGeoParams::_positions
private

The positions of each cube.

◆ _prismaticEnvelopeParams

PrismaticEnvelope Herd::CaloGeoParams::_prismaticEnvelopeParams
mutableprivate

Parameters of the prismatic envelope of the standard CALO.

◆ _sphericalRadius

float Herd::CaloGeoParams::_sphericalRadius
private

The radius of the spherical CALO expressed in cube ID units.

◆ _wells

AxesArray<float> Herd::CaloGeoParams::_wells
private

The sizes of the wells (cm).


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