Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
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 89 of file DriftPartitions.h.

Member Typedef Documentation

Object used to compute projections on drift volume readout plane.

Definition at line 139 of file DriftPartitions.h.

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

Definition at line 129 of file DriftPartitions.h.

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

Definition at line 136 of file DriftPartitions.h.

Type representing a position in 3D space.

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

Type for description of drift range.

Definition at line 96 of file DriftPartitions.h.

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

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

147 : 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 100 of file DriftPartitions.cxx.

101 {
102  auto const range = computeCoverage(*part);
103  auto iVol = volumeAfter(range.lower);
104  volumes.emplace(iVol, std::move(part), range);
105 } // 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.
def move(depos, offset)
Definition: depos.py:107
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 110 of file DriftPartitions.cxx.

111 {
112  /*
113  * Computes the range of drift covered by the TPCs in the specified partition.
114  * The range is currently defined to include any drift distance covered by
115  * any single TPC.
116  * The drift distance is computed in "absolute" coordinates, meaning that the
117  * origin of the drift is at the origin of the global coordinate system.
118  * The drift direction is the one stored in this object.
119  */
120 
121  struct CoverageExtractor {
122  Range_t coverage;
123 
124  CoverageExtractor(DriftPartitions::Decomposer_t const& decomp)
125  : decomp(decomp) {}
126 
127  void operator() (TPCPartition_t const& TPCpart)
128  {
129  geo::TPCGeo const* TPC = TPCpart.data();
130  if (!TPC) return;
131  includePoint(TPC->GetCathodeCenter<Position_t>());
132  includePoint(TPC->LastPlane().GetCenter<Position_t>());
133  }
134 
135  private:
136  DriftPartitions::Decomposer_t const& decomp;
137 
138  double driftCoord(Position_t const& pos) const
139  { return decomp.PointNormalComponent(pos); }
140  void includePoint(Position_t const& pos)
141  { coverage.extendToInclude(driftCoord(pos)); }
142  }; // struct CoverageExtractor
143 
144  CoverageExtractor extractor(decomposer);
145  TPCpart.walk(extractor);
146  return extractor.coverage;
147 
148 } // 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:298
Geometry information for a single TPC.
Definition: TPCGeo.h:38
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:479
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:248
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 153 of file DriftPartitions.h.

154  { 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 158 of file DriftPartitions.h.

159  { 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 80 of file DriftPartitions.cxx.

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

296  {
297 
298  out << volumes.size() << " drift volume partitions:";
299  for (auto const& driftVol: volumes) {
300  out << "\n[" << driftVol.driftCoverage.lower
301  << " -- " << driftVol.driftCoverage.upper << "]: "
302  << driftVol.partition->describe(" ", "");
303  } // for
304  out << "\n";
305 } // 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 90 of file DriftPartitions.cxx.

90  {
91  auto comp = decomposer.DecomposePoint(pos);
92  auto volume = driftVolumeAt(comp.distance);
93  return (volume && volume->partition)
94  ? volume->partition->atPoint(comp.projection.X(), comp.projection.Y())
95  : nullptr;
96 } // geo::DriftPartitions::TPCat()
Decomposer_t decomposer
Decomposition on drift, width and depth axes.
static const std::string volume[nvol]
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 279 of file DriftPartitions.h.

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

288 {
289  return std::upper_bound
290  (volumes.begin(), volumes.end(), pos, DriftVolume_t::Comparer_t());
291 } // 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 144 of file DriftPartitions.h.

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

All drift volumes, sorted by position.

Definition at line 143 of file DriftPartitions.h.


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