LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
PlaneGeo.h
Go to the documentation of this file.
1 
7 #ifndef LARCOREALG_GEOMETRY_PLANEGEO_H
8 #define LARCOREALG_GEOMETRY_PLANEGEO_H
9 
10 // LArSoft libraries
18 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect
20 
21 // ROOT libraries
22 #include "Math/GenVector/Cartesian2D.h"
23 #include "Math/GenVector/DisplacementVector2D.h"
24 #include "Math/GenVector/PositionVector2D.h"
25 
26 // ROOT libraries
27 #include "TGeoMatrix.h" // TGeoHMatrix
28 
29 // C/C++ standard libraries
30 #include <cmath> // std::atan2()
31 #include <functional>
32 #include <string>
33 #include <vector>
34 
35 class TGeoNode;
36 
37 namespace geo {
38 
39  class WireGeo;
40  using WirePtr = WireGeo const*; // this will become an object in the future
41 
67  class PlaneGeo {
68  public:
69  using ID_t = PlaneID;
70  using WireCollection_t = std::vector<WireGeo>;
71  using GeoNodePath_t = std::vector<TGeoNode const*>;
72 
75 
77 
90  struct PlaneGeoCoordinatesTag {};
92 
95 
98 
100 
103 
106 
108  using WireCoordProjection_t =
109  ROOT::Math::DisplacementVector2D<ROOT::Math::Cartesian2D<double>, WireCoordinateReferenceTag>;
110 
113 
116 
118 
121 
124 
127  using WidthDepthProjection_t =
128  ROOT::Math::DisplacementVector2D<ROOT::Math::Cartesian2D<double>, WidthDepthReferenceTag>;
129 
132  ROOT::Math::DisplacementVector2D<ROOT::Math::Cartesian2D<double>, WidthDepthReferenceTag>;
133 
136 
140 
142 
145 
147  PlaneGeo(TGeoNode const* node, TransformationMatrix&& trans, WireCollection_t&& wires);
148 
149  TGeoVolume const* TPCVolume() const { return fNode->GetMotherVolume(); }
150 
153 
155  View_t View() const { return fView; }
156 
158  Orient_t Orientation() const { return fOrientation; }
159 
161  double ThetaZ() const;
162 
164  double PhiZ() const { return std::atan2(fSinPhiZ, fCosPhiZ); }
165 
167  double SinPhiZ() const { return fSinPhiZ; }
168 
170  double CosPhiZ() const { return fCosPhiZ; }
171 
173  PlaneID const& ID() const { return fID; }
174 
176 
179 
181 
189  Vector_t const& WidthDir() const { return fDecompFrame.MainDir(); }
191 
193 
201  Vector_t const& DepthDir() const { return fDecompFrame.SecondaryDir(); }
203 
210  double Width() const { return fFrameSize.Width(); }
211 
218  double Depth() const { return fFrameSize.Depth(); }
219 
222  BoxBoundedGeo BoundingBox() const;
223 
225 
228 
230  unsigned int Nwires() const { return fWire.size(); }
232  unsigned int NElements() const { return Nwires(); }
234 
236 
241  bool HasWire(unsigned int iwire) const { return iwire < Nwires(); }
242  bool HasElement(unsigned int iwire) const { return HasWire(iwire); }
244 
246 
254  bool HasWire(WireID const& wireid) const { return HasWire(wireid.Wire); }
255  bool HasElement(WireID const& wireid) const { return HasWire(wireid); }
257 
261  WireGeo const& Wire(unsigned int iwire) const;
262 
264 
273  WireGeo const& Wire(WireID const& wireid) const { return Wire(wireid.Wire); }
274  WireGeo const& GetElement(WireID const& wireid) const { return Wire(wireid); }
276 
282  auto WirePtr(unsigned int iwire) const { return HasWire(iwire) ? &fWire[iwire] : nullptr; }
283 
285 
293  auto WirePtr(WireID const& wireid) const { return WirePtr(wireid.Wire); }
294  auto GetElementPtr(WireID const& wireid) const { return WirePtr(wireid); }
296 
298  WireGeo const& FirstWire() const { return Wire(0); }
299 
301  WireGeo const& MiddleWire() const { return Wire(Nwires() / 2); }
302 
304  WireGeo const& LastWire() const { return Wire(Nwires() - 1); }
305 
307 
310 
312  double WirePitch() const { return fWirePitch; }
313 
323  bool WireIDincreasesWithZ() const;
324 
326 
339  Vector_t const& GetNormalDirection() const { return fNormal; }
341 
343 
352 
354 
366  Point_t const& GetCenter() const { return fCenter; }
368 
370 
380  Point_t GetBoxCenter() const { return toWorldCoords(LocalPoint_t{0.0, 0.0, 0.0}); }
382 
384 
390  Vector_t const& GetWireDirection() const { return fDecompWire.MainDir(); }
392 
394 
418  WireID NearestWireID(Point_t const& pos) const;
420 
441  WireGeo const& NearestWire(Point_t const& pos) const;
442 
457  WireID ClosestWireID(WireID::WireID_t wireNo) const; // inline
458 
468  WireID ClosestWireID(WireID const& wireid) const; // inline
469 
471 
484  double DistanceFromPlane(Point_t const& point) const
485  {
486  return fDecompWire.PointNormalComponent(point);
487  }
489 
491 
503  void DriftPoint(Point_t& position, double distance) const
504  {
505  position -= distance * GetNormalDirection();
506  }
508 
510 
518  void DriftPoint(Point_t& position) const { DriftPoint(position, DistanceFromPlane(position)); }
520 
522 
540  double InterWireProjectedDistance(WireCoordProjection_t const& projDir) const;
542 
544 
562  double InterWireDistance(Vector_t const& dir) const;
564 
566 
583  double InterWireProjectedDistance(Vector_t const& dir) const
584  {
586  }
588 
597  Rect const& ActiveArea() const { return fActiveArea; }
598 
621  template <typename Stream>
622  void PrintPlaneInfo(Stream&& out, std::string indent = "", unsigned int verbosity = 1) const;
623 
631  std::string PlaneInfo(std::string indent = "", unsigned int verbosity = 1) const;
632 
634  static constexpr unsigned int MaxVerbosity = 6;
635 
637 
645 
647 
663  double PlaneCoordinateFrom(Point_t const& point, WireGeo const& refWire) const
664  {
665  return fDecompWire.VectorSecondaryComponent(point - refWire.GetCenter());
666  }
668 
670 
684  double PlaneCoordinate(Point_t const& point) const
685  {
686  return fDecompWire.PointSecondaryComponent(point);
687  }
689 
704  double WireCoordinate(Point_t const& point) const
705  {
706  return PlaneCoordinate(point) / WirePitch();
707  }
708 
710 
724  {
725  return fDecompWire.DecomposePoint(point);
726  }
728 
730 
738 
740 
756  {
757  return fDecompWire.ProjectPointOnPlane(point);
758  }
760 
762 
774  {
776  }
778 
780 
791  {
792  return fDecompWire.ComposeVector(decomp);
793  } //@}
794 
796 
809  Vector_t ComposeVector(double distance, WireCoordProjection_t const& proj) const
810  {
811  return fDecompWire.ComposeVector(distance, proj);
812  }
814 
816 
825  {
826  return fDecompWire.ComposePoint(decomp);
827  }
829 
831 
850  Point_t ComposePoint(double distance, WireCoordProjection_t const& proj) const
851  {
852  return fDecompWire.ComposePoint(distance, proj);
853  }
855 
857 
865 
867 
881  {
882  return fDecompFrame.DecomposePoint(point);
883  }
885 
887 
898  {
899  return fDecompFrame.ProjectPointOnPlane(point);
900  }
902 
904 
915  {
917  }
919 
921 
931  bool isProjectionOnPlane(Point_t const& point) const;
933 
958  double wMargin,
959  double dMargin) const;
960 
974  double margin = 0.0) const
975  {
976  return DeltaFromPlane(proj, margin, margin);
977  }
978 
1005  double wMargin,
1006  double dMargin) const;
1007 
1022  double margin = 0.0) const
1023  {
1024  return DeltaFromActivePlane(proj, margin, margin);
1025  }
1026 
1042 
1044 
1055  Point_t MovePointOverPlane(Point_t const& point) const;
1057 
1059 
1070  {
1071  return fDecompFrame.ComposePoint(decomp);
1072  }
1074 
1076 
1093  Point_t ComposePoint(double distance, WidthDepthProjection_t const& proj) const
1094  {
1095  return fDecompFrame.ComposePoint(distance, proj);
1096  }
1098 
1100 
1102 
1110  Point_t toWorldCoords(LocalPoint_t const& local) const { return fTrans.toWorldCoords(local); }
1112 
1114  Vector_t toWorldCoords(LocalVector_t const& local) const { return fTrans.toWorldCoords(local); }
1115 
1117  LocalPoint_t toLocalCoords(Point_t const& world) const { return fTrans.toLocalCoords(world); }
1118 
1120  LocalVector_t toLocalCoords(Vector_t const& world) const { return fTrans.toLocalCoords(world); }
1121 
1123 
1126 
1128  void SetView(View_t view) { fView = view; }
1129 
1131 
1133  void SortWires(Compare<WireGeo> cmp);
1134 
1136  void UpdateAfterSorting(PlaneID planeid, BoxBoundedGeo const& TPCbox);
1137 
1139  static std::string ViewName(View_t view);
1140 
1142  static std::string OrientationName(Orient_t orientation);
1143 
1144  private:
1145  TGeoVolume const& Volume() const { return *fNode->GetVolume(); }
1146 
1148  void DetectGeometryDirections();
1149 
1151  Vector_t GetNormalAxis() const;
1152 
1154  void UpdatePlaneNormal(BoxBoundedGeo const& TPCbox);
1155 
1157  void UpdateWidthDepthDir();
1158 
1160  void UpdateIncreasingWireDir();
1161 
1163  void UpdateWireDir();
1164 
1166  void UpdateOrientation();
1167 
1169  void UpdateWirePitch();
1170 
1172  void UpdateWirePlaneCenter();
1173 
1175  void UpdatePhiZ();
1176 
1178  void UpdateView();
1179 
1181  void UpdateWirePitchSlow();
1182 
1184  void UpdateDecompWireOrigin();
1185 
1187  void UpdateActiveArea();
1188 
1190  bool shouldFlipWire(WireGeo const& wire) const;
1191 
1192  using LocalTransformation_t =
1194 
1195  struct RectSpecs {
1196  double halfWidth;
1197  double halfDepth;
1198 
1199  double HalfWidth() const { return halfWidth; }
1200  double HalfDepth() const { return halfDepth; }
1201  double Width() const { return 2.0 * HalfWidth(); }
1202  double Depth() const { return 2.0 * HalfDepth(); }
1203  }; // RectSpecs
1204 
1205  TGeoNode const* fNode;
1210  double fWirePitch{0.};
1211  double fSinPhiZ{0.};
1212  double fCosPhiZ{0.};
1213 
1224  Rect fActiveArea;
1228 
1230 
1231  // friend struct details::ActiveAreaCalculator;
1232 
1233  }; // class PlaneGeo
1234 
1235  static_assert(std::is_move_assignable_v<PlaneGeo>);
1236  static_assert(std::is_move_constructible_v<PlaneGeo>);
1237 
1238 } // namespace geo
1239 
1240 //------------------------------------------------------------------------------
1241 //--- inline implementation
1242 //---
1244 {
1245  return {ID(), std::min(wireNo, Nwires())};
1246 }
1247 
1249 {
1250  if (wireid.asPlaneID() != ID()) { return {}; }
1251  return ClosestWireID(wireid.Wire);
1252 }
1253 
1254 //------------------------------------------------------------------------------
1255 //--- template implementation
1256 //---
1257 template <typename Stream>
1259  std::string indent /* = "" */,
1260  unsigned int verbosity /* = 1 */
1261 ) const
1262 {
1263 
1264  //----------------------------------------------------------------------------
1265  out << "plane " << std::string(ID());
1266 
1267  if (verbosity-- <= 0) return; // 0
1268 
1269  //----------------------------------------------------------------------------
1270  out << " at " << GetCenter() << " cm"
1271  << ", theta: " << ThetaZ() << " rad";
1272 
1273  if (verbosity-- <= 0) return; // 1
1274 
1275  //----------------------------------------------------------------------------
1276  unsigned int const nWires = Nwires();
1277 
1278  out << "\n"
1279  << indent << "normal to wire: " << PhiZ() << " rad"
1280  << ", with orientation " << OrientationName(Orientation()) << ", has " << nWires
1281  << " wires measuring " << ViewName(View()) << " with a wire pitch of " << WirePitch()
1282  << " cm";
1283 
1284  if (verbosity-- <= 0) return; // 2
1285 
1286  //----------------------------------------------------------------------------
1287  auto const& normal = GetNormalDirection();
1288  auto const& incrZdir = GetIncreasingWireDirection();
1289  auto const& wireNormalDir = fDecompWire.NormalDir();
1290  out << "\n"
1291  << indent << "normal to plane: " << normal
1292  << ", direction of increasing wire number: " << incrZdir
1293  << " [wire frame normal: " << wireNormalDir << "]"
1294  << " (" << (WireIDincreasesWithZ() ? "increases" : "decreases") << " with z)";
1295 
1296  if (verbosity-- <= 0) return; // 3
1297 
1298  //----------------------------------------------------------------------------
1299 
1300  auto const& wireDir = GetWireDirection();
1301  auto const& widthDir = WidthDir();
1302  auto const& depthDir = DepthDir();
1303  auto const& frameNormalDir = fDecompFrame.NormalDir();
1304 
1305  out << "\n"
1306  << indent << "wire direction: " << wireDir << "; width " << Width()
1307  << " cm in direction: " << widthDir << ", depth " << Depth()
1308  << " cm in direction: " << depthDir << " [normal: " << frameNormalDir << "]";
1309 
1310  if (verbosity-- <= 0) return; // 4
1311 
1312  //----------------------------------------------------------------------------
1313  // get the area spanned by the wires
1314  out << "\n"
1315  << indent << "wires cover width " << ActiveArea().width.lower << " to "
1316  << ActiveArea().width.upper << ", depth " << ActiveArea().depth.lower << " to "
1317  << ActiveArea().depth.upper << " cm";
1318  if (verbosity-- <= 0) return; // 5
1319 
1320  //----------------------------------------------------------------------------
1321  // print also the containing box
1322  auto const box = BoundingBox();
1323  out << "\n" << indent << "bounding box: " << box.Min() << " -- " << box.Max();
1324 }
1325 
1326 //------------------------------------------------------------------------------
1327 
1328 #endif // LARCOREALG_GEOMETRY_PLANEGEO_H
1329 
WireGeo const * WirePtr
Definition: PlaneGeo.h:40
Point_t ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: Decomposer.h:605
unsigned int NElements() const
Number of wires in this plane.
Definition: PlaneGeo.h:232
WireGeo const & Wire(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:273
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:112
Vector_t GetNormalAxis() const
Returns a direction normal to the plane (pointing is not defined).
Definition: PlaneGeo.cxx:676
double HalfWidth() const
Definition: PlaneGeo.h:1199
TGeoNode const * fNode
Node within full geometry.
Definition: PlaneGeo.h:1205
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a vector.
Definition: Decomposer.h:525
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag > WidthDepthDisplacement_t
Type for vector projections in the plane frame base representation.
Definition: PlaneGeo.h:132
WidthDepthProjection_t DeltaFromPlane(WidthDepthProjection_t const &proj, double margin=0.0) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.h:973
Point_t const & GetCenter() const
Returns the world coordinate of the center of the wire [cm].
Definition: WireGeo.h:219
Point_t ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: PlaneGeo.h:824
WireCollection_t const & ElementIteratorBox
Type returned by IterateElements().
Definition: PlaneGeo.h:74
BoxBoundedGeo BoundingBox() const
Definition: PlaneGeo.cxx:370
auto PointNormalComponent(Point_t const &point) const
Returns the secondary component of a point.
Definition: Decomposer.h:476
std::string PlaneInfo(std::string indent="", unsigned int verbosity=1) const
Returns a string with plane information.
Definition: PlaneGeo.cxx:422
void UpdateIncreasingWireDir()
Updates the cached direction to increasing wires.
Definition: PlaneGeo.cxx:856
double fWirePitch
Pitch of wires in this plane.
Definition: PlaneGeo.h:1210
TGeoVolume const & Volume() const
Definition: PlaneGeo.h:1145
static std::string ViewName(View_t view)
Returns the name of the specified view.
Definition: PlaneGeo.cxx:584
void UpdateWirePitch()
Updates the stored wire pitch.
Definition: PlaneGeo.cxx:721
void UpdateWidthDepthDir()
Updates the cached depth and width direction.
Definition: PlaneGeo.cxx:842
Vector_t const & DepthDir() const
Return the direction of plane depth.
Definition: PlaneGeo.h:201
void DriftPoint(Point_t &position) const
Shifts the position along drift direction to fall on the plane.
Definition: PlaneGeo.h:518
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:160
Point_t const & GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:366
double WireCoordinate(Point_t const &point) const
Returns the coordinate of the point on the plane, in wire units.
Definition: PlaneGeo.h:704
Vector_t const & NormalDir() const
Returns the plane normal axis direction.
Definition: Decomposer.h:456
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
WireID NearestWireID(Point_t const &pos) const
Returns the ID of wire closest to the specified position.
Definition: PlaneGeo.cxx:485
Unknown view.
Definition: geo_types.h:138
enum geo::_plane_orient Orient_t
Enumerate the possible plane projections.
WireCoordProjection_t Projection(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:773
void UpdateOrientation()
Updates plane orientation.
Definition: PlaneGeo.cxx:694
void UpdateAfterSorting(PlaneID planeid, BoxBoundedGeo const &TPCbox)
Performs all needed updates after the TPC has sorted the planes.
Definition: PlaneGeo.cxx:555
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
Point_t fCenter
Center of the plane, lying on the wire plane.
Definition: PlaneGeo.h:1227
bool isProjectionOnPlane(Point_t const &point) const
Returns if the projection of specified point is within the plane.
Definition: PlaneGeo.cxx:449
Vector_t ComposeVector(DecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: Decomposer.h:646
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
auto WirePtr(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:293
Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1111
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:403
double DistanceFromPlane(Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:484
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:430
PlaneID fID
ID of this plane.
Definition: PlaneGeo.h:1229
Rect const & ActiveArea() const
Returns an area covered by the wires in the plane.
Definition: PlaneGeo.h:597
WidthDepthProjection_t VectorWidthDepthProjection(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:914
Vector_t fNormal
Definition: PlaneGeo.h:1214
Vector_t ComposeVector(WireDecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: PlaneGeo.h:790
double Depth() const
Definition: PlaneGeo.h:1202
void UpdatePlaneNormal(BoxBoundedGeo const &TPCbox)
Updates the cached normal to plane versor; needs the TPC box coordinates.
Definition: PlaneGeo.cxx:826
WidthDepthProjection_t MoveProjectionToPlane(WidthDepthProjection_t const &proj) const
Returns the projection, moved onto the plane if necessary.
Definition: PlaneGeo.cxx:456
View_t fView
Does this plane measure U, V, or W?
Definition: PlaneGeo.h:1207
LocalVector_t toLocalCoords(Vector_t const &world) const
Transform direction vector from world to local.
Definition: PlaneGeo.h:1120
void DetectGeometryDirections()
Sets the geometry directions.
Definition: PlaneGeo.cxx:609
WireGeo const & NearestWire(Point_t const &pos) const
Returns the wire closest to the specified position.
Definition: PlaneGeo.cxx:514
double InterWireProjectedDistance(WireCoordProjection_t const &projDir) const
Returns the distance between wires along the specified direction.
Definition: PlaneGeo.cxx:531
Rect fActiveArea
Area covered by wires in frame base.
Definition: PlaneGeo.h:1225
void DriftPoint(Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:503
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
double ThetaZ() const
Angle of the wires from positive z axis; .
Definition: PlaneGeo.cxx:549
Projection_t ProjectPointOnPlane(Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: Decomposer.h:492
Interface to algorithm class for sorting geo::AuxDet objects .
double PlaneCoordinateFrom(Point_t const &point, WireGeo const &refWire) const
Returns the coordinate of point on the plane respect to a wire.
Definition: PlaneGeo.h:663
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:155
double PlaneCoordinate(Point_t const &point) const
Returns the coordinate of the point on the plane.
Definition: PlaneGeo.h:684
Point_t GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:380
double InterWireDistance(Vector_t const &dir) const
Returns the distance between wires along the specified direction.
Definition: PlaneGeo.cxx:538
WireGeo const & MiddleWire() const
Return the middle wire in the plane.
Definition: PlaneGeo.h:301
Classes to project and compose a vector on a plane.
WidthDepthDecomposer_t::DecomposedVector_t WDDecomposedVector_t
Definition: PlaneGeo.h:139
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1222
std::function< bool(T const &, T const &)> Compare
Definition: fwd.h:22
Local-to-world transformations with LArSoft geometry vectors.
void UpdatePhiZ()
Updates the stored .
Definition: PlaneGeo.cxx:733
double PhiZ() const
Angle from positive z axis of the wire coordinate axis, in radians.
Definition: PlaneGeo.h:164
Planes that are in the vertical plane (e.g. ArgoNeuT).
Definition: geo_types.h:143
TGeoVolume const * TPCVolume() const
Definition: PlaneGeo.h:149
Tag for vectors in the "local" GDML coordinate frame of the plane.
Definition: PlaneGeo.h:91
Vector_t const & GetWireDirection() const
Returns the direction of the wires.
Definition: PlaneGeo.h:390
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1209
WireGeo const & GetElement(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:274
double Depth() const
Return the depth of the plane.
Definition: PlaneGeo.h:218
std::string indent(std::size_t const i)
double fSinPhiZ
Sine of .
Definition: PlaneGeo.h:1211
WidthDepthProjection_t PointWidthDepthProjection(Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:897
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:67
double Width() const
Return the width of the plane.
Definition: PlaneGeo.h:210
Utilities to extend the interface of geometry vectors.This library provides facilities that can be us...
std::vector< WireGeo > WireCollection_t
Definition: PlaneGeo.h:70
WireGeo const & FirstWire() const
Return the first wire in the plane.
Definition: PlaneGeo.h:298
DecomposedVector_t DecomposePoint(Point_t const &point) const
Decomposes a 3D point in two components.
Definition: Decomposer.h:511
void SortWires(Compare< WireGeo > cmp)
Apply sorting to WireGeo objects.
Definition: PlaneGeo.cxx:410
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WireCoordinateReferenceTag > WireCoordProjection_t
Type for projections in the wire base representation.
Definition: PlaneGeo.h:109
Vector_t ComposeVector(double distance, WireCoordProjection_t const &proj) const
Returns the 3D vector from composition of projection and distance.
Definition: PlaneGeo.h:809
Range_t width
Range along width direction.
Definition: SimpleGeo.h:428
double CosPhiZ() const
Cosine of PhiZ()
Definition: PlaneGeo.h:170
void UpdateWirePitchSlow()
Updates the stored wire pitch with a slower, more robust algorithm.
Definition: PlaneGeo.cxx:890
bool HasElement(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:242
RectSpecs fFrameSize
Definition: PlaneGeo.h:1223
double SinPhiZ() const
Sine of PhiZ()
Definition: PlaneGeo.h:167
void SetView(View_t view)
Set the signal view (for TPCGeo).
Definition: PlaneGeo.h:1128
std::vector< TGeoNode const * > GeoNodePath_t
Definition: PlaneGeo.h:71
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1206
Definition of data types for geometry description.
Point_t ReferencePoint() const
Returns the reference point for the plane coordinate, as a 3D point.
Definition: Decomposer.h:444
void UpdateView()
Updates the stored view.
Definition: PlaneGeo.cxx:740
Provides a base class aware of world box coordinates.
static std::string OrientationName(Orient_t orientation)
Returns the name of the specified orientation.
Definition: PlaneGeo.cxx:599
auto GetElementPtr(WireID const &wireid) const
Returns the wire in wireid from this plane.
Definition: PlaneGeo.h:294
typename PlaneDecomposer_t::DecomposedVector_t DecomposedVector_t
Type representing a decomposition on the plane.
Definition: Decomposer.h:406
PlaneGeo(TGeoNode const *node, TransformationMatrix &&trans, WireCollection_t &&wires)
Construct a representation of a single plane of the detector.
Definition: PlaneGeo.cxx:353
double HalfDepth() const
Definition: PlaneGeo.h:1200
Orient_t Orientation() const
What is the orientation of the plane.
Definition: PlaneGeo.h:158
Encapsulate the geometry of a wire .
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag > WidthDepthProjection_t
Definition: PlaneGeo.h:128
Vector_t toWorldCoords(LocalVector_t const &local) const
Transform direction vector from local to world.
Definition: PlaneGeo.h:1114
Point_t ComposePoint(double distance, WireCoordProjection_t const &proj) const
Returns the 3D point from composition of projection and distance.
Definition: PlaneGeo.h:850
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:180
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:429
Tag for plane frame base vectors.
Definition: PlaneGeo.h:123
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:453
WidthDepthProjection_t DeltaFromPlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:431
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:450
WidthDepthProjection_t DeltaFromActivePlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:440
WireID ClosestWireID(WireID::WireID_t wireNo) const
Returns the closest valid wire ID to the specified wire.
Definition: PlaneGeo.h:1243
Selection of the type of transformation matrix used in geometry.
Vector3DBase_t< PlaneGeoCoordinatesTag > LocalVector_t
Type of displacement vectors in the local GDML wire plane frame.
Definition: PlaneGeo.h:97
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:31
auto PointSecondaryComponent(Point_t const &point) const
Returns the secondary component of a point.
Definition: Decomposer.h:470
Projection_t ProjectVectorOnPlane(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: Decomposer.h:544
double InterWireProjectedDistance(Vector_t const &dir) const
Returns the distance between wires along the specified direction.
Definition: PlaneGeo.h:583
bool HasWire(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:241
void PrintPlaneInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this plane.
Definition: PlaneGeo.h:1258
bool HasWire(WireID const &wireid) const
Returns whether the wire in wireid is present in this plane.
Definition: PlaneGeo.h:254
TDirectory * dir
Definition: macro.C:5
auto WirePtr(unsigned int iwire) const
Returns the wire number iwire from this plane.
Definition: PlaneGeo.h:282
Point_t ComposePoint(WDDecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: PlaneGeo.h:1069
LocalPoint_t toLocalCoords(Point_t const &world) const
Transform point from world frame to local plane frame.
Definition: PlaneGeo.h:1117
Vector_t const & WidthDir() const
Return the direction of plane width.
Definition: PlaneGeo.h:189
WireGeo const & LastWire() const
Return the last wire in the plane.
Definition: PlaneGeo.h:304
Float_t proj
Definition: plot.C:35
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:231
bool WireIDincreasesWithZ() const
Returns whether the higher z wires have higher wire ID.
Definition: PlaneGeo.cxx:416
Some simple functions to represent geometry entitiesThis library is simple and header-only.
WireDecomposer_t::DecomposedVector_t WireDecomposedVector_t
Type describing a 3D point or vector decomposed on a plane on wire base.
Definition: PlaneGeo.h:115
double fCosPhiZ
Cosine of .
Definition: PlaneGeo.h:1212
Data_t upper
Ending coordinate.
Definition: SimpleGeo.h:358
Vector_t const & GetIncreasingWireDirection() const
Returns the direction of increasing wires.
Definition: PlaneGeo.h:350
Vector_t const & GetNormalDirection() const
Returns the direction normal to the plane.
Definition: PlaneGeo.h:339
GenPoint3DBase_t< double, C > Point3DBase_t
Type of 3D point with representation in double precision.
Definition: geo_vectors.h:88
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:422
void UpdateWirePlaneCenter()
Updates the stored wire plane center.
Definition: PlaneGeo.cxx:928
bool shouldFlipWire(WireGeo const &wire) const
Whether the specified wire should have start and end swapped.
Definition: PlaneGeo.cxx:953
GenVector3DBase_t< double, C > Vector3DBase_t
Definition: geo_vectors.h:83
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1218
WireCoordProjection_t Projection(Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:755
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
WireDecomposedVector_t DecomposePoint(Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:723
double Width() const
Definition: PlaneGeo.h:1201
bool HasElement(WireID const &wireid) const
Returns whether the wire in wireid is present in this plane.
Definition: PlaneGeo.h:255
void UpdateDecompWireOrigin()
Updates the position of the wire coordinate decomposition.
Definition: PlaneGeo.cxx:909
Point_t ProjectionReferencePoint() const
Returns the reference point used by PointProjection().
Definition: PlaneGeo.h:736
void UpdateActiveArea()
Updates the internally used active area.
Definition: PlaneGeo.cxx:916
Point_t MovePointOverPlane(Point_t const &point) const
Returns the point, moved so that its projection is over the plane.
Definition: PlaneGeo.cxx:475
WDDecomposedVector_t DecomposePointWidthDepth(Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:880
Data_t lower
Starting coordinate.
Definition: SimpleGeo.h:357
static constexpr unsigned int MaxVerbosity
Maximum value for print verbosity.
Definition: PlaneGeo.h:634
ROOT libraries.
Point3DBase_t< PlaneGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
Definition: PlaneGeo.h:94
PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:173
Orient_t fOrientation
Is the plane vertical or horizontal?
Definition: PlaneGeo.h:1208
void UpdateWireDir()
Updates the cached direction to wire.
Definition: PlaneGeo.cxx:880
Point_t ComposePoint(double distance, WidthDepthProjection_t const &proj) const
Returns the 3D point from composition of projection and distance.
Definition: PlaneGeo.h:1093
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:312
WidthDepthProjection_t DeltaFromActivePlane(WidthDepthProjection_t const &proj, double margin=0.0) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.h:1021
Tag for wire base vectors.
Definition: PlaneGeo.h:105
constexpr PlaneID const & asPlaneID() const
Conversion to WireID (for convenience of notation).
Definition: geo_types.h:466