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