LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
sim::LArVoxelCalculator Class Reference

#include "LArVoxelCalculator.h"

Public Member Functions

 LArVoxelCalculator (fhicl::ParameterSet const &pset)
 
double VoxelSizeX () const
 Access to voxel dimensions and offsets. More...
 
double VoxelSizeY () const
 
double VoxelSizeZ () const
 
double VoxelSizeT () const
 
double VoxelOffsetX () const
 
double VoxelOffsetY () const
 
double VoxelOffsetZ () const
 
double VoxelOffsetT () const
 
double EnergyCut () const
 
double SuggestedStepSize () const
 
int AxisToBin (const int, const double) const
 
int XAxisToBin (const double value) const
 
int YAxisToBin (const double value) const
 
int ZAxisToBin (const double value) const
 
int TAxisToBin (const double value) const
 
double BinToAxis (const int, const int) const
 
double XBinToAxis (const int value) const
 
double YBinToAxis (const int value) const
 
double ZBinToAxis (const int value) const
 
double TBinToAxis (const int value) const
 

Private Types

typedef std::vector< double > vector_type
 

Private Attributes

vector_type const m_voxelSize
 The sizes of the voxels in (x,y,z,t). Units are (mm,ns). More...
 
vector_type const m_voxelOffset
 
double const m_energyCut
 

Detailed Description

Definition at line 33 of file LArVoxelCalculator.h.

Member Typedef Documentation

typedef std::vector<double> sim::LArVoxelCalculator::vector_type
private

Definition at line 80 of file LArVoxelCalculator.h.

Constructor & Destructor Documentation

sim::LArVoxelCalculator::LArVoxelCalculator ( fhicl::ParameterSet const &  pset)

Definition at line 27 of file LArVoxelCalculator.cc.

References fhicl::ParameterSet::get(), m_energyCut, and m_voxelOffset.

28  : m_voxelSize{pset.get<double>("VoxelSizeX"),
29  pset.get<double>("VoxelSizeY"),
30  pset.get<double>("VoxelSizeZ"),
31  pset.get<double>("VoxelSizeT")}
32  , m_voxelOffset{pset.get<double>("VoxelOffsetX"),
33  pset.get<double>("VoxelOffsetY"),
34  pset.get<double>("VoxelOffsetZ"),
35  pset.get<double>("VoxelOffsetT")}
36  , m_energyCut{pset.get<double>("VoxelEnergyCut")}
37  {}
vector_type const m_voxelOffset
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).

Member Function Documentation

int sim::LArVoxelCalculator::AxisToBin ( const int  axis,
const double  coord 
) const

Convert a co-ordinate axis (x, y, z, or t) into a bin number. The first argument is the axis (x=0, y=1, z=2, t=3) and the second is the value on that axis.

Definition at line 51 of file LArVoxelCalculator.cc.

References m_voxelOffset, and m_voxelSize.

52  {
53  // We have to be careful of how to handle the case when coord -
54  // offset < 0. The standard floor() function rounds the number in
55  // the correct direction.
56  return static_cast<int>(floor((coord - m_voxelOffset[axis]) / m_voxelSize[axis]));
57  }
vector_type const m_voxelOffset
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
double sim::LArVoxelCalculator::BinToAxis ( const int  axis,
const int  bin 
) const

Get the value of an axis at the center of the given bin. The first argument is the axis (x=0, y=1, z=2, t=3) and the second is the bin number on that axis.

Definition at line 63 of file LArVoxelCalculator.cc.

References m_voxelOffset, and m_voxelSize.

64  {
65  return (static_cast<double>(bin) + 0.5) * m_voxelSize[axis] + m_voxelOffset[axis];
66  }
vector_type const m_voxelOffset
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
float bin[41]
Definition: plottest35.C:14
double sim::LArVoxelCalculator::EnergyCut ( ) const
inline

The energy in a voxel must be greater than this cut for it to be written to the output file.

Definition at line 49 of file LArVoxelCalculator.h.

49 { return m_energyCut; }
double sim::LArVoxelCalculator::SuggestedStepSize ( ) const

Returns a step size that's reasonable to use so that each segment of a track will be contained within a single voxel.

Returns a Monte-Carlo step size that's reasonable to use so that each segment of a track will be contained within a single voxel.

Definition at line 42 of file LArVoxelCalculator.cc.

References m_voxelSize.

43  {
44  return std::min(m_voxelSize[0], std::min(m_voxelSize[1], m_voxelSize[2]));
45  }
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
int sim::LArVoxelCalculator::TAxisToBin ( const double  value) const
inline

Definition at line 65 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::LArVoxelID().

65 { return AxisToBin(3, value); }
double value
Definition: spectrum.C:18
int AxisToBin(const int, const double) const
double sim::LArVoxelCalculator::TBinToAxis ( const int  value) const
inline

Definition at line 77 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::T().

77 { return BinToAxis(3, value); }
double value
Definition: spectrum.C:18
double BinToAxis(const int, const int) const
double sim::LArVoxelCalculator::VoxelOffsetT ( ) const
inline

Definition at line 45 of file LArVoxelCalculator.h.

45 { return m_voxelOffset[3]; }
vector_type const m_voxelOffset
double sim::LArVoxelCalculator::VoxelOffsetX ( ) const
inline

Definition at line 42 of file LArVoxelCalculator.h.

Referenced by larg4::LArVoxelReadoutGeometry::Construct().

42 { return m_voxelOffset[0]; }
vector_type const m_voxelOffset
double sim::LArVoxelCalculator::VoxelOffsetY ( ) const
inline

Definition at line 43 of file LArVoxelCalculator.h.

Referenced by larg4::LArVoxelReadoutGeometry::Construct().

43 { return m_voxelOffset[1]; }
vector_type const m_voxelOffset
double sim::LArVoxelCalculator::VoxelOffsetZ ( ) const
inline

Definition at line 44 of file LArVoxelCalculator.h.

Referenced by larg4::LArVoxelReadoutGeometry::Construct().

44 { return m_voxelOffset[2]; }
vector_type const m_voxelOffset
double sim::LArVoxelCalculator::VoxelSizeT ( ) const
inline

Definition at line 41 of file LArVoxelCalculator.h.

41 { return m_voxelSize[3]; }
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
double sim::LArVoxelCalculator::VoxelSizeX ( ) const
inline

Access to voxel dimensions and offsets.

Definition at line 38 of file LArVoxelCalculator.h.

Referenced by larg4::LArVoxelReadoutGeometry::Construct(), larg4::ISCalculationCorrelated::ISCalculationCorrelated(), and larg4::ISCalculationSeparate::ISCalculationSeparate().

38 { return m_voxelSize[0]; }
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
double sim::LArVoxelCalculator::VoxelSizeY ( ) const
inline

Definition at line 39 of file LArVoxelCalculator.h.

Referenced by larg4::LArVoxelReadoutGeometry::Construct(), larg4::ISCalculationCorrelated::ISCalculationCorrelated(), and larg4::ISCalculationSeparate::ISCalculationSeparate().

39 { return m_voxelSize[1]; }
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
double sim::LArVoxelCalculator::VoxelSizeZ ( ) const
inline

Definition at line 40 of file LArVoxelCalculator.h.

Referenced by larg4::LArVoxelReadoutGeometry::Construct(), larg4::ISCalculationCorrelated::ISCalculationCorrelated(), and larg4::ISCalculationSeparate::ISCalculationSeparate().

40 { return m_voxelSize[2]; }
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
int sim::LArVoxelCalculator::XAxisToBin ( const double  value) const
inline

Provide an alternate access to the above routine with individual routines for the axes:

Definition at line 62 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::LArVoxelID().

62 { return AxisToBin(0, value); }
double value
Definition: spectrum.C:18
int AxisToBin(const int, const double) const
double sim::LArVoxelCalculator::XBinToAxis ( const int  value) const
inline

Provide an alternate access to the above routine with individual routines for the axes:

Definition at line 74 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::X().

74 { return BinToAxis(0, value); }
double value
Definition: spectrum.C:18
double BinToAxis(const int, const int) const
int sim::LArVoxelCalculator::YAxisToBin ( const double  value) const
inline

Definition at line 63 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::LArVoxelID().

63 { return AxisToBin(1, value); }
double value
Definition: spectrum.C:18
int AxisToBin(const int, const double) const
double sim::LArVoxelCalculator::YBinToAxis ( const int  value) const
inline

Definition at line 75 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::Y().

75 { return BinToAxis(1, value); }
double value
Definition: spectrum.C:18
double BinToAxis(const int, const int) const
int sim::LArVoxelCalculator::ZAxisToBin ( const double  value) const
inline

Definition at line 64 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::LArVoxelID().

64 { return AxisToBin(2, value); }
double value
Definition: spectrum.C:18
int AxisToBin(const int, const double) const
double sim::LArVoxelCalculator::ZBinToAxis ( const int  value) const
inline

Definition at line 76 of file LArVoxelCalculator.h.

Referenced by sim::LArVoxelID::Z().

76 { return BinToAxis(2, value); }
double value
Definition: spectrum.C:18
double BinToAxis(const int, const int) const

Member Data Documentation

double const sim::LArVoxelCalculator::m_energyCut
private

The total amount of energy in a voxel must be greater than this value for it to be written to the output.

Definition at line 91 of file LArVoxelCalculator.h.

Referenced by LArVoxelCalculator().

vector_type const sim::LArVoxelCalculator::m_voxelOffset
private

The offsets of the voxel binning from the origin in (x,y,z,t). Units are (mm,ns).

Definition at line 87 of file LArVoxelCalculator.h.

Referenced by AxisToBin(), BinToAxis(), and LArVoxelCalculator().

vector_type const sim::LArVoxelCalculator::m_voxelSize
private

The sizes of the voxels in (x,y,z,t). Units are (mm,ns).

Definition at line 83 of file LArVoxelCalculator.h.

Referenced by AxisToBin(), BinToAxis(), and SuggestedStepSize().


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