LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
SpacePointIsolationAlg.cxx
Go to the documentation of this file.
1 
11 // LArSoft libraries
14 
15 // infrastructure and utilities
16 #include "cetlib_except/exception.h"
17 
18 // C/C++ standard libraries
19 #include <stdexcept> // std::runtime_error()
20 #include <memory> // std::make_unique()
21 
22 
23 //------------------------------------------------------------------------------
24 //--- lar::example::SpacePointIsolationAlg
25 //---
26 
27 
29 
31 
32  config.radius2 = radius2; // square of isolation radius [cm^2]
34 
35  // proceed to validate the configuration we are going to use
36  try {
38  }
39  catch (std::runtime_error const& e) {
40  throw cet::exception("SpacePointIsolationAlg")
41  << "Error in PointIsolationAlg configuration: " << e.what() << "\n";
42  }
43 
44  if (isolationAlg) isolationAlg->reconfigure(config);
45  else isolationAlg = std::make_unique<PointIsolationAlg_t>(config);
46 
47 } // lar::example::SpacePointIsolationAlg::initialize()
48 
49 
52 {
53  // merge the volumes from all TPCs
54  auto iTPC = geom->begin_TPC(), tpcend = geom->end_TPC();
55 
56  // a TPC is (also) a bounded box:
58 
59  while (++iTPC != tpcend) box.ExtendToInclude(*iTPC);
60 
61  // convert the box into the configuration structure
62  config.rangeX = { box.MinX(), box.MaxX() };
63  config.rangeY = { box.MinY(), box.MaxY() };
64  config.rangeZ = { box.MinZ(), box.MaxZ() };
65 
66 } // lar::example::SpacePointIsolationAlg::fillAlgConfigFromGeometry()
67 
Coord_t radius2
square of isolation radius [cm^2]
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:90
Coord_t radius2
square of isolation radius [cm^2]
Range_t rangeY
range in Y of the covered volume
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:93
Range_t rangeX
range in X of the covered volume
void initialize()
Initialises the algorithm with the current configuration and setup.
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
Access the description of detector geometry.
Algorithm(s) dealing with space point isolation in space.
void fillAlgConfigFromGeometry(PointIsolationAlg_t::Configuration_t &config)
Detects the boundaries of the volume to be sorted from the geometry.
std::unique_ptr< PointIsolationAlg_t > isolationAlg
the actual generic algorithm
Type containing all configuration parameters of the algorithm.
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxY() const
Returns the world y coordinate of the end of the box.
static void validateConfiguration(Configuration_t const &config)
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:35
Range_t rangeZ
range in Z of the covered volume
double MaxZ() const
Returns the world z coordinate of the end of the box.
void ExtendToInclude(Coord_t x, Coord_t y, Coord_t z)
Extends the current box to also include the specified point.
Float_t e
Definition: plot.C:34
double MinY() const
Returns the world y coordinate of the start of the box.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.
geo::GeometryCore const * geom
Pointer to the geometry to be used.