LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
sim::LArVoxelCalculator Class Reference

#include "LArVoxelCalculator.h"

Public Member Functions

 LArVoxelCalculator (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
 ~LArVoxelCalculator ()
 Destructor. More...
 
void reconfigure (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 m_voxelSize
 The sizes of the voxels in (x,y,z,t). Units are (mm,ns). More...
 
vector_type m_voxelOffset
 
double m_energyCut
 

Detailed Description

Definition at line 36 of file LArVoxelCalculator.h.

Member Typedef Documentation

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

Definition at line 89 of file LArVoxelCalculator.h.

Constructor & Destructor Documentation

sim::LArVoxelCalculator::LArVoxelCalculator ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 
)

Definition at line 26 of file LArVoxelCalculator_service.cc.

References reconfigure().

28  {
29 
30  this->reconfigure(pset);
31 
32  }
void reconfigure(fhicl::ParameterSet const &pset)
sim::LArVoxelCalculator::~LArVoxelCalculator ( )

Destructor.

Definition at line 36 of file LArVoxelCalculator_service.cc.

37  {
38  }

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 80 of file LArVoxelCalculator_service.cc.

References m_voxelOffset, and m_voxelSize.

Referenced by EnergyCut(), TAxisToBin(), XAxisToBin(), YAxisToBin(), and ZAxisToBin().

82  {
83  // We have to be careful of how to handle the case when coord -
84  // offset < 0. The standard floor() function rounds the number in
85  // the correct direction.
86  return static_cast<int>( floor( ( coord - m_voxelOffset[axis] ) / m_voxelSize[axis] ) );
87  }
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
vector_type m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
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 93 of file LArVoxelCalculator_service.cc.

References DEFINE_ART_SERVICE, m_voxelOffset, and m_voxelSize.

Referenced by TAxisToBin(), TBinToAxis(), XBinToAxis(), YBinToAxis(), and ZBinToAxis().

95  {
96  return ( static_cast<double>(bin) + 0.5 ) * m_voxelSize[axis] + m_voxelOffset[axis];
97  }
vector_type 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 57 of file LArVoxelCalculator.h.

References AxisToBin(), m_energyCut, and SuggestedStepSize().

57 { return m_energyCut; }
void sim::LArVoxelCalculator::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 41 of file LArVoxelCalculator_service.cc.

References fhicl::ParameterSet::get(), m_energyCut, m_voxelOffset, m_voxelSize, voxelSizeX, voxelSizeY, and voxelSizeZ.

Referenced by LArVoxelCalculator().

42  {
43  m_energyCut = pset.get<double>("VoxelEnergyCut");
44 
45  double voxelSizeX = pset.get<double>("VoxelSizeX");
46  double voxelSizeY = pset.get<double>("VoxelSizeY");
47  double voxelSizeZ = pset.get<double>("VoxelSizeZ");
48  double voxelSizeT = pset.get<double>("VoxelSizeT");
49  double voxelOffsetX = pset.get<double>("VoxelOffsetX");
50  double voxelOffsetY = pset.get<double>("VoxelOffsetY");
51  double voxelOffsetZ = pset.get<double>("VoxelOffsetZ");
52  double voxelOffsetT = pset.get<double>("VoxelOffsetT");
53 
54  m_voxelSize.clear();
55  m_voxelSize.push_back( voxelSizeX );
56  m_voxelSize.push_back( voxelSizeY );
57  m_voxelSize.push_back( voxelSizeZ );
58  m_voxelSize.push_back( voxelSizeT );
59  m_voxelOffset.clear();
60  m_voxelOffset.push_back( voxelOffsetX );
61  m_voxelOffset.push_back( voxelOffsetY );
62  m_voxelOffset.push_back( voxelOffsetZ );
63  m_voxelOffset.push_back( voxelOffsetT );
64 
65  return;
66  }
Float_t voxelSizeY
Definition: plot.C:41
Float_t voxelSizeZ
Definition: plot.C:41
vector_type m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
Float_t voxelSizeX
Definition: plot.C:41
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 71 of file LArVoxelCalculator_service.cc.

References m_voxelSize, and min.

Referenced by EnergyCut().

72  {
73  return std::min( m_voxelSize[0], std::min( m_voxelSize[1], m_voxelSize[2] ) );
74  }
vector_type m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
Int_t min
Definition: plot.C:26
int sim::LArVoxelCalculator::TAxisToBin ( const double  value) const
inline

Definition at line 73 of file LArVoxelCalculator.h.

References AxisToBin(), and BinToAxis().

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

73 { return AxisToBin(3,value); }
std::string value(boost::any const &)
int AxisToBin(const int, const double) const
double sim::LArVoxelCalculator::TBinToAxis ( const int  value) const
inline

Definition at line 85 of file LArVoxelCalculator.h.

References BinToAxis().

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

85 { return BinToAxis(3,value); }
std::string value(boost::any const &)
double BinToAxis(const int, const int) const
double sim::LArVoxelCalculator::VoxelOffsetT ( ) const
inline

Definition at line 53 of file LArVoxelCalculator.h.

References m_voxelOffset.

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

Definition at line 50 of file LArVoxelCalculator.h.

References m_voxelOffset.

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

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

Definition at line 51 of file LArVoxelCalculator.h.

References m_voxelOffset.

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

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

Definition at line 52 of file LArVoxelCalculator.h.

References m_voxelOffset.

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

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

Definition at line 49 of file LArVoxelCalculator.h.

References m_voxelSize.

49 { return m_voxelSize[3]; }
vector_type 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 46 of file LArVoxelCalculator.h.

References m_voxelSize.

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

46 { return m_voxelSize[0]; }
vector_type 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 47 of file LArVoxelCalculator.h.

References m_voxelSize.

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

47 { return m_voxelSize[1]; }
vector_type 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 48 of file LArVoxelCalculator.h.

References m_voxelSize.

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

48 { return m_voxelSize[2]; }
vector_type 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 70 of file LArVoxelCalculator.h.

References AxisToBin().

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

70 { return AxisToBin(0,value); }
std::string value(boost::any const &)
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 82 of file LArVoxelCalculator.h.

References BinToAxis().

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

82 { return BinToAxis(0,value); }
std::string value(boost::any const &)
double BinToAxis(const int, const int) const
int sim::LArVoxelCalculator::YAxisToBin ( const double  value) const
inline

Definition at line 71 of file LArVoxelCalculator.h.

References AxisToBin().

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

71 { return AxisToBin(1,value); }
std::string value(boost::any const &)
int AxisToBin(const int, const double) const
double sim::LArVoxelCalculator::YBinToAxis ( const int  value) const
inline

Definition at line 83 of file LArVoxelCalculator.h.

References BinToAxis().

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

83 { return BinToAxis(1,value); }
std::string value(boost::any const &)
double BinToAxis(const int, const int) const
int sim::LArVoxelCalculator::ZAxisToBin ( const double  value) const
inline

Definition at line 72 of file LArVoxelCalculator.h.

References AxisToBin().

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

72 { return AxisToBin(2,value); }
std::string value(boost::any const &)
int AxisToBin(const int, const double) const
double sim::LArVoxelCalculator::ZBinToAxis ( const int  value) const
inline

Definition at line 84 of file LArVoxelCalculator.h.

References BinToAxis().

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

84 { return BinToAxis(2,value); }
std::string value(boost::any const &)
double BinToAxis(const int, const int) const

Member Data Documentation

double 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 100 of file LArVoxelCalculator.h.

Referenced by EnergyCut(), and reconfigure().

vector_type 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 96 of file LArVoxelCalculator.h.

Referenced by AxisToBin(), BinToAxis(), reconfigure(), VoxelOffsetT(), VoxelOffsetX(), VoxelOffsetY(), and VoxelOffsetZ().

vector_type sim::LArVoxelCalculator::m_voxelSize
private

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

Definition at line 92 of file LArVoxelCalculator.h.

Referenced by AxisToBin(), BinToAxis(), reconfigure(), SuggestedStepSize(), VoxelSizeT(), VoxelSizeX(), VoxelSizeY(), and VoxelSizeZ().


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