All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
24 
25 namespace fhicl {
26  class ParameterSet;
27 }
28 
29 #include <vector>
30 
31 namespace sim {
32 
34  public:
35 
36  LArVoxelCalculator(fhicl::ParameterSet const& pset);
37 
38  /// Access to voxel dimensions and offsets.
39  double VoxelSizeX() const { return m_voxelSize[0]; }
40  double VoxelSizeY() const { return m_voxelSize[1]; }
41  double VoxelSizeZ() const { return m_voxelSize[2]; }
42  double VoxelSizeT() const { return m_voxelSize[3]; }
43  double VoxelOffsetX() const { return m_voxelOffset[0]; }
44  double VoxelOffsetY() const { return m_voxelOffset[1]; }
45  double VoxelOffsetZ() const { return m_voxelOffset[2]; }
46  double VoxelOffsetT() const { return m_voxelOffset[3]; }
47 
48  /// The energy in a voxel must be greater than this cut for it to
49  /// be written to the output file.
50  double EnergyCut() const { return m_energyCut; }
51 
52  /// Returns a step size that's reasonable to use so that each
53  /// segment of a track will be contained within a single voxel.
54  double SuggestedStepSize() const;
55 
56  /// Convert a co-ordinate axis (x, y, z, or t) into a bin number.
57  /// The first argument is the axis (x=0, y=1, z=2, t=3) and the
58  /// second is the value on that axis.
59  int AxisToBin( const int, const double ) const;
60 
61  /// Provide an alternate access to the above routine with
62  /// individual routines for the axes:
63  int XAxisToBin( const double value ) const { return AxisToBin(0,value); }
64  int YAxisToBin( const double value ) const { return AxisToBin(1,value); }
65  int ZAxisToBin( const double value ) const { return AxisToBin(2,value); }
66  int TAxisToBin( const double value ) const { return AxisToBin(3,value); }
67 
68  /// Get the value of an axis at the center of the given bin. The
69  /// first argument is the axis (x=0, y=1, z=2, t=3) and the second
70  /// is the bin number on that axis.
71  double BinToAxis( const int, const int ) const;
72 
73  /// Provide an alternate access to the above routine with
74  /// individual routines for the axes:
75  double XBinToAxis( const int value ) const { return BinToAxis(0,value); }
76  double YBinToAxis( const int value ) const { return BinToAxis(1,value); }
77  double ZBinToAxis( const int value ) const { return BinToAxis(2,value); }
78  double TBinToAxis( const int value ) const { return BinToAxis(3,value); }
79 
80  private:
81 
82  typedef std::vector<double> vector_type;
83 
84  /// The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
86 
87  /// The offsets of the voxel binning from the origin in (x,y,z,t).
88  /// Units are (mm,ns).
90 
91  /// The total amount of energy in a voxel must be greater than
92  /// this value for it to be written to the output.
93  double const m_energyCut;
94 
95  };
96 
97 } // namespace sim
98 
99 DECLARE_ART_SERVICE(sim::LArVoxelCalculator, SHARED)
100 #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
int TAxisToBin(const double value) const
double VoxelOffsetX() const
double SuggestedStepSize() const
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)
temporary value
double ZBinToAxis(const int value) const
int YAxisToBin(const double value) const
double VoxelOffsetY() const