All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpacePointIsolationAlg.cxx
Go to the documentation of this file.
1 /**
2  * @file SpacePointIsolationAlg.cxx
3  * @brief Algorithm(s) dealing with space point isolation in space
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date May 26, 2016
6  * @see SpacePointIsolationAlg.h
7  * @ingroup RemoveIsolatedSpacePoints
8  *
9  */
10 
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 
30  PointIsolationAlg_t::Configuration_t config;
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 {
37  PointIsolationAlg_t::validateConfiguration(config);
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 
51  (PointIsolationAlg_t::Configuration_t& config)
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:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
void initialize()
Initialises the algorithm with the current configuration and setup.
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
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.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
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.
do i e
double MinY() const
Returns the world y coordinate of the start of the box.