LArVoxelCalculator.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file LArVoxelCalculator.h
3 /// \brief Encapsulates calculation of LArVoxelID and LArVoxel parameters
4 /// \author seligman@nevis.columbia.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 /// This class encapsulates the calculations associated with
8 /// computing the LArVoxelID, and provides access to the any LArVoxel
9 /// parameters from the input file(s).
10 
11 /// It is to be called using art::ServiceHandle<sim::LArVoxelCalculator const> lvx;
12 /// The service makes it act like a singleton, but it knows about the
13 /// Parameters defined in the input file.
14 
15 /// Definition: "Voxels" are three-dimensional "pixels"; basically
16 /// they divide the energy deposition in the LAr into (x,y,z) cubes.
17 /// Well, hyper-cubes actually, since we have to potentially include
18 /// divisions in time as well.
19 
20 #ifndef sim_LArVoxelCalculator_H
21 #define sim_LArVoxelCalculator_H
22 
23 #include <vector>
24 
26 #include "fhiclcpp/ParameterSet.h"
27 
28 namespace sim {
29 
31  public:
32 
34 
35  /// Access to voxel dimensions and offsets.
36  double VoxelSizeX() const { return m_voxelSize[0]; }
37  double VoxelSizeY() const { return m_voxelSize[1]; }
38  double VoxelSizeZ() const { return m_voxelSize[2]; }
39  double VoxelSizeT() const { return m_voxelSize[3]; }
40  double VoxelOffsetX() const { return m_voxelOffset[0]; }
41  double VoxelOffsetY() const { return m_voxelOffset[1]; }
42  double VoxelOffsetZ() const { return m_voxelOffset[2]; }
43  double VoxelOffsetT() const { return m_voxelOffset[3]; }
44 
45  /// The energy in a voxel must be greater than this cut for it to
46  /// be written to the output file.
47  double EnergyCut() const { return m_energyCut; }
48 
49  /// Returns a step size that's reasonable to use so that each
50  /// segment of a track will be contained within a single voxel.
51  double SuggestedStepSize() const;
52 
53  /// Convert a co-ordinate axis (x, y, z, or t) into a bin number.
54  /// The first argument is the axis (x=0, y=1, z=2, t=3) and the
55  /// second is the value on that axis.
56  int AxisToBin( const int, const double ) const;
57 
58  /// Provide an alternate access to the above routine with
59  /// individual routines for the axes:
60  int XAxisToBin( const double value ) const { return AxisToBin(0,value); }
61  int YAxisToBin( const double value ) const { return AxisToBin(1,value); }
62  int ZAxisToBin( const double value ) const { return AxisToBin(2,value); }
63  int TAxisToBin( const double value ) const { return AxisToBin(3,value); }
64 
65  /// Get the value of an axis at the center of the given bin. The
66  /// first argument is the axis (x=0, y=1, z=2, t=3) and the second
67  /// is the bin number on that axis.
68  double BinToAxis( const int, const int ) const;
69 
70  /// Provide an alternate access to the above routine with
71  /// individual routines for the axes:
72  double XBinToAxis( const int value ) const { return BinToAxis(0,value); }
73  double YBinToAxis( const int value ) const { return BinToAxis(1,value); }
74  double ZBinToAxis( const int value ) const { return BinToAxis(2,value); }
75  double TBinToAxis( const int value ) const { return BinToAxis(3,value); }
76 
77  private:
78 
79  typedef std::vector<double> vector_type;
80 
81  /// The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
82  vector_type const m_voxelSize;
83 
84  /// The offsets of the voxel binning from the origin in (x,y,z,t).
85  /// Units are (mm,ns).
86  vector_type const m_voxelOffset;
87 
88  /// The total amount of energy in a voxel must be greater than
89  /// this value for it to be written to the output.
90  double const m_energyCut;
91 
92  };
93 
94 } // namespace sim
95 
97 #endif // sim_LArVoxelCalculator_H
std::vector< double > vector_type
vector_type const m_voxelOffset
double VoxelOffsetT() const
double YBinToAxis(const int value) const
double VoxelSizeX() const
Access to voxel dimensions and offsets.
vector_type const m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
int ZAxisToBin(const double value) const
double TBinToAxis(const int value) const
int XAxisToBin(const double value) const
#define DECLARE_ART_SERVICE(svc, scope)
int TAxisToBin(const double value) const
double VoxelOffsetX() const
Code to link reconstructed objects back to the MC truth information.
double VoxelOffsetZ() const
double XBinToAxis(const int value) const
int AxisToBin(const int, const double) const
double BinToAxis(const int, const int) const
LArVoxelCalculator(fhicl::ParameterSet const &pset)
double ZBinToAxis(const int value) const
int YAxisToBin(const double value) const
double VoxelOffsetY() const