LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PlaneGeo.h
Go to the documentation of this file.
1 #ifndef LARCOREALG_GEOMETRY_PLANEGEO_H
9 #define LARCOREALG_GEOMETRY_PLANEGEO_H
10 
11 // LArSoft libraries
19 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect
21 
22 // ROOT libraries
23 #include "Math/GenVector/Cartesian2D.h"
24 #include "Math/GenVector/PositionVector2D.h"
25 #include "Math/GenVector/DisplacementVector2D.h"
26 
27 // ROOT libraries
28 #include "TGeoMatrix.h" // TGeoHMatrix
29 
30 // C/C++ standard libraries
31 #include <cmath> // std::atan2()
32 #include <vector>
33 #include <string>
34 
35 
36 class TGeoNode;
37 class TVector3;
38 
39 namespace geo {
40 
41  namespace details {
42  struct ActiveAreaCalculator;
43  } // namespace details
44 
45  //......................................................................
46 
75  // Note: SignalType() and SetSignalType() have been removed.
76  // Use `geo::GeometryCore::SignalType` instead.
77  // (see LArSoft issue #14365 at https://cdcvs.fnal.gov/redmine/issues/14365 )
78  class PlaneGeo {
79 
80  using DefaultVector_t = TVector3; // ... not for long
81  using DefaultPoint_t = TVector3; // ... not for long
82 
83  public:
84 
85  using GeoNodePath_t = std::vector<TGeoNode const*>;
86 
88 
102  struct PlaneGeoCoordinatesTag {};
104 
107 
110 
112 
115 
118 
120  using WireCoordProjection_t = ROOT::Math::DisplacementVector2D
121  <ROOT::Math::Cartesian2D<double>, WireCoordinateReferenceTag>;
122 
126 
129 
131 
132 
135 
138 
141  using WidthDepthProjection_t = ROOT::Math::DisplacementVector2D
142  <ROOT::Math::Cartesian2D<double>, WidthDepthReferenceTag>;
143 
145  using WidthDepthDisplacement_t = ROOT::Math::DisplacementVector2D
146  <ROOT::Math::Cartesian2D<double>, WidthDepthReferenceTag>;
147 
151 
155 
157 
158 
161 
162 
164  PlaneGeo(GeoNodePath_t& path, size_t depth);
165 
166 
169 
171  View_t View() const { return fView; }
172 
174  Orient_t Orientation() const { return fOrientation; }
175 
177  double ThetaZ() const;
178 
180  double PhiZ() const
181  { return std::atan2(fSinPhiZ, fCosPhiZ); }
182 
184  double SinPhiZ() const { return fSinPhiZ; }
185 
187  double CosPhiZ() const { return fCosPhiZ; }
188 
190  geo::PlaneID const& ID() const { return fID; }
191 
193 
196 
206  template <typename Vector = DefaultVector_t>
207  Vector WidthDir() const { return geo::vect::convertTo<Vector>(fDecompFrame.MainDir()); }
208 
218  template <typename Vector = DefaultVector_t>
219  Vector DepthDir() const { return geo::vect::convertTo<Vector>(fDecompFrame.SecondaryDir()); }
220 
227  double Width() const { return fFrameSize.Width(); }
228 
235  double Depth() const { return fFrameSize.Depth(); }
236 
237 
241 
243 
244 
247 
249  unsigned int Nwires() const { return fWire.size(); }
251  unsigned int NElements() const { return Nwires(); }
253 
255 
260  bool HasWire(unsigned int iwire) const { return iwire < Nwires(); }
261  bool HasElement(unsigned int iwire) const { return HasWire(iwire); }
263 
265 
273  bool HasWire(geo::WireID const& wireid) const
274  { return HasWire(wireid.Wire); }
275  bool HasElement(geo::WireID const& wireid) const
276  { return HasWire(wireid); }
278 
282  WireGeo const& Wire(unsigned int iwire) const;
283 
285 
294  WireGeo const& Wire(WireID const& wireid) const
295  { return Wire(wireid.Wire); }
296  WireGeo const& GetElement(WireID const& wireid) const
297  { return Wire(wireid); }
299 
305  WireGeo const* WirePtr(unsigned int iwire) const
306  { return HasWire(iwire)? &(fWire[iwire]): nullptr; }
307 
309 
317  WireGeo const* WirePtr(WireID const& wireid) const
318  { return WirePtr(wireid.Wire); }
319  WireGeo const* GetElementPtr(WireID const& wireid) const
320  { return WirePtr(wireid); }
322 
323 
325  const WireGeo& FirstWire() const { return Wire(0); }
326 
328  const WireGeo& MiddleWire() const { return Wire(Nwires()/2); }
329 
331  const WireGeo& LastWire() const { return Wire(Nwires()-1); }
332 
357  auto IterateWires() const
358  { return fWire; }
359 
361 
362 
365 
367  double WirePitch() const { return fWirePitch; }
368 
378  bool WireIDincreasesWithZ() const;
379 
396  template <typename Vector = DefaultVector_t>
397  Vector GetNormalDirection() const { return geo::vect::convertTo<Vector>(fNormal); }
398 
407  template <typename Vector = DefaultVector_t>
409  { return geo::vect::convertTo<Vector>(fDecompWire.SecondaryDir()); }
410 
411 
425  template <typename Point = DefaultPoint_t>
426  Point GetCenter() const
427  { return geo::vect::convertTo<Point>(fCenter); }
428 
440  template <typename Point = DefaultPoint_t>
442  { return geo::vect::convertTo<Point>(toWorldCoords(LocalPoint_t{ 0.0, 0.0, 0.0 })); }
443 
451  template <typename Vector = DefaultVector_t>
452  Vector GetWireDirection() const { return geo::vect::convertTo<Vector>(fDecompWire.MainDir()); }
453 
454 
456 
480  geo::WireID NearestWireID(geo::Point_t const& pos) const;
481  geo::WireID NearestWireID(TVector3 const& pos) const
482  { return NearestWireID(geo::vect::toPoint(pos)); }
484 
485 
507  geo::WireGeo const& NearestWire(geo::Point_t const& pos) const;
508 
509 
525  geo::WireID ClosestWireID(geo::WireID::WireID_t wireNo) const;
526 
527 
538  geo::WireID ClosestWireID(geo::WireID const& wireid) const; // inline
539 
540 
542 
557  double DistanceFromPlane(geo::Point_t const& point) const
558  { return fDecompWire.PointNormalComponent(point); }
559  double DistanceFromPlane(TVector3 const& point) const
560  { return DistanceFromPlane(geo::vect::toPoint(point)); }
562 
563 
565 
579  void DriftPoint(geo::Point_t& position, double distance) const
580  { position -= distance * GetNormalDirection<geo::Vector_t>(); }
581  void DriftPoint(TVector3& position, double distance) const
582  { position -= distance * GetNormalDirection(); }
584 
586 
595  void DriftPoint(geo::Point_t& position) const
596  { DriftPoint(position, DistanceFromPlane(position)); }
597  void DriftPoint(TVector3& position) const
598  { DriftPoint(position, DistanceFromPlane(position)); }
600 
601 
613  Rect const& ActiveArea() const { return fActiveArea; }
614 
616  lar::util::simple_geo::Volume<> Coverage() const;
617 
640  template <typename Stream>
641  void PrintPlaneInfo
642  (Stream&& out, std::string indent = "", unsigned int verbosity = 1) const;
643 
645  static constexpr unsigned int MaxVerbosity = 6;
646 
648 
649 
657 
659 
676  double PlaneCoordinateFrom
677  (geo::Point_t const& point, geo::WireGeo const& refWire) const
678  {
679  return
680  fDecompWire.VectorSecondaryComponent(point - geo::vect::toPoint(refWire.GetCenter()));
681  }
682  double PlaneCoordinateFrom
683  (TVector3 const& point, geo::WireGeo const& refWire) const
684  { return PlaneCoordinateFrom(geo::vect::toPoint(point), refWire); }
686 
687 
689 
704  double PlaneCoordinate(geo::Point_t const& point) const
705  { return fDecompWire.PointSecondaryComponent(point); }
706  double PlaneCoordinate(TVector3 const& point) const
707  { return PlaneCoordinate(geo::vect::toPoint(point)); }
709 
724  template <typename Point = DefaultPoint_t>
725  double WireCoordinate(Point const& point) const
726  { return PlaneCoordinate(point) / WirePitch(); }
727 
728 
730 
744  WireDecomposedVector_t DecomposePoint(geo::Point_t const& point) const
745  { return fDecompWire.DecomposePoint(point); }
746  WireDecomposedVector_t DecomposePoint(TVector3 const& point) const
747  { return DecomposePoint(geo::vect::toPoint(point)); }
748 
750 
758  template <typename Point = DefaultPoint_t>
760  { return geo::vect::convertTo<Point>(fDecompWire.ReferencePoint()); }
761 
763 
779  WireCoordProjection_t Projection(geo::Point_t const& point) const
780  { return fDecompWire.ProjectPointOnPlane(point); }
781  WireCoordProjection_t PointProjection(geo::Point_t const& point) const
782  { return Projection(point); }
783  WireCoordProjection_t PointProjection(TVector3 const& point) const
784  { return PointProjection(geo::vect::toPoint(point)); }
786 
788 
800  WireCoordProjection_t Projection(geo::Vector_t const& v) const
801  { return fDecompWire.ProjectVectorOnPlane(v); }
802  WireCoordProjection_t VectorProjection(geo::Vector_t const& v) const
803  { return Projection(v); }
804  WireCoordProjection_t VectorProjection(TVector3 const& v) const
805  { return VectorProjection(geo::vect::toVector(v)); }
807 
817  template <typename Point = DefaultPoint_t>
819  { return geo::vect::convertTo<Point>(fDecompWire.ComposePoint(decomp)); }
820 
845  template <typename Point = DefaultPoint_t>
846  Point ComposePoint
847  (double distance, WireCoordProjection_t const& proj) const
848  { return geo::vect::convertTo<Point>(fDecompWire.ComposePoint(distance, proj)); }
849 
850 
852 
853 
862 
864 
878  WDDecomposedVector_t DecomposePointWidthDepth(geo::Point_t const& point) const
879  { return fDecompFrame.DecomposePoint(point); }
880  WDDecomposedVector_t DecomposePointWidthDepth(TVector3 const& point) const
881  { return DecomposePointWidthDepth(geo::vect::toPoint(point)); }
883 
885 
896  WidthDepthProjection_t PointWidthDepthProjection
897  (geo::Point_t const& point) const
898  { return fDecompFrame.ProjectPointOnPlane(point); }
899  WidthDepthProjection_t PointWidthDepthProjection
900  (TVector3 const& point) const
901  { return PointWidthDepthProjection(geo::vect::toPoint(point)); }
903 
905 
916  WidthDepthProjection_t VectorWidthDepthProjection
917  (geo::Vector_t const& v) const
918  { return fDecompFrame.ProjectVectorOnPlane(v); }
919  WidthDepthProjection_t VectorWidthDepthProjection
920  (TVector3 const& v) const
921  { return VectorWidthDepthProjection(geo::vect::toVector(v)); }
923 
925 
936  bool isProjectionOnPlane(geo::Point_t const& point) const;
937  bool isProjectionOnPlane(TVector3 const& point) const
938  { return isProjectionOnPlane(geo::vect::toPoint(point)); }
940 
966  WidthDepthProjection_t DeltaFromPlane
967  (WidthDepthProjection_t const& proj, double wMargin, double dMargin)
968  const;
969 
983  WidthDepthProjection_t DeltaFromPlane
984  (WidthDepthProjection_t const& proj, double margin = 0.0) const
985  { return DeltaFromPlane(proj, margin, margin); }
986 
1014  WidthDepthProjection_t DeltaFromActivePlane
1015  (WidthDepthProjection_t const& proj, double wMargin, double dMargin)
1016  const;
1017 
1031  WidthDepthProjection_t DeltaFromActivePlane
1032  (WidthDepthProjection_t const& proj, double margin = 0.0) const
1033  { return DeltaFromActivePlane(proj, margin, margin); }
1034 
1051  WidthDepthProjection_t MoveProjectionToPlane
1052  (WidthDepthProjection_t const& proj) const;
1053 
1055 
1066  geo::Point_t MovePointOverPlane(geo::Point_t const& point) const;
1067  TVector3 MovePointOverPlane(TVector3 const& point) const;
1069 
1082  template <typename Point = DefaultPoint_t>
1084  { return geo::vect::convertTo<Point>(fDecompFrame.ComposePoint(decomp)); }
1085 
1105  template <typename Point = DefaultPoint_t>
1106  Point ComposePoint
1107  (double distance, WidthDepthProjection_t const& proj) const
1108  { return geo::vect::convertTo<Point>(fDecompFrame.ComposePoint(distance, proj)); }
1109 
1110 
1112 
1113 
1115 
1123  void LocalToWorld(const double* plane, double* world) const
1125  { fTrans.LocalToWorld(plane, world); }
1126 
1128  TVector3 LocalToWorld(const TVector3& local) const
1129  { return fTrans.LocalToWorld<TVector3>(local); }
1130 
1132  geo::Point_t toWorldCoords(LocalPoint_t const& local) const
1133  { return fTrans.toWorldCoords(local); }
1134 
1136  void LocalToWorldVect(const double* plane, double* world) const
1137  { fTrans.LocalToWorldVect(plane, world); }
1138 
1140  TVector3 LocalToWorldVect(const TVector3& local) const
1141  { return fTrans.LocalToWorldVect<TVector3>(local); }
1142 
1145  { return fTrans.toWorldCoords(local); }
1146 
1148  void WorldToLocal(const double* world, double* plane) const
1149  { fTrans.WorldToLocal(world, plane); }
1150 
1152  TVector3 WorldToLocal(TVector3 const& world) const
1153  { return fTrans.WorldToLocal<TVector3>(world); }
1154 
1156  LocalPoint_t toLocalCoords(geo::Point_t const& world) const
1157  { return fTrans.toLocalCoords(world); }
1158 
1160  void WorldToLocalVect(const double* world, double* plane) const
1161  { fTrans.WorldToLocalVect(world, plane); }
1162 
1164  TVector3 WorldToLocalVect(TVector3 const& world) const
1165  { return fTrans.WorldToLocalVect<TVector3>(world); }
1166 
1169  { return fTrans.toLocalCoords(world); }
1170 
1172 
1173 
1174 
1177 
1179  void SetView(geo::View_t view) { fView = view; }
1180 
1182 
1184  void SortWires(geo::GeoObjectSorter const& sorter);
1185 
1187  void UpdateAfterSorting
1188  (geo::PlaneID planeid, geo::BoxBoundedGeo const& TPCbox);
1189 
1191  static std::string ViewName(geo::View_t view);
1192 
1194  static std::string OrientationName(geo::Orient_t orientation);
1195 
1196 
1197  private:
1198 
1199  void FindWire(GeoNodePath_t& path, size_t depth);
1200  void MakeWire(GeoNodePath_t& path, size_t depth);
1201 
1203  void DetectGeometryDirections();
1204 
1206  geo::Vector_t GetNormalAxis() const;
1207 
1209  void UpdatePlaneNormal(geo::BoxBoundedGeo const& TPCbox);
1210 
1212  void UpdateWidthDepthDir();
1213 
1215  void UpdateIncreasingWireDir();
1216 
1218  void UpdateWireDir();
1219 
1221  void UpdateOrientation();
1222 
1224  void UpdateWirePitch();
1225 
1227  void UpdateWirePlaneCenter();
1228 
1230  void UpdatePhiZ();
1231 
1233  void UpdateView();
1234 
1236  void UpdateWirePitchSlow();
1237 
1239  void UpdateDecompWireOrigin();
1240 
1242  void UpdateActiveArea();
1243 
1245  bool shouldFlipWire(geo::WireGeo const& wire) const;
1246 
1247  private:
1248  using WireCollection_t = std::vector<geo::WireGeo>;
1249 
1250  using LocalTransformation_t
1252 
1253  struct RectSpecs {
1254  double halfWidth;
1255  double halfDepth;
1256 
1257  double HalfWidth() const { return halfWidth; }
1258  double HalfDepth() const { return halfDepth; }
1259  double Width() const { return 2.0 * HalfWidth(); }
1260  double Depth() const { return 2.0 * HalfDepth(); }
1261  }; // RectSpecs
1262 
1264  TGeoVolume const* fVolume;
1268  double fWirePitch;
1269  double fSinPhiZ;
1270  double fCosPhiZ;
1271 
1273  WireDecomposer_t fDecompWire;
1282  Rect fActiveArea;
1285  geo::Point_t fCenter;
1286 
1288 
1290 
1292  template <typename T>
1293  static T boundedValue(T v, T min, T max)
1294  { return std::min(max, std::max(min, v)); }
1295 
1296  }; // class PlaneGeo
1297 
1298 } // namespace geo
1299 
1300 
1301 //------------------------------------------------------------------------------
1302 //--- inline implementation
1303 //---
1305  (geo::WireID::WireID_t wireNo) const
1306 {
1307  return { ID(), boundedValue<geo::WireID::WireID_t>(wireNo, 0, Nwires()) };
1308 }
1309 
1311 {
1312  if (wireid.asPlaneID() != ID()) {
1313  geo::WireID invalid{ wireid };
1314  invalid.markInvalid();
1315  return invalid;
1316  }
1317  return ClosestWireID(wireid.Wire);
1318 } // geo::PlaneGeo::ClosestWireID()
1319 
1320 //------------------------------------------------------------------------------
1321 //--- template implementation
1322 //---
1323 template <typename Stream>
1325  Stream&& out,
1326  std::string indent /* = "" */,
1327  unsigned int verbosity /* = 1 */
1328 ) const {
1329 
1330  //----------------------------------------------------------------------------
1331  out << "plane " << std::string(ID());
1332 
1333  if (verbosity-- <= 0) return; // 0
1334 
1335  //----------------------------------------------------------------------------
1336  out
1337  << " at " << GetCenter<geo::Vector_t>() << " cm"
1338  << ", theta: " << ThetaZ() << " rad";
1339 
1340  if (verbosity-- <= 0) return; // 1
1341 
1342  //----------------------------------------------------------------------------
1343  unsigned int const nWires = Nwires();
1344 
1345  out << "\n" << indent
1346  << "normal to wire: " << PhiZ() << " rad"
1347  << ", with orientation " << OrientationName(Orientation())
1348  << ", has " << nWires << " wires measuring " << ViewName(View())
1349  << " with a wire pitch of " << WirePitch() << " cm"
1350  ;
1351 
1352  if (verbosity-- <= 0) return; // 2
1353 
1354  //----------------------------------------------------------------------------
1355  auto const& normal = GetNormalDirection<geo::Vector_t>();
1356  auto const& incrZdir = GetIncreasingWireDirection<geo::Vector_t>();
1357  auto const& wireNormalDir = fDecompWire.NormalDir();
1358  out << "\n" << indent
1359  << "normal to plane: " << normal
1360  << ", direction of increasing wire number: " << incrZdir
1361  << " [wire frame normal: " << wireNormalDir << "]"
1362  << " (" << (WireIDincreasesWithZ()? "increases": "decreases") << " with z)";
1363 
1364  if (verbosity-- <= 0) return; // 3
1365 
1366  //----------------------------------------------------------------------------
1367 
1368  auto const& wireDir = GetWireDirection<geo::Vector_t>();
1369  auto const& widthDir = WidthDir<geo::Vector_t>();
1370  auto const& depthDir = DepthDir<geo::Vector_t>();
1371  auto const& frameNormalDir = fDecompFrame.NormalDir();
1372 
1373  out << "\n" << indent
1374  << "wire direction: " << wireDir
1375  << "; width " << Width() << " cm in direction: " << widthDir
1376  << ", depth " << Depth() << " cm in direction: " << depthDir
1377  << " [normal: " << frameNormalDir << "]"
1378  ;
1379 
1380  if (verbosity-- <= 0) return; // 4
1381 
1382  //----------------------------------------------------------------------------
1383  // get the area spanned by the wires
1384  out << "\n" << indent << "wires cover width "
1385  << ActiveArea().width.lower << " to " << ActiveArea().width.upper
1386  << ", depth "
1387  << ActiveArea().depth.lower << " to " << ActiveArea().depth.upper
1388  << " cm";
1389  if (verbosity-- <= 0) return; // 5
1390 
1391  //----------------------------------------------------------------------------
1392  // print also the containing box
1393  auto const box = BoundingBox();
1394  out << "\n" << indent
1395  << "bounding box: " << box.Min() << " -- " << box.Max();
1396 
1397 // if (verbosity-- <= 0) return; // 6
1398 
1399  //----------------------------------------------------------------------------
1400 } // geo::PlaneGeo::PrintPlaneInfo()
1401 
1402 
1403 #endif // LARCOREALG_GEOMETRY_PLANEGEO_H
1404 
unsigned int NElements() const
Number of wires in this plane.
Definition: PlaneGeo.h:251
WireGeo const & Wire(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:294
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:61
double HalfWidth() const
Definition: PlaneGeo.h:1257
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:167
geo::Vector_t toWorldCoords(LocalVector_t const &local) const
Transform direction vector from local to world.
Definition: PlaneGeo.h:1144
WireDecomposedVector_t DecomposePoint(TVector3 const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:746
void SetView(geo::View_t view)
Set the signal view (for TPCGeo).
Definition: PlaneGeo.h:1179
geo::Point_t fCenter
Center of the plane, lying on the wire plane.
Definition: PlaneGeo.h:1285
double fWirePitch
Pitch of wires in this plane.
Definition: PlaneGeo.h:1268
WireCoordProjection_t PointProjection(TVector3 const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:783
std::vector< geo::WireGeo > WireCollection_t
Definition: PlaneGeo.h:1248
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
enum geo::_plane_orient Orient_t
Enumerate the possible plane projections.
double DistanceFromPlane(TVector3 const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:559
WireCoordProjection_t VectorProjection(TVector3 const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:804
geo::PlaneID fID
ID of this plane.
Definition: PlaneGeo.h:1287
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
Volume delimited by two points.
Definition: SimpleGeo.h:261
Point ProjectionReferencePoint() const
Returns the reference point used by PointProjection().
Definition: PlaneGeo.h:759
void DriftPoint(TVector3 &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:581
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
Point GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:441
WireGeo const * WirePtr(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:317
Point ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: PlaneGeo.h:818
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
TVector3 DefaultPoint_t
Definition: PlaneGeo.h:81
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:313
Rect const & ActiveArea() const
Returns an area covered by the wires in the plane.
Definition: PlaneGeo.h:613
Vector GetNormalDirection() const
Returns the direction normal to the plane.
Definition: PlaneGeo.h:397
bool HasElement(geo::WireID const &wireid) const
Returns whether the wire in wireid is present in this plane.
Definition: PlaneGeo.h:275
double Depth() const
Definition: PlaneGeo.h:1260
WireCoordProjection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:779
Vector GetIncreasingWireDirection() const
Returns the direction of increasing wires.
Definition: PlaneGeo.h:408
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local plane frame.
Definition: PlaneGeo.h:1156
WDDecomposedVector_t DecomposePointWidthDepth(TVector3 const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:880
void WorldToLocal(const double *world, double *plane) const
Transform point from world frame to local plane frame.
Definition: PlaneGeo.h:1148
View_t fView
Does this plane measure U, V, or W?
Definition: PlaneGeo.h:1265
WireGeo const * GetElementPtr(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:319
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:579
geo::Vector_t fNormal
Definition: PlaneGeo.h:1272
Interface to algorithm class for sorting geo::XXXGeo objects.
TGeoVolume const * fVolume
Plane volume description.
Definition: PlaneGeo.h:1264
bool isProjectionOnPlane(TVector3 const &point) const
Returns if the projection of specified point is within the plane.
Definition: PlaneGeo.h:937
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:171
auto IterateWires() const
Allows range-for iteration on all wires in this plane.
Definition: PlaneGeo.h:357
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag > WidthDepthProjection_t
Definition: PlaneGeo.h:142
Int_t max
Definition: plot.C:27
Offer iterators automatically dereferencing their values.
WireDecomposedVector_t DecomposePoint(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:744
Classes to project and compose a vector on a plane.
WidthDepthDecomposer_t::DecomposedVector_t WDDecomposedVector_t
Definition: PlaneGeo.h:154
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1280
Local-to-world transformations with LArSoft geometry vectors.
TVector3 DefaultVector_t
Definition: PlaneGeo.h:80
double PhiZ() const
Angle from positive z axis of the wire coordinate axis, in radians.
Definition: PlaneGeo.h:180
const WireGeo & MiddleWire() const
Return the middle wire in the plane.
Definition: PlaneGeo.h:328
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1132
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WireCoordinateReferenceTag > WireCoordProjection_t
Type for projections in the wire base representation.
Definition: PlaneGeo.h:121
Tag for vectors in the "local" GDML coordinate frame of the plane.
Definition: PlaneGeo.h:103
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1267
WireGeo const & GetElement(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:296
WireCoordProjection_t Projection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:800
double Depth() const
Return the depth of the plane.
Definition: PlaneGeo.h:235
Point GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:426
std::string indent(std::size_t const i)
double fSinPhiZ
Sine of .
Definition: PlaneGeo.h:1269
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
double Width() const
Return the width of the plane.
Definition: PlaneGeo.h:227
Utilities to extend the interface of geometry vectors.
PlaneID const & asPlaneID() const
Conversion to PlaneID (for convenience of notation).
Definition: geo_types.h:282
void DriftPoint(geo::Point_t &position) const
Shifts the position along drift direction to fall on the plane.
Definition: PlaneGeo.h:595
WireCoordProjection_t PointProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:781
double CosPhiZ() const
Cosine of PhiZ()
Definition: PlaneGeo.h:187
const WireGeo & FirstWire() const
Return the first wire in the plane.
Definition: PlaneGeo.h:325
bool HasElement(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:261
RectSpecs fFrameSize
Definition: PlaneGeo.h:1281
double SinPhiZ() const
Sine of PhiZ()
Definition: PlaneGeo.h:184
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag > WidthDepthDisplacement_t
Type for vector projections in the plane frame base representation.
Definition: PlaneGeo.h:146
std::vector< TGeoNode const * > GeoNodePath_t
Definition: PlaneGeo.h:85
void markInvalid()
Sets the ID as invalid.
Definition: geo_types.h:157
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1263
Definition of data types for geometry description.
static T boundedValue(T v, T min, T max)
Returns min if v < min, max if v > max, v otherwise.
Definition: PlaneGeo.h:1293
Provides a base class aware of world box coordinates.
typename PlaneDecomposer_t::DecomposedVector_t DecomposedVector_t
Type representing a decomposition on the plane.
Definition: Decomposer.h:414
double HalfDepth() const
Definition: PlaneGeo.h:1258
Orient_t Orientation() const
What is the orientation of the plane.
Definition: PlaneGeo.h:174
Encapsulate the geometry of a wire.
Vector DepthDir() const
Return the direction of plane depth.
Definition: PlaneGeo.h:219
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:306
RTree::BoundingBox BoundingBox
Definition: main.cpp:34
Tag for plane frame base vectors.
Definition: PlaneGeo.h:137
WireCoordProjection_t VectorProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:802
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:35
bool HasWire(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:260
void PrintPlaneInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this plane.
Definition: PlaneGeo.h:1324
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:557
Int_t min
Definition: plot.C:26
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:190
WireGeo const * WirePtr(unsigned int iwire) const
Returns the wire number iwire from this plane.
Definition: PlaneGeo.h:305
Float_t proj
Definition: plot.C:34
TVector3 WorldToLocal(TVector3 const &world) const
Transform point from world frame to local plane frame.
Definition: PlaneGeo.h:1152
geo::WireID ClosestWireID(geo::WireID::WireID_t wireNo) const
Returns the closest valid wire ID to the specified wire.
Definition: PlaneGeo.h:1305
Some simple functions to represent geometry entities.
WireDecomposer_t::DecomposedVector_t WireDecomposedVector_t
Type describing a 3D point or vector decomposed on a plane on wire base.
Definition: PlaneGeo.h:128
double fCosPhiZ
Cosine of .
Definition: PlaneGeo.h:1270
TVector3 LocalToWorldVect(const TVector3 &local) const
Transform direction vector from local to world.
Definition: PlaneGeo.h:1140
Vector WidthDir() const
Return the direction of plane width.
Definition: PlaneGeo.h:207
WDDecomposedVector_t DecomposePointWidthDepth(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:878
GenPoint3DBase_t< double, C > Point3DBase_t
Type of 3D point with representation in double precision.
Definition: geo_vectors.h:95
GenVector3DBase_t< double, C > Vector3DBase_t
Definition: geo_vectors.h:90
void LocalToWorldVect(const double *plane, double *world) const
Transform direction vector from local to world.
Definition: PlaneGeo.h:1136
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
Definition: WireGeo.cxx:68
double WireCoordinate(Point const &point) const
Returns the coordinate of the point on the plane, in wire units.
Definition: PlaneGeo.h:725
double Width() const
Definition: PlaneGeo.h:1259
Class computing the active area of the plane.
Definition: PlaneGeo.cxx:85
bool HasWire(geo::WireID const &wireid) const
Returns whether the wire in wireid is present in this plane.
Definition: PlaneGeo.h:273
geo::Vector3DBase_t< PlaneGeoCoordinatesTag > LocalVector_t
Type of displacement vectors in the local GDML wire plane frame.
Definition: PlaneGeo.h:109
Point ComposePoint(WDDecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: PlaneGeo.h:1083
const WireGeo & LastWire() const
Return the last wire in the plane.
Definition: PlaneGeo.h:331
TVector3 WorldToLocalVect(TVector3 const &world) const
Transform direction vector from world to local.
Definition: PlaneGeo.h:1164
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:187
Namespace collecting geometry-related classes utilities.
void DriftPoint(TVector3 &position) const
Shifts the position along drift direction to fall on the plane.
Definition: PlaneGeo.h:597
Orient_t fOrientation
Is the plane vertical or horizontal?
Definition: PlaneGeo.h:1266
double PlaneCoordinate(geo::Point_t const &point) const
Returns the coordinate of the point on the plane.
Definition: PlaneGeo.h:704
TVector3 LocalToWorld(const TVector3 &local) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1128
double PlaneCoordinate(TVector3 const &point) const
Returns the coordinate of the point on the plane.
Definition: PlaneGeo.h:706
geo::Point3DBase_t< PlaneGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
Definition: PlaneGeo.h:106
LocalVector_t toLocalCoords(geo::Vector_t const &world) const
Transform direction vector from world to local.
Definition: PlaneGeo.h:1168
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:367
void WorldToLocalVect(const double *world, double *plane) const
Transform direction vector from world to local.
Definition: PlaneGeo.h:1160
geo::WireID NearestWireID(TVector3 const &pos) const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:481
Tag for wire base vectors.
Definition: PlaneGeo.h:117
Vector GetWireDirection() const
Returns the direction of the wires.
Definition: PlaneGeo.h:452