LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TPCGeo.cxx
Go to the documentation of this file.
1 
7 // class header
9 
10 // LArSoft includes
14 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect::fillCoords()
15 
16 // Framework includes
17 #include "cetlib/container_algorithms.h"
18 #include "cetlib_except/exception.h"
20 
21 // ROOT includes
22 #include "TGeoBBox.h"
23 #include "TGeoMatrix.h"
24 #include "TGeoNode.h"
25 
26 // C/C++ standard libraries
27 #include <algorithm> // std::max(), std::copy()
28 #include <cassert>
29 #include <cmath>
30 #include <functional> // std::mem_fn()
31 #include <iterator> // std::inserter()
32 #include <map>
33 #include <sstream> // std::ostringstream
34 
35 namespace geo {
36 
37  //......................................................................
38  TPCGeo::TPCGeo(TGeoNode const& node,
40  PlaneCollection_t&& planes)
41  : BoxBoundedGeo() // we initialize boundaries at the end of construction
42  , fTrans(std::move(trans))
43  , fPlanes(std::move(planes))
44  , fActiveVolume(0)
45  , fTotalVolume(0)
46  , fDriftDirection(geo::kUnknownDrift)
47  , fWidthDir(geo::Xaxis())
48  , fHeightDir(geo::Yaxis())
49  , fLengthDir(geo::Zaxis())
50  , fDriftDir() // null until known
51  {
52 
53  // all planes are going to be contained in the volume named volTPC
54  // now get the total volume of the TPC
55  TGeoVolume* vc = node.GetVolume();
56  if (!vc) {
57  throw cet::exception("Geometry")
58  << "cannot find detector outline volume - bail ungracefully\n";
59  }
60 
61  fTotalVolume = vc;
62 
63  // loop over the daughters of this node and look for the active volume
64  int nd = vc->GetNdaughters();
65  TGeoNode const* pActiveVolNode = nullptr;
66  for (int i = 0; i < nd; ++i) {
67  if (strncmp(vc->GetNode(i)->GetName(), "volTPCActive", 12) != 0) continue;
68 
69  pActiveVolNode = vc->GetNode(i);
70  TGeoVolume* vca = pActiveVolNode->GetVolume();
71  if (vca) fActiveVolume = vca;
72  break;
73 
74  } // end loop over daughters of the volume
75 
77 
78  MF_LOG_DEBUG("Geometry") << "detector total volume is " << fTotalVolume->GetName()
79  << "\ndetector active volume is " << fActiveVolume->GetName();
80 
81  // compute the active volume transformation too
82  auto ActiveHMatrix(fTrans.Matrix());
83  if (pActiveVolNode) {
84  ActiveHMatrix *= geo::makeTransformationMatrix(*(pActiveVolNode->GetMatrix()));
85  }
86  // we don't keep the active volume information... just store its center:
88 
89  // set the width, height, and lengths
90  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
91  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
92  fActiveLength = 2.0 * ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
93 
94  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
95  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
96  fLength = 2.0 * ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
97 
98  // check that the rotation matrix to the world is the identity, if not
99  // we need to change the width, height and length values;
100  // the correspondence of these to x, y and z are not guaranteed to be
101  // trivial, so we store the two independently (cartesian dimensions in the
102  // bounding boxes, the sizes in data members directly);
103  // TODO: there must be a more general way to do this...
104  double Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz;
105  fTrans.Matrix().Rotation().GetComponents(Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz);
106  if (Rxx != 1) {
107  if (std::abs(Rxz) == 1) {
108  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
109  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
110  fWidthDir = Zaxis();
111  }
112  if (std::abs(Rxy) == 1) {
113  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
114  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
115  fWidthDir = Yaxis();
116  }
117  }
118  if (Ryy != 1) {
119  if (std::abs(Rxy) == 1) {
120  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
121  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
122  fHeightDir = Xaxis();
123  }
124  if (std::abs(Rzy) == 1) {
125  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
126  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
127  fHeightDir = Zaxis();
128  }
129  }
130  if (Rzz != 1) {
131  if (std::abs(Rzx) == 1) {
132  fActiveLength = 2. * ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
133  fLength = 2. * ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
134  fLengthDir = Xaxis();
135  }
136  if (std::abs(Ryz) == 1) {
137  fActiveLength = 2. * ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
138  fLength = 2. * ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
139  fLengthDir = Yaxis();
140  }
141  }
142 
145 
146  } // TPCGeo::TPCGeo()
147 
148  //......................................................................
150  {
151 
152  //
153  // 1. determine the drift axis
154  // 2. determine the drift direction on it
155  //
156  // We assume that all the planes cover most of the TPC face; therefore,
157  // the centre of the plane and the one of the TPC should be very close
158  // to each other, when projected on the same drift plane.
159  // Here we find which is the largest coordinate difference.
160 
161  if (Nplanes() == 0) {
162  // chances are that we get this because stuff is not initialised yet,
163  // and then even the ID might be wrong
164  throw cet::exception("TPCGeo")
165  << "DetectDriftDirection(): no planes in TPC " << std::string(ID()) << "\n";
166  }
167 
168  auto const TPCcenter = GetCenter();
169  auto const PlaneCenter = Plane(0).GetBoxCenter(); // any will do
170 
171  auto const driftVector = PlaneCenter - TPCcenter; // approximation!
172 
173  if ((std::abs(driftVector.X()) > std::abs(driftVector.Y())) &&
174  (std::abs(driftVector.X()) > std::abs(driftVector.Z()))) {
175  // x is the solution
176  return (driftVector.X() > 0) ? +1 : -1;
177  }
178  else if (std::abs(driftVector.Y()) > std::abs(driftVector.Z())) {
179  // y is the man
180  return (driftVector.Y() > 0) ? +2 : -2;
181  }
182  else {
183  // z is the winner
184  return (driftVector.Z() > 0) ? +3 : -3;
185  }
186 
187  } // TPCGeo::DetectDriftDirection()
188 
189  //......................................................................
190  // sort the PlaneGeo objects and the WireGeo objects inside
192  {
194 
195  // the PlaneID_t cast convert InvalidID into a rvalue (non-reference);
196  // leaving it a reference would cause C++ to treat it as such,
197  // that can't be because InvalidID is a static member constant without an address
198  // (it is not defined in any translation unit, just declared in header)
199  fViewToPlaneNumber.resize(1U + (size_t)geo::kUnknown,
201  for (size_t p = 0; p < this->Nplanes(); ++p)
202  fViewToPlaneNumber[(size_t)fPlanes[p].View()] = p;
203 
204  for (size_t p = 0; p < fPlanes.size(); ++p)
205  fPlanes[p].SortWires(sorter);
206  }
207 
208  //......................................................................
210  {
211 
212  // reset the ID
213  fID = tpcid;
214 
215  // ask the planes to update; also check
216 
217  for (unsigned int plane = 0; plane < Nplanes(); ++plane) {
218  fPlanes[plane].UpdateAfterSorting(geo::PlaneID(fID, plane), *this);
219 
220  // check that the plane normal is opposite to the TPC drift direction
221  assert(lar::util::makeVector3DComparison(1e-5).equal(-(fPlanes[plane].GetNormalDirection()),
222  DriftDir()));
223 
224  } // for
225 
228 
229  } // TPCGeo::UpdateAfterSorting()
230 
231  //......................................................................
232  std::string TPCGeo::TPCInfo(std::string indent /* = "" */, unsigned int verbosity /* = 1 */) const
233  {
234  std::ostringstream sstr;
235  PrintTPCInfo(sstr, indent, verbosity);
236  return sstr.str();
237  } // TPCGeo::TPCInfo()
238 
239  //......................................................................
240  const PlaneGeo& TPCGeo::Plane(unsigned int iplane) const
241  {
242  geo::PlaneGeo const* pPlane = PlanePtr(iplane);
243  if (!pPlane) {
244  throw cet::exception("PlaneOutOfRange")
245  << "Request for non-existant plane " << iplane << "\n";
246  }
247 
248  return *pPlane;
249  }
250 
251  //......................................................................
252  const PlaneGeo& TPCGeo::Plane(geo::View_t view) const
253  {
254  geo::PlaneID::PlaneID_t const p = fViewToPlaneNumber[size_t(view)];
255  if (p == geo::PlaneID::InvalidID) {
256  throw cet::exception("TPCGeo")
257  << "TPCGeo[" << ((void*)this) << "]::Plane(): no plane for view #" << (size_t)view << "\n";
258  }
259  return fPlanes[p];
260  } // TPCGeo::Plane(geo::View_t)
261 
262  //......................................................................
264  {
265 
266  //
267  // Returns the plane with the smallest width x depth. No nonsense here.
268  //
269 
270  auto iPlane = fPlanes.begin(), pend = fPlanes.end();
271  auto smallestPlane = iPlane;
272  double smallestSurface = smallestPlane->Width() * smallestPlane->Depth();
273  while (++iPlane != pend) {
274  double const surface = iPlane->Width() * iPlane->Depth();
275  if (surface > smallestSurface) continue;
276  smallestSurface = surface;
277  smallestPlane = iPlane;
278  } // while
279  return *smallestPlane;
280 
281  } // TPCGeo::SmallestPlane()
282 
283  //......................................................................
284  unsigned int TPCGeo::MaxWires() const
285  {
286  unsigned int maxWires = 0;
287  for (geo::PlaneGeo const& plane : fPlanes) {
288  unsigned int maxWiresInPlane = plane.Nwires();
289  if (maxWiresInPlane > maxWires) maxWires = maxWiresInPlane;
290  } // for
291  return maxWires;
292  } // TPCGeo::MaxWires()
293 
294  //......................................................................
296  {
297  return fPlanes;
298  }
299 
300  //......................................................................
301  std::set<geo::View_t> TPCGeo::Views() const
302  {
303  std::set<geo::View_t> views;
304  std::transform(fPlanes.cbegin(),
305  fPlanes.cend(),
306  std::inserter(views, views.begin()),
307  std::mem_fn(&geo::PlaneGeo::View));
308  return views;
309  } // TPCGeo::Views()
310 
311  //......................................................................
312  // returns distance between plane 0 to each of the remaining planes
313  // not the distance between two consecutive planes
314  double TPCGeo::Plane0Pitch(unsigned int p) const
315  {
316  return fPlane0Pitch[p];
317  }
318 
319  //......................................................................
321  {
322 
323  //
324  // 1. find the center of the face of the TPC opposite to the anode
325  // 2. compute the distance of it from the last wire plane
326  //
327 
328  //
329  // find the cathode center
330  //
331  geo::Point_t cathodeCenter = GetActiveVolumeCenter();
332  switch (DetectDriftDirection()) {
333  case -1:
334  geo::vect::Xcoord(cathodeCenter) += ActiveHalfWidth();
335  // cathodeCenter.SetX(cathodeCenter.X() + ActiveHalfWidth());
336  break;
337  case +1: cathodeCenter.SetX(cathodeCenter.X() - ActiveHalfWidth()); break;
338  case -2: cathodeCenter.SetY(cathodeCenter.Y() + ActiveHalfHeight()); break;
339  case +2: cathodeCenter.SetY(cathodeCenter.Y() - ActiveHalfHeight()); break;
340  case -3: cathodeCenter.SetZ(cathodeCenter.Z() + ActiveLength() / 2.0); break;
341  case +3: cathodeCenter.SetZ(cathodeCenter.Z() - ActiveLength() / 2.0); break;
342  case 0:
343  default:
344  // in this case, a better algorithm is probably needed
345  throw cet::exception("TPCGeo")
346  << "CathodeCenter(): Can't determine the cathode plane (code=" << DetectDriftDirection()
347  << ")\n";
348  } // switch
349  return cathodeCenter;
350 
351  } // TPCGeo::GetCathodeCenterImpl()
352 
353  //......................................................................
355  {
356  auto const& activeBox = ActiveBoundingBox();
357  return {activeBox.CenterX(), activeBox.CenterY(), activeBox.MinZ()};
358  } // TPCGeo::GetFrontFaceCenterImpl()
359 
360  //......................................................................
361  double TPCGeo::PlanePitch(unsigned int p1, unsigned int p2) const
362  {
363  return std::abs(fPlane0Pitch[p2] - fPlane0Pitch[p1]);
364  }
365 
366  //......................................................................
367  // This method returns the distance between wires in the given plane.
368  double TPCGeo::WirePitch(unsigned plane) const
369  {
370  return this->Plane(plane).WirePitch();
371  }
372 
373  //......................................................................
375  {
376 
377  auto const driftDirCode = DetectDriftDirection();
378  switch (driftDirCode) {
379  case +1:
380  fDriftDirection = geo::kPosX; // this is the same as kPos!
381  fDriftDir = geo::Xaxis();
382  break;
383  case -1:
384  fDriftDirection = geo::kNegX; // this is the same as kNeg!
385  fDriftDir = -geo::Xaxis();
386  break;
387  case +2:
388  fDriftDir = geo::Yaxis();
390  break;
391  case -2:
392  fDriftDir = -geo::Yaxis();
394  break;
395  case +3:
396  fDriftDir = geo::Zaxis();
398  break;
399  case -3:
400  fDriftDir = -geo::Zaxis();
402  break;
403  default:
404  // TPC ID is likely not yet set
406 
407  // we estimate the drift direction roughly from the geometry
409 
410  mf::LogError("TPCGeo") << "Unable to detect drift direction (result: " << driftDirCode
411  << ", drift: ( " << fDriftDir.X() << " ; " << fDriftDir.Y() << " ; "
412  << fDriftDir.Z() << " )";
413  break;
414  } // switch
415 
417 
418  } // TPCGeo::ResetDriftDirection()
419 
420  //......................................................................
422  {
423 
424  //
425  // 1. find the center of the face of the TPC opposite to the anode
426  // 2. compute the distance of it from the last wire plane
427  //
428 
429  geo::PlaneGeo const& plane = fPlanes.back();
431 
432  } // TPCGeo::ComputeDriftDistance()
433 
434  //......................................................................
436  {
437  // note that this assumes no rotations of the TPC
438  // (except for rotations of a flat angle around one of the three main axes);
439  // to avoid this, we should transform the six vertices
440  // rather than just the centre
441 
442  // we rely on the asumption that the center of TPC is at the local origin
445 
446  // the center of the active volume may be elsewhere than the local origin:
447  auto const& activeCenter = GetActiveVolumeCenter();
448  fActiveBox.SetBoundaries(activeCenter.X() - ActiveHalfWidth(),
449  activeCenter.X() + ActiveHalfWidth(),
450  activeCenter.Y() - ActiveHalfHeight(),
451  activeCenter.Y() + ActiveHalfHeight(),
452  activeCenter.Z() - ActiveHalfLength(),
453  activeCenter.Z() + ActiveHalfLength());
454 
455  } // CryostatGeo::InitTPCBoundaries()
456 
457  //......................................................................
458 
460  {
461 
462  // the PlaneID_t cast convert InvalidID into a rvalue (non-reference);
463  // leaving it a reference would cause C++ to treat it as such,
464  // that can't be because InvalidID is a static member constant without an address
465  // (it is not defined in any translation unit, just declared in header)
466  fViewToPlaneNumber.clear();
467  fViewToPlaneNumber.resize(1U + (size_t)geo::kUnknown,
469  for (size_t p = 0; p < Nplanes(); ++p)
470  fViewToPlaneNumber[(size_t)fPlanes[p].View()] = p;
471 
472  } // TPCGeo::UpdatePlaneViewCache()
473 
474  //......................................................................
475 
477  {
478 
479  /*
480  * set the plane pitch for this TPC
481  */
482  fPlaneLocation.resize(fPlanes.size());
483  fPlane0Pitch.resize(Nplanes(), 0.);
484  geo::Point_t refPlaneCenter = fPlanes[0].GetCenter();
485  for (size_t p = 0; p < Nplanes(); ++p) {
486  geo::Point_t const& center = fPlanes[p].GetCenter();
487  fPlane0Pitch[p] =
488  (p == 0) ? 0.0 : fPlane0Pitch[p - 1] + std::abs(center.X() - refPlaneCenter.X());
489  fPlaneLocation[p].resize(3);
491  refPlaneCenter = center;
492  } // for planes
493 
494  } // TPCGeo::UpdatePlaneViewCache()
495 
496  //......................................................................
497  void TPCGeo::SortPlanes(std::vector<geo::PlaneGeo>& planes) const
498  {
499  //
500  // Sort planes by increasing drift distance.
501  //
502  // This function should work in bootstrap mode, relying on least things as
503  // possible. Therefore we compute here a proxy of the drift axis.
504  //
505 
506  //
507  // determine the drift axis (or close to): from TPC center to plane center
508  //
509 
510  // Instead of using the plane center, which might be not available yet,
511  // we use the plane box center, which only needs the geometry description
512  // to be available.
513  // We use the first plane -- it does not make any difference.
514  auto const TPCcenter = GetCenter();
515  auto const driftAxis = geo::vect::normalize(planes[0].GetBoxCenter() - TPCcenter);
516 
517  auto by_distance = [&TPCcenter, &driftAxis](auto const& a, auto const& b) {
518  return geo::vect::dot(a.GetBoxCenter() - TPCcenter, driftAxis) <
519  geo::vect::dot(b.GetBoxCenter() - TPCcenter, driftAxis);
520  };
521  cet::sort_all(planes, by_distance);
522 
523  } // TPCGeo::SortPlanes()
524 
525  //......................................................................
526 
527 }
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:270
void InitTPCBoundaries()
Recomputes the TPC boundary.
Definition: TPCGeo.cxx:435
geo::Point_t GetCathodeCenterImpl() const
Definition: TPCGeo.cxx:320
void round01(Vector &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
Point_t GetCathodeCenter() const
Definition: TPCGeo.h:254
geo::BoxBoundedGeo fActiveBox
Box of the active volume.
Definition: TPCGeo.h:620
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:604
double PlanePitch(unsigned int p1=0, unsigned int p2=1) const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.cxx:361
void UpdatePlaneCache()
Updates plane cached information.
Definition: TPCGeo.cxx:476
void PrintTPCInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this TPC.
Definition: TPCGeo.h:656
Drift direction is unknown.
Definition: geo_types.h:163
std::vector< geo::PlaneGeo > PlaneCollection_t
Definition: TPCGeo.h:39
double fLength
Length of total volume.
Definition: TPCGeo.h:613
geo::Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:64
double ComputeDriftDistance() const
Definition: TPCGeo.cxx:421
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:88
Drift towards positive values.
Definition: geo_types.h:164
Unknown view.
Definition: geo_types.h:142
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
double fActiveHalfWidth
Half width of active volume.
Definition: TPCGeo.h:608
TransformationMatrix_t const & Matrix() const
Direct access to the transformation matrix.
geo::Point_t GetFrontFaceCenterImpl() const
Definition: TPCGeo.cxx:354
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:464
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
constexpr Vector Yaxis()
Returns a y axis vector of the specified type.
Definition: geo_vectors.h:215
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
constexpr auto abs(T v)
Returns the absolute value of the argument.
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:263
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:625
STL namespace.
double HalfLength() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:106
void UpdateAfterSorting(geo::TPCID tpcid)
Performs all updates after cryostat has sorted TPCs.
Definition: TPCGeo.cxx:209
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Drift towards negative X values.
Definition: geo_types.h:167
void SortSubVolumes(geo::GeoObjectSorter const &sorter)
Apply sorting to the PlaneGeo objects.
Definition: TPCGeo.cxx:191
geo::Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:616
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:482
geo::TPCID fID
ID of this TPC.
Definition: TPCGeo.h:622
Class for approximate comparisons.
unsigned int fillCoords(Coords &dest, Vector const &src)
Fills a coordinate array with the coordinates of a vector.
TPCGeo(TGeoNode const &node, geo::TransformationMatrix &&trans, PlaneCollection_t &&planes)
Definition: TPCGeo.cxx:38
Point_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:247
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:166
geo::Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:615
double ActiveHalfLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:94
Point_t GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:449
double fHalfWidth
Half width of total volume.
Definition: TPCGeo.h:611
auto makeVector3DComparison(RealType threshold)
Creates a Vector3DComparison from a RealComparisons object.
geo::PlaneGeo const & SmallestPlane() const
Returns the wire plane with the smallest surface.
Definition: TPCGeo.cxx:263
double fActiveLength
Length of active volume.
Definition: TPCGeo.h:610
PlaneCollection_t const & ElementIteratorBox
Type returned by IterateElements().
Definition: TPCGeo.h:43
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:84
ElementIteratorBox IterateElements() const
Returns an object for iterating through all geo::PlaneGeo.
Definition: TPCGeo.cxx:295
std::string indent(std::size_t const i)
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
Utilities to extend the interface of geometry vectors.
void UpdatePlaneViewCache()
Refills the plane vs. view cache of the TPC.
Definition: TPCGeo.cxx:459
constexpr Vector Xaxis()
Returns a x axis vector of the specified type.
Definition: geo_vectors.h:208
decltype(auto) makeTransformationMatrix(Trans &&trans)
Converts a transformation matrix into a geo::TransformationMatrix.
TGeoVolume * fTotalVolume
Total volume of TPC, called volTPC in GDML file.
Definition: TPCGeo.h:602
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:603
double WirePitch(unsigned plane=0) const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.cxx:368
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
constexpr auto dot(Vector const &a, OtherVector const &b)
Return cross product of two vectors.
unsigned int MaxWires() const
Returns the largest number of wires among the planes in this TPC.
Definition: TPCGeo.cxx:284
double Plane0Pitch(unsigned int p) const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.cxx:314
void SortPlanes(std::vector< geo::PlaneGeo > &) const
Sorts (in place) the specified PlaneGeo objects by drift distance.
Definition: TPCGeo.cxx:497
std::vector< std::vector< double > > fPlaneLocation
xyz locations of planes in the TPC.
Definition: TPCGeo.h:605
Point_t GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:250
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:92
Encapsulate the geometry of a wire.
auto Xcoord(Vector &v)
Returns an object to manage the coordinate X of the vector v.
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:100
constexpr Vector Zaxis()
Returns a z axis vector of the specified type.
Definition: geo_vectors.h:222
std::string TPCInfo(std::string indent="", unsigned int verbosity=1) const
Returns a string with information about this TPC.
Definition: TPCGeo.cxx:232
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
TGeoVolume * fActiveVolume
Active volume of LAr, called volTPCActive in GDML file.
Definition: TPCGeo.h:601
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
Drift towards positive X values.
Definition: geo_types.h:166
Encapsulate the construction of a single detector plane.
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:558
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:190
void SetBoundaries(Coord_t x_min, Coord_t x_max, Coord_t y_min, Coord_t y_max, Coord_t z_min, Coord_t z_max)
Sets the boundaries in world coordinates as specified.
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:149
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:42
geo::Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:617
#define MF_LOG_DEBUG(id)
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:598
void ResetDriftDirection()
Recomputes the drift direction; needs planes to have been initialised.
Definition: TPCGeo.cxx:374
Drift towards negative values.
Definition: geo_types.h:165
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:618
std::set< geo::View_t > Views() const
Returns a set of all views covered in this TPC.
Definition: TPCGeo.cxx:301
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:252
static constexpr PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:479
Vector normalize(Vector const &v)
Returns a vector parallel to v and with norm 1.
Float_t e
Definition: plot.C:35
Vector_t DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:124
Namespace collecting geometry-related classes utilities.
geo::Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
Definition: TPCGeo.h:606
double fHalfHeight
Half height of total volume.
Definition: TPCGeo.h:612
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:96
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:378
Encapsulate the construction of a single detector plane.
double fActiveHalfHeight
Half height of active volume.
Definition: TPCGeo.h:609