All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
icarus::TPCGeoUtil Namespace Reference

Functions

int DetectedInTPC (std::vector< art::Ptr< recob::Hit >> hits)
 
std::pair< double, double > XLimitsFromHits (const geo::GeometryCore *GeometryService, std::vector< art::Ptr< recob::Hit >> hits)
 
int DriftDirectionFromHits (const geo::GeometryCore *GeometryService, std::vector< art::Ptr< recob::Hit >> hits)
 
bool InsideTPC (geo::Point_t point, const geo::TPCGeo &tpc, double buffer)
 

Function Documentation

int icarus::TPCGeoUtil::DetectedInTPC ( std::vector< art::Ptr< recob::Hit >>  hits)

Definition at line 5 of file icaruscode/icaruscode/CRT/CRTUtils/TPCGeoUtil.cc.

5  {
6  // Return tpc of hit collection or -1 if in multiple
7  if(hits.size() == 0) return -1;
8  int tpc = hits[0]->WireID().TPC;
9  for(size_t i = 0; i < hits.size(); i++){
10  if((int)hits[i]->WireID().TPC != tpc) return -1;
11  }
12  return tpc;
13  }
int icarus::TPCGeoUtil::DriftDirectionFromHits ( const geo::GeometryCore GeometryService,
std::vector< art::Ptr< recob::Hit >>  hits 
)

Definition at line 28 of file icaruscode/icaruscode/CRT/CRTUtils/TPCGeoUtil.cc.

28  {
29  // If there are no hits then return 0
30  if(hits.size() == 0) return 0;
31 
32  // If the track is stitched (in multiple TPCs) return 0
33  if(DetectedInTPC(hits) == -1) return 0;
34 
35  // Work out the drift direction
36  geo::TPCID tpcID = hits[0]->WireID().asTPCID();
37  const geo::TPCGeo& tpcGeo = GeometryService->GetElement(tpcID);
38  double driftDirection = tpcGeo.DetectDriftDirection();
39  if(std::abs(driftDirection) != 1) driftDirection = 0;
40  return driftDirection;
41  }
CryostatGeo const & GetElement(geo::CryostatID const &cryoid) const
Geometry information for a single TPC.
Definition: TPCGeo.h:38
int DetectedInTPC(std::vector< art::Ptr< recob::Hit >> hits)
T abs(T value)
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:157
bool icarus::TPCGeoUtil::InsideTPC ( geo::Point_t  point,
const geo::TPCGeo tpc,
double  buffer 
)

Definition at line 44 of file icaruscode/icaruscode/CRT/CRTUtils/TPCGeoUtil.cc.

44  {
45  if(point.X() < (tpc.MinX()-buffer) || point.X() > (tpc.MaxX()+buffer)
46  || point.Y() < (tpc.MinY()-buffer) || point.Y() > (tpc.MaxY()+buffer)
47  || point.Z() < (tpc.MinZ()-buffer) || point.Z() > (tpc.MaxZ()+buffer)) return false;
48  return true;
49  }
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxY() const
Returns the world y coordinate of the end of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
double MinY() const
Returns the world y coordinate of the start of the box.
std::pair< double, double > icarus::TPCGeoUtil::XLimitsFromHits ( const geo::GeometryCore GeometryService,
std::vector< art::Ptr< recob::Hit >>  hits 
)

Definition at line 15 of file icaruscode/icaruscode/CRT/CRTUtils/TPCGeoUtil.cc.

15  {
16  // If there are no hits then return 0
17  if(hits.size() == 0) return std::make_pair(0, 0);
18 
19  // If the track is stitched (in multiple TPCs) return 0
20  if(DetectedInTPC(hits) == -1) return std::make_pair(0, 0);
21 
22  // Work out the drift direction
23  geo::TPCID tpcID = hits[0]->WireID().asTPCID();
24  const geo::TPCGeo& tpcGeo = GeometryService->GetElement(tpcID);
25  return std::make_pair(tpcGeo.MinX(), tpcGeo.MaxX());
26  }
CryostatGeo const & GetElement(geo::CryostatID const &cryoid) const
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
Geometry information for a single TPC.
Definition: TPCGeo.h:38
int DetectedInTPC(std::vector< art::Ptr< recob::Hit >> hits)
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
The data type to uniquely identify a TPC.
Definition: geo_types.h:386