LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::DriftPartitions Class Reference

Set of drift volumes. More...

#include "DriftPartitions.h"

Classes

struct  DriftVolume_t
 Data associated to a single drift volume. More...
 

Public Types

using TPCPartition_t = geo::part::Partition< geo::TPCGeo const >
 Type of TPC collection for the partition of a single drift volume. More...
 
using Range_t = lar::util::simple_geo::Range< double >
 Type for description of drift range. More...
 
using Position_t = geo::Point_t
 Type representing a position in 3D space. More...
 
using Direction_t = geo::Vector_t
 Type representing a direction in 3D space (norm is not constrained). More...
 
using Projection_t = ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >>
 Type representing a position in the 2D space. More...
 
using DriftDir_t = Direction_t
 Type representing the drift direction (assumed to have norm 1). More...
 
using Decomposer_t = geo::Decomposer< Direction_t, Position_t, Projection_t >
 Object used to compute projections on drift volume readout plane. More...
 

Public Member Functions

 DriftPartitions (Decomposer_t const &decomp)
 Constructor: no partition, but sets the main "drift" direction. More...
 
template<typename Stream >
void print (Stream &&out) const
 Printout of the drift volume information. More...
 
void addPartition (std::unique_ptr< TPCPartition_t > &&part)
 Adds the specified partition as a new drift volume. More...
 
Drift volume lookup.
double driftCoord (Position_t const &pos) const
 Returns drift coordinate (in the drift-volume-specific frame) of pos. More...
 
DriftVolume_t const * driftVolumeAt (Position_t const &pos) const
 
DriftVolume_t const * driftVolumeAt (double drift) const
 Returns which volume contains the specified drift (nullptr if none). More...
 
geo::TPCGeo const * TPCat (Position_t const &pos) const
 Returns which TPC contains the specified position (nullptr if none). More...
 

Public Attributes

std::vector< DriftVolume_tvolumes
 All drift volumes, sorted by position. More...
 
Decomposer_t decomposer
 Decomposition on drift, width and depth axes. More...
 

Private Member Functions

std::vector< DriftVolume_t >::iterator volumeAfter (double pos)
 Returns an iterator to the drift volume starting after pos. More...
 
std::vector< DriftVolume_t >::const_iterator volumeAfter (double pos) const
 Returns an iterator to the drift volume starting after pos. More...
 
Range_t computeCoverage (TPCPartition_t const &TPCpart) const
 Computes the coverage of the specified partition in the drift direction. More...
 

Detailed Description

Set of drift volumes.

A drift volume is a set of TPCs whose readout planes lie on the same geometric plane.

Definition at line 87 of file DriftPartitions.h.

Member Typedef Documentation

Object used to compute projections on drift volume readout plane.

Definition at line 132 of file DriftPartitions.h.

Type representing a direction in 3D space (norm is not constrained).

Definition at line 123 of file DriftPartitions.h.

Type representing the drift direction (assumed to have norm 1).

Definition at line 129 of file DriftPartitions.h.

Type representing a position in 3D space.

Definition at line 120 of file DriftPartitions.h.

using geo::DriftPartitions::Projection_t = ROOT::Math::DisplacementVector2D<ROOT::Math::Cartesian2D<double>>

Type representing a position in the 2D space.

Definition at line 126 of file DriftPartitions.h.

Type for description of drift range.

Definition at line 94 of file DriftPartitions.h.

Type of TPC collection for the partition of a single drift volume.

Definition at line 91 of file DriftPartitions.h.

Constructor & Destructor Documentation

geo::DriftPartitions::DriftPartitions ( Decomposer_t const &  decomp)
inlineexplicit

Constructor: no partition, but sets the main "drift" direction.

Definition at line 139 of file DriftPartitions.h.

139 : decomposer(decomp) {}
Decomposer_t decomposer
Decomposition on drift, width and depth axes.

Member Function Documentation

void geo::DriftPartitions::addPartition ( std::unique_ptr< TPCPartition_t > &&  part)

Adds the specified partition as a new drift volume.

Definition at line 97 of file DriftPartitions.cxx.

References computeCoverage(), part, volumeAfter(), and volumes.

Referenced by geo::buildDriftVolumes().

98 {
99  auto const range = computeCoverage(*part);
100  auto iVol = volumeAfter(range.lower);
101  volumes.emplace(iVol, std::move(part), range);
102 } // geo::DriftPartitions::addPartition()
Range_t computeCoverage(TPCPartition_t const &TPCpart) const
Computes the coverage of the specified partition in the drift direction.
std::vector< DriftVolume_t >::iterator volumeAfter(double pos)
Returns an iterator to the drift volume starting after pos.
std::vector< DriftVolume_t > volumes
All drift volumes, sorted by position.
auto geo::DriftPartitions::computeCoverage ( TPCPartition_t const &  TPCpart) const
private

Computes the coverage of the specified partition in the drift direction.

Definition at line 105 of file DriftPartitions.cxx.

References geo::part::Partition< Data >::data(), decomposer, driftCoord(), lar::util::simple_geo::Range< Data >::extendToInclude(), geo::TPCGeo::GetCathodeCenter(), geo::PlaneGeo::GetCenter(), geo::TPCGeo::LastPlane(), and geo::Decomposer< Vector, Point, ProjVector >::PointNormalComponent().

Referenced by addPartition().

106 {
107  /*
108  * Computes the range of drift covered by the TPCs in the specified partition.
109  * The range is currently defined to include any drift distance covered by
110  * any single TPC.
111  * The drift distance is computed in "absolute" coordinates, meaning that the
112  * origin of the drift is at the origin of the global coordinate system.
113  * The drift direction is the one stored in this object.
114  */
115 
116  struct CoverageExtractor {
117  Range_t coverage;
118 
119  CoverageExtractor(DriftPartitions::Decomposer_t const& decomp) : decomp(decomp) {}
120 
121  void operator()(TPCPartition_t const& TPCpart)
122  {
123  geo::TPCGeo const* TPC = TPCpart.data();
124  if (!TPC) return;
125  includePoint(TPC->GetCathodeCenter());
126  includePoint(TPC->LastPlane().GetCenter());
127  }
128 
129  private:
130  DriftPartitions::Decomposer_t const& decomp;
131 
132  double driftCoord(Position_t const& pos) const { return decomp.PointNormalComponent(pos); }
133  void includePoint(Position_t const& pos) { coverage.extendToInclude(driftCoord(pos)); }
134  }; // struct CoverageExtractor
135 
136  CoverageExtractor extractor(decomposer);
137  TPCpart.walk(extractor);
138  return extractor.coverage;
139 
140 } // DriftPartitions::computeCoverage()
double driftCoord(Position_t const &pos) const
Returns drift coordinate (in the drift-volume-specific frame) of pos.
Point_t GetCathodeCenter() const
Definition: TPCGeo.h:254
Decomposer_t decomposer
Decomposition on drift, width and depth axes.
Point_t const & GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:435
Geometry information for a single TPC.
Definition: TPCGeo.h:36
lar::util::simple_geo::Range< double > Range_t
Type for description of drift range.
geo::Point_t Position_t
Type representing a position in 3D space.
geo::Decomposer< Direction_t, Position_t, Projection_t > Decomposer_t
Object used to compute projections on drift volume readout plane.
geo::PlaneGeo const & LastPlane() const
Returns the last wire plane (the farther from TPC center).
Definition: TPCGeo.h:215
geo::part::Partition< geo::TPCGeo const > TPCPartition_t
Type of TPC collection for the partition of a single drift volume.
double geo::DriftPartitions::driftCoord ( Position_t const &  pos) const
inline

Returns drift coordinate (in the drift-volume-specific frame) of pos.

Definition at line 145 of file DriftPartitions.h.

References geo::Decomposer< Vector, Point, ProjVector >::PointNormalComponent().

Referenced by checkTPCcoords(), computeCoverage(), and sortTPCsByDriftCoord().

145 { return decomposer.PointNormalComponent(pos); }
Decomposer_t decomposer
Decomposition on drift, width and depth axes.
auto PointNormalComponent(Point_t const &point) const
Returns the secondary component of a point.
Definition: Decomposer.h:481
DriftVolume_t const* geo::DriftPartitions::driftVolumeAt ( Position_t const &  pos) const
inline

Returns which partition contains the specified position.

Returns
volume containing the specified position (nullptr if none)

Definition at line 149 of file DriftPartitions.h.

References geo::buildDriftVolumes(), and part.

Referenced by TPCat().

150  {
151  return driftVolumeAt(driftCoord(pos));
152  }
double driftCoord(Position_t const &pos) const
Returns drift coordinate (in the drift-volume-specific frame) of pos.
DriftVolume_t const * driftVolumeAt(Position_t const &pos) const
geo::DriftPartitions::DriftVolume_t const * geo::DriftPartitions::driftVolumeAt ( double  drift) const

Returns which volume contains the specified drift (nullptr if none).

Definition at line 78 of file DriftPartitions.cxx.

References volumeAfter(), and volumes.

79 {
80  auto iVol = volumeAfter(drift); // points to partition after the good one
81  if (iVol == volumes.cbegin()) return nullptr;
82  if (!(--iVol)->coversDrift(drift)) return nullptr; // maybe not that good?
83  return &*iVol;
84 } // geo::DriftPartitions::driftVolumeAt()
std::vector< DriftVolume_t >::iterator volumeAfter(double pos)
Returns an iterator to the drift volume starting after pos.
std::vector< DriftVolume_t > volumes
All drift volumes, sorted by position.
template<typename Stream >
void geo::DriftPartitions::print ( Stream &&  out) const

Printout of the drift volume information.

Definition at line 280 of file DriftPartitions.h.

281 {
282 
283  out << volumes.size() << " drift volume partitions:";
284  for (auto const& driftVol : volumes) {
285  out << "\n[" << driftVol.driftCoverage.lower << " -- " << driftVol.driftCoverage.upper
286  << "]: " << driftVol.partition->describe(" ", "");
287  } // for
288  out << "\n";
289 } // geo::DriftPartitions::print()
std::vector< DriftVolume_t > volumes
All drift volumes, sorted by position.
geo::TPCGeo const * geo::DriftPartitions::TPCat ( Position_t const &  pos) const

Returns which TPC contains the specified position (nullptr if none).

Definition at line 87 of file DriftPartitions.cxx.

References geo::Decomposer< Vector, Point, ProjVector >::DecomposePoint(), decomposer, and driftVolumeAt().

88 {
89  auto comp = decomposer.DecomposePoint(pos);
90  auto volume = driftVolumeAt(comp.distance);
91  return (volume && volume->partition) ?
92  volume->partition->atPoint(comp.projection.X(), comp.projection.Y()) :
93  nullptr;
94 } // geo::DriftPartitions::TPCat()
Decomposer_t decomposer
Decomposition on drift, width and depth axes.
DriftVolume_t const * driftVolumeAt(Position_t const &pos) const
DecomposedVector_t DecomposePoint(Point_t const &point) const
Decomposes a 3D point in two components.
Definition: Decomposer.h:516
auto geo::DriftPartitions::volumeAfter ( double  pos)
inlineprivate

Returns an iterator to the drift volume starting after pos.

Definition at line 267 of file DriftPartitions.h.

Referenced by addPartition(), and driftVolumeAt().

268 {
269  return std::upper_bound(volumes.begin(), volumes.end(), pos, DriftVolume_t::Comparer_t());
270 } // geo::DriftPartitions::volumeAfter()
details::Comparer< DriftVolume_t, double, DriftVolume_t::Position > Comparer_t
Type of static object to compare DriftVolume_t objects.
std::vector< DriftVolume_t > volumes
All drift volumes, sorted by position.
auto geo::DriftPartitions::volumeAfter ( double  pos) const
inlineprivate

Returns an iterator to the drift volume starting after pos.

Definition at line 272 of file DriftPartitions.h.

274 {
275  return std::upper_bound(volumes.begin(), volumes.end(), pos, DriftVolume_t::Comparer_t());
276 } // geo::DriftPartitions::volumeAfter()
details::Comparer< DriftVolume_t, double, DriftVolume_t::Position > Comparer_t
Type of static object to compare DriftVolume_t objects.
std::vector< DriftVolume_t > volumes
All drift volumes, sorted by position.

Member Data Documentation

Decomposer_t geo::DriftPartitions::decomposer

Decomposition on drift, width and depth axes.

Definition at line 136 of file DriftPartitions.h.

Referenced by geo::buildDriftVolumes(), computeCoverage(), and TPCat().

std::vector<DriftVolume_t> geo::DriftPartitions::volumes

All drift volumes, sorted by position.

Definition at line 135 of file DriftPartitions.h.

Referenced by addPartition(), and driftVolumeAt().


The documentation for this class was generated from the following files: