LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
LArVoxelCalculator_service.cc
Go to the documentation of this file.
1 
11 
16 
17 // Framework includes
18 
20 
21 #include <cmath>
22 
23 namespace sim {
24 
25  //----------------------------------------------------------------------------
27  art::ActivityRegistry & /* reg */)
28  {
29 
30  this->reconfigure(pset);
31 
32  }
33 
34  //----------------------------------------------------------------------------
37  {
38  }
39 
40  //----------------------------------------------------------------------------
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  }
67 
68  //----------------------------------------------------------------------------
72  {
73  return std::min( m_voxelSize[0], std::min( m_voxelSize[1], m_voxelSize[2] ) );
74  }
75 
76  //----------------------------------------------------------------------------
80  int LArVoxelCalculator::AxisToBin( const int axis,
81  const double coord ) const
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  }
88 
89  //----------------------------------------------------------------------------
93  double LArVoxelCalculator::BinToAxis( const int axis,
94  const int bin ) const
95  {
96  return ( static_cast<double>(bin) + 0.5 ) * m_voxelSize[axis] + m_voxelOffset[axis];
97  }
98 
99 } // namespace sim
100 
101 namespace sim {
102 
104 
105 
106 } // namespace sim
107 
Encapsulates calculation of LArVoxelID and LArVoxel parameters.
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:93
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
Float_t voxelSizeY
Definition: plot.C:41
void reconfigure(fhicl::ParameterSet const &pset)
Float_t voxelSizeZ
Definition: plot.C:41
T get(std::string const &key) const
Definition: ParameterSet.h:231
vector_type m_voxelSize
The sizes of the voxels in (x,y,z,t). Units are (mm,ns).
LArVoxelCalculator(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
float bin[41]
Definition: plottest35.C:14
Monte Carlo Simulation.
Float_t voxelSizeX
Definition: plot.C:41
int AxisToBin(const int, const double) const
double BinToAxis(const int, const int) const
Int_t min
Definition: plot.C:26