LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 81 of file DriftPartitions.h.

Member Typedef Documentation

Object used to compute projections on drift volume readout plane.

Definition at line 131 of file DriftPartitions.h.

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

Definition at line 121 of file DriftPartitions.h.

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

Definition at line 128 of file DriftPartitions.h.

Type representing a position in 3D space.

Definition at line 118 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 125 of file DriftPartitions.h.

Type for description of drift range.

Definition at line 88 of file DriftPartitions.h.

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

Definition at line 85 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 103 of file DriftPartitions.cxx.

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

Referenced by geo::buildDriftVolumes().

104 {
105  auto const range = computeCoverage(*part);
106  auto iVol = volumeAfter(range.lower);
107  volumes.emplace(iVol, std::move(part), range);
108 } // 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 113 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(), geo::Decomposer< Vector, Point, ProjVector >::PointNormalComponent(), and geo::part::Partition< Data >::walk().

Referenced by addPartition().

114 {
115  /*
116  * Computes the range of drift covered by the TPCs in the specified partition.
117  * The range is currently defined to include any drift distance covered by
118  * any single TPC.
119  * The drift distance is computed in "absolute" coordinates, meaning that the
120  * origin of the drift is at the origin of the global coordinate system.
121  * The drift direction is the one stored in this object.
122  */
123 
124  struct CoverageExtractor {
125  Range_t coverage;
126 
127  CoverageExtractor(DriftPartitions::Decomposer_t const& decomp)
128  : decomp(decomp) {}
129 
130  void operator() (TPCPartition_t const& TPCpart)
131  {
132  geo::TPCGeo const* TPC = TPCpart.data();
133  if (!TPC) return;
134  includePoint(TPC->GetCathodeCenter<Position_t>());
135  includePoint(TPC->LastPlane().GetCenter<Position_t>());
136  }
137 
138  private:
139  DriftPartitions::Decomposer_t const& decomp;
140 
141  double driftCoord(Position_t const& pos) const
142  { return decomp.PointNormalComponent(pos); }
143  void includePoint(Position_t const& pos)
144  { coverage.extendToInclude(driftCoord(pos)); }
145  }; // struct CoverageExtractor
146 
147  CoverageExtractor extractor(decomposer);
148  TPCpart.walk(extractor);
149  return extractor.coverage;
150 
151 } // DriftPartitions::computeCoverage()
double driftCoord(Position_t const &pos) const
Returns drift coordinate (in the drift-volume-specific frame) of pos.
Decomposer_t decomposer
Decomposition on drift, width and depth axes.
Point GetCathodeCenter() const
Definition: TPCGeo.h:253
Geometry information for a single TPC.
Definition: TPCGeo.h:37
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.
Point GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:426
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:228
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().

146  { 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:486
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 150 of file DriftPartitions.h.

References geo::buildDriftVolumes(), and part.

Referenced by TPCat().

151  { return driftVolumeAt(driftCoord(pos)); }
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 83 of file DriftPartitions.cxx.

84 {
85  auto iVol = volumeAfter(drift); // points to partition after the good one
86  if (iVol == volumes.cbegin()) return nullptr;
87  if (!(--iVol)->coversDrift(drift)) return nullptr; // maybe not that good?
88  return &*iVol;
89 } // 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 288 of file DriftPartitions.h.

288  {
289 
290  out << volumes.size() << " drift volume partitions:";
291  for (auto const& driftVol: volumes) {
292  out << "\n[" << driftVol.driftCoverage.lower
293  << " -- " << driftVol.driftCoverage.upper << "]: "
294  << driftVol.partition->describe(" ", "");
295  } // for
296  out << "\n";
297 } // 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 93 of file DriftPartitions.cxx.

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

93  {
94  auto comp = decomposer.DecomposePoint(pos);
95  auto volume = driftVolumeAt(comp.distance);
96  return (volume && volume->partition)
97  ? volume->partition->atPoint(comp.projection.X(), comp.projection.Y())
98  : nullptr;
99 } // 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:517
auto geo::DriftPartitions::volumeAfter ( double  pos)
inlineprivate

Returns an iterator to the drift volume starting after pos.

Definition at line 271 of file DriftPartitions.h.

Referenced by addPartition().

273 {
274  return std::upper_bound
275  (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.
auto geo::DriftPartitions::volumeAfter ( double  pos) const
inlineprivate

Returns an iterator to the drift volume starting after pos.

Definition at line 278 of file DriftPartitions.h.

280 {
281  return std::upper_bound
282  (volumes.begin(), volumes.end(), pos, DriftVolume_t::Comparer_t());
283 } // 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().


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