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